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.

  • Resolved

Compiler/TMS320F28035: Linker file explanation

Prodigy 220 points

Replies: 4

Views: 129

Part Number: TMS320F28035

Tool/software: TI C/C++ Compiler

Can anyone help me to understand this linker file section?

progRAM : origin = 0x008000, length = 0x001400 /* on-chip RAM (L0-L2)*/
OTP : origin = 0x3D7800, length = 0x000400 /* on-chip OTP */
FLASHH : origin = 0x3E8000, length = 0x008000 /* on-chip FLASH */

/* Allocate program areas: */
/* Initalized sections go in Flash */
/* For SDFlash to program these, they must be allocated to page 0 */
.econst : > FLASHH PAGE = 0
.switch : > FLASHH PAGE = 0

/* Allocate IQ math areas: */
IQmath : > FLASHH PAGE = 0 /* Math Code */

.cinit : > FLASHH, PAGE = 0
.pinit : > FLASHH, PAGE = 0
//.text : > FLASHH, PAGE = 0
/*For CRC tables */
.TI.crctab : > APPCRC, PAGE=0
.text : > FLASHH, PAGE=0, crc_table(_linkerCRC,algorithm=CRC32_PRIME )

codestart : > BEGIN PAGE = 0
ramfuncs : LOAD = FLASHH,
RUN = progRAM,
LOAD_START(_RamfuncsLoadStart),
LOAD_END(_RamfuncsLoadEnd),
RUN_START(_RamfuncsRunStart),
PAGE = 0

Here my entire code is in FLASHH. I defined .cinit., .init as part of the FLASHH.

I have some functions which need to be run from RAM. So I defined those as ramfuncs. 

Is there anything wrong with this? 

"ramfuncs : LOAD = FLASHH" what does this mean? Does it place entire FLASHH on ram? 

  • Patel,

    I will advise that you take a look at the FLASH examples and linker command files provided in C2000Ware as a starting point. These are our latest and most up to date files.

    The Flash example project executes the Flash API functions from RAM. To do so you allocate the FLASH API library to the .TI.ramfunc section which has both a Flash load address and a RAM run address. This is what is shown in the snippet of code you attached. Within the example's main function, the memcpy() function is called to copy the contents of the section defined the in the linker cmd file from FLash to RAM before execution.

    From what you have attached, I would recommend you keep the ramfuncs in a different flash memory range from the .cinit and .init assingments.

    Here's an appnote that details how to run application from internal Flash memory:
    www.ti.com/.../spra958l.pdf

    For more information on FLASH check out this wiki (Question 36):
    processors.wiki.ti.com/.../C2000_Flash_FAQ

    For more information on linking check out this wiki:
    processors.wiki.ti.com/.../C28x_Compiler_-_Understanding_Linking

    Regards,
    Ozino

  • In reply to Ozino Odharo:

    Thanks, Ozino.

    What is wrong if I have .cinit and ramfuncs are in the same flash memory? 

  • In reply to Patel:

    I don't see anything wrong at the moment. I just wasn't sure how much memory was allocated in that FLASH section of memory.

  • In reply to Ozino Odharo:

    I combined other sectors to form a big sector.

    FLASHH : origin = 0x3E8000, length = 0x008000 /* on-chip FLASH */
    // FLASHG : origin = 0x3EA000, length = 0x002000 /* on-chip FLASH */
    // FLASHF : origin = 0x3EC000, length = 0x002000 /* on-chip FLASH */
    // FLASHE : origin = 0x3EE000, length = 0x002000 /* on-chip FLASH */

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.