When you press the upload button 2 xterms are auto launched after the upload has finished. You can see my Arduino IDE running on the left of the image. It is the lowest window. Next up the window stack and to the right is an xterm that is running the st-util listening on port 4242. Finally, the window we really care about is the top window running the arm-none-eabi-gdb command line program.
In that gdb window you can see I setup a breakpoint on the loop() function:
(gdb) break loop()
But, a far cry to the GUI I am accustomed to with the PSoC4200 M0+ debugger under Cypress.
But still a light-year ahead of having to sprinkle Serial.println() throughout the sketch.
Ray
If you want a full gui ide experience you could replace the arm-none-eabi-gdb with something like the DDD, the Eclispe standalone thing .. or whatever is the hotest new gdb ui thing. I find the command line stuff is pretty useful once you get a handle on the commands. However, if you aren’t using those commands everyday those things vanish from your memory pretty quickly.
Which is why so many of my older friends have their initials on their belt buckles! Sadly, I’m thinking about it myself these days.

-Code flow and breakpoints example-
Some of the common commands you will use to set breakpoints are ones that control when the debugger stops:
run - resets the stm32f103 and starts from the beginning
break - set a breakpoint on a function or a line in a function
continue - tell the debugger to run until a breakpoint is hit or the you press CTRL-C
next - step over a line of c code, if the line of code is a function call, it will run the function but not go into it
step - step into a line of c code, if that is a function it will then stop at each line in the function
finish - exits whatever function you are running and stops at the first line of code in the caller after the function call
where - show the line of code you are on and the call stack
info breakpoints - show all the current breakpoints
delete - deletes all the breakpoints
print - used to display variables and registers.
But, a far cry to the GUI I am accustomed to with the PSoC4200 M0+ debugger under Cypress.
But, a far cry to the GUI I am accustomed to with the PSoC4200 M0+ debugger under Cypress.
If you switch to using openocd as the gdb server. It is much faster and shows mixed asm/source as you would expect and you can instruction step very quickly and accurately.
I need to clean up the script some to get rid of my hardcoded hacks. Basically I added 2 scripts, (launch_gdb and gdb) and modified the stlink_uploader. I dropped a shell script gdb into the tools/linux/stlink mainly so i can manipulate the arguments as I didn’t find a way to override the name of launch configuration parameters for the gdb executable.
no pictures .. same looking as before
Here you can see me debugging the ASCIITable example. I have putty running as a serial terminal on /dev/ttyUSB0. You can see that it has output some data but I’m stepping through the write functions and you can see the next character it is going to output is ‘e’ (the value of *str)
If you are interested in this stuff join IRC to get more info.
-rick
FYI.
I posted to the Arduino Developers mailing list (i.e the IDE developers), to find out how they intended to support he in-circuit debugging on the Arduino Zero
Well, I havent got a response from the dev’s yet (I may never), but someone suggested I use DDD
I’d tried to compile DDD on windows but it won’t, as it looks like it was never test compiled under MingW on windows
So I thought I’d try compiling on my Linux 32 machine.
Well, its just as bad. but fails differently
Firstly its a sod to get all the necessary development libs installed, there doesn’t seem to be a list of the required libs, or a script to apt-get install them for you. (as far as I can tell)
So I had to run configure over and over again and each time it failed with a cryptic message, I’d have to track down the necessary lib and install it.
When I finally got past the configure script stage, and ran Make, it fails to compile
So…
It looks like DDD is another non starter
Hence Exclipse is looking the best bet at the moment, but…
But I can’t find any docs on whether there is a Windows version of the Eclipse Standalone debugger.
The percentage of Linux users is probably 20% on this forum , possibly lower.
So unless we can get a cross platform solution, I’m not sure how much take up there would be
Albeit if we an get a Windows version working, I think it would be a game changer
I think the magic you are looking for is…
sudo apt-get install ddd libmotif-common libmrm4 libuil4 libxm4 ddd-doc pydb glibc-doc
Thanks
I’ll give that a try
It does however mean that DDD is a Linux only solution, because we can’t do the same thing
Well, I know it won’t work under MinGW
I’ve posted to the Eclipse forum in the hope someone can help on how to install the debugger under Windows
I’ve instaleld using the apt-get you sent, and DDD now seems to run, but I’m not going ot have time until the weekend to see how to use it.
BTW. I posted to the Eclipse users forum to find out about the Standalone debugger on windows, but my post has to be moderated so I don’t know when if ever I’ll get a reply
I’m sure the same could be done for an stlink upload, I just don’t use that upload method. I want to test it a bit more and then will post the batch and the modified platform file here.
I will try to linuxify your script when it will become available, because I still didn’t received my STLink clone from China.
I will try to linuxify your script when it will become available, because I still didn’t received my STLink clone from China.

I seems to work fine with STM32F4Stamp board (an F405) with txeane/st-util and gdb, that will be nice for my future debugging.
But trying the same on my Maple Mini Baite clone, st-util responded “stlink-common.c: unknown chip id! 0xe0042000” …

Is there something I missed ? Are those Baite clones really use genuine chip ? or is it a bug in texane ?
https://github.com/rogerclarkmelbourne/ … rd.cpp#L48
You can hold the boot1 pin high, and press reset. That will let you at least get in. The better solution is to delete this code and never use the SWD pins except for debugging.
-rick
There is a defined in boards.txt which enabled the SWD pins.
On the Maple mini builds, SWD will be off by default.
Do you have this set in the upload flags
-DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG=1
Edit.
Rick we posted at virtually the same time .. (you just beat me ;0)
[…] The better solution is to delete this code and never use the SWD pins except for debugging.
tools.maple_upload_gdb.upload.pattern="{path}/{cmd}" {serial.port.file} {upload.altID} {upload.usbID} "{build.path}/{build.project_name}.bin" "{runtime.ide.path}/hardware/tools/gcc-arm-none-eabi-4.8.3-2014q1/bin/arm-none-eabi-gdb" "{build.path}/{build.project_name}.elf"
I will check that when I get chance and I will linuxify the script …
Ciao !
I haven’t had much time to play with GDB lately, but I really wish it was rather a graphical application


After struggling to get the initial reset, I got it to work ! So, I can debug my LPC1768 too !

On the other thread http://www.stm32duino.com/viewtopic.php?f=29&t=522 I am trying to get Eclipse debugging working using win32 and openocd with ST-link on nucleo board. It works perfectly and is easy to setup with GNU ARM plugins. IDE does all the magic with GNU OpenOCd plugin to connect to target and provide scripts for gdb too. The only and very very annoying problem is that the IDE can’t find the source for .ino! Lol. It can find sources for everything else that I’ve tested. I’d be really grateful to hear comments if you have ideas what to try next. I just feel I’m so close I don’t want to give up yet. Seeing your screenshot with .ino source gave me some more motivation to continue. Ok it was in Linux but anyway … Thanks.
At the gdb prompt, you can add to the file search directory using the “directory” command. Here I add the sketch directory blink_std … where /mnt/vbox/shared/Arduino_STM32RK_Sketch is the setting of my arduino sketch preference:
(gdb) directory
Source directories searched: $cdir:$cwd
(gdb) directory /mnt/vbox/shared/Arduino_STM32RK_Sketch/blink_std
Source directories searched: /mnt/vbox/shared/Arduino_STM32RK_Sketch/blink_std:$cdir:$cwd
(gdb) list setup
17 // the setup function runs once when you press reset or power the board
18 void setup() {
19 // initialize digital pin 13 as an output.
20 pinMode(PC13, OUTPUT);
21 }
22
23 // the loop function runs over and over again forever
24 void loop() {
Now, that’s a direct statement!
I really, really need to toughen up and get away from the M$ crap.
Ray
(MCSE, once upon a time…)
If only it was that easy.
I think its going to be several years (or perhaps never) that I’ll be able to get away from Windows for work stuff, as there is plenty of commercial SW that only runs on Windows
However, unless Windows 10 changes substantially in the next year or two. I suspect that Windows 7 will be the last MS OS I’ll be running for my own use as well as business.
If I every have to use Windows 10, with its intrusive spyware built in, will be resigned to a separate machine just for work.
i ‘retired’ 4 wks later:-)
the first cracks in the wall were
1 ) gnu ada compiler around ’94 saving i suspect a lot of ada per station costs
2 ) saving the u$ office & windows costs on a ‘something’ rig, also i got to write and play with linux device drivers
stephen
And among my large repertoire of apps I use a lot, including embedded system tools, financial management apps, Linux and often too, OS X, are just not viable.
I don’t like Microsoft’s monopoly either, but some of us would prefer to pay $80 every 4 years to them.
User will be blocked.
srp
Could you please share your scripts again for auto upload & start debugging.
Your github repository is down and I couldn’t find it on your github page.
I want to port this linux project to Mac OS X
The gdb modifications were just changes to the platform.txt and board.txt. However, those files were changing so frequently it became painful to keep up and not break things. As there wasn’t much interest in this, I kind of let it fall by the wayside and I can’t find the modifications I did.
In platform.txt I added a new tool and its command line did all the magic. For that tools command line, I started two xterms when you did an upload. One xterm ran the stlink utility ( acting as a gdb proxy ), the other xterm ran arm-none-eabi-gdb. The gdb command connected to remote target :4242, erased the flash, loaded the new version of the program and then set a temporary break point on setup and then issued a reset mon init, continue.
In board.txt I added a new menu item that used the new programming method
If you are using linux and BMP as your upload method, you can use this one line change to platform.txt
platform.txt change wrote:tools.bmp_upload.upload.pattern=xterm -e “{path}{cmd}” -q -cd “{build.path}” {upload.verbose} -ex “layout src” -ex “set target-async off” -ex “set confirm off” -ex “set mem inaccessible-by-default off” -ex “target extended-remote {serial.port}” -ex “monitor swdp_scan” -ex “attach 1” -ex “stop” -ex “file {build.project_name}.elf” -ex “load” -ex “tbreak setup” -ex “run”