DSPRelated.com
Forums

SECTIONS and debug / release possibilities?

Started by William C Bonner April 20, 2006
I'm currently working with a sections portion of my linker command
file. I'm also developing a project that is using project dependencies
on a library that I'm also developing, and I use the fact that when I
switch from debug to release mode, the library that the main project is
dependent on gets switched to use the correct version at the same time.

I want to have some special items in the linker command file, that get
treated differently depending on if I'm compiling in release mode or
debug mode. One is that I've like to have my .stack entry be defined to
be initialized in debug mode, but not in release mode.
SECTIONS
{
.stack > L2RAM
/* .stack > L2RAM, fill = 0xDEADBEEF */
}

The other is that I'd like to specify some modules from my library
be located in different memory sections without modifying the code files
themselves. The way to do that would be simple if I was directly
linking the object files as part of the project, and fairly simple if I
was linking to the stadard library, but because I want it to switch
between debug and release I've not figured things out. Here's the part
that I'm currently using.

SECTIONS
{
/* only required if you link your own IVT */
.vect > VECT
/* I'm filling the stack for Debugging purposes. It should be
removed for RELEASE, as it makes the image file larger! */
/* .stack > L2RAM, fill = 0xDEADBEEF */
.stack > L2RAM
.iram > L2RAM
{
module_control_1v1_far.obj (.far)
module_control_1v1_far.obj (.text)
-lrts6700.lib (.far)
-lcsl6713.lib (.far)
zmdm.obj (.text)
}
.l2ram > L2RAM /* Wim's label, since code and data can't share
labels */
.cio > L2RAM
.switch > L2RAM /* The .switch section contains tables for
large switch statements. */
.pinit > L2RAM /* Table of Global Object Constructors. See
below for full description */
.data > L2RAM /* .data is not used by the C compiler */
.bss > L2RAM /* The .bss section reserves space for global and
static variables. When you specify the -c linker option, at program
startup, the C/C++ boot routine copies data out of the .cinit section
(which can be in ROM) it in the .bss section. The compiler defines the
global symbol $bss and assigns $bss the value of the starting address of
the .bss section. */
.far >> L2RAM | SRAM /* The .far section reserves space for
global and static variables that are declared far. */
.text >> L2RAM | SRAM /* Use the >> operator to indicate that an
output section can be split, if necessary, into the specified memory
ranges. */
/* .text > SRAM */ /* The .text section contains all the
executable code. */
.cinit > SRAM /* The .cinit section contains tables for
initializing variables and constants. I believe that this is only the
values that are used to initialize things at startup, and so are not
needed during runtime. */
.const > SRAM /* The .const section contains string literals,
floating-point constants, and data defined with the C/C++ qualifier
const (provided the constant is not also defined as volatile). */
.sysmem > SRAM /* The .sysmem section reserves space for
dynamic memory allocation. The reserved space is used by the malloc,
calloc, and realloc functions. If a C/C++ program does not use these
functions, the compiler does not create the .sysmem section. */
}