NOTE: I also posted this on github:https://github.com/zephyrproject-rtos/zephyr/issues/27706 I don't know which channel is the correct one for these types of issues.
In order to debug I need to disable some optimizations. I tried to configure this in the prj.conf which is located in the application folder (samples/bluetooth/peripheral_hr/prj.conf).
My config file looks like this:
Without the debug configurations I can't traverse through the main.c correctly, but with the CONFIG_DEBUG flag enabled I can. But when I want to step in/over lines of code in:
the debugger jumps to lines that doesn't exist or opens functions that are not present on that line. This is both for CONFIG_DEBUG and CONFIG_NO_OPTIMIZATIONS.
Somehow I think the bluetooth controller files for nordic are still optimized, and I can't find a method to disable the optimizations.
Also I found that enabling CONFIG_NO_OPTIMIZATIONS flag will not let me connect with the device anymore, is this intended?