0

I'm running a debug session.

I set a break point inside of function services_init on line 201.

I ran the run up to break point command

enter image description here

The processor pauses on line 201 as expected. However, the stack window only displays variables local to the main function.

Why don't I see the variables local to services_init?

enter image description here

the_prole
  • 8,275
  • 16
  • 78
  • 163

1 Answers1

0

A developer from Nordic solved my problem

Hi,

Try going into project settings -> C/C++ tab, and set optimization level to -O0. Then re-compile and flash the firmware again. When enabling higher optimization, the compiler looks for patterns in your all of your code, squishes similar sections together, and the outcome is not as streamlined as your source code. This is the reason why debugging with high optimization may give inconsistent "jumps" in code, and the call stack may not show all variables correctly.

Cheers, HÃ¥kon

the_prole
  • 8,275
  • 16
  • 78
  • 163