This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Where is the stack pointer initialized

I'm trying to get the ble_app_hrs example working in Eclipse, but the stack pointer is not setup correctly. It's at the start of the RAM (0x20000000), and therefore it already breaks in the SystemInit. It seems that memory map is correct. According to this the stack top is the start of the RAM + 0x2000. I'm using the S110 SD.

ble_hrs_gcc_s110_xxaa.zip

Parents
  • OK, I figured it is initially set by the value in adress 0x00000000 of the ROM. The value of this address is currently 0x20000000, which doesn't seem right if it's not supposed to be changed later by some startup code. So I guess that I need to figure out why the flashed image is not having the right value in the first place.

    EDIT: And at address 0x00014000 the value is 0x20004000 which seems right to me. OK, now I'm totally guessing - but it seems like the application is running with it's own vectors (in user mode), but why is my stack pointer not set to 0x20004000 when the system is entering the user mode then?

    EDIT2: And now I've cleared the device, reprogrammed the SD and the stack pointer is now working correctly and pointing at 0x20001BD0 This is also the value of memory location 0x00000000 So somehow the initialization vectors in the SD location was overwritten with a wrong value. It's probably during the setup of Eclipse and the toolchain that I've managed to brick the SD.

Reply
  • OK, I figured it is initially set by the value in adress 0x00000000 of the ROM. The value of this address is currently 0x20000000, which doesn't seem right if it's not supposed to be changed later by some startup code. So I guess that I need to figure out why the flashed image is not having the right value in the first place.

    EDIT: And at address 0x00014000 the value is 0x20004000 which seems right to me. OK, now I'm totally guessing - but it seems like the application is running with it's own vectors (in user mode), but why is my stack pointer not set to 0x20004000 when the system is entering the user mode then?

    EDIT2: And now I've cleared the device, reprogrammed the SD and the stack pointer is now working correctly and pointing at 0x20001BD0 This is also the value of memory location 0x00000000 So somehow the initialization vectors in the SD location was overwritten with a wrong value. It's probably during the setup of Eclipse and the toolchain that I've managed to brick the SD.

Children
No Data
Related