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.

sysbios global variable initialization

Expert 2875 points


Hi,

I found some global initialize varables are not initialized in some case.

What might be the problem?

Thanks.

Steve

  • Steve,

    What are the "in some case"?

    If your application always starts up at the TI codegen tools' entry symbol of 'c_int00' then initialized variables should ALWAYS be initialized prior to arriving at main().

    Alan
  • Alan,

    I do start with c_int00, then goes to main.
    I am using CCS 5.4, C6657 chip. I have a global array FLT_IFLT[4] of function pointers statically initialized to 4 routines, namely FLT_EX_alloc, FLT_EX_control, FLT_EX_free and FLT_EX_apply . At the first power up, this a array is not initialized after down loading the code via CCS debugger. But if I download it again, the FLT_IFLT[4] array is initialized. I can duplicate it every time.
    In short, the first run after power up, the initialization of FLT_IFLT[4] is not done. Other statically initialized globle variables are initialized correctly. I check the variable contents when code stops at main().
    Thank you.
    Steve
  • Can you provide your .map file, linker command file, and code snippet showing the definition of the global array?

    Alan
  • Alan,

    Here are the request items.

    // ======== FLT_EX_IFLT ========

    // This structure defines our implementation of the IFLT interface

    // for the FLT_EX module.

    #pragma DATA_SECTION (FLT_IFLT, ".AudioRateCode:FLT_IFLT");

    IFLT_Fxns FLT_IFLT = {   /* module_vendor_interface */    

    //IALGFXNS,   //IFLT no longer extends the IALG  

    FLT_EX_alloc,  

    FLT_EX_control,  

    FLT_EX_initObj,  

    FLT_EX_apply,

    4760.linkercmd.txt5226.Projectmap.txt };

  • Hmm. Everything looks ok to me. I'm wondering if the array is getting written over after it is initialized during the climbup sequence prior to main().

    Using CCS, can you set a memory write watchpoint at one of the array entries and see if it is ever being written to prior to main()?

    Alan
  • I had put a hardware watchpoint on it and did not break. So it is not over written.
    Steve
  • Alan,
    I feel that might be the CCS load problem. Because the initalized values are there after the second CCS downloading code. Only first time after power up, loading the code did not have value for the array.
    Thank you.
    Steve
  • Alan,
    I have found the problem. It is that CCS code load doesn't do the "system reset" first. So it caused the code not loaded correctly.
    I am using C6657 DSP and CCSv5.3. I checked evmc6657l.gel which has the routine OnPreFileLoaded() that has GEL_Reset(). Why my CCS code load doesn't reset the DSP?
    Thank you.
    Steve
  • I'm glad you resolved the problem.
    I'm not knowledgeable about how the GEL_Reset() function works.
    I suggest that you ask that question in the CCS forum:

    e2e.ti.com/.../code_composer_studio

    Alan