Linker-Defined Symbols

The linker defines special symbols that can be used to determine where some sections where linked in memory. These symbols can be used in your code, if required.

The link address of a section can be obtained from the value of a global symbol with name __Lname (two leading underscores) where name is the name of the section. For example, __LbssBANK0 is the low bound of the bssBANK0 section. The highest address of a section (i.e., the link address plus the size) is represented by the symbol __Hname. If the section has different load and link addresses, the load start address is represented by the symbol __Bname.

Sections that are not placed in memory using a -P linker option. See P: Position Psect are not assigned this type of symbol, and note that section names can change from one device to another.

Assembly code can use these symbol by globally declaring them (noting the two leading underscore characters in the names), for example:

GLOBAL __Lidata

and C code could use them by declaring a symbol such as the following.

extern char * _Lidata;

Note that there is only one leading underscore in the C domain. As the symbol represents an address, a pointer is the typical type choice.