tsaitgaist has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-ccid-firmware/+/16866 )


Change subject: reserve RAM for DFU magic
......................................................................

reserve RAM for DFU magic

this changes the linker script so the first word (smallest unit
since the data needs to be 4 baty aligned) is not reserved for
the RAM section.
this allows the application to write any data at this address
without the rest of the code messing with the content.
since the SRAM is preserved after reset, this allows to share
data between firmware.
in particular it allows the application to tell the bootloader it
should start the flashing procedure.
this is already implemented in the osmo-asf4-dfu DFU bootloader.
if the application wants to switch to the DFU bootloader, write
the DFU magic 0x44465521 (DFU!) at the beginning of RAM at address
(uint32_t*)HSRAM_ADDR, and perform a system reset.

Change-Id: Ibafd08429b05fd3cab6af060904201db83186a4e
---
M sysmoOCTSIM/gcc/gcc/same54n19a_dfu.ld
M sysmoOCTSIM/gcc/gcc/same54n19a_flash.ld
2 files changed, 4 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ccid-firmware 
refs/changes/66/16866/1

diff --git a/sysmoOCTSIM/gcc/gcc/same54n19a_dfu.ld 
b/sysmoOCTSIM/gcc/gcc/same54n19a_dfu.ld
index 7d76cc2..17fc417 100644
--- a/sysmoOCTSIM/gcc/gcc/same54n19a_dfu.ld
+++ b/sysmoOCTSIM/gcc/gcc/same54n19a_dfu.ld
@@ -36,7 +36,8 @@
 MEMORY
 {
   rom      (rx)  : ORIGIN = 0x00000000 + 16K, LENGTH = 0x00080000 - 16K
-  ram      (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00030000
+  /* The first word of the RAM is used for the DFU magic */
+  ram      (rwx) : ORIGIN = 0x20000000 + 4, LENGTH = 0x00030000 - 4
   bkupram  (rwx) : ORIGIN = 0x47000000, LENGTH = 0x00002000
   qspi     (rwx) : ORIGIN = 0x04000000, LENGTH = 0x01000000
 }
diff --git a/sysmoOCTSIM/gcc/gcc/same54n19a_flash.ld 
b/sysmoOCTSIM/gcc/gcc/same54n19a_flash.ld
index 33b8ed9..ce30971 100644
--- a/sysmoOCTSIM/gcc/gcc/same54n19a_flash.ld
+++ b/sysmoOCTSIM/gcc/gcc/same54n19a_flash.ld
@@ -36,7 +36,8 @@
 MEMORY
 {
   rom      (rx)  : ORIGIN = 0x00000000, LENGTH = 0x00080000
-  ram      (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00030000
+  /* The first word of the RAM is used for the DFU magic */
+  ram      (rwx) : ORIGIN = 0x20000000 + 4, LENGTH = 0x00030000 - 4
   bkupram  (rwx) : ORIGIN = 0x47000000, LENGTH = 0x00002000
   qspi     (rwx) : ORIGIN = 0x04000000, LENGTH = 0x01000000
 }

--
To view, visit https://gerrit.osmocom.org/c/osmo-ccid-firmware/+/16866
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ccid-firmware
Gerrit-Branch: master
Gerrit-Change-Id: Ibafd08429b05fd3cab6af060904201db83186a4e
Gerrit-Change-Number: 16866
Gerrit-PatchSet: 1
Gerrit-Owner: tsaitgaist <kre...@sysmocom.de>
Gerrit-MessageType: newchange

Reply via email to