Showing results for 
Search instead for 
Did you mean: 

Information about the content of RAM.ld file

Senior II

Hi All,

I notice that there are two linker files. One is called STM32F407VGT_FLASH.ld and the other one is called STM32F407VGTX_RAM.ld. When I check the content of ...FLASH.ld file, I see that there is a section for RAM as shown below.


On the other hand, when I check the content of RAM.ld, I also see that there are sections dedicated to RAM as shown below. 




So, I would like to know what the difference of these two files ?

Also, is there any way to see the content of the RAM ? For example I can see the content of Flash memory via STM32CubeProgrammer. Is there any similar approach to see the content of RAM ?

Thank you.


The RAM one looks more complete and can likely handle C++ constructors, newer compiler versions, etc.

It really depends on what the compiler generates in the way of sections, and how the linker handles them.

If the compiler generates objects the linker can't handle/recognize from the script, it will fail and complain, and then you might need to amend the script to fully describe what you want to happen. Alternatively they'll get to the end of the script and discard thing that's can't be managed, which will be Ok unless there's some actual dependency on them being handled, and in the memory image.

One of the primary differences with FLASH vs RAM is that the initial memory content that needs to end up in RAM needs to be staged in FLASH so the startup code can move the content at each power-up.

RAM base scripts, thing EXE/DLL type output objects, the content is simply loaded into RAM by the file system, and immediately run in place.

STM32 Cube Programmer can read / dump RAM the same as FLASH and ROM, plug in the address.

From your application you can dump memory content in a form you like to the serial console.

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

Thank you.

In order to see the content of the RAM, I started CubeProgrammer and entered the address as 0x200000000 as stated in the linker file. The size is selected as 0x20000. Please see below image. Is this a correct approach ?



I also do wonder that, when the microcontroller starts-up, what is loaded into RAM ? What are values for I am seeing in the above image ?

As far as I know, .text, .data, .bss, heap and stack makes up the RAM. I dont understand this concept well, because code (.text) is loaded into FLASH not RAM. Even flash and RAM size differs a lot, Flash is 8x more than RAM. Thats why RAM region can not be used for storing the .text. I believe I am missing something. Please see below what I have found on google.




Could you please guide me with this ?

I have also attached linker file for my board.

Thank you.