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.

CCS/TMS320F28377D: Need memory map / linker help for .TI.ramfunc

Part Number: TMS320F28377D

Tool/software: Code Composer Studio

I have been debugging some time-critical code running out of RAM, and now when I run out of Flash, I get some amount of performance degradation (SYSCLK= 150MHz, Flash Wait States = 2).  So I've been moving routines into ram using #pragma CODE_SECTION(<func_name>, ".TI.ramfunc"); 

Once I do this too liberally, the linker informs me that I don't have a contiguous block of memory that is big enough for everything I've tried to put into RAM using this directive.

"C:/Users/sbeiter/workspace_v7/my_project/2837xD_FLASH_lnk_cpu1.cmd", line 93: error #10099-D: program will not fit into available memory. run placement with alignment/blocking fails for section ".TI.ramfunc" size 0x108f page 0. Available memory ranges:
RAMLS0 size: 0x800 unused: 0x800 max hole: 0x800
RAMLS1 size: 0x800 unused: 0x800 max hole: 0x800
RAMLS2 size: 0x800 unused: 0x800 max hole: 0x800
RAMLS3 size: 0x800 unused: 0x800 max hole: 0x800
RAMGS14 size: 0x1000 unused: 0x1000 max hole: 0x1000
RAMGS15 size: 0x1000 unused: 0x1000 max hole: 0x1000

I had already modified the supplied linker command file by including GS14 and GS15 in the available RAM space back when I went over the 0x0800:

 .TI.ramfunc : {} LOAD = FLASHD,
       RUN = RAMLS0 | RAMLS1 | RAMLS2 |RAMLS3|RAMGS14|RAMGS15,
                         LOAD_START(_RamfuncsLoadStart),
                         LOAD_SIZE(_RamfuncsLoadSize),
                         LOAD_END(_RamfuncsLoadEnd),
                         RUN_START(_RamfuncsRunStart),
                         RUN_SIZE(_RamfuncsRunSize),
                         RUN_END(_RamfuncsRunEnd),
       PAGE = 0, ALIGN(4)

I guess I'm unsure why the linker is looking for a contiguous block and also why it doesn't recognize the adjacency of LS0 to LS3, which really represents 0x800 x 4?  Is there a syntax for concatenating these blocks together?  I suppose I could just make RAMLS0 look like a contiguous block of 4 x 0x800, but is there a preferred or recommended way other than this or getting a bigger chunk of RAM for program?  I could also declare a second section .TI.ramfunc2 or something, but I'd like to do this the way TI recommends, if possible.  Obviously there is plenty of memory there, just want to be sure I am using the linker command file capabilities appropriately. Thanks!

  • As far as I can tell, there's no way to split the run section across memory regions. I'll ping the codegen team to be sure, but I suspect you'll need to combine some blocks like you mentioned. Something like

    RAMLS0_3 : origin = 0x008000, length = 0x002000

    Whitney
  • Thanks, Whitney.  While you are checking, can I ask a follow-up?  I'm just curious because the linker command file for a RAM build doesn't seem to care that my code spans more than one 0x800 "sector" of RAM, so why does the Flash build?  What I mean is that my RAM build does not encounter a similar error when I build it into the same space of RAMLS0 to RAMLS3?

  • I recommend the memory ranges RAMLS0 through RAMLS3 be collapsed into one memory range.  That involves two changes.

    First, in the MEMORY directive, this ...

       RAMLS0          	: origin = 0x008000, length = 0x000800
       RAMLS1          	: origin = 0x008800, length = 0x000800
       RAMLS2      		: origin = 0x009000, length = 0x000800
       RAMLS3      		: origin = 0x009800, length = 0x000800
    

    ... changes to ...

       RAMLS0_LS3       : origin = 0x008000, length = 0x000800 * 4
    

    Second, in the SECTIONS directive, any use of the memory range names RAMLS0 through RAMLS3 must be changed to use RAMLS0_LS3 instead.  So ...

    						 RUN = RAMLS0 | RAMLS1 | RAMLS2 |RAMLS3,
    

    ... becomes ...

    						 RUN = RAMLS0_LS3
    

    Background ... The syntax ...

    Susan Beiter78 said:
           RUN = RAMLS0 | RAMLS1 | RAMLS2 |RAMLS3|RAMGS14|RAMGS15,

    ... means allocate the entire output section, named .TI.ramfunc, into the first memory range in the list which can contain that section.  Only one memory range is selected.  The rest are not used.  Once .TI.ramfunc is bigger than the largest of those memory ranges, allocation fails.

    Collapsing those memory ranges into one creates a larger memory range into which more functions can be allocated.

    As for splitting the run address ... It is possible.  However, in addition to changing the linker command file, you also have to change the system startup code.  I suspect you don't want to get into the details on that.

    Thanks and regards,

    -George