Creating a Linker Command File
2 - 16 TMS320F2837xD Microcontroller Workshop - Programming Development Environment
}
Remember that the MCU has two memory maps: Program, and Data. Therefore, the MEMORY
description must describe each of these separately. The loader uses the following syntax to
delineate each of these:
Linker Page TI Definition
Page 0 Program
Page 1 Data
Linker Command File
SECTIONS
{
.text:> FLASH PAGE = 0
.ebss:> RAMM0 PAGE = 1
.cinit:> FLASH PAGE = 0
.stack:> RAMM1 PAGE = 1
}
MEMORY
{
PAGE 0: /* Program Memory */
FLASH: origin = 0x080000, length = 0x40000
PAGE 1: /* Data Memory */
RAMM0: origin = 0x000000, length = 0x400
RAMM1: origin = 0x000400, length = 0x400
}
A linker command file consists of two sections, a memory section and a sections section. In the
memory section, page 0 defines the program memory space, and page 1 defines the data
memory space. Each memory block is given a unique name, along with its origin and length. In
the sections section, the section is directed to the appropriate memory block.
Section Placement
The SECTIONS section will specify how you want the sections to be distributed through memory.
The following code is used to link the sections into the memory specified in the previous example:
SECTIONS
{
.text:> FLASH PAGE 0
.ebss:> RAMM0 PAGE 1
.cinit:> FLASH PAGE 0
.stack:> RAMM1 PAGE 1
}