Change in osmo-asf4-dfu[master]: fix DFU magic address and linker script
Harald Welte has posted comments on this change. ( https://gerrit.osmocom.org/12918 ) Change subject: fix DFU magic address and linker script .. Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/12918 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-asf4-dfu Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I69ad101593e903b74084f179cfc97fdfa5a3 Gerrit-Change-Number: 12918 Gerrit-PatchSet: 2 Gerrit-Owner: Kévin Redon Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder (102) Gerrit-Reviewer: Kévin Redon Gerrit-Comment-Date: Fri, 15 Feb 2019 10:28:05 + Gerrit-HasComments: No Gerrit-HasLabels: Yes
Change in osmo-asf4-dfu[master]: fix DFU magic address and linker script
Harald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/12918 ) Change subject: fix DFU magic address and linker script .. fix DFU magic address and linker script using the address specified in the linker script leads to a large output binary (as large as the address specified. instead the address is now specified in the source file. Change-Id: I69ad101593e903b74084f179cfc97fdfa5a3 --- M gcc/gcc/same54p20a_flash.ld M usb_dfu_main.c 2 files changed, 3 insertions(+), 9 deletions(-) Approvals: Jenkins Builder: Verified Harald Welte: Looks good to me, approved 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 @@ /* 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 0x2000 : -{ -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_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 -- To view, visit https://gerrit.osmocom.org/12918 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-asf4-dfu Gerrit-Branch: master Gerrit-MessageType: merged Gerrit-Change-Id: I69ad101593e903b74084f179cfc97fdfa5a3 Gerrit-Change-Number: 12918 Gerrit-PatchSet: 2 Gerrit-Owner: Kévin Redon Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder (102) Gerrit-Reviewer: Kévin Redon
Change in osmo-asf4-dfu[master]: fix DFU magic address and linker script
Kévin Redon has posted comments on this change. ( https://gerrit.osmocom.org/12918 ) Change subject: fix DFU magic address and linker script .. Patch Set 2: > (1 comment) fixed. the same define is also used in the next commit -- To view, visit https://gerrit.osmocom.org/12918 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-asf4-dfu Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I69ad101593e903b74084f179cfc97fdfa5a3 Gerrit-Change-Number: 12918 Gerrit-PatchSet: 2 Gerrit-Owner: Kévin Redon Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder (102) Gerrit-Reviewer: Kévin Redon Gerrit-Comment-Date: Fri, 15 Feb 2019 09:12:15 + Gerrit-HasComments: No Gerrit-HasLabels: No
Change in osmo-asf4-dfu[master]: fix DFU magic address and linker script
Harald Welte has posted comments on this change. ( https://gerrit.osmocom.org/12918 ) Change subject: fix DFU magic address and linker script .. Patch Set 1: Code-Review+1 (1 comment) https://gerrit.osmocom.org/#/c/12918/1/usb_dfu_main.c File usb_dfu_main.c: https://gerrit.osmocom.org/#/c/12918/1/usb_dfu_main.c@31 PS1, Line 31: 0x2000 HSRAM_ADDR might be used here? -- To view, visit https://gerrit.osmocom.org/12918 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-asf4-dfu Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I69ad101593e903b74084f179cfc97fdfa5a3 Gerrit-Change-Number: 12918 Gerrit-PatchSet: 1 Gerrit-Owner: Kévin Redon Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder (102) Gerrit-Comment-Date: Fri, 15 Feb 2019 07:48:10 + Gerrit-HasComments: Yes Gerrit-HasLabels: Yes
Change in osmo-asf4-dfu[master]: fix DFU magic address and linker script
Kévin Redon has uploaded this change for review. ( https://gerrit.osmocom.org/12918 Change subject: fix DFU magic address and linker script .. fix DFU magic address and linker script using the address specified in the linker script leads to a large output binary (as large as the address specified. instead the address is now specified in the source file. Change-Id: I69ad101593e903b74084f179cfc97fdfa5a3 --- M gcc/gcc/same54p20a_flash.ld M usb_dfu_main.c 2 files changed, 3 insertions(+), 9 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-asf4-dfu refs/changes/18/12918/1 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 @@ /* 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 0x2000 : -{ -KEEP(*(.dfu_magic)) ; -} - .text : { . = ALIGN(4); diff --git a/usb_dfu_main.c b/usb_dfu_main.c index 7fd54d3..e6d933d 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*)0x2000; // 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_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 -- To view, visit https://gerrit.osmocom.org/12918 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-asf4-dfu Gerrit-Branch: master Gerrit-MessageType: newchange Gerrit-Change-Id: I69ad101593e903b74084f179cfc97fdfa5a3 Gerrit-Change-Number: 12918 Gerrit-PatchSet: 1 Gerrit-Owner: Kévin Redon