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.

Compiler/TMS320F280025C: the main function code will jump to abort() function when initialize big array

Part Number: TMS320F280025C
Other Parts Discussed in Thread: C2000WARE, DRV8312

Tool/software: TI C/C++ Compiler

Hi Expert,

I use the example code from the below link, define a big array as below:

C:\ti\c2000\C2000Ware_MotorControl_SDK_F28002x_3_00_00_01\solutions\drv8312_c2_kit\f28002x\ccs\sensorless_foc

uint16_t array[4096];

 

and initialize the array after the function HAL_enableDebugInt();//

// enable debug interrupts

//

HAL_enableDebugInt(halHandle);

for(i=0;i<4096;i++)

{

array[i] =i;

}

After run the code, there will have a strange issue, that is the code will run to abort() function as below showed, but the code also can run to

mainISR interrupt.

void abort(void)

{

/*-------------------------------------------------------------------*/

/* SET C$$EXIT LABEL SO THE DEBUGGER KNOWS WHEN THE C++ PROGRAM HAS */

/* COMPLETED. THIS CAN BE REMOVED IF THE DEBUGGER IS NOT USED. */

/*-------------------------------------------------------------------*/

__asm(" .global C$$EXIT");

__asm("C$$EXIT: nop");

for (;;); /* SPINS FOREVER */

}

If I modify the code below, then everything is ok.

for(i=0;i<100;i++)

{

array[i] =i;

}

I compare the memory map between the changed code and original code, it seems there are the same.

I post the code attached so that the issue can be reproduced, could you help take a look at what is the reason?

is01_intro_hal_coff.7z

  • The command file (.cmd) has been changed incorrectly since the dault .cmd can support such size array in the .ebss/.bss section. The memory of the array overlaps other memory for program code.

  • Hi Yanming,

    The default cmd's  ebss/.bss section is not enough for this array, so I use a separate and bigger RAM size for these array, it should not overlaps other memory for program code.

    RAMLS4_5_6 : origin = 0x0000A000, length = 0x00001400

    The program code are allocated to different RAM address:

    .TI.ramfunc : LOAD = FLASHBANK0_S2_15

    RUN = RAMLS7 | RAMGS0,

    LOAD_START(_RamfuncsLoadStart),

    LOAD_SIZE(_RamfuncsLoadSize),

    LOAD_END(_RamfuncsLoadEnd),

    RUN_START(_RamfuncsRunStart),

    RUN_SIZE(_RamfuncsRunSize),

    RUN_END(_RamfuncsRunEnd),

    PAGE = 0, ALIGN(4)

    Also if put the initialization code at the beginning of the main function like below, then there is no this issue:

    void main(void)

    {

    uint16_t estNumber = 0;

    bool flagEstStateChanged = false;

    motorVars.flagEnableSys = 1;

    for(i=0;i<4096;i++)

    {

    array[i] =i;

    }

    but if put the code after the function HAL_enableDebugInt(halHandle), then will have this issue.

     //

    // enable debug interrupts

    //

    HAL_enableDebugInt(halHandle);

    for(i=0;i<4096;i++)

    {

    array[i] =i;

    }

    //

     

  • Strong,

    The RAMLS5 is reserved for the FAST library, you can't assign this memory for other sections if you used the FAST functions in the project.