Debug the software

Post Reply
User avatar
zilion
Posts: 58
Joined: Tue Feb 02, 2021 7:50 am
Location: Poland

Debug the software

Post by zilion »

I managed to setup CodeBlocks with STLINK and openOCD, but I can't debug the code.
I mean, it runs in debug, but IDE is not following the code.

If anyone wishes to help me with that, I will post some screens with configuration.
I smell lithium in the air. It's not lithium, it's glycolium.
User avatar
johu
Site Admin
Posts: 5683
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 153 times
Been thanked: 960 times
Contact:

Re: Debug the software

Post by johu »

One thing: you need to compile with “-O0 -g3“
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
User avatar
zilion
Posts: 58
Joined: Tue Feb 02, 2021 7:50 am
Location: Poland

Re: Debug the software

Post by zilion »

Thank you. Still much to learn.
I smell lithium in the air. It's not lithium, it's glycolium.
davefiddes
Posts: 211
Joined: Mon Jan 18, 2021 12:39 pm
Location: Edinburgh, Scotland, UK
Has thanked: 14 times
Been thanked: 35 times

Re: Debug the software

Post by davefiddes »

Is there any chance that debug symbols could be included in the default builds? It confused the heck out of me when I first started working with the code base. I thought it was something complicated to do with the bootloader. Enabling debugging symbols shouldn't cost anything other than a little bit of disk space on the host. I enabled "-ggdb3" on my builds of libopencm3 and stm32_sine as this gives the most information when using gdb which I'd imagine is everyone.

Also, FWIW, "-Og" is the better optimisation setting for debugging than "-O0". It basically optimises within a given source line but doesn't enable optimisation between different source lines. This keeps the code size under control whilst keeping behaviour able to be reasoned about in the debugger.
User avatar
johu
Site Admin
Posts: 5683
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 153 times
Been thanked: 960 times
Contact:

Re: Debug the software

Post by johu »

-Og is interesting
Makefile could be modified to have debug and release target
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
Post Reply