cancel
Showing results for 
Search instead for 
Did you mean: 

Registers off by one with GCC+GDB

igor_b
Associate II

I'm trying to port simple Keil project (which works on my custom STM32WL board) to CubeIDE and got to a point where it compiles and I can flash the board using stlink+GDB (I patched the stlink to add STM32WL support). However, it seems like when I try to write to some CPU register it is stored in the next register (for example, at the beginning of the startup file I add a line to store some value to R7 but the GDB shows it in R8).

The consequence of that is that when the default 0xffffffff value is stored to LR it is written to PC and the CPU tries to (unsuccessfully) jump to that address.

Does anyone have any ideas where should I look for the issue?

1 REPLY 1
igor_b
Associate II

It turns out there is some issue with stlink. I tried using pyOCD and everything works.