Download GU0114 Using the MicroBlaze Embedded Tools

Transcript
Using the MicroBlaze Embedded Tools
This completes the LSL file for the sample architecture and sample program. You can now invoke the linker with this file and the
sample program to obtain an application that works for this architecture.
For a complete description of the Linker Script Language, refer to Chapter 8, Linker Script Language, in the reference
manual.
6.10
Linker Labels
The linker creates labels that you can use to refer to from within the application software. Some of these labels are real labels at
the beginning or the end of a section. Other labels have a second function, these labels are used to address generated data in
the locating phase. The data is only generated if the label is used.
Linker labels are labels starting with _lc_. The linker assigns addresses to the following labels when they are referenced:
Label
Description
_lc_ub_name
Begin of section name. Also used to mark the begin of the stack or heap or copy table.
_lc_b_name
_lc_ue_name
End of section name. Also used to mark the end of the stack or heap.
_lc_e_name
_lc_cb_name
Start address of an overlay section in ROM.
_lc_ce_name
End address of an overlay section in ROM.
_lc_gb_name
Begin of group name. This label appears in the output file even if no reference to the label exists in the
input file.
_lc_ge_name
End of group name. This label appears in the output file even if no reference to the label exists in the
input file.
Table 6−6: Linker labels
The linker only allocates space for the stack and/or heap when a reference to either of the section labels exists in one of the
input object files.
If you want to use linker labels in your C source for sections that have a dot (.) in the name, you have to replace all dots
by underscores.
See also section 8.9.4, Creating Symbols, in Chapter 8, Linker Script Language of the reference manual.
Example: refer to a label with section name with dots from C
Suppose a section has the name .text. When you want to refer to the begin of this section you have to replace all dots in the
section name by underscores:
#include <stdio.h>
extern __no_sdata void *_lc_ub__text;
int main(void)
{
printf("The section .text is located at %X\n",
&_lc_ub__text);
}
6−20