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.

F28M35H52C: Static variable problem with RAM loaded program in C28x.

Part Number: F28M35H52C

I am loading a program in RAM memory and executing it with Code Composer Studio v7.4 debugger. I launch the selected configuration for the target, connect the C28x and load the program. The first time I run the program, it is everything fine. However, when I reset it and start its execution again, the values of static declared variables have whatever value. I thing this could make sense but is not the reset supposed to reinitialize static variables?

  • Hi,
    Which reset you are applying how are you re-running the testcase. Also what do you mean by "is not the reset supposed to reinitialize static variables?" ? Are you expecting the initialization of variables in hardware?

    Regards,
    Vivek Singh
  • Sorry for my poor explanation. I am not sure what kind of reset it is but the thing I do is to click on Reset (Reset CPU) on the debug view toolbar. To re-run the program, I start the execution of the C28x program (it gets into IDLE mode) and then I start the M3 which makes the C28x boot from RAM after giving it the required permissions over the shared RAM.
    Regarding to your questions (..."what do you mean by "is not the reset supposed to reinitialize static variables?" ? Are you expecting the initialization of variables in hardware?"...), as far as I know (not too much because of my lack of experience with microcontrollers), static variables are supposed to be initiated with 0 value and to keep their value through different calls to the function in which they are defined. I expected the variable to keep its value during the execution of the program but I thought that it was going to be restarted to 0 when I reseted the device. Is this wrong?
  • Hi,

    Please see if this wiki link answers your query - processors.wiki.ti.com/.../Uninitialized_Static_Objects_Not_Set_to_Zero_in_COFF

    Please note on startup all the RAM locations are cleared via RAMINIT process executed by BOOTROM but not on debugger reset so if proper initialization is not done in code then you could see different behavior at power-up vs debug or any other reset.

    Regards,

    Vivek Singh

  • Let us know if you have any further queries on this.