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.

program will not fit into available memory ,TMS320F2837xS

hi

I am using the TMS320F2837xS  device with its default RAM_lnk.cmd file  and i am getting the "program will not fit into available memory" error .

can somebody please provide me with a solution how i can modify the cmd file (i am all ready using the max compiler optimization ) .

my final program will run from flash (only my main ISR will run from RAM) but i sow many examples that use RAM for debugging , can you please explain me the difference of debugging from RAM vs FLASH? maybe i am wrong and i just need to run everything from flash?

"../28377S_RAM_lnk.cmd", line 50: error #10099-D: program will not fit into available memory. placement with alignment/blocking fails for section ".text" size 0x1b96 page 0. Available memory ranges:
RAMM0 size: 0x2de unused: 0x2 max hole: 0x2
RAMD0 size: 0x800 unused: 0x0 max hole: 0x0
RAMLS0 size: 0x800 unused: 0x7 max hole: 0x7
RAMLS1 size: 0x800 unused: 0x6a7 max hole: 0x6a7
RAMLS2 size: 0x800 unused: 0x800 max hole: 0x800
RAMLS3 size: 0x800 unused: 0x800 max hole: 0x800
RAMLS4 size: 0x800 unused: 0x800 max hole: 0x800

best regards

Mark

  • can you upload you cmd file on community?
    CMD may have some problems.
  • MEMORY
    {
    PAGE 0 :
    /* BEGIN is used for the "boot to SARAM" bootloader mode */

    BEGIN : origin = 0x000000, length = 0x000002
    RAMM0 : origin = 0x000122, length = 0x0002DE
    RAMD0 : origin = 0x00B000, length = 0x000800
    RAMLS0 : origin = 0x008000, length = 0x000800
    RAMLS1 : origin = 0x008800, length = 0x000800
    RAMLS2 : origin = 0x009000, length = 0x000800
    RAMLS3 : origin = 0x009800, length = 0x000800
    RAMLS4 : origin = 0x00A000, length = 0x000800
    RAMGS14 : origin = 0x01A000, length = 0x001000
    RAMGS15 : origin = 0x01B000, length = 0x001000
    RESET : origin = 0x3FFFC0, length = 0x000002

    PAGE 1 :

    BOOT_RSVD : origin = 0x000002, length = 0x000120 /* Part of M0, BOOT rom will use this for stack */
    RAMM1 : origin = 0x000400, length = 0x000400 /* on-chip RAM block M1 */
    RAMD1 : origin = 0x00B800, length = 0x000800


    RAMLS5 : origin = 0x00A800, length = 0x000800

    RAMGS0 : origin = 0x00C000, length = 0x001000
    RAMGS1 : origin = 0x00D000, length = 0x001000
    RAMGS2 : origin = 0x00E000, length = 0x001000
    RAMGS3 : origin = 0x00F000, length = 0x001000
    RAMGS4 : origin = 0x010000, length = 0x001000
    RAMGS5 : origin = 0x011000, length = 0x001000
    RAMGS6 : origin = 0x012000, length = 0x001000
    RAMGS7 : origin = 0x013000, length = 0x001000
    RAMGS8 : origin = 0x014000, length = 0x001000
    RAMGS9 : origin = 0x015000, length = 0x001000
    RAMGS10 : origin = 0x016000, length = 0x001000
    RAMGS11 : origin = 0x017000, length = 0x001000
    RAMGS12 : origin = 0x018000, length = 0x001000
    RAMGS13 : origin = 0x019000, length = 0x001000

    }


    SECTIONS
    {
    codestart : > BEGIN, PAGE = 0
    ramfuncs : > RAMM0 PAGE = 0
    .text : >>RAMM0 | RAMD0 | RAMLS0 | RAMLS1 | RAMLS2 | RAMLS3 | RAMLS4, PAGE = 0
    .cinit : > RAMM0, PAGE = 0
    .pinit : > RAMM0, PAGE = 0
    .switch : > RAMM0, PAGE = 0
    .reset : > RESET, PAGE = 0, TYPE = DSECT /* not used, */

    .stack : > RAMM1, PAGE = 1
    .ebss : > RAMLS5, PAGE = 1
    .econst : > RAMLS5, PAGE = 1
    .esysmem : > RAMLS5, PAGE = 1

    ramgs0 : > RAMGS0, PAGE = 1
    ramgs1 : > RAMGS1, PAGE = 1
    }

    /*
    //===========================================================================
    // End of file.
    //===========================================================================
    */
  • program run in Flash should link 2837xS_Generic_Flash_lnk.cmd.
    program run in SRAM should link 2837xS_RAM_lnk.cmd.
  • Mark,

    The main difference between debugging from RAM and flash is that in flash you are limited to only two break-points, whereas in RAM you can have as many as you like.  The error message is telling you the .text section is too big to fit in any of the sections allocated for it.  The "|" operator tells the linker to try to fit the entire .text section into the first section in the list into which it all fits. Your .text section is 0x1b96 words in length, but the biggest single block you have allocated for is is 0x800 words.  

    If you want to work with your entire program in RAM, what you can do is to comment out a couple of those lines in the MEMORY section and combine them into one contiguous memory block which is big enough to take your program.  For example:

    MEMORY
    {
    PAGE 0 :
    /* BEGIN is used for the "boot to SARAM" bootloader mode */

    BEGIN : origin = 0x000000, length = 0x000002
    RAMM0 : origin = 0x000122, length = 0x0002DE
    RAMD0 : origin = 0x00B000, length = 0x000800
    /* RAMLS0 : origin = 0x008000, length = 0x000800 */
    /* RAMLS1 : origin = 0x008800, length = 0x000800 */
    /* RAMLS2 : origin = 0x009000, length = 0x000800 */
    /* RAMLS3 : origin = 0x009800, length = 0x000800 */
    /* RAMLS4 : origin = 0x00A000, length = 0x000800 */

    RAMLS04 : origin = 0x008000, length = 0x002800

    ...

    Then, in the SECTIONS part, allocate your .text section to this block:

    /* .text : >>RAMM0 | RAMD0 | RAMLS0 | RAMLS1 | RAMLS2 | RAMLS3 | RAMLS4, PAGE = 0 */

    .text : > RAMLS04, PAGE = 0

    Regards,

    Richard

  • ".text : >>RAMM0 | RAMD0 | RAMLS0 | RAMLS1 | RAMLS2 | RAMLS3 | RAMLS4, PAGE = 0"
    the code above is no problem
    pease see
    processors.wiki.ti.com/.../C28x_Compiler_-_Understanding_Linking

    Q: In the linker command file, can I combine continuous flash blocks into one section?
    SECTIONS
    {
    .text: { *(.text) } >> FLASHE| FLASHH
    }
  • Hi Richard

    got it! thank you for the fast and detailed reply .
    can you please also explain to me the flash usage as defined in the cmd file - i see that as default most of the flash is not allocated/used - is there an special reason for that ?

    best regards
    Mark
  • Hi Mark,

    I doubt there's a special reason. The F28377S device has a lot of flash - more than any of our examples need. I suspect whoever wrote the linker command file allocated just a typical amount. All the flash sectors have the same wait states so code will execute equally well from any sector. The only thing to keep in mind is the sectors are organised in two banks: A to N go into bank 0, O to AB into bank 1. Code can execute from either bank while the other is being programmed.

    Regards,

    Richard