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.

Cortex M3 Local Address Calculated Incorrectly

CCS 6.1
AM335x, WKUP_M3
gcc version 4.9.3 20150413 (prerelease) (Linaro GCC 4.9-2015.05)

I added a local variable into a function in order to make a spin loop, e.g. like this:


volatile int stop=1

while (stop) {}; // connect here with JTAG

For some reason, when I put the "stop" variable into the debugger it was looking at the wrong address!  Here's a screenshot that I think captures the issue well:

So in particular, here are a few points of interest in the screenshot:

  1. In the "Expressions" window, the stop variable shows a value of 18 despite the fact that I assign it to be 1.  However, the address it's viewing is 0x80FAC which is not correct.
  2. If you look in the disassembly window at address 00001c18 you can see that the value it's loading is SP+4.  So if you look in the Memory Browser window you can see that 000080FC4 contains the expected value of 1.
  3. In the Registers window you can see that SP = 0x00080FC0 and R3=1 (as expected from the disassembly).

Any idea what's wrong here?  Here is my elf file:  https://e2e.ti.com/cfs-file/__key/communityserver-discussions-components-files/81/am335x_2D00_pm_2D00_firmware.elf