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.

TMS320F28069F: C2Prog Sector Violation for CLA RAM

Part Number: TMS320F28069F

Hello

I am able to flash my CLA enabled code on my device using CCS. However when I try to flash using C2Prog I get this error:

Reading the SPRS698I document I know that CLA Program needs to reside in 0x9000 (region L3). I also C2Prog only supports saving code to flash memory so I made my linker file save the CLA code to flash then load to RAM at startup.

MEMORY

{

PAGE 0:

    BEGINRAM:     origin=0x0, length=0x2

    PRAM:        origin=0xC000, length=0x2000 //L5

    CLA_PROG_RAM: origin = 0x9000, length = 0x1000 //L3

    OTP:         origin=0x3d7800, length=0x3fa

    BEGINFLASH:   origin=0x3D8000, length=0x2

    APPHDR:      origin=0x3D8002, length=0xC   

    FLASH:       origin=0x3d800e, length=0x1Bff2

   …

PAGE 1:

    RAMM0M1:      origin=0x2, length=0x7fe

    CLA1_MSGRAMLOW:  origin = 0x1480, length = 0x000080

    CLA1_MSGRAMHIGH: origin = 0x1500, length = 0x000080

    CLA_DATA_RAM:    origin = 0x8000, length = 0x001000 //L0, L1, L2

    DRAM:   origin=0xe000, length=0x6000

}

 

SECTIONS

{

....

   Cla1Prog        : LOAD = FLASH,

                     RUN = CLA_PROG_RAM,

                     LOAD_START(_Cla1funcsLoadStart),

                     LOAD_END(_Cla1funcsLoadEnd),

                     LOAD_SIZE(_Cla1funcsLoadSize),

                     RUN_START(_Cla1funcsRunStart),

                     PAGE = 0

 

   CLAscratch       :

                     { *.obj(CLAscratch)

                     . += CLA_SCRATCHPAD_SIZE;

                     *.obj(CLAscratch_end) } > CLA_DATA_RAM,

                              PAGE = 1

                             

   CLA1mathTables :   LOAD = FLASH,

                      RUN = CLA_DATA_RAM,

                      LOAD_START(_Cla1mathTablesLoadStart),

                      LOAD_END(_Cla1mathTablesLoadEnd),

                      LOAD_SIZE(_Cla1mathTablesLoadSize),

                      RUN_START(_Cla1mathTablesRunStart),

                      PAGE = 1

}

Then on startup I copy Cla1Prog and CLA1mathTables to program RAM and data RAM respectively.

 

void c2000_flash_init(void)

{

  #if MW_RUNTIME_FLASHLOAD

  // Copy InitFlash function code and Flash setup code to RAM

  memcpy(& RamfuncsRunStart,&RamfuncsLoadStart, (Uint32)(&RamfuncsLoadEnd-&RamfuncsLoadStart));

  #ifdef CLA_BLOCK_INCLUDED

    memcpy(&Cla1funcsRunStart, &Cla1funcsLoadStart, (Uint32)&Cla1funcsLoadSize);

    memcpy(&Cla1mathTablesRunStart, &Cla1mathTablesLoadStart, (Uint32)&Cla1mathTablesLoadSize);

  #endif

  // Call Flash Initialization to setup flash waitstates

  // This function must reside in RAM

  InitFlash();

  #endif

}

What could be causing the C2Prog error?


  • Mashrur,

    Since you did not share the entire linker cmd file, not sure if anything else is mapped at 0x9000.  Could you check if anything else (other than Cla1Prog) is mapped to CLA_PROG_RAM in your linker cmd file?  Please check your map file to know what exactly is mapped at 0x9000.

    Did you get any warning when you compiled?  Warning like "creating output section without a sections specification" or anything else?  

    Thanks and regards,

    Vamsi

  • I was able to fix the issue by moving CLA1_MSGRAMLOW, CLA1_MSGRAMHIGH, CLA_DATA_RAM to page 0.

    I am now able to flash over CAN.

    MEMORY

    {

    PRAM: origin=0xC000, length=0x2000 //L5
    CLA_PROG_RAM: origin = 0x9000, length = 0x1000 //L3
    ...
    CLA1_MSGRAMLOW: origin = 0x1480, length = 0x000080
    CLA1_MSGRAMHIGH: origin = 0x1500, length = 0x000080
    CLA_DATA_RAM: origin = 0x8000, length = 0x001000 //L0, L1, L2
    DRAM: origin=0xe000, length=0x6000

    }

    SECTIONS

    {

    Cla1Prog : LOAD = FLASH,
    RUN = CLA_PROG_RAM,
    LOAD_START(_Cla1funcsLoadStart),
    LOAD_END(_Cla1funcsLoadEnd),
    LOAD_SIZE(_Cla1funcsLoadSize),
    RUN_START(_Cla1funcsRunStart),
    PAGE = 0

    CLAscratch :
    { *.obj(CLAscratch)
    . += CLA_SCRATCHPAD_SIZE;
    *.obj(CLAscratch_end) } > CLA_DATA_RAM,
    PAGE = 0

    CLA1mathTables : LOAD = FLASH,
    RUN = CLA_DATA_RAM,
    LOAD_START(_Cla1mathTablesLoadStart),
    LOAD_END(_Cla1mathTablesLoadEnd),
    LOAD_SIZE(_Cla1mathTablesLoadSize),
    RUN_START(_Cla1mathTablesRunStart),
    PAGE = 0

    }