Ultra simple STM32 debugger

User avatar
Vassilis
Posts: 313
Joined: Thu May 21, 2015 6:42 am
Location: Thessaloniki, Greece
Contact:

Ultra simple STM32 debugger

Post by Vassilis » Sat Sep 23, 2017 8:53 am

The software I wrote (windows only, sorry...) is for those who work with Arduino IDE that, as you know, does not have a debugging feature for STM32.

How many times did you wonder: "Oh, my sketch is hanged, but in which part of the code ? ". So, I wrote a small software that combines the ST-Link + OpenOCD in a graphical enviroment for using a computer mouse instead of writing a lot of commands in a terminal window.
Ultra simple debugger.JPG
Ultra simple debugger.JPG (118.06 KiB) Viewed 415 times

How to use
  1. Select the ELF file of your compiled sketch. Click on that button and select the folder that is named "arduino_build_XXXXXX" where XXXXXX is a number that is generated by the Arduino IDE. If your sketch name is "blink_STM32.ino" then the elf file is named as "Blink_stm32.ino.elf"
  2. Select the folder where your project is saved (the folder that your .ino file is saved).
  3. Select the file arm-none-eabi-gdb.exe. Normally, that file is in that folder:

    Code: Select all

    C:\Users\<USER>\AppData\Local\Arduino15\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1\bin
  4. Reboot the MCU
  5. Pause the program execution
  6. Continue the program execution
  7. Informs us to where the program execution is paused. The picture above show us that the program is paused at the "start.S" file, at the line 51.
  8. Click on that link to open that file. I prefer the notepad++
  9. The link to my web site ;-)
http://www.serasidis.gr/ARM/Ultra_simple_debugger.zip

The software is tested only in Windows 10. I would like to see any feedback from you.


-= EDIT =-
New cross platform version is available on Windows and Linux
viewtopic.php?f=35&t=2615&p=35828#p35828
Ultra_simple_STM32_Debugger.JPG
Ultra_simple_STM32_Debugger.JPG (199.57 KiB) Viewed 37 times
Last edited by Vassilis on Tue Oct 17, 2017 7:28 pm, edited 1 time in total.

stevestrong
Posts: 1609
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany

Re: Ultra simple STM32 debugger

Post by stevestrong » Sat Sep 23, 2017 2:18 pm

Unfortunately, it does not work for me.
Win 10, 64 bit.
I select all folders/bins.
As soon as I press any button (reboot, pause, play) the program freezes for ~15seconds, then it shows a corresponding message in the window ("MCU is rebooting... (0x08000000)", "Continuing program execution..."), but it will not do any debug operation, nor reboot.
Field 8 is empty.

What am I missing?

Do you have a debug version of the software, which would output some internal messages in a log file?

Feature request: - save the last input folders/files for next time.

User avatar
Vassilis
Posts: 313
Joined: Thu May 21, 2015 6:42 am
Location: Thessaloniki, Greece
Contact:

Re: Ultra simple STM32 debugger

Post by Vassilis » Sat Sep 23, 2017 6:54 pm

Hm... I will see that again tomorrow :(

User avatar
Vassilis
Posts: 313
Joined: Thu May 21, 2015 6:42 am
Location: Thessaloniki, Greece
Contact:

Re: Ultra simple STM32 debugger

Post by Vassilis » Sun Sep 24, 2017 1:12 pm

I forgot to include the config file in the zip file.
At the moment, the software works only on STM32F103 MCUs

Could you please try it again ?
http://www.serasidis.gr/ARM/Ultra_simpl ... bugger.zip

stevestrong
Posts: 1609
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany

Re: Ultra simple STM32 debugger

Post by stevestrong » Sun Sep 24, 2017 3:04 pm

Same result, no improvement... :(
I am testing it with the BP supplied over USB, and a ST-Link V2 clone (connected: GND, SWCLK, SWDIO).

SUCCESS!
I figured out my problem: I was uploading over USB, so the debug port was deactivated. I wondered why I could also not connect with the ST-LINK utility...
As soon as I went to upload over ST-Link... bingo, it worked!
So maybe it would be worth mentioning this in your "how-to".
BP-USSD.jpg
BP-USSD.jpg (64.44 KiB) Viewed 314 times

Feature requests:
0. - do a step.
1. - output internal (error) messages to a log file.
2. - save input data and fill in the corresponding fields automatically for the next time the user runs the application.
3. - leave the user the possibility to open the INO file with a different application (NP++), because now it will be opened with the default associated application, which is Arduino IDE. Right click has the same effect, it opens directly with Arduino. This could be eventually specified in the config file.
Btw, opening any file with Np++ at specific line: add switch "-n<line_number"

Good work! :P

stevestrong
Posts: 1609
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany

Re: Ultra simple STM32 debugger

Post by stevestrong » Sun Sep 24, 2017 3:40 pm

After opening it any further time, unhandled exception after clicking four times on any button in any combination/order.
Error message attached.

Fields are auto-filled, but the program does not reset anymore.
For "pause" it stops and shows the line number, but after further clicks comes the said exception, so it is unusable... :?
How can I clear its cache?
Attachments
exception_1.txt
(3.88 KiB) Downloaded 9 times

User avatar
Vassilis
Posts: 313
Joined: Thu May 21, 2015 6:42 am
Location: Thessaloniki, Greece
Contact:

Re: Ultra simple STM32 debugger

Post by Vassilis » Sun Sep 24, 2017 5:14 pm

My program executes the openocd.exe file, takes the results and then ot closes it. If an exeption is occured, the openocd.exe stays resident in ram. If the openocd is executed for more than 4 times at the same time, then you cannot use it anymore. Right-click on taskbar and run the task manager (or alt+ctrl+del). See if the openocd.exe is running more than 4 times. If yes, click to end the process.

I will work on the exeptions. That was a very fist version to see if that software is a helpfull tool for other people.

User avatar
Vassilis
Posts: 313
Joined: Thu May 21, 2015 6:42 am
Location: Thessaloniki, Greece
Contact:

Re: Ultra simple STM32 debugger

Post by Vassilis » Wed Sep 27, 2017 8:54 pm

A small improvement.
-
Ultra_simple_debugger__02.JPG
Ultra_simple_debugger__02.JPG (133.84 KiB) Viewed 212 times
-
The source code is appeared on the main form. I used the ScintillaNET.dll Windows Forms control.
The buttons are only for testing the software. The next release will have the buttons that really needs a developer.

User avatar
Rick Kimball
Posts: 1014
Joined: Tue Apr 28, 2015 1:26 am
Location: Eastern NC, US
Contact:

Re: Ultra simple STM32 debugger

Post by Rick Kimball » Wed Sep 27, 2017 9:06 pm

I can't really look at this as I'm linux only. However, it seems if you want to go down this path you really need to use something that is cross platform. If you expend effort now to do a GUI thing and it is windows only, you will never go back after this point.
-rick

User avatar
RogerClark
Posts: 6911
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Ultra simple STM32 debugger

Post by RogerClark » Wed Sep 27, 2017 9:23 pm

Rick Kimball wrote:
Wed Sep 27, 2017 9:06 pm
I can't really look at this as I'm linux only. However, it seems if you want to go down this path you really need to use something that is cross platform. If you expend effort now to do a GUI thing and it is windows only, you will never go back after this point.

Python ??
I've been writing a simple Python based UI so i can read data via serial and display as an image.
But there seem to be different Windowing toolkits, each with their own set if widgets....

Or perhaps have this as a Java based plugin to the IDE its self.

Or do it in Java as an external program, but that would require people to install Java


PS..

Probably a good idea would be to be able to start this via command line, so that we could add an "Upload and debug" option to the IDE menu

Then you would not have to specify all the paths yourself.

Post Reply