Page 1 of 1

Debug the software

Posted: Tue May 25, 2021 11:36 am
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.

Re: Debug the software

Posted: Tue May 25, 2021 5:53 pm
by johu
One thing: you need to compile with “-O0 -g3“

Re: Debug the software

Posted: Tue May 25, 2021 8:11 pm
by zilion
Thank you. Still much to learn.

Re: Debug the software

Posted: Wed May 26, 2021 12:12 pm
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.

Re: Debug the software

Posted: Wed May 26, 2021 12:33 pm
by johu
-Og is interesting
Makefile could be modified to have debug and release target