Barcode Reader User Manual

Getting Started With the Assembler and Linker
5-5
Getting Started With the Code Generation Tools
The two files, file1 and file2, can be linked together with or without a com-
mand file. However, using a command file allows you to configure your
memory using the MEMORY and SECTIONS directives:
The MEMORY directive lets you specify a model of target memory so
that you can define the types of memory your system contains and the
address ranges they occupy.
The SECTIONS directive describes how input sections are combined
into output sections and specifies where output sections are placed in
memory.
You can include the linker options and filenames in the linker command
file, or you can enter them on the command line. If you do not include a
linker command file, the linker uses a default allocation algorithm. Refer to
the
TMS470R1x Assembly Language Tools User’s Guide
for more in-
formation about the linker command file and the default allocation algo-
rithm.
Example 5–5. Sample Linker Command File, linker2.cmd
/* Specify the System Memory Map */
MEMORY
{
D_MEM : org = 0x00000000 len = 0x00001000 /* Data Memory (RAM) */
P_MEM : org = 0x00001000 len = 0x00001000 /* Program Memory (ROM) */
}
/* Specify the Sections Allocation Into Memory */
SECTIONS
{
.data : {} > D_MEM /* Initialized Data */
.text : {} > P_MEM /* Code */
}
Typing in the following command line using the linker command file shown
in Example 5–5 results in the map file shown in Example 5–6.
lnk470 file1 file2 linker2.cmd –m linker2.map –o prog.out