<p>tsaitgaist has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/osmo-asf4-dfu/+/16855">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">fix DFU magic address and linker script<br><br>using the address specified in the linker script leads to a large<br>output binary (as large as the address specified.<br>instead the address is now specified in the source file.<br><br>Change-Id: I69ad101593e903b74084f179cfc97fccccdfa5a3<br>---<br>M gcc/gcc/same54p20a_flash.ld<br>M usb_dfu_main.c<br>2 files changed, 3 insertions(+), 9 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/osmo-asf4-dfu refs/changes/55/16855/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/gcc/gcc/same54p20a_flash.ld b/gcc/gcc/same54p20a_flash.ld</span><br><span>index 32ded77..6aa3fb1 100644</span><br><span>--- a/gcc/gcc/same54p20a_flash.ld</span><br><span>+++ b/gcc/gcc/same54p20a_flash.ld</span><br><span>@@ -48,12 +48,6 @@</span><br><span> /* Section Definitions */</span><br><span> SECTIONS</span><br><span> {</span><br><span style="color: hsl(0, 100%, 40%);">-    /* Location of the DFU magic. The application must set the magic value "DFU!" (e.g. 0x44465521) at this address to force the DFU bootloader to start (e.g. to perform a DFU detach) */</span><br><span style="color: hsl(0, 100%, 40%);">-    .dfu_magic 0x20000000 :</span><br><span style="color: hsl(0, 100%, 40%);">-    {</span><br><span style="color: hsl(0, 100%, 40%);">-        KEEP(*(.dfu_magic)) ;</span><br><span style="color: hsl(0, 100%, 40%);">-    }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span>     .text :</span><br><span>     {</span><br><span>         . = ALIGN(4);</span><br><span>diff --git a/usb_dfu_main.c b/usb_dfu_main.c</span><br><span>index 7fd54d3..f431d29 100644</span><br><span>--- a/usb_dfu_main.c</span><br><span>+++ b/usb_dfu_main.c</span><br><span>@@ -28,7 +28,7 @@</span><br><span> static uint32_t* application_start_address;</span><br><span> </span><br><span> /** Location of the DFU magic value to force starting DFU */</span><br><span style="color: hsl(0, 100%, 40%);">-static uint32_t dfu_magic __attribute__ ((section (".dfu_magic"))) __attribute__ ((__used__));</span><br><span style="color: hsl(120, 100%, 40%);">+static volatile uint32_t* dfu_magic = (uint32_t*)HSRAM_ADDR; // magic value should be written at start of RAM</span><br><span> </span><br><span> /** Check if the bootloader is valid</span><br><span>  *  \return true if the bootloader is valid and can be run</span><br><span>@@ -51,8 +51,8 @@</span><br><span>  */</span><br><span> static bool check_force_dfu(void)</span><br><span> {</span><br><span style="color: hsl(0, 100%, 40%);">-  if (0x44465521 == dfu_magic) { // check for the magic value which can be set by the main application</span><br><span style="color: hsl(0, 100%, 40%);">-            dfu_magic = 0; // erase value so we don't stay in the DFU bootloader upon reset</span><br><span style="color: hsl(120, 100%, 40%);">+   if (0x44465521 == *dfu_magic) { // check for the magic value which can be set by the main application</span><br><span style="color: hsl(120, 100%, 40%);">+         *dfu_magic = 0; // erase value so we don't stay in the DFU bootloader upon reset</span><br><span>                 return true;</span><br><span>         }</span><br><span>    if (0 == gpio_get_pin_level(BUTTON_FORCE_DFU)) { // signal is low when button is pressed</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-asf4-dfu/+/16855">change 16855</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/c/osmo-asf4-dfu/+/16855"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-asf4-dfu </div>
<div style="display:none"> Gerrit-Branch: sysmoOCTSIM </div>
<div style="display:none"> Gerrit-Change-Id: I69ad101593e903b74084f179cfc97fccccdfa5a3 </div>
<div style="display:none"> Gerrit-Change-Number: 16855 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: tsaitgaist <kredon@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>