SPRUI03E June 2015 – January 2023
This example links three object files named demo.c.obj, filter.c.obj, tables.c.obj, and lex.c.obj and creates a program called demo.out.
Assume that target memory has the following program memory configuration:
Address Range | Contents | ||
---|---|---|---|
0x0080 to 0x7000 | On-chip RAM_PG | ||
0xC000 to 0xFF80 | On-chip ROM |
Address Range | Contents | ||
---|---|---|---|
0x0080 to 0x0FFF | RAM block ONCHIP | ||
0x0060 to 0xFFFF | Mapped external addresses EXT |
Address Range | Contents | ||
---|---|---|---|
0x00000020 to 0x00210000 | PMEM | ||
0x00400000 to 0x01400000 | EXT0 | ||
0x01400000 to 0x01800000 | EXT1 | ||
0x02000000 to 0x03000000 | EXT2 | ||
0x03000000 to 0x04000000 | EXT3 | ||
0x80000000 to 0x82000000 | BMEM |
The output sections are constructed in the following manner:
Linker Command File, mylnk.cmd shows the linker command file for this example. Output Map File, demo.map shows the map file.
/****************************************************************************/
/*** Specify Linker Options ***/
/****************************************************************************/
-c
--heap 0x3000
--stack 0x6000
--args 0x1000
--output_file=demo.out /* Name the output file */
--map_file=demo.map /* Create an output map file */
-u filter_table_A
-u filter_table_B
/****************************************************************************/
/*** Specify the Input Files ***/
/****************************************************************************/
demo.c.obj
tables.c.obj
filter.c.obj
lex.c.obj
/****************************************************************************/
/*** Specify Runtime Support Library to be linked in ***/
/****************************************************************************/
-l libc.a
/****************************************************************************/
/*** Specify the Memory Configuration ***/
/****************************************************************************/
MEMORY
{
PMEM: o = 00000020h l = 0020ffe0h
EXT0: o = 00400000h l = 01000000h
EXT1: o = 01400000h l = 00400000h
EXT2: o = 02000000h l = 01000000h
EXT3: o = 03000000h l = 01000000h
BMEM: o = 80000000h l = 02000000h
}
/****************************************************************************/
/* Specify the Output Sections ***/
/****************************************************************************/
SECTIONS
{
.text : > PMEM
UNION
{
.tableA: { tables.c.obj(.tableA) } load > BMEM, table(tableA_cpy)
.tableB: { tables.c.obj(.tableB) } load > BMEM, table(tableB_cpy)
} RUN = EXT1, RUN_START(filter_matrix)
GROUP
{
.neardata:
.rodata:
.bss:
} > EXT2
.stack: > BMEM
.args : > BMEM
.cinit: > BMEM
.cio: > BMEM
.const: > BMEM
.data: > BMEM
.switch: > BMEM
.sysmem: > BMEM
.far: > BMEM
.fardata: > BMEM
.ppinfo: > BMEM
}
/****************************************************************************/
/*** End of Command File ***/
/****************************************************************************/
Invoke the linker by entering the following command:
cl6x --run_linker mylnk.cmd
This creates the map file shown in Output Map File, demo.map and an output file called demo.out that can be run on a TMS320C6000.
OUTPUT FILE NAME: <demo.out>
EENTRY POINT SYMBOL: "_c_int00" address: 00007a00
MEMORY CONFIGURATION
name origin length used unused attr fill
---------------------- -------- --------- -------- -------- ---- --------
PMEM 00000020 0020ffe0 00008080 00207f60 RWIX
EXT0 00400000 01000000 00000000 01000000 RWIX
EXT1 01400000 00400000 00000030 003fffd0 RWIX
EXT2 02000000 01000000 0000001c 00ffffe4 RWIX
EXT3 03000000 01000000 00000000 01000000 RWIX
BMEM 80000000 02000000 0000a9d4 01ff562c RWIX
SEGMENT ALLOCATION MAP
run origin load origin length init length attrs members
---------- ----------- ---------- ----------- ----- -------
00000020 00000020 00008080 00008080 r-x
00000020 00000020 00008060 00008060 r-x .text
00008080 00008080 00000020 00000020 r-- .ovly
01400000 8000a8c0 00000030 00000030 rw-
01400000 8000a8c0 00000030 00000030 rw- .tableA
01400000 8000a8f0 00000030 00000030 rw-
01400000 8000a8f0 00000030 00000030 rw- .tableB
02000000 02000000 0000001c 00000000 rw-
02000000 02000000 0000001c 00000000 rw- .neardata
80000000 80000000 00009000 00000000 rw-
80000000 80000000 00006000 00000000 rw- .stack
80006000 80006000 00003000 00000000 rw- .sysmem
80009000 80009000 00001398 00001000 rw-
80009000 80009000 00001000 00001000 rw- .args
8000a000 8000a000 00000398 00000000 rw- .fardata
8000a398 8000a398 00000288 00000288 r--
8000a398 8000a398 00000288 00000288 r-- .const
8000a620 8000a620 00000268 00000000 rw-
8000a620 8000a620 00000148 00000000 rw- .far
8000a768 8000a768 00000120 00000000 rw- .cio
8000a888 8000a888 00000038 00000038 r--
8000a888 8000a888 00000038 00000038 r-- .switch
8000a920 8000a920 000000b4 000000b4 r--
8000a920 8000a920 000000b4 000000b4 r-- .cinit
SECTION ALLOCATION MAP
output attributes/
section page origin length input sections
-------- ---- ---------- ---------- ----------------
.text 0 00000020 00008060
00000020 000005c0 rts6740_elf.lib : divd.c.obj (.text:__c6xabi_divd)
000005e0 000005c0 : _printfi.c.obj (.text:_getarg_diouxp)
00000ba0 000005a0 : _printfi.c.obj (.text:_setfield)
00001140 00000460 : _printfi.c.obj (.text:__TI_printfi)
000015a0 00000380 : fputs.c.obj (.text:fputs)
...
.neardata
* 0 02000000 0000001c UNINITIALIZED
02000000 0000001c lex.c.obj (.neardata)
.rodata 0 0200001c 00000000 UNINITIALIZED
.bss 0 0200001c 00000000 UNINITIALIZED
.stack 0 80000000 00006000 UNINITIALIZED
80000000 00000008 rts6740_elf.lib : boot.c.obj (.stack)
80000008 00005ff8 --HOLE--
.sysmem 0 80006000 00003000 UNINITIALIZED
80006000 00000008 rts6740_elf.lib : memory.c.obj (.sysmem)
80006008 00002ff8 --HOLE--
.args 0 80009000 00001000
80009000 00001000 --HOLE-- [fill = 0]
...
.tableA 0 8000a8c0 00000030 RUN ADDR = 01400000
8000a8c0 00000030 tables.c.obj (.tableA)
.tableB 0 8000a8f0 00000030 RUN ADDR = 01400000
8000a8f0 00000030 tables.c.obj (.tableB)
...
LINKER GENERATED COPY TABLES
tableA_cpy @ 00008080 records: 1, size/record: 12, table size: 16
.tableA: load addr=8000a8c0, load size=00000030, run addr=01400000,
run size=00000030, compression=none
tableB_cpy @ 00008090 records: 1, size/record: 12, table size: 16
.tableB: load addr=8000a8f0, load size=00000030, run addr=01400000,
run size=00000030, compression=none
__TI_cinit_table @ 8000a9bc records: 3, size/record: 8, table size: 24
.fardata: load addr=8000a920, load size=00000072 bytes, run addr=8000a000,
run size=00000398 bytes, compression=rle
.neardata: load addr=8000a994, load size=00000014 bytes, run addr=02000000,
run size=0000001c bytes, compression=rle
.far: load addr=8000a9b4, load size=00000008 bytes, run addr=8000a620,
run size=00000148 bytes, compression=zero_init
LINKER GENERATED HANDLER TABLE
__TI_handler_table @ 8000a9a8 records: 3, size/record: 4, table size: 12
index: 0, handler: __TI_decompress_rle24
index: 1, handler: __TI_decompress_none
index: 2, handler: __TI_zero_init
GLOBAL SYMBOLS: SORTED ALPHABETICALLY BY Name
address name
------- ----
00007fc0 C$$EXIT
00007700 C$$IO$$
000071c0 HOSTclose
00005d20 HOSTlseek
...
00008080 __TI_table_tableA_cpy
00008090 __TI_table_tableB_cpy
...
[121 symbols]