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.

Restarting program - Requires reload when running from RAM?

Hi,

I'm debugging some code on AM335x using XDS100v2 JTAG emulator. I load the code to DDR RAM using the debugger and then run it.

As far as I understand, to restart the program I have to pause, reset and then reload the program, otherwise initialized static variables don't get their initial values. Is this the only right way or I miss something?

Regards,
Vasili

  • Hi,

    Static variables can be altered using the Watch window. You can load the variables onto the watch window and then alter them while debugging. 

    Regards,

    Gautam

  • Hmm, I probably explained myself poorly... I'm not interested in changing static variables by hand. What I mean, when the program runs - it changes their values, but when I restart the program - I need their values to be restored to initial.

  • Hi,

    Oh, but when you restart the program the variables do get initialized to their initial values. I guess you're talking about the restart program during debugging session, right?

    Regards,

    Gautam

  • Right. That's why I put it on the CCS forum :-)

  • Vasili Galka said:
    I'm debugging some code on AM335x using XDS100v2 JTAG emulator. I load the code to DDR RAM using the debugger and then run it.

    As far as I understand, to restart the program I have to pause, reset and then reload the program, otherwise initialized static variables don't get their initial values. Is this the only right way or I miss something?

    Assuming you are using the TI ARM linker, it depends on the Linker Initialization Model (selected under CCS Project Properties -> Build -> ARM Linker -> Advanced Options -> Runtime Environment).

    With "Link using RAM autoinitialization model" the static variables will only get their initial values when the program is re-loaded into memory by CCS.

    With "Link using ROM autoinitialization model" the linker inserts start-up code to initialize the static variables with their initial values. In this case restarting the program in the CCS debugger will re-run the start-up code to re-initialize the static variables with their initial values. The downside is an increase in memory usage.

  • Oh, that is interesting! But if I use "RAM autoinitialization model" I have to reload the image each time?
    Is there such linker option for GNU linker too? I'm using GCC toolchain and not TI's.

  • Vasili Galka said:
    Is there such linker option for GNU linker too? I'm using GCC toolchain and not TI's.

    Looking at the gcc-arm-none-eabi-4_7-2012q4 toolchain which comes with CCS 5.5 I can't see such a linker option.

    Think that with the GCC toolchain you have to modify the linker script .lds file and the initialization assembler to get the equivalent of the "ROM autoinitialization model" TI linker option.