I am currently trying to setup our system using Code Composer Studio v5 for the IDE and the CodeSourcery g++ compiler.
I can build and properly debug an application built using on gcc on c code. The issue I am having seems to only appear with functions compiled using g++. The code executes properly but variables allocated on the stack are not properly resolved in the debugger. The debugger thinks the variables allocated within a function are at a different location then they really reside. In the debug window, the address shown for the variables is lower than the stack pointer when all the variables are located at or above the address of the SP.
I don't know if this issue lies with Code Composer iteself or with some of the configuration settings. To me it seems like the debug environment is either computing the variable locations after the stack pointer has been updated (decreased) when it assumes it hasn't changed yet or it thinks the stack is growing in the opposite direction. I have tried changing the debug format to all options (dwarf-2, stab, stab+, gdb) with no effect.
Here is an example
int main(void)
{
int x;
int y;
x = 5;
y = x + 2;
return y;
}
When I compile using g++
Shown in the debugger
SP (while in main) = 0x20000798
&x = 0x2000078C
&y = 0x20000788
The assembly code accesses 0x2000079C for x and 0x20000798 for y.
When I compile using gcc
Shown in the debugger
SP (while in main) = 0x20000794
&x = 0x20000798
&y = 0x20000794