Example Linker Command File

App.cmd is an example linker command file.

Refer to Memory Requirements for further details

The \BoardSupport\lnk\memorymap.cmd file defines all available memory areas:

/***************************************************************************//**
@file memorymap.cmd
@brief memory mapping for D.Module2.DM642
@verbatim
_ _ _
__| | ___(_) ____ _ __ | |_
/ _` | / __| |/ _` | '_ \| __|
| (_| | _ \__ \ | (_| | | | | |_
\__,_|(_) ___/_|\__, |_| |_|\__|
Signalprocessing |___/ Technology
@endverbatim
@details This file defines a default memory mapping for D.Module2.DM642
@note before including this file define DDR origin and length:
@verbatim
#define RAMDSIC_SIZE 0x03d00000 // adjust this define as needed
#include "../../../BoardSupport/memorymap.cmd"
@endverbatim
*******************************************************************************/
/*******************************************************************************
MEMORY defines the available physical memory areas
IRAM: 256 Kbytes, usable as direct mapped SRAM and/or L2-cache
IVT (interrupt vector table) located at address 0
STARTUP section holds D.Module2.BIOS functions for board
initialization and bootloader
SDRAM: 64 MBytes, first 16 Kbytes hold D.Module2.BIOS functions
*******************************************************************************/
MEMORY
{
IVT : org = 0x00000000, len = 0x200 /* Interrupt Vector Table */
/***************************************************************************
the following memory areas are reserved for the BIOS functions
***************************************************************************/
STARTUP : org = 0x00000200, len = 0x200 /* Startup and bootload code, reserved */
DM2BIOS : org = 0x80000000, len = 0x00004000 /* BIOS, reserved */
/***************************************************************************
the following memory areas depend on cache settings
***************************************************************************/
IRAM : org = 0x00000400, len = 0x3FC00 /* no L2-cache, L2MODE = 000 */
/* IRAM : org = 0x00000400, len = 0x37C00 32K L2-cache. L2MODE = 001 */
/* IRAM : org = 0x00000400, len = 0x2FC00 64K L2-cache. L2MODE = 010 */
/* IRAM : org = 0x00000400, len = 0x1FC00 128K L2-cache. L2MODE = 011 */
/***************************************************************************
the following section is spread over three divisions to have heap and rts
in different locations
start address is 0x80004000 (below is reserved for BIOS)
***************************************************************************/
SDRAM : org = 0x80004000, len = 0x001ec000 /* available for application */
SDRTS : org = 0x801f0000, len = 0x00010000 /* used for RTS */
SDHEAP : org = 0x80200000, len = 0x00100000 /* used for heap */
/***************************************************************************
remaining size for ram disc is:
0x04000000
-0x00004000 BIOS
-0x001ec000 SDRAM
-0x00010000 SDRTS
-0x00100000 SDHEAP
=0x03d00000
***************************************************************************/
#if RAMDSIC_SIZE /* if a RAM disc is used */
SDRAMDISK: org = 0x80300000, len = RAMDSIC_SIZE
#endif
}

Include this default memory mapping in your application linker command file:

/***************************************************************************//**
@file App.cmd
@brief @ref P_APPCMD "Example Linker Command File" for D.Module2.DM642
@verbatim
_ _ _
__| | ___(_) ____ _ __ | |_
/ _` | / __| |/ _` | '_ \| __|
| (_| | _ \__ \ | (_| | | | | |_
\__,_|(_) ___/_|\__, |_| |_|\__|
Signalprocessing |___/ Technology
@endverbatim
@details This file is a sample DM642 linker command file that can
be used for linking programs built with the TMS320DM642
C Compiler. Use it as a guideline; you may want to change
the allocation scheme according to the size of your
program and the memory layout of your target system.
*******************************************************************************/
/*******************************************************************************
define SDRAM allocation without RAM disc
0x04000000 total memory size
-0x00004000 BIOS functions
-0x03ffc000 allocated for SDRAM
=0x00000000 no RAMDISC
define SDRAM allocation with RAM disc
0x04000000 total memory size
-0x00004000 BIOS
-0x001ec000 SDRAM
-0x00010000 SDRTS
-0x00100000 SDHEAP
=0x03d00000 RAMDISC
note: these settings are required for include file memorymap.cmd below
*******************************************************************************/
/*! [SDRAM allocation] */
#define RAMDSIC_SIZE 0x00000000 /* adjust this define as needed */
/* #define RAMDSIC_SIZE 0x03d00000 */ /* adjust this define as needed */
/*! [SDRAM allocation] */
/*******************************************************************************
default MEMORY mapping for D.Module2.DM642
*******************************************************************************/
#include "../../../BoardSupport/memorymap.cmd"
/*******************************************************************************
SECTIONS defines the mapping of compiler sections to physical memory
*******************************************************************************/
SECTIONS
{
/*------------------------------------------------------------------------*/
/* Sections defined only in RTS. */
/*------------------------------------------------------------------------*/
"vectors" > IVT /* only required if you link your own IVT */
.stack > IRAM /* internal for performance reasons */
.sysmem > IRAM /* heap for dynamic memory allocation intern */
/* .sysmem > SDHEAP heap for dynamic memory allocation extern */
.cio > SDRAM /* buffer for printf etc. */
/*------------------------------------------------------------------------*/
/* Sections of user code and data */
/*------------------------------------------------------------------------*/
.text > IRAM /* Executable code and constants */
.data > IRAM /* not used bythe C-Compiler */
.far > IRAM /* table of far call addresses */
.bss > IRAM /* globals and statics */
.const > IRAM /* Global and static const variables that are expli-
citly initialized and contain string literals */
.switch > IRAM /* Jump tables for large switch statements */
/*------------------------------------------------------------------------*/
/* RTS Sections */
/*------------------------------------------------------------------------*/
.cinit > SDRTS /* Tables for explicitly initialized global and static variables */
.pinit > SDRTS /* Table of constructors to be called at startup */
/* use the following three lines to link the RTS to internal memory */
.rtstext { -lrts6400.lib(.text) } > IRAM /* rts code */
.rtsbss { -lrts6400.lib(.far) } > IRAM /* Global and static variables declared far */
.rtsdata { -lrts6400.lib(.const) } > IRAM
/* use the following three lines to link the RTS to external memory */
/* .rtstext { -lrts6400.lib(.text) } > SDRTS */ /* rts code */
/* .rtsbss { -lrts6400.lib(.far) } > SDRTS */ /* Global and static variables declared far */
/* .rtsdata { -lrts6400.lib(.const) } > SDRTS */
/* commented out to supress not used warning */
/* .rtsbss { -lrts6400.lib(.bss) } > SDRTS */
/* .rtsswitch { -lrts6400.lib(.switch) } > SDRTS */
}
/*******************************************************************************
user defined sections
*******************************************************************************/
SECTIONS
{
.dbuffer > SDRAM /* data buffer */
.itext > IRAM /* use with pragma CODE_SECTION */
.iram > IRAM /* use with pragma DATA_SECTION */
.sdram > SDRAM /* use with pragma CODE_SECTION or DATA_SECTION */
}
/*******************************************************************************
Section specification for common modules
*******************************************************************************/
/*! [Common Code sections] */
/* #define COMMONSECTIONS IRAM all common modules linked to internal RAM */
#define COMMONSECTIONS SDRAM /* all common modules linked to external RAM */
#include "../../../Common/CommonSections.cmd"
/*! [Common Code sections] */
/*******************************************************************************
Network library sections
*******************************************************************************/
/*! [Network library sections] */
#define NETSECFAST IRAM
#define NETSECSLOW SDRAM
/*! [Network library sections] */
/*! [EMAC Packet Buffer] */
/*------------------------------------------------------------------------*/
/* define receive packet buffer size for EMAC DMA */
/* this buffer is divided into chunks of 0x600 bytes */
/* for best performance the maximum of 32 chunks should be used */
/* 32 x 0x600 == 0x0c000 */
/*------------------------------------------------------------------------*/
#define PBUFFER_SIZE 0x0c000
#define PBUFFER_ORG IRAM
/*! [EMAC Packet Buffer] */
#include "../../../Libs/Netlib/net.cmd"
SECTIONS
{
/* make sure to link the library .far section into internal RAM */
/* .far:FTPLIB { -lftp.lib(.far) } > IRAM */
/* .far:FTPCLIB { -lftpc.lib(.far) } > IRAM */
/* .far:HTTPLIB { -lhttp.lib(.far) } > IRAM */
}