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.
Assume that target memory has the following program memory configuration:
|
Address Range |
Contents |
|
|
0x00000000 to 0x00001000 |
SLOW_MEM |
|
|
0x00001000 to 0x00002000 |
FAST_MEM |
|
|
0x08000000 to 0x08000400 |
EEPROM |
|
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 FAST_MEM.
- A set of interrupt vectors, contained in the .intvecs section of tables.c.obj, must be linked at address FAST_MEM.
- A table of coefficients, contained in the .data section of tables.c.obj, must be linked into EEPROM. The remainder of block FLASH must be initialized to the value 0xFF00FF00.
- A set of variables, contained in the .bss section of ctrl.c.obj, must be linked into SLOW_MEM and preinitialized to 0x00000100.
- The .bss sections of demo.c.obj and tables.c.obj must be linked into SLOW_MEM.
Example 31 shows the linker command file for this example. Example 32 shows the map file.