Skip to main content
HoMan Statham
Associate II
September 30, 2022
Solved

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

  • September 30, 2022
  • 3 replies
  • 2733 views

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?!

    This topic has been closed for replies.
    Best answer by Tesla DeLorean

    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

    3 replies

    Wolfgang Pupp
    Associate III
    September 30, 2022

    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).

    HoMan Statham
    Associate II
    October 8, 2022

    Great! Thank you�?

    Nikita91
    Lead II
    September 30, 2022

    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

    HoMan Statham
    Associate II
    October 8, 2022

    Great! Thank you�?

    Tesla DeLorean
    Tesla DeLoreanBest answer
    Guru
    September 30, 2022

    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 VenmoUp vote any posts that you find helpful, it shows what's working..
    HoMan Statham
    Associate II
    October 8, 2022

    Great! Thank you�?