Debugging with eclipse/sloeber

Post here first, or if you can't find a relevant section!
STM32_Newbbe
Posts: 47
Joined: Thu Nov 05, 2020 10:26 am

Debugging with eclipse/sloeber

Post by STM32_Newbbe »

Has anyone recently got eclipse/sloeber running with openOCD/gdb?

I followed the instructions on github (https://github.com/stm32duino/wiki/wiki/How-to-debug) but I always get an error message saying

no source available for "function()" at "address"

as well as "No symbol table is loaded. Use the "file" command." in the debugger console

Is this because I installed the debugging packages ontop of an existing eclipse/sloeber? (installed as complete package conveniently offered by sloeber devs?

any help appreciated...
ag123
Posts: 1653
Joined: Thu Dec 19, 2019 5:30 am
Answers: 24

Re: Debugging with eclipse/sloeber

Post by ag123 »

you would need st-link v2
https://www.adafruit.com/product/2548
https://www.st.com/en/development-tools/st-link-v2.html
you have got that?
most Nucleo boards has it built on board

on Windows I think you'd also need stm32cubeprogrammer
https://www.st.com/en/development-tools ... eprog.html
Last edited by ag123 on Fri Aug 19, 2022 10:27 am, edited 3 times in total.
STM32_Newbbe
Posts: 47
Joined: Thu Nov 05, 2020 10:26 am

Re: Debugging with eclipse/sloeber

Post by STM32_Newbbe »

yes, I use Nucleo-L4R5

sorry for ommiting that crucial detail
ag123
Posts: 1653
Joined: Thu Dec 19, 2019 5:30 am
Answers: 24

Re: Debugging with eclipse/sloeber

Post by ag123 »

there are quite a few things there, i don't use sloeber so can't really comment.
the build needs to have -g debug and -Og optimisation

you'd need to pay attention to the Setting up GDB part
https://github.com/stm32duino/wiki/wiki ... ing-up-gdb

and not least, you need to build your sketch with the core in eclipse (sloeber)
oh and openocd
https://github.com/stm32duino/wiki/wiki ... up-openocd

google turns up some docs, hope it helps
https://www.st.com/resource/en/user_man ... ronics.pdf
^ note stm32cube IDE may have its own gdb server that does the same thing as openocd.
you may want to check if it is after all installed together with stm32cube programmer
https://www.st.com/resource/en/applicat ... ronics.pdf
STM32_Newbbe
Posts: 47
Joined: Thu Nov 05, 2020 10:26 am

Re: Debugging with eclipse/sloeber

Post by STM32_Newbbe »

-Og is available and active but I don't know where to check och enable the -g flag
STM32_Newbbe
Posts: 47
Joined: Thu Nov 05, 2020 10:26 am

Re: Debugging with eclipse/sloeber

Post by STM32_Newbbe »

some parts seem to be working correctly, in the console window I get output from openOCD that looks fairly like it successfully connected toe the STLink/µC
STM32_Newbbe
Posts: 47
Joined: Thu Nov 05, 2020 10:26 am

Re: Debugging with eclipse/sloeber

Post by STM32_Newbbe »

and thanks for the links!
the github smt32duino, I knew already. That is the instructions I followed - with one little difference: I had eclipse/sloeber package already installed
STM32_Newbbe
Posts: 47
Joined: Thu Nov 05, 2020 10:26 am

Re: Debugging with eclipse/sloeber

Post by STM32_Newbbe »

I found it - must have had tomatoes on my eyes...
It is readily available in the sloeber project config menu
shame on me!

but alas, the problem remains :/
ag123
Posts: 1653
Joined: Thu Dec 19, 2019 5:30 am
Answers: 24

Re: Debugging with eclipse/sloeber

Post by ag123 »

unfortunately, I do not use sloeber, only eclipse CDT with a makefile, and in Linux.

generally, I think you need to build your sketch in eclipse and install it on your device, e.g. using st-link etc.
This is in part as eclipse keeps a structure for its projects on where to find the files.
the bin file install can even be done externally, but that the build/compile needs to be done in eclipse, so that eclipse would save its compiled object files, symbol tables somewhere (mostly in the .elf file and possible the 'map' file) that it can find and show the traces.

then the next thing is to setup a debug configuration.
https://github.com/stm32duino/wiki/wiki ... ing-up-gdb
this part is mainly to connect to the gdb server.
- the gdb server can either be open ocd.
or like mentioned prior
- stm32 cube ide has a gdb server that can connect to stm32 cube programmer. I'm wondering if it could have been installed if you simply install stm32cube programmer

oh check things like this out, in case they work 'easier'/'better'
https://www.gdbgui.com/
User avatar
Juraj
Posts: 47
Joined: Fri Jan 03, 2020 7:47 pm
Answers: 1
Location: Slovakia
Contact:

Re: Debugging with eclipse/sloeber

Post by Juraj »

I made it work some time ago. The debugging with Sloeber.
For compile options add in boards.txt for your board

BluePill128kswd.build.flags.optimize=-g -Og
BluePill128kswd.compiler.c.extra_flags=-DDEBUG
BluePill128kswd.compiler.cpp.extra_flags=-DDEBUG
BluePill128kswd.compiler.elf2hex.extra_flags=--debugging

follow these instructions to create a "Debug configuration" in Eclipse
https://github.com/jantje/hardware/blob ... md/read.me
Post Reply

Return to “General discussion”