I have the nrf52-dk, want to use the mbed framework and debug it. Many things seems to work, but i can not see any local variables while debugging. I can set breakpoints, do steps, see some registers, peripherals, … , but can not see any variable.
If I do the same with an arduino-framework (as example arduino-blink-example), I can debug and see the variables there. Do you have a reason for that?
/Users/Admin/.platformio/packages/framework-mbed/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/sleep.c: In function ‘hal_sleep’:
/Users/Admin/.platformio/packages/framework-mbed/targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/sleep.c:86:1: error: unrecognizable insn:
When I only add the build_flags line
build_flags = -O0 -g3 -ggdb
then it is possible to build (success), but unfortunately the same behaviour while debugging (can not see the variables).
Since I have neither the board nor the debugger tool I can’t reproduce.
Maybe you need a more complex function to debug because -O1 really does optimize away the trivial blinky code so that no local variable is used anymore.
Until now, I did not found a solution for that. I also tried exactly the same example (and other examples) with the default platformio.ini-config and the edited config (unbuild/build-flags,…) on Windows10 which shows the same behaviour.
As example:
myled is a global variable and it’s there. Also the compiler completely optmized i to be held in a register so it doesn’t show up as a global / local var. Would have to see the assembly, but at -O1 that’s pretty reasonable.
I expect to see “j”, “i” and “myled” on the left side in “Überwachen”.
Makes it sense that I can not see these variables?
Additionally, when I tried it with the arduino-framework, then I could see the value of the variable “i” when I did a mouseover over the variable. Here, with the mbed framework, this does not work.
Here is an similar example with the arduino framework: