[Solved] Simplest way of debugging?

turboscrew
Sat Jul 21, 2018 11:46 pm
I finally got reliable cabling between Si4432 module and Blue Pill, and I got FR22-library modified for stm32duino, but there’s a problem: the program should run forever, but now it runs 8 loops (+/-1) and jams, and now i need to debug the library, but what’s the simplest way to do it?
I think I’m facing one of those RF22 interrupt problems.

I’m using this code to check that my HW works. Normally I use C and Eclipse/OpenOCD (on another machine) and I wonder if
– there are debugging tools built in Arduino
– or what should I do to be able to debug the code with Eclipse/OpenOCD

I think using just debug-prints is quite laborous way to debug unfamiliar code.


david.prentice
Sun Jul 22, 2018 6:21 am
I just add debug flag to the Arduino IDE build recipe. And copy the ELF to a visible directory as part of the recipe.

Then I use Rowley Crossworks to debug the “Externally built executable”.
I have a hobbyist licence for Rowley.

This means that I am debugging the actual genuine Arduino project.

David.


stevestrong
Sun Jul 22, 2018 7:56 am
There is search field on the top right part of the page…

turboscrew
Sun Jul 22, 2018 9:36 am
stevestrong: I tried searching, but after a couple of dozen pages, I gave up.

turboscrew
Sun Jul 22, 2018 10:22 am
[david.prentice – Sun Jul 22, 2018 6:21 am] –
I just add debug flag to the Arduino IDE build recipe. And copy the ELF to a visible directory as part of the recipe.

Then I use Rowley Crossworks to debug the “Externally built executable”.
I have a hobbyist licence for Rowley.

This means that I am debugging the actual genuine Arduino project.

David.

How does it work with that?
Is there really enough info in the ELF that you can debug in source level?

For assembly level debugging, GDB is fine, but debugging unfamiliar library, like RF22, in assembly level…
And I’m not very familiar with STMduino cores either… It took me more than an hour to find out what’s the stm32 GPIO for “interrupt 0”.


turboscrew
Sun Jul 22, 2018 10:32 am
Maybe I should try… I already have gdb-multiarch installed. I only need OpenOCD…

dannyf
Sun Jul 22, 2018 2:10 pm
now i need to debug the library, but what’s the simplest way to do it?

use a hardware debugger, like stlink / jlink / cmsis-dap…


turboscrew
Sun Jul 22, 2018 2:48 pm
[dannyf – Sun Jul 22, 2018 2:10 pm] –
now i need to debug the library, but what’s the simplest way to do it?

use a hardware debugger, like stlink / jlink / cmsis-dap…

I use ST-LINK V2 mini (a cheap clone, but works fine). That’s what the OpenOCD is for, actually.

I was rather wondering how to debug using Arduino or how to set up the sketch + stuff to be able to debug with GDB, rather in source level.


Rick Kimball
Sun Jul 22, 2018 4:42 pm
[turboscrew – Sun Jul 22, 2018 2:48 pm] –
I was rather wondering how to debug using Arduino or how to set up the sketch + stuff to be able to debug with GDB, rather in source level.

If you are using Roger’s libmaple based core, it is already including the ‘-g’ flag which adds the symbol table to the .elf file. Is that the core you are using? If you aren’t seeing the source code and you are using the Roger’s core, make sure you are using a recent version of arm-none-eabi-gdb and a recent version of openocd.

You might take a look at this if you are on linux or OS/X

viewtopic.php?f=35&t=3872&p=47302#p47302


turboscrew
Sun Jul 22, 2018 5:03 pm
[Rick Kimball – Sun Jul 22, 2018 4:42 pm] –

[turboscrew – Sun Jul 22, 2018 2:48 pm] –
I was rather wondering how to debug using Arduino or how to set up the sketch + stuff to be able to debug with GDB, rather in source level.

If you are using Roger’s libmaple based core, it is already including the ‘-g’ flag which adds the symbol table to the .elf file. Is that the core you are using? If you aren’t seeing the source code and you are using the Roger’s core, make sure you are using a recent version of arm-none-eabi-gdb and a recent version of openocd.

You might take a look at this if you are on linux or OS/X

viewtopic.php?f=35&t=3872&p=47302#p47302

Yes, I’m using Roger’s core.
And I have another machine (my development machine) with Eclipse, gdb and OpenOCD already in use.
I guess I have to bring Arduino and the SW there or install the debugging stuff in this machine (where I have the Arduino now).

Arduino needs to be running, otherwise the stuff from /tmp disappears?
You can, of course, export the binary, but then the paths are gone.

Thanks, I’ll dig into the link you gave.


Rick Kimball
Sun Jul 22, 2018 7:26 pm
Regarding the source not being available. If you don’t save the source file, it won’t be available. You must save any changes before debug.

One note on my earlier comments, I modified my original post and added a zip file that has the changes to the board.txt and platform.txt along with the script I’ve tested, so you select upload with debug directly from Roger’s libmaple core.

viewtopic.php?f=35&t=3872&p=47302#p47421


turboscrew
Sun Jul 22, 2018 8:55 pm
That I’ll need to try next time I have problems!
I stored the link in my bookmarks toolbar.
(I copied the bash-script and the gdb-script.)

I think I’m getting closer to the problem, and it’s not the RF22 library, but blue pill interrupt handling.
The interrupt line is active (low), but the interrupt handler is – suddenly – not called.

And about the sources: it’s not about saving changes, but debugging on a different machine than compiling.


zmemw16
Wed Jul 25, 2018 6:52 am
is there a verbose option that details where it is reading the source file from?
perhaps the updated source is being looked for on the target?
srp

ag123
Wed Jul 25, 2018 7:00 am
gnu has something called DDD
https://www.gnu.org/software/ddd/
i’m not too sure if this would work with arm / but if it does it may well be pretty useful

turboscrew
Thu Jul 26, 2018 3:43 pm
DDD is a front end to GDB.
There’s also Nemiver. It works better than DDD and is not a front end to gdb. I’m not sure about its cross-debugging capabilities, but on native environment it works fine.

MoDu
Thu Aug 02, 2018 2:59 pm
[turboscrew – Sun Jul 22, 2018 8:55 pm] –
I think I’m getting closer to the problem, and it’s not the RF22 library, but blue pill interrupt handling.
The interrupt line is active (low), but the interrupt handler is – suddenly – not called.

You’re very close. I had the very same issue on a different driver library for my own comms framework.

TL;DR: Current solution: after each interrupt, call and check if any interrupt is pending before moving on.


Leave a Reply

Your email address will not be published. Required fields are marked *