6 years, 10 months ago.

EFM32 Mbed Bootloader

Hi,

I have a question regarding the Mbed Bootloader https://github.com/ARMmbed/mbed-os-example-bootloader.

First of all, I want to build an Application which gets a Firmware-Update (over Ethernet, Bluetooth, RS232, …) stores it somewhere (SD-Card, Flash, …) and self-updates it by resetting.

I successfully build and run the Mbed Bootloader for the on the EFM32 Pearl Gecko (EFM32PG12_STK3402). Therefore I had to adapt the targets.json file and did some minor modifications, so far so good. But I have problems loading/starting the “new” blinky-firmware-example.

I debugged it and the bootloader is able to read the firmware form the SD-Card and stores it to the Flash, but when I call

#define POST_APPLICATION_ADDR      0x40000
[…]
mbed_start_application(POST_APPLICATION_ADDR);

the firmware will not start.

I also tested “mbed_start_application()” by setting the address to 0x0, which should recall the bootloader and it does it like I expected. Therefore I suggest the bootloader itself is working correctly.

I think I need to change/adapt something in the linker script of the blinky-firmware-example. I already set the Mbed Start address to 0x40000. See:

#if !defined(MBED_APP_START)
  #warning "MBED_APP_START not defined" /* Added to see if the linker jumps inside it */
  #define MBED_APP_START 0x40000
#endif

I think that I need to add/change the address of the Vector Table Address in the linker script, but I don’t know how to do that (see https://docs.mbed.com/docs/mbed-os-handbook/en/latest/advanced/flash/), because until now, I never modified or wrote linker-scripts, so I have zero experience with it.

Can anyone please help me with this issue, or show me how and which parts to adapt in the linker script? I am running out of ideas…

I added the linker script as pdf, because a *.ld wasn't accepted... :-(

/media/uploads/DBS06/efm32pg12b.pdf

I'd suggest to raise this at https://github.com/armmbed/mbed-os, core team sits around there, they should be able to help you with the vector tables. Regardless, if you attach a debugger (gdb for example), does the application jump to the new application? Do you see the application hard faulting or does it do something else?

posted by Jan Jongboom 12 Jan 2018

Hi, thank your for your answer. I solved the issue and the problem wasn't the linkerscript. I tested the bootloader and the FLASH IAP again, and found out that the FLASH IAP wasn't able to write on the internal flash, but the return value gave the false information that this was successful.

I went deeper into the library and saw that on flash_init() and flash.free() inside the flash_api.c from TARGET_EFM32 it does nothing... Actually I add MSC_Init() and MSC_Deinit() to the corresponding flash_api.c functions and now it works.

posted by Phillipp Steiner 18 Jan 2018
Be the first to answer this question.