This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Debugging with breakpoints: correct gcc flags

I'm building a software for the nrf5822 using pc10028. I'm using CMake and after following both morf.lv/modules.php and devzone.nordicsemi.com/.../ I successfully made the debugger to work... except I'm not having breakpoints.

I'm pretty sure I'm using the wrong compile flags here. Is there a place I can check them? Else, can you tell me which ones I should be using?

Parents
  • Hi,

    In order to debug you need to add the -g3 flag and remove compiler optimization (to get expected debug results). So you need to change the CFLAGS += -Wall -Werror -O3 line to CFLAGS += -Wall -Werror -O0 -g3.

    Note that the BLE link will get disconnected when hitting a breakpoint, because the radio will be halted, and the radio will therefore not be able to transmit the necessary packets to keep the connection. The link will disconnected after a timeout given in the connect request (or a connection parameter update).

Reply
  • Hi,

    In order to debug you need to add the -g3 flag and remove compiler optimization (to get expected debug results). So you need to change the CFLAGS += -Wall -Werror -O3 line to CFLAGS += -Wall -Werror -O0 -g3.

    Note that the BLE link will get disconnected when hitting a breakpoint, because the radio will be halted, and the radio will therefore not be able to transmit the necessary packets to keep the connection. The link will disconnected after a timeout given in the connect request (or a connection parameter update).

Children
Related