cancel
Showing results for 
Search instead for 
Did you mean: 

STM32f4x and Data section

n.serina
Associate III
Posted on September 04, 2017 at 15:18

Hello, 

I need small clarifications about  .data section placement in the STM32F446x mcu. 

Let say i have a global array in the program and if i run the program on MCU, 

The arry can be located at 0x20000000 address onwards . 

How did that array came to that location ? I dont see any code in my project (built using KEIL) which copies data section from flash to SRAM. 

and as far i know, code region will be mapped to flash memory and not to SRAM. 

Can anybody please help me to understand how did .data section moves from flash to SRAM ? is it done through sofware or hardware remapping ? Thanks

#stm32f4 #stm32f466
1 ACCEPTED SOLUTION

Accepted Solutions
Posted on September 04, 2017 at 17:47

The linker determines where code/data is placed, the 'Load Region' from the Keil Scatter File (linker script) via the Target address options, packs the static RAM data into FLASH. The code within __main (called from startup_stm32f4xx.s) zeros and copies statics into RAM from FLASH, and then executes your main() function.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

View solution in original post

4 REPLIES 4
Posted on September 04, 2017 at 17:47

The linker determines where code/data is placed, the 'Load Region' from the Keil Scatter File (linker script) via the Target address options, packs the static RAM data into FLASH. The code within __main (called from startup_stm32f4xx.s) zeros and copies statics into RAM from FLASH, and then executes your main() function.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on September 05, 2017 at 04:22

Thanks Clive, 

Understood.

Posted on September 05, 2017 at 10:46

This is the ARM linker. You can find the documentation here:

http://www.keil.com/support/man/docs/armlink/armlink_pge1362065968963.htm

 
Posted on September 08, 2017 at 06:26

Thanks . i got it