8.12 Linker Example
This example links three object files named demo.c.obj, ctrl.c.obj, and tables.c.obj and creates a program called demo.out. The symbol SETUP is the program entry point.
Assume that target memory has the following program memory configuration:
|
Address Range |
Contents |
|
|
0x0200 to 0x0A00 |
RAM |
|
|
0x1100 to 0xFFF0 |
FLASH |
|
|
0xFFE0 to 0xFFFF |
VECTORS |
|
The output sections are constructed in the following manner:
- Executable code, contained in the .text sections of demo.c.obj, ctrl.c.obj, and tables.c.obj, must be linked into FLASH.
- A set of interrupt vectors, contained in the .intvecs section of tables.c.obj, must be linked at address 0xFFE0.
- A table of coefficients, contained in the .data section of tables.c.obj, must be linked into FLASH. The remainder of block FLASH must be initialized to the value 0xFF00.
- A set of variables, contained in the .bss section of ctrl.c.obj, must be linked into RAM and preinitialized to 0x0100.
- Another .bss section in ctrl.c.obj must be linked into RAM.
Example 30 shows the linker command file for this example. Example 31 shows the map file.