|
|||||||||||
|
Technical Support Support Resources
Product Information |
ARMLINK: Boot from flash and load application to RAMInformation in this knowledgebase article applies to:
QUESTIONIn my use case, I want to flash my program into the default internal flash of my device, so that later on it can boot normally. After booting it should copy and load my user application to the RAM and executes it from there. How to write a scatter file to achieve this use case? ANSWERBy default, Cortex-M devices will boot from fetching the first two words in the vector table, which are the initial value of Main Stack Pointer (MSP) and the starting address of the reset handler. Without vector table relocation, the vector table is by default allocated at the start address of the flash memory. Additionally some Arm library sections, such as __main.o, __scatter*.o etc., must always be placed in the root region. The section selector InRoot$$Sections can be used to place all such sections into the root region via a scatter file. Moreover, device-specific system initialization CMSIS-Core function SystemInit() is usually executed before __main() and the scatter loading. Thus, SystemInit() together with other codes in the system*_.c should also be placed in the default flash region. After all necessary sections to be placed in the default flash region are defined in the scatter file, all remaining user application code, RO, RW or ZI data can be placed to the RAM region via the scatter file, which will be automatically scatter loaded to the corresponding RAM address by executing the __main() function. A demo project for such an use case is attached to this article. The project is based on the MCBSTM32F400 board. But the principle can be applied to other Cortex-M devices as well. MORE INFORMATIONATTACHED FILESRequest the files attached to this knowledgebase article. Last Reviewed: Wednesday, October 30, 2019 | ||||||||||
|
|||||||||||
Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.