cancel
Showing results for 
Search instead for 
Did you mean: 

How does the STM32 knows where should the .BSS section be addressed,and what's the range,when the chip startup initially?

HoMan Statham
Associate II

How does the STM32 knows where should the .BSS section be addressed,and what's the range,when the chip startup initially? We know that firmware downloaded into the flash contains section information like .text ,.data ect,while .bss section should be build up dynamiclly by the system,but how does the chip knows about the address and range for the .BSS section?!

1 ACCEPTED SOLUTION

Accepted Solutions

The STM32 knows nothing..

The linker manages the symbols and the packing of the load regions, code in startup.s moves and clears data into RAM from it's holding location in FLASH

The Linker Script .LD (or Scatter File in Keil) describes the size of available resources, and the linker builds the package tracking and fixing up the symbols.

The Linker Script in GNU lays down marker symbols as to where data in flash is parked, and the address space utilization in RAM

Sort of concepts probably covered in under-grad Assemblers, Compilers, Linkers, and Loaders type classes/texts

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

6 REPLIES 6
Wolfgang Pupp
Associate III

The information is in the firmware itself: If you have any variable that "lives" inside your bss section, then the exact address of that variable is embedded (by the linker) when you compile your hex/bin/elf/dfu file.

The linker script provides the necessary information to the linker (and is typically device specific).

Nikita91
Lead II

The BSS section is not dynamic, it is computed at link time.

The linker script know the RAM characteristics: start address and size, and the linker script know how to place each section. So all sections addresses are computed at link time.

It is instructive to study the default linker script of your project with the GNU ld manual at hand

The STM32 knows nothing..

The linker manages the symbols and the packing of the load regions, code in startup.s moves and clears data into RAM from it's holding location in FLASH

The Linker Script .LD (or Scatter File in Keil) describes the size of available resources, and the linker builds the package tracking and fixing up the symbols.

The Linker Script in GNU lays down marker symbols as to where data in flash is parked, and the address space utilization in RAM

Sort of concepts probably covered in under-grad Assemblers, Compilers, Linkers, and Loaders type classes/texts

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

Great! Thank you�?

Great! Thank you�?

Great! Thank you�?