aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--gcc/gcc/same54p20a_flash.ld6
-rw-r--r--usb_dfu_main.c6
2 files changed, 3 insertions, 9 deletions
diff --git a/gcc/gcc/same54p20a_flash.ld b/gcc/gcc/same54p20a_flash.ld
index 32ded77..6aa3fb1 100644
--- a/gcc/gcc/same54p20a_flash.ld
+++ b/gcc/gcc/same54p20a_flash.ld
@@ -48,12 +48,6 @@ STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : DEFINED(__stack_size__) ? __stac
/* Section Definitions */
SECTIONS
{
- /* 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) */
- .dfu_magic 0x20000000 :
- {
- KEEP(*(.dfu_magic)) ;
- }
-
.text :
{
. = ALIGN(4);
diff --git a/usb_dfu_main.c b/usb_dfu_main.c
index 7fd54d3..f431d29 100644
--- a/usb_dfu_main.c
+++ b/usb_dfu_main.c
@@ -28,7 +28,7 @@
static uint32_t* application_start_address;
/** Location of the DFU magic value to force starting DFU */
-static uint32_t dfu_magic __attribute__ ((section (".dfu_magic"))) __attribute__ ((__used__));
+static volatile uint32_t* dfu_magic = (uint32_t*)HSRAM_ADDR; // magic value should be written at start of RAM
/** Check if the bootloader is valid
* \return true if the bootloader is valid and can be run
@@ -51,8 +51,8 @@ static bool check_bootloader(void)
*/
static bool check_force_dfu(void)
{
- if (0x44465521 == dfu_magic) { // check for the magic value which can be set by the main application
- dfu_magic = 0; // erase value so we don't stay in the DFU bootloader upon reset
+ if (0x44465521 == *dfu_magic) { // check for the magic value which can be set by the main application
+ *dfu_magic = 0; // erase value so we don't stay in the DFU bootloader upon reset
return true;
}
if (0 == gpio_get_pin_level(BUTTON_FORCE_DFU)) { // signal is low when button is pressed