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
andCOMMON
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 sectionssdata
,sdata2
,sbss2
,bss
, andsbss
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 does not work. You should write your own CRT that initializes all the.bss
sections.