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.

CCS v6.1 Debugging Issues

I'm having some odd behaviors while debugging a project in CCS v6.1.  One such case is that there's two local variables that are assigned to the same register so when one variable changes, the other changes too.  I'm not sure why it's being assigned to the same register.

Here's the code snippet when the variables are defined, this is from the CheckImageCRC32 function within the bl_crc32.c file:

uint32_t ui32Loop, ui32FlashSize, ui32CRC;

And here's the image showing that two of these variables, ui32CRC and ui32FlashSize, are stored in the same register:

Another interesting behavior I'm seeing while debugging is that the code jumps from line to line at times, it's not executing in the sequential order that I was expecting as I'm stepping through the code.  There will be times it would jump back up a few lines and then jump back to the line I was expecting to be executed.

Is there something incorrectly configured on my setup that's causing this, either in the compiler or the linking?

Thanks!

  • SL said:
    Is there something incorrectly configured on my setup that's causing this, either in the compiler or the linking?

    The compiler optimizer may:

    a) Re-order instructions so that they are no longer in the source code order, which can cause the observed behavior of the code not executing in the sequential order.

    b) Place two local variables in the same register, if the scope of the two variables doesn't overlap. e.g. variables used for intermediate calculations.

    To making debugging simpler:

    - If you are using a TI compiler, under project properties -> Build -> device family Compiler -> Optimization try setting the Optimization Level to "Off".

    - If you are using a GNU compiler, under project properties -> Build -> GNU Compiler -> Optimization try setting the Optimization Level to "None (-O0)".