Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
5 years, 6 months ago.
How to change the linker options in MBED ?
Hello all,
I have designed quite a large projetc with Mbed-Online, using Mbed-Library version 164 (the latest one, version 165 was causing a warning during compilation, so we decided to keep on version 164 as the behaviour of the program was looking like beeing stable), with a Nucleo L476RG card.
We also tried to migrated under MbedOS 5.xxx, but so far we're getting an expansion of the code, many warnings, and a hard fault crash at startup. So we kept the MbedLib 164...
Now we need to use a boot from SRAM feature, in order to build our full custom DFU module when the pin Boot0 is on its high state. Using STM32CubeIDE, after a little struggling and a little help from ST, I managed in building an executable that runs perfectly from the SRam. Now the point is that we would like to shift the adresses in SRAM where the variables are set from the main project, build under MBed Online, so that the firmware in SRam would not be overwritten by the main program.
Is there a way to compile a project with Mbed Online, so that the variables would be stored in SRam beyond the address 0x20010000 instead of 0x20000000 ?
Thanks a lot for the time you will take helping me!
1 Answer
5 years, 6 months ago.
Hello,
You will have to modify the linker script / scatter file to adapt it to your needs. This can be done only by modifying mbed library so you have to load it as source code in mbed compiler.
I think you'll need to replace the mbed library by mbed-dev library (from Author mbed official). From your project, import library from wizard, then search for mbed-dev and import it (note that it may take a while or even fail sometimes :-( ...)
Then you can point to the same revision as you have today.
Once you get the full source tree, you can find the linker script in below path (depends on which compiler you want to use): targets/TARGET_STM/TARGET_STM32L4/TARGET_STM32L476xG/device/TOOLCHAIN_ARM_STD/stm32l476xx.sct targets/TARGET_STM/TARGET_STM32L4/TARGET_STM32L476xG/device/TOOLCHAIN_GCC_ARM/STM32L476XX.ld targets/TARGET_STM/TARGET_STM32L4/TARGET_STM32L476xG/device/TOOLCHAIN_IAR/stm32l476xx.icf
hope this helps