SPRU513Z August 2001 – October 2023 SM320F28335-EP
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 | ||
---|---|---|---|
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 | ||
---|---|---|---|
Memory Type | Address Range | Contents |
---|---|---|
Program | 0x0f0000 to 0x3fffbf | SLOW_MEM |
0x3fffc0 to 0x3fffff | Interrupt vector table | |
Data | 0x000040 to 0x0001ff | Stack |
0x000200 to 0x0007ff | FAST_MEM_1 | |
0x3ed000 to 0x3effff | FAST_MEM_2 |
The output sections are constructed in the following manner:
Linker Command File, demo.cmd shows the linker command file for this example. Output Map File, demo.map shows the map file.
/***************************************************************/
/*** Specify Linker Options ***/
/***************************************************************/
--output_file=demo.out /* Name the output file */
--map_file=demo.map /* Create an output map */
/***************************************************************/
/*** Specify the Input Files ***/
/***************************************************************/
demo.c.obj
fft.c.obj
tables.c.obj
/***************************************************************/
/*** Specify the Memory Configuration ***/
/***************************************************************/
MEMORY
{
PAGE 0: SLOW_MEM (R): origin=0x3f0000 length=0x00ffc0
VECTORS (R): origin=0x3fffc0 length=0x000040
PAGE 1: STACK (RW): origin=0x000040 length=0x0001c0
FAST_MEM_1 (RW): origin=0x000200 length=0x000600
FAST_MEM_2 (RW): origin=0x3ed000 length=0x003000
}
/***************************************************************/
/*** Specify the Output Sections ***/
/***************************************************************/
SECTIONS
{
vectors : { } > VECTORS page=0
.text : load = SLOW_MEM, page = 0 /* link in .text */
.data : fill = 07A1Ch, Load=FAST_MEM_1, page=1
{
tables.c.obj(.data) /* .data input */
fft.c.obj(.data) /* .data input */
. += 100h; /* create hole, fill with 0x07A1C */
}
var_defs : { } > FAST_MEM_2 page=1 /* defs in RAM */
.ebss : page=1, fill=0x0ffff /*.ebss fill and link*/
}
/***************************************************************/
/*** End of Command File ***/
/***************************************************************/
Invoke the linker by entering the following command:
cl2000 --run_linker demo.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 TMS320C28x.
OUTPUT FILE NAME: <demo.out>
ENTRY POINT SYMBOL: 0
MEMORY CONFIGURATION
name origin length attributes fill
-------- -------- --------- ---------- --------
PAGE 0: SLOW_MEM 003f0000 0000ffc0 R
VECTORS 003fffc0 00000040 R
PAGE 1: STACK 00000040 000001c0 RW
FAST_MEM_1 00000200 00000600 RW
FAST_MEM_2 003ed000 00003000 RW
SECTION ALLOCATION MAP
output attributes/
section page origin length input sections
-------- ---- ---------- ---------- ----------------
vectors 0 003fffc0 00000000 UNINITIALIZED
.text 0 003f0000 0000001a
003f0000 0000000e demo.c.obj (.text)
003f000e 00000000 tables.c.obj (.text)
003foooe 0000000c fft.c.obj (.text)
var_defs 1 003ed000 00000002
003ed000 00000002 demo.c.obj (var_defs)
.data 1 00000200 0000010c
00000200 00000004 tables.c.obj (.data)
00000204 00000000 fft.c.obj (.data)
00000204 00000100 --HOLE-- [fill = 7a1c]
00000304 00000008 demo.c.obj (.data)
.ebss 0 00000040 00000069
00000040 00000068 demo.c.obj (.ebss) [fill=ffff]
000000a8 00000000 fft.c.obj (.ebss)
000000a8 00000001 tables.c.obj (.ebss) [fill=ffff]
xy 1 000000a9 00000014 UNINITIALIZED
000000a9 00000014 demo.c.obj (xy)
GLOBAL SYMBOLS: SORTED ALPHABETICALLY BY Name
address name
-------- ----
00000040 .ebss
00000200 .data
003f0000 .text
00000040 ARRAY
000000a8 TEMP
00000040 ___ebss__
00000200 ___data__
0000030c ___edata__
000000a9 ___end__
003f001a ___etext__
003f0000 ___text__
003f000e _func1
003f0000 _main
0000030c edata
000000a9 end
003f001a etext
GLOBAL SYMBOLS: SORTED BY Symbol Address
address name
-------- ----
00000040 ARRAY
00000040 ___ebss__
00000040 .ebss
000000a8 TEMP
000000a9 ___end__
000000a9 end
00000200 ___data__
00000200 .data
0000030c edata
0000030c ___edata__
003f0000 _main
003f0000 .text
003f0000 ___text__
003f000e _func1
003f001a etext
003f001a ___etext__
[16 symbols]