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.

Code Size or size of .switch problem on TMS320F28035

Other Parts Discussed in Thread: TMS320F28035

I am trying to code with TMS320F28035 and fit a some chunk of code there. It gives me some errors, here is the main one I believe:

1. #10099-D -  In advice :

 "./lnk.cmd", line 48: error #10099-D: program will not fit into available
    memory.  placement with alignment fails for section ".text" size 0x2b12 .
    Available memory ranges:
    FLASH        size: 0x1000       unused: 0xe56        max hole: 0xe56 

Is it related to the code size? I looked at the .map file(attached in .pdf and .docx file) and saw that under section allocation map, there is such a line :
.switch    0    00000000    00000080     FAILED TO ALLOCATE
I am not quite sure what does this supposed to mean? Any kind of explanation or suggestion is appreciated,
Regards!!
1663.TMS320C2000 Linker PC v6.docx
0363.TMS320C2000 Linker PC v6.pdf
  • There are two key points here

    1. The size of your .text section is 0x2b12
    2. FLASH is only 0x1000

    Therefore your .text will not fit into FLASH.  Is there somewhere else you can put it? 

    This has nothing to do with .switch; as the map file shows, it is of zero size.

  • Thanks for the quick reply

    Please forgive my ignorance but this is the first time that I am openning a .map file and I am not aware of the terms (e.g. .text). 

    The board is a an experimenter kit for TMS320F28035. If you mean by "Is there somewhere else you can put it" additional external source, there is non on the board. So I am guessing it is the size of the code?

    (I cannot see the numbers you brought up in the file, so I believe there is a such way to calculate it. DI would be appreciated if you could suggest to read a TI document to understand how to read these?  )

  • Yes, .text is the code instructions.  I highlight below where the numbers I quoted come from:

    kerem kahraman said:

    I am trying to code with TMS320F28035 and fit a some chunk of code there. It gives me some errors, here is the main one I believe:

    1. #10099-D -  In advice :

     "./lnk.cmd", line 48: error #10099-D: program will not fit into available
        memory.  placement with alignment fails for section ".text" size 0x2b12 .
        Available memory ranges:
        FLASH size: 0x1000       unused: 0xe56        max hole: 0xe56 
    
    
    Is it related to the code size? I looked at the .map file(attached in .pdf and .docx file) and saw that under section allocation map, there is such a line :
    .switch    0    00000000    00000080     FAILED TO ALLOCATE
    I am not quite sure what does this supposed to mean? Any kind of explanation or suggestion is appreciated,
    Regards!!
    1663.TMS320C2000 Linker PC v6.docx
    0363.TMS320C2000 Linker PC v6.pdf

    Your .text (your program code) will not fit in FLASH.  You need to try to make the program smaller, or you need to find some other memory in your system in which to place it.  Do you call printf?

  • I don't call printf.

    Some of my source files are optional so I excluded a source file from the build/debug/release and the error is disappeared. I am guessing at this moment that the code now fits in my FLASH. To be ahead of the things, is there anyway to verify the code size in ccs?

    Thanks..!!!

  • kerem kahraman said:
    To be ahead of the things, is there anyway to verify the code size in ccs?

    The first table in the linker map file shows how much of each memory range is unused.  That's the file you attached to the first post.

    You may find the Assembly Language Tools guide generally helpful.

    Thanks and regards,

    -George

  • Thanks for the directions..

    I keep modifying my code and now with a little code adding I get the same error back. I looked into my memory configuration with George's suggestion and I realized that  I have so much memory unused (below). I tried to combine these FLASH sectors and I still get the same error. Would it something else causing it or I am looking to the wrong place. I also copy the memory configurations. Could it be that I have large size arrays?? By the way again the error is:

    10099-D

         Advice: 

     "./lnk.cmd", line 48: error #10099-D: program will not fit into available
        memory.  placement with alignment fails for section ".text" size 0x2b12 .
        Available memory ranges:
        FLASH        size: 0x1000       unused: 0xe56        max hole: 0xe56 
    --------------------------------------------

    MEMORY CONFIGURATION

    name origin length used unused attr fill
    ---------------------- -------- --------- -------- -------- ---- --------
    PAGE 0:
    RAML0 00008000 00000800 0000001f 000007e1 RWIX
    RAML3 00009000 00001000 00000a84 0000057c RWIX
    OTP 003d7800 00000400 00000000 00000400 RWIX
    FLASHH 003e8000 00002000 00000000 00002000 RWIX
    FLASHG 003ea000 00002000 00000000 00002000 RWIX
    FLASHF 003ec000 00002000 00000000 00002000 RWIX
    FLASHE 003ee000 00002000 00001d7c 00000284 RWIX
    FLASHD 003f0000 00002000 0000001f 00001fe1 RWIX
    FLASHC 003f2000 00002000 00000a84 0000157c RWIX
    FLASHA 003f6000 00001f80 00000020 00001f60 RWIX
    CSM_RSVD 003f7f80 00000076 00000000 00000076 RWIX
    BEGIN 003f7ff6 00000002 00000002 00000000 RWIX
    CSM_PWL 003f7ff8 00000008 00000000 00000008 RWIX
    IQTABLES 003fe000 00000b50 00000000 00000b50 RWIX
    IQTABLES2 003feb50 0000008c 00000000 0000008c RWIX
    IQTABLES3 003febdc 000000aa 00000000 000000aa RWIX
    BOOTROM 003ff27c 00000d44 00000000 00000d44 RWIX
    RESET 003fffc0 00000002 00000000 00000002 RWIX
    VECTORS 003fffc2 0000003e 00000000 0000003e RWIX

    PAGE 1:
    BOOT_RSVD 00000000 00000050 00000000 00000050 RWIX
    RAMM0 00000050 000003b0 00000300 000000b0 RWIX
    RAMM1 00000400 00000400 00000000 00000400 RWIX
    DEV_EMU 00000880 00000105 00000004 00000101 RWIX
    SYS_PWR_CTL 00000985 00000003 00000003 00000000 RWIX
    FLASH_REGS 00000a80 00000060 00000008 00000058 RWIX
    CSM 00000ae0 00000010 00000010 00000000 RWIX
    ADC_RESULT 00000b00 00000020 00000020 00000000 RWIX
    CPU_TIMER0 00000c00 00000008 00000008 00000000 RWIX
    CPU_TIMER1 00000c08 00000008 00000008 00000000 RWIX
    CPU_TIMER2 00000c10 00000008 00000008 00000000 RWIX
    PIE_CTRL 00000ce0 00000020 0000001a 00000006 RWIX
    PIE_VECT 00000d00 00000100 00000100 00000000 RWIX
    CLA1 00001400 00000080 00000040 00000040 RWIX
    CLA_CPU_MSGRAM 00001480 00000080 00000010 00000070 RWIX
    CPU_CLA_MSGRAM 00001500 00000080 00000012 0000006e RWIX
    ECANA 00006000 00000040 00000034 0000000c RWIX
    ECANA_LAM 00006040 00000040 00000040 00000000 RWIX
    ECANA_MOTS 00006080 00000040 00000040 00000000 RWIX
    ECANA_MOTO 000060c0 00000040 00000040 00000000 RWIX
    ECANA_MBOX 00006100 00000100 00000100 00000000 RWIX
    COMP1 00006400 00000020 00000014 0000000c RWIX
    COMP2 00006420 00000020 00000014 0000000c RWIX
    COMP3 00006440 00000020 00000014 0000000c RWIX
    EPWM1 00006800 00000040 00000040 00000000 RWIX
    EPWM2 00006840 00000040 00000040 00000000 RWIX
    EPWM3 00006880 00000040 00000040 00000000 RWIX
    EPWM4 000068c0 00000040 00000040 00000000 RWIX
    EPWM5 00006900 00000040 00000040 00000000 RWIX
    EPWM6 00006940 00000040 00000040 00000000 RWIX
    EPWM7 00006980 00000040 00000040 00000000 RWIX
    ECAP1 00006a00 00000020 00000020 00000000 RWIX
    HRCAP1 00006ac0 00000020 00000020 00000000 RWIX
    HRCAP2 00006ae0 00000020 00000020 00000000 RWIX
    EQEP1 00006b00 00000040 00000040 00000000 RWIX
    LINA 00006c00 00000080 0000004a 00000036 RWIX
    GPIOCTRL 00006f80 00000040 00000040 00000000 RWIX
    GPIODAT 00006fc0 00000020 00000020 00000000 RWIX
    GPIOINT 00006fe0 00000020 0000000c 00000014 RWIX
    SYSTEM 00007010 00000020 00000020 00000000 RWIX
    SPIA 00007040 00000010 00000010 00000000 RWIX
    SCIA 00007050 00000010 00000010 00000000 RWIX
    NMIINTRUPT 00007060 00000010 00000010 00000000 RWIX
    XINTRUPT 00007070 00000010 00000010 00000000 RWIX
    ADC 00007100 00000080 00000050 00000030 RWIX
    SPIB 00007740 00000010 00000010 00000000 RWIX
    I2CA 00007900 00000040 00000022 0000001e RWIX
    CLARAM0 00008800 00000400 000001e0 00000220 RWIX
    CLARAM1 00008c00 00000400 00000000 00000400 RWIX
    PARTID 003d7e80 00000001 00000001 00000000 RWIX
    FLASHB 003f4000 00002000 00000000 00002000 RWIX
    CSM_PWL 003f7ff8 00000008 00000008 00000000 RWIX


    SECTION ALLOCATION MAP

    output attributes/
    section page origin length input sections
    -------- ---- ---------- ---------- ----------------
    .pinit 0 003ee000 00000000 UNINITIALIZED

    .ebss 1 00000000 0000049a FAILED TO ALLOCATE
    .cinit 0 003ee000 000000f9
    003ee000 000000e3 HVACI_Sensorless_CLA-Main.obj (.cinit)
    003ee0e3 0000000a rts2800_ml.lib : _lock.obj (.cinit)
    003ee0ed 0000000a : exit.obj (.cinit)
    003ee0f7 00000002 --HOLE-- [fill = 0]

    .text 0 003ee0f9 00001c83
    003ee0f9 000007c2 dp_if.obj (.text)
    003ee8bb 00000627 HVACI_Sensorless_CLA-Main.obj (.text)
    003eeee2 00000431 DpDiag.obj (.text)
    003ef313 0000022b HVACI_Sensorless_CLA-DevInit_F2803x.obj (.text)
    003ef53e 000001ea ProfibusMain.obj (.text)
    003ef728 000001bf ADC_SOC_Cnf.obj (.text)
    003ef8e7 00000133 dp_isr.obj (.text)
    003efa1a 0000012b DpAppl.obj (.text)
    003efb45 000000ca PWM_1ch_Cnf.obj (.text)
    003efc0f 00000045 DpPrm.obj (.text)
    003efc54 00000044 rts2800_ml.lib : boot.obj (.text)
    003efc98 0000003c DpCfg.obj (.text)
    003efcd4 00000025 rts2800_ml.lib : fs_toi.obj (.text)
    003efcf9 00000021 : memcpy_ff.obj (.text)
    003efd1a 0000001a : i_tofs.obj (.text)
    003efd34 00000019 : args_main.obj (.text)
    003efd4d 00000019 : exit.obj (.text)
    003efd66 00000009 : _lock.obj (.text)
    003efd6f 00000008 DSP2803x_CodeStartBranch.obj (.text)
    003efd77 00000005 HVACI_Sensorless_CLA-DevInit_F2803x.obj (.text:retain)

    ramfuncs 0 003f0000 0000001f RUN ADDR = 00008000
    003f0000 0000001b HVACI_Sensorless_CLA-DevInit_F2803x.obj (ramfuncs)
    003f001b 00000004 DSP2803x_usDelay.obj (ramfuncs)

    Cla1Prog 0 003f2000 00000a84 RUN ADDR = 00009000
    003f2000 00000a84 HVACI_Sensorless_CLA-Tasks_C.obj (Cla1Prog:retain)

    .econst 0 003f6000 00000020
    003f6000 00000006 DpDiag.obj (.econst:_$P$T7$8)
    003f6006 00000005 DpDiag.obj (.econst:_$P$T2$3)
    003f600b 00000005 DpDiag.obj (.econst:_$P$T3$4)
    003f6010 00000003 DpDiag.obj (.econst:_$P$T0$1)
    003f6013 00000003 DpDiag.obj (.econst:_$P$T1$2)
    003f6016 00000003 DpDiag.obj (.econst:_$P$T4$5)
    003f6019 00000003 DpDiag.obj (.econst:_$P$T5$6)
    003f601c 00000002 DpDiag.obj (.econst:_$P$T6$7)
    003f601e 00000002 DpCfg.obj (.econst:_DpApplDefCfg)

    
    
    ---------------------------------
    
    

    MEMORY
    {
    /*Program Space*/
    PAGE 0:
    RAML0 : origin = 0x008000, length = 0x000800 /* on-chip RAM (L0)*/
    RAML3 : origin = 0x009000, length = 0x001000 /* data RAM (L3) */
    OTP : origin = 0x3D7800, length = 0x000400 /* on-chip OTP */
    FLASHH : origin = 0x3E8000, length = 0x002000 /* 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 */
    FLASHD : origin = 0x3F0000, length = 0x002000 /* on-chip FLASH */
    FLASHC : origin = 0x3F2000, length = 0x002000 /* on-chip FLASH */
    FLASHA : origin = 0x3F6000, length = 0x001F80 /* on-chip FLASH */
    CSM_RSVD : origin = 0x3F7F80, length = 0x000076 /* Part of FLASHA. Program with all 0x0000 when CSM is in use. */
    BEGIN : origin = 0x3F7FF6, length = 0x000002 /* Part of FLASHA. Used for "boot to Flash" bootloader mode. */
    CSM_PWL : origin = 0x3F7FF8, length = 0x000008 /* Part of FLASHA. CSM password locations in FLASHA */

    IQTABLES : origin = 0x3FE000, length = 0x000B50 /* IQ Math Tables in Boot ROM */
    IQTABLES2 : origin = 0x3FEB50, length = 0x00008C /* IQ Math Tables in Boot ROM */
    IQTABLES3 : origin = 0x3FEBDC, length = 0x0000AA /* IQ Math Tables in Boot ROM */

    BOOTROM : origin = 0x3FF27C, length = 0x000D44 /* Boot ROM */
    RESET : origin = 0x3FFFC0, length = 0x000002 /* part of boot ROM */
    VECTORS : origin = 0x3FFFC2, length = 0x00003E /* part of boot ROM */

    /*Data Space*/
    PAGE 1 :
    BOOT_RSVD : origin = 0x000000, length = 0x000050 /* Part of M0, BOOT rom will use this for stack */
    RAMM0 : origin = 0x000050, length = 0x0003B0 /* on-chip RAM block M0 */
    RAMM1 : origin = 0x000400, length = 0x000400 /* on-chip RAM block M1 */
    CLARAM0 : origin = 0x008800, length = 0x000400 /* on-chip RAM block L1 */
    CLARAM1 : origin = 0x008C00, length = 0x000400 /* on-chip RAM block L2 */
    CLA_CPU_MSGRAM : origin = 0x001480, length = 0x000080 /* CLA-R/W, CPU-R message RAM */
    CPU_CLA_MSGRAM : origin = 0x001500, length = 0x000080 /* CPU-R/W, CLA-R message RAM */

    FLASHB : origin = 0x3F4000, length = 0x002000 /* on-chip FLASH */

    }


    SECTIONS
    {
    /* Allocate program areas: */
    // .cinit : > FLASHA, PAGE = 0
    // .pinit : > FLASHA, PAGE = 0
    // .text : > FLASHA, PAGE = 0

    .cinit : > FLASHE, PAGE = 0
    .pinit : > FLASHE, PAGE = 0
    .text : > FLASHE|FLASHF|FLASHH, PAGE = 0

    codestart : > BEGIN PAGE = 0

    ramfuncs : LOAD = FLASHD,
    RUN = RAML0,
    LOAD_START(_RamfuncsLoadStart),
    LOAD_END(_RamfuncsLoadEnd),
    RUN_START(_RamfuncsRunStart),
    PAGE = 0

    Cla1Prog : LOAD = FLASHC, /* Note for running from RAM the load and RUN can be the same */
    RUN = RAML3,
    LOAD_START(_Cla1funcsLoadStart),
    LOAD_END(_Cla1funcsLoadEnd),
    RUN_START(_Cla1funcsRunStart),
    PAGE = 0



    csmpasswds : > CSM_PWL PAGE = 0
    csm_rsvd : > CSM_RSVD PAGE = 0

    /* Allocate uninitalized data sections: */
    .stack : > RAMM0, PAGE = 1
    .ebss : > RAMM1, PAGE = 1
    .esysmem : > RAMM1, PAGE = 1

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

    /* Allocate IQ math areas: */
    IQmath : > FLASHD PAGE = 0 /* Math Code */
    IQmathTables : > IQTABLES PAGE = 0, TYPE = NOLOAD /* Math Tables In ROM */

    Cla1ToCpuMsgRAM : > CLA_CPU_MSGRAM PAGE = 1
    CpuToCla1MsgRAM : > CPU_CLA_MSGRAM PAGE = 1

    ClaDataRam0 : > CLARAM0, PAGE = 1
    ClaDataRam1 : > CLARAM1, PAGE = 1
    CLAmathTables : > CLARAM1, PAGE = 1
    CLA1mathTables : > CLARAM1, PAGE = 1

    Thanks

  • There is no MEMORY named "FLASH" in the linker command file or map file in your post above.  It does not make sense that you would get that exact error message if you are using that linker command file.  Are you sure you are using exactly that linker command file when you get that exact error message?

  • I am actually sure that I am using the exactly the same linker. 

    I looked closer and realized that I was looking in Advice(the tab right by the Problems) and it states the error above still

    I am not sure whether it is relevant but whenever I look into the Console: It shows the following error:

    "../28035_FLASH_HVACI_Sensorless_CLA_lnk.cmd", line 124: error #10099-D:
    program will not fit into available memory. run placement with
    alignment/blocking fails for section ".ebss" size 0x49a page 1. Available
    memory ranges:
    RAMM1 size: 0x400 unused: 0x400 max hole: 0x400
    .ebss : > RAMM1, PAGE = 1

    These are the corresponding lines in the linker file

    /*Data Space*/
    PAGE 1 :
    BOOT_RSVD : origin = 0x000000, length = 0x000050 /* Part of M0, BOOT rom will use this for stack */
    RAMM0 : origin = 0x000050, length = 0x0003B0 /* on-chip RAM block M0 */
    RAMM1 : origin = 0x000400, length = 0x000400 /* on-chip RAM block M1 */
    CLARAM0 : origin = 0x008800, length = 0x000400 /* on-chip RAM block L1 */
    CLARAM1 : origin = 0x008C00, length = 0x000400 /* on-chip RAM block L2 */
    CLA_CPU_MSGRAM : origin = 0x001480, length = 0x000080 /* CLA-R/W, CPU-R message RAM */
    CPU_CLA_MSGRAM : origin = 0x001500, length = 0x000080 /* CPU-R/W, CLA-R message RAM */

    FLASHB : origin = 0x3F4000, length = 0x002000 /* on-chip FLASH */

    }

    in Sections--> Just the related lines

    /* Allocate uninitalized data sections: */
    .stack : > RAMM0, PAGE = 1
    .ebss : > RAMM1, PAGE = 1
    .esysmem : > RAMM1, PAGE = 1


  • Okay, .ebss represents non-const global variables, which must go into RAM.  Unfortunately, there isn't much RAM on that device.  Look at each of your global variables and make them const if possible, so that they will be placed in .const instead of .ebss.

    I think you can split .ebss among MEMORY areas for C2000.  If that's the case, you can direct the linker to split .ebss among two or more MEMORY areas:

    .ebss : >> RAMM0 | RAMM1, PAGE = 1
  • Thanks Archaeologist,

    I know the source of the problems and know how to track them now. 

    Making global variables const helped but it was not enough.

    Directing the linker to split .ebss among two or more MEMORY areas worked.