Debugging with breakpoints: correct gcc flags [closed]

asked 2017-02-20 15:48:55 +0200

I'm building a software for the nrf5822 using pc10028. I'm using CMake and after following both http://morf.lv/modules.php?name=tutor... and https://devzone.nordicsemi.com/blogs/... 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?

edit retag flag offensive reopen delete report spam

Closed as "the question is answered, right answer was accepted" by Lisandro Damián Nicanor Pérez Meyer at 2017-03-09 19:40:32 +0200



This is normal. You cannot use breakpoints with Softdevice.

Keton ( 2017-02-20 19:42:34 +0200 )editconvert to answer

What debugger program did you use ? Segger OZone ?? Or something else ??

Roger Clark ( 2017-02-22 00:48:00 +0200 )editconvert to answer

gdb trough JLinkGDBServer.

Lisandro Damián Nicanor Pérez Meyer ( 2017-02-22 13:35:19 +0200 )editconvert to answer

gdb command line ?

Roger Clark ( 2017-02-22 21:56:52 +0200 )editconvert to answer

Either gdb path/to/.hex or using Qt Creator as detailed in http://perezmeyer.blogspot.com.ar/201...

Lisandro Damián Nicanor Pérez Meyer ( 2017-02-23 13:57:28 +0200 )editconvert to answer

1 answer

Sort by » oldest newest most voted
sigurdon gravatar image

answered 2017-02-21 15:52:57 +0200


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).

edit flag offensive delete publish link more


Excellent! That did my day! Thanks a lot!

Lisandro Damián Nicanor Pérez Meyer ( 2017-02-21 20:25:42 +0200 )editconvert to answer

Question Tools

1 follower


Asked: 2017-02-20 15:48:55 +0200

Seen: 349 times

Last updated: Feb 21