AnsweredAssumed Answered

Question about linker script

Question asked by Ming Wong on May 6, 2018
Latest reply on May 6, 2018 by pavel a

Hello,

I am trying to write a firmware upgrade and bootloader module for a hobby project of mine. I am using a STM32L4 chip.

The bootloader is a customer bootloader residing in the first bank taking about 10 pages of flash.

Then the first of the flash is split evenly, first half for Application #1 and second half is Application #2.

The idea was to re-flash the other half whenever I have a new firmware to update, and then reboot the device and execute the new firmware. The file format is .bin file generated using -objcopy.

So for example, if I am originally running at application #1, I would flash the new firmware to application #2 space. Reboot the device, and the bootloader would jump to application #2 space.

 

As a test, I flashed the same application 1 binary to application 2 space, and performed CRC calcs (which matches), however, for some reason, code executing at application 2 would crash. I am not too sure why as the binary data was exactly the same.

 

I rebuilt the application, but this time changed the linker script to have flash start at the address of application #2 space. I then flashed this binary file and to my relievement, application 2 runs fine!

 

I am still new to the coding world and my understanding of linkers and what not has not yet fully matured, but why would changing the linker's flash starting address affect my result?

Outcomes