Topics

Cannot debug specific files #nrf52832 #nrf52 #builds #debug #bluetooth


b.j.hendriks@...
 

Hello,

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. 

I have a question about debugging. I am using a nRF52 DK with Zephyr (sdk 0.11.3). I debug with Segger Ozone, using the zephyr.elf file and the recommended configurations: Target Interface: SWD,Interface Speed: 4000 KHz.
I try to debug a peripheral application: samples/bluetooth/peripheral_hr (tested with other apps as well).

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:

CONFIG_BT=y
CONFIG_BT_DEBUG_LOG=y
CONFIG_BT_SMP=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_GATT_DIS=y
CONFIG_BT_GATT_DIS_PNP=n
CONFIG_BT_GATT_BAS=y
CONFIG_BT_GATT_HRS=y
CONFIG_BT_DEVICE_NAME="Zephyr Heartrate Sensor"
CONFIG_BT_DEVICE_APPEARANCE=833

CONFIG_DEBUG=y
# CONFIG_NO_OPTIMIZATIONS=y

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:

zephyr/subsys/bluetooth/controller/ll_sw/nordic/lll/lll.c
or
zephyr/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio.c
and many more files in the controller

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?

Thank you,

Kind regards
John Hendriks


pawel.dunaj@...
 

Hi,
you can check the content of the build.ninja in the build directory. Look for the files that you suspect are built incorrectly and check the build flags. That should at least confirm that the problem is real.
Thanks,
Paweł