This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
laforge gerrit-no-reply at lists.osmocom.orglaforge has submitted this change. ( https://gerrit.osmocom.org/c/simtrace2/+/16556 ) Change subject: improve shared bootloader/application memory ...................................................................... improve shared bootloader/application memory now both partitions (bootloader and application) use a commonly defined memory location to shared the DFU state (which includes the magic value to know which part to start), instead of using a hard coded value. the bootloader size has now also been restricted to 16 kB. this limitation is enforced so to not be able to create larger images, which could be corrupted when flashing the application. bootloader and application flashing have been successfully tested on qmod st12 and st34. Change-Id: I204bed7e9391602672ed894decec1fc12e879275 --- M firmware/atmel_softpack_libraries/usb/device/dfu/dfu_driver.c M firmware/atmel_softpack_libraries/usb/device/dfu/dfu_runtime.c M firmware/libboard/common/resources/sam3s4/dfu.ld M firmware/libboard/common/resources/sam3s4/flash.ld 4 files changed, 17 insertions(+), 8 deletions(-) Approvals: Jenkins Builder: Verified laforge: Looks good to me, approved diff --git a/firmware/atmel_softpack_libraries/usb/device/dfu/dfu_driver.c b/firmware/atmel_softpack_libraries/usb/device/dfu/dfu_driver.c index 3ffd9b3..e95c67b 100644 --- a/firmware/atmel_softpack_libraries/usb/device/dfu/dfu_driver.c +++ b/firmware/atmel_softpack_libraries/usb/device/dfu/dfu_driver.c @@ -33,8 +33,7 @@ #include <usb/common/dfu/usb_dfu.h> #include <usb/device/dfu/dfu.h> -/* FIXME: this was used for a special ELF section which then got called - * by DFU code and Application code, across flash partitions */ +/** specific memory location shared across bootloader and application */ #define __dfudata __attribute__ ((section (".dfudata"))) #define __dfufunc @@ -42,11 +41,14 @@ static USBDDriver usbdDriver; static unsigned char if_altsettings[1]; +/** structure containing the DFU state and magic value to know if DFU or application should be started */ __dfudata struct dfudata _g_dfu = { .state = DFU_STATE_appIDLE, .past_manifest = 0, .total_bytes = 0, }; + +/** variable to structure containing DFU state */ struct dfudata *g_dfu = &_g_dfu; WEAK void dfu_drv_updstatus(void) diff --git a/firmware/atmel_softpack_libraries/usb/device/dfu/dfu_runtime.c b/firmware/atmel_softpack_libraries/usb/device/dfu/dfu_runtime.c index ac4d7df..4f772be 100644 --- a/firmware/atmel_softpack_libraries/usb/device/dfu/dfu_runtime.c +++ b/firmware/atmel_softpack_libraries/usb/device/dfu/dfu_runtime.c @@ -36,7 +36,12 @@ #include <usb/common/dfu/usb_dfu.h> #include <usb/device/dfu/dfu.h> -struct dfudata *g_dfu = (struct dfudata *) IRAM_ADDR; +/** specific memory location shared across bootloader and application */ +#define __dfudata __attribute__ ((section (".dfudata"))) +/** structure containing the magic value to know if DFU or application should be started */ +__dfudata struct dfudata _g_dfu; +/** variable to structure containing the magic value to know if DFU or application should be started */ +struct dfudata *g_dfu = &_g_dfu; /* FIXME: this was used for a special ELF section which then got called * by DFU code and Application code, across flash partitions */ diff --git a/firmware/libboard/common/resources/sam3s4/dfu.ld b/firmware/libboard/common/resources/sam3s4/dfu.ld index e56a435..a485770 100644 --- a/firmware/libboard/common/resources/sam3s4/dfu.ld +++ b/firmware/libboard/common/resources/sam3s4/dfu.ld @@ -39,9 +39,9 @@ MEMORY { /* reserve the first 16k (= 0x4000) for the DFU bootloader */ - rom (rx) : ORIGIN = 0x00404000, LENGTH = 0x0003c000 /* flash, 256K */ - /* reserve the first 32 (= 0x20) bytes for the _g_dfu struct */ - ram (rwx) : ORIGIN = 0x20000020, LENGTH = 0x0000bfe0 /* sram, 48K */ + rom (rx) : ORIGIN = 0x00400000 + 16K, LENGTH = 256K - 16K /* flash, 256K */ + /* note: dfudata will be at the start */ + ram (rwx) : ORIGIN = 0x20000000, LENGTH = 48K /* SRAM, 48K */ } /* Section Definitions */ @@ -111,6 +111,8 @@ { . = ALIGN(4); _srelocate = .; + /* we must make sure the .dfudata is linked to start of RAM */ + *(.dfudata .dfudata.*); *(.ramfunc .ramfunc.*); *(.data .data.*); . = ALIGN(4); diff --git a/firmware/libboard/common/resources/sam3s4/flash.ld b/firmware/libboard/common/resources/sam3s4/flash.ld index bdebbde..f5cdbfd 100644 --- a/firmware/libboard/common/resources/sam3s4/flash.ld +++ b/firmware/libboard/common/resources/sam3s4/flash.ld @@ -38,8 +38,8 @@ /* Memory Spaces Definitions */ MEMORY { - rom (rx) : ORIGIN = 0x00400000, LENGTH = 0x00040000 /* flash, 256K */ - ram (rwx) : ORIGIN = 0x20000000, LENGTH = 0x0000c000 /* sram, 48K */ + rom (rx) : ORIGIN = 0x00400000, LENGTH = 16K /* flash, 256K, but only the first 16K should be used for the bootloader */ + ram (rwx) : ORIGIN = 0x20000000, LENGTH = 48K /* SRAM, 48K */ } /* Section Definitions */ -- To view, visit https://gerrit.osmocom.org/c/simtrace2/+/16556 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: simtrace2 Gerrit-Branch: master Gerrit-Change-Id: I204bed7e9391602672ed894decec1fc12e879275 Gerrit-Change-Number: 16556 Gerrit-PatchSet: 1 Gerrit-Owner: tsaitgaist <kredon at sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge at osmocom.org> Gerrit-MessageType: merged -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20191211/f76827d9/attachment.htm>