Tips for Writing or Customizing Linker Scripts - 2022.1 English

Vitis Unified Software Platform Documentation: Embedded Software Development (UG1400)

Document ID
Release Date
2022.1 English

Keep the following points in mind when writing or customizing your own linker script:

  • Ensure that the different vector sections are assigned to the appropriate memories as defined by the MicroBlaze hardware.
  • Allocate space in the .bss section for stack and heap. Set the _stack variable to the location after _STACK_SIZE locations of this area, and the _heap_start variable to the next location after the _STACK_SIZE location. Because the stack and heap need not be initialized for hardware as well as simulation, define the _bss_end variable after the .bss and COMMON definitions.
    Note: The .bss section boundary does not include either stack or heap.
  • Ensure that the variables _SDATA_START__ , _SDATA_END__, SDATA2_START, _SDATA2_END__, _SBSS2_START__ , _SBSS2_END__, _bss_start, _bss_end, _sbss_start, and _sbss_end are defined to the beginning and end of the sections sdata, sdata2, sbss2, bss, and sbss respectively.
  • ANSI C requires that all uninitialized memory be initialized to startup (not required for stack and heap). The standard CRT that is provided assumes a single .bss section that is initialized to zero. If there are multiple .bss sections, this CRT will not work. You should write your own CRT that initializes all the .bss sections.