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 environment for using a computer mouse instead of writing a lot of commands in a terminal window.
- Ultra simple debugger.JPG (118.06 KiB) Viewed 1524 times
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.

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

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 (64.44 KiB) Viewed 1423 times
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?
I will work on the exeptions. That was a very fist version to see if that software is a helpfull tool for other people.
–
- Ultra_simple_debugger__02.JPG (133.84 KiB) Viewed 1321 times
[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.
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.

However, I would go with Java if cross-platform needed.
https://github.com/sandeepmistry/arduin … evice.java
and Arduino’s own tools seem to be here
https://github.com/arduino/Arduino/tree … essing/app
Perhaps someone knows where this is documented ??
https://github.com/sandeepmistry/arduin … softdevice
It uses these Arduino packages:
https://github.com/arduino/Arduino/tree … o/packages
Example of integrating tools to Arduino IDE: http://blog.ardublock.com/2011/09/14/in … duino-ide/
Yes. I did mean the SoftDevice flashing tool, written by Sandeep…
i see he has a build.sh file, which can easily be ported to build.bat, so it should be possible to test the build process for these sorts of tools.
I know some people were also interested in a burn bootloader tool, so I may investigate doing that..
Also, thanks for the link to that other tool, I will read it and perhaps it shows how to integrate the debugger that Vasillis has written.
Edit.
I looked at Adublocks, but its not especially helpful, as there is no discussion about what API is available in the Arduino IDE.
I guess there is no alternative except to trawl though the code trying to understand how it does specific things.
I looked on the Arduino.cc , and they have a page about using Java with the IDE but it does not document the API which is exposed to these Java tools.
I presume ArdunoBlocks has some form of integration with the editor window in the IDE, which would be useful, but its not going to be easy to find how it updates the IDE editor without searching though all the java files
Or, one step further, one could maybe use Notepad++ for editing, launch Arduino CLI to build the project and Eclipse standalone CDT to debug…
I cannot imagine any much more complicated solution
But perhaps they have fixed it now.
Even if it work… Its a big additional program to install.
Much better if some sort if simple debugger was part of the Arduino IDE, but for some reason the management at Arduino.cc have always been very negative about debuggers and claim they are only for advanced users, and not the sort of people that use the Arduino IDE.
This is of course complete rubbish, as all browsers now contain a javascript debugger for the script kiddies to play with.
So perhaps the real reason that the Arduino IDE does not have a debugger is because of Arduino.cc’s close ties to Atmel aka Microchip, as Arduino.cc tell people to use Atmel Studio if you want a debugger.
Unless you open source it so people can help you improve your idea and make it portable, this project is going to a dead end.
You can try Python or Qt to avoid proprietary traps like C#n F# or Java.
[Squonk42 – Sat Sep 30, 2017 8:27 am] –
…You can try Python or Qt to avoid proprietary traps like C#n F# or Java.
The Arduino IDE already uses Java and the “tools” use its runtime. So if the debugger is for use with the Arduino IDE, I don’t see any problem with using Java.
However if it was intended to be a general purpose / cross platform application, probably Python has the least restrictive license
I have to admit that Rick is right on that. It is better for me to write the debugger in a cross platform language. I would prefer Java instead of python because I am familiar with that language.
So, I will give a try to port the debugger to Java.
[RogerClark – Fri Sep 29, 2017 8:37 pm] –
I tried to use the Eclipse Standalone Debugger a few months ago, but it did not work on Windows, and as far as I could tell, no one on the Eclipse dev team was working on it.
It seems like there are binaries for all platforms now:
My memory is a bit hazy, but from what I recalled, there was Windows binary, but it didnt work for some reaosn.
Possibly something to do with using gdb ARM…
But I would have to look at my posts to their dev team to remember the precise nature of the problem.
However it must have been at least 6 months since I last tried it, so there is a chance its working now..
- Ultra simple STM32 debugger (cross platform).png (45.78 KiB) Viewed 576 times
Is this now done with Java?
Can we have a test version?
I think it just needs to be linked with some Jars from the IDE
Can be this embedded in a HTML page (as long as Java/Javascript is enabled?).
–
- Ultra_simple_STM32_Debugger_b.JPG (96.95 KiB) Viewed 460 times
If you build with the STLink upload option, then it is default enabled, otherwise not.

viewtopic.php?f=2&t=2775&start=20#p36940
Yes, it is alive now, here with Win7 64b.
It connects to the stlink, the stlink blinks.
I can set the .elf file. I cannot see any source, getting some info from Where, Threads, Registers..
Other buttons give me
C:\Users\123ert\Desktop\Ultra_Simple_STM32_Debugger>java -jar Ultra_Simple_STM32_D
ebugger.jar
Exception in thread "AWT-EventQueue-0" java.lang.StringIndexOutOfBoundsException
: String index out of range: -4
at java.lang.String.substring(Unknown Source)
at main_form.extract_filepath(main_form.java:682)
at main_form.send_gdb_cmd(main_form.java:455)
at main_form.btn_haltActionPerformed(main_form.java:518)
at main_form.access$500(main_form.java:34)
at main_form$3.actionPerformed(main_form.java:132)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Sour
ce)
at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$500(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionP
rivilege(Unknown Source)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionP
rivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionP
rivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Your debugger.cfg file seems to be correct.
1. I guess you run the ‘RunMe_windows.bat’ file
2. When you click <connect> do the two st-link leds blink?
The .elf file contains the sub-file paths are used in the project. That means, (usually) you cannot compile your project in one computer and use the produced .elf file in other computer. I guess the debugger is running on the same computer where you have compiled your project.
@LightningStalker
Could you please check if the ‘openocd/linux/openocd’ and ‘gdb/linux/arm-none-eabi-gdb’ files are executable ?
If not, run in terminal the command ‘sudo chmod +x filename’ where ‘filename’ is the openocd file (and the arm-none-eabi-gdb file).
If you run the .jar file from terminal, make sure you are in that folder path because the jar uses that file path (relative path).
2. there is only a single led on the stlink (clone) and it blinks when connected, there is an activity as I wrote above – ie. it shows registers..
3. I run it on the same computer
1. after few minutes of clicking on buttons and several replugings/reconnecting the USSD, it suddenly shows a source file from core
2. I can step through with Next somehow, but mostly there is an error in java – the system cannot find the .ino, sometimes the exception as above
3. when it is working it shows the files from maple core..
4. pressing Reset (in USSD) shots down the usb as well as the USSD, needs to replug the usb and reconnect the USSD
5. sometimes clicking Halt<=>Resume grays out the Halt, such it cannot be halted anymore
Why the .ino is not to find?
[Vassilis – Sat Nov 11, 2017 5:27 pm] –
@Pito
Your debugger.cfg file seems to be correct.
1. I guess you run the ‘RunMe_windows.bat’ file
2. When you click <connect> do the two st-link leds blink?The .elf file contains the sub-file paths are used in the project. That means, (usually) you cannot compile your project in one computer and use the produced .elf file in other computer. I guess the debugger is running on the same computer where you have compiled your project.
@LightningStalker
Could you please check if the ‘openocd/linux/openocd’ and ‘gdb/linux/arm-none-eabi-gdb’ files are executable ?
If not, run in terminal the command ‘sudo chmod +x filename’ where ‘filename’ is the openocd file (and the arm-none-eabi-gdb file).
If you run the .jar file from terminal, make sure you are in that folder path because the jar uses that file path (relative path).
They are all executable. I did have to set the .jar executable at the beginning. I’m now noticing the light on the ST-Link flashes and I get this in the terminal:
Exception in thread "AWT-EventQueue-0" java.lang.StringIndexOutOfBoundsException: String index out of range: -95
at java.lang.String.substring(String.java:1967)
at main_form.extract_filepath(main_form.java:683)
at main_form.send_gdb_cmd(main_form.java:455)
at main_form.btn_haltActionPerformed(main_form.java:518)
at main_form.access$500(main_form.java:34)
at main_form$3.actionPerformed(main_form.java:132)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:289)
at java.awt.Component.processMouseEvent(Component.java:6533)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
at java.awt.Component.processEvent(Component.java:6298)
at java.awt.Container.processEvent(Container.java:2236)
at java.awt.Component.dispatchEventImpl(Component.java:4889)
at java.awt.Container.dispatchEventImpl(Container.java:2294)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466)
at java.awt.Container.dispatchEventImpl(Container.java:2280)
at java.awt.Window.dispatchEventImpl(Window.java:2746)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:90)
at java.awt.EventQueue$4.run(EventQueue.java:731)
at java.awt.EventQueue$4.run(EventQueue.java:729)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
p.s. I don’t know if that helps but my first ST-Link has firmware V2.J27.S6 STM32+STM8 Debugger and the second V2.J28.S7 STM32+STM8 Debugger. Both of them work fine with the debugger
- Ultra_Simple_STM32_Debugger.zip
- (31.01 KiB) Downloaded 36 times
[LightningStalker – Sat Nov 11, 2017 10:32 pm] –
I don’t see any way to set breakpoints.
At this moment breakpoints function is not supported. I will add this future if there is interest in the software.
[LightningStalker – Sat Nov 11, 2017 10:32 pm] –
Oh and one other thing is that the text is really small on my screen and a bit difficult to read (4k monitor)
That is a good addition (text resizing). Done !
Upon connect it writes “ST_Link found!”

The Halt/Resume is not stable, after several H/R it greys out the Halt and I see java exceptions. It seems it throws exception when looking for .ino while H/R.
Error: ..\Ice40_Read_1.ino (The system cannot find the file specified)
Exception in thread "AWT-EventQueue-0" java.lang.StringIndexOutOfBoundsException
: String index out of range: -4
at java.lang.String.substring(Unknown Source)
at main_form.extract_filepath(main_form.java:694)
at main_form.send_gdb_cmd(main_form.java:462)
at main_form.btn_resumeActionPerformed(main_form.java:777)
at main_form.access$1100(main_form.java:34)
at main_form$9.actionPerformed(main_form.java:223)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Sour
ce)
at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
..
For example:
C:\Users\123ert\Desktop\my project\test.ino
Do you expect the sketch location (or of any other file) at a specific path?
There is no absolute .ino path inside the elf file – there is “..\Ice40_Read_1.ino”
Go to the temp folder and then to the folder: arduino_build_XXXXXX/sketch
You will see the file YYYYYYYY.ino.cpp. Open it. At the second line (and maybe at the 3rd line) you will see the full .ino file path that is used.


[Vassilis – Sun Nov 12, 2017 4:57 pm] –
At this moment breakpoints function is not supported. I will add this future if there is interest in the software.
I find it quite interesting.
[Vassilis – Sun Nov 12, 2017 4:57 pm] – That is a good addition (text resizing). Done !
Great thanks
[Pito – Sun Nov 12, 2017 6:25 pm] –
I do not use Arduino IDE, but Eclipse.
Never tried e-clips, right now I’m using Arduino IDE and Atom/xed when I need to.
[Vassilis – Tue Oct 17, 2017 7:22 pm] –
The Ultra Simple STM32 debugger is available at the moment on Windows (it is tested on Win 10 64-bit) and Linux (It it tested on Ubuntu 64-bit)
You can download it from my web site because the zip file is too big (7 MB) to be attached.
http://www.serasidis.gr/ARM/Ultra_simpl … bugger.zip
Vassilis, I cannot unpack it, 7zip says “Unsupported compression method…”.
How can I get it?
EDIT
OK, I could unpack it with Win10 explorer.
EDIT
After a restart it seems to work, it shows source code.
– if you resume and halt again, the old source location will be shown. I had to press “Where” in order to refresh the right position in code.
– It does not want to go inside millis() (inline function), cannot parse header files?
– it would be nice if the displayed file could be opened by clicking on it.
– the register display is not aligned, the 16/8 bit decimal values are shifted to left compared to the 32 bit values.