This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
I have used DATA_SECTION and CODE_SECTION to control the location of the variables, code, and constants. But the Code Composer Studio version 4 seem to ignore these instructions.
Here is some examples in code.
pragma DATA_SECTION( GwExeCRC, "VERSION1" )
const XWORD GwExeCRC = 0xFFFF;
pragma DATA_SECTION( GszModel, "VERSION2" )
const XCHAR GszModel[16] = { "PHASE FAIL-GW " };
pragma DATA_SECTION( GszModelRev, "VERSION3" )
const XCHAR GszModelRev[8] = { "1.00D02" };
Here is what was defined in the linker command file.
VERSION1 : origin = 0x3000, length = 0x0002
VERSION2 : origin = 0x3002, length = 0x0010
VERSION3 : origin = 0x3012, length = 0x0008
VERSION1 : {} > FLASH
VERSION2 : {} > FLASH
VERSION3 : {} > FLASH
Here is where the linker put these constants:
VERSION1 0 0000a2f8 00000002
VERSION2 0 0000a27e 00000010
VERSION3 0 0000a2e6 00000008
What am I doing wrong?
I am also trying to control variables with DATA_SECTION and code with CODE_SECTION, but I thought if I can get help with the above I should be able to do the same for the rest.
Thanks,
John Aggers
Emerson Climate Technologies
770-425-2724
John Aggers said:VERSION1 : origin = 0x3000, length = 0x0002VERSION2 : origin = 0x3002, length = 0x0010VERSION3 : origin = 0x3012, length = 0x0008
These are memory ranges defined wtihin the MEMORY directive in the linker command file. Here is where you specify the memory ranges available for your target.
John Aggers said:VERSION1 0 0000a2f8 00000002VERSION2 0 0000a27e 00000010VERSION3 0 0000a2e6 00000008
These are section allocations defined within the SECTIONS directive in the linker command file. Here is where you specify to which memory the different compiler sections are allocated.
It is advisable to keep the names of the memory ranges different from the section names to avoid confusion. Typically memory regions are named in a manner that makes them easily identifiable such as FLASH, RAM, SRAM etc. (although they can be anything else). So assuming these memory regions are named MEM1, MEM2 and MEM3, you can allocate your user sections to these regions with the following:
MEMORY
{
MEM1 : origin = 0x3000, length = 0x0002
MEM2 : origin = 0x3002, length = 0x0010
MEM3 : origin = 0x3012, length = 0x0008
}
SECTIONS
{
VERSION1 : {} > MEM1
VERSION2 : {} > MEM2
VERSION3 : {} > MEM3
}
More details on the linker command file directives can be found in the Assembly Language Tools Users Guide for the processor family you are using.