How about setting up debugging with BlackMagic Probe

What could be included in further releases, or for the forum.
User avatar
Rick Kimball
Posts: 852
Joined: Tue Apr 28, 2015 1:26 am
Location: Eastern NC, US
Contact:

How about setting up debugging with BlackMagic Probe

Post by Rick Kimball » Tue Apr 28, 2015 1:56 pm

One of the first debuggers to support Serial Wire Debug was a thing called Black Magic Probe (BMP). It has both custom hardware and an open source firmware component. Of interest to the STM32duino crowd is the fact that original platform is the stm32f103c8 chip. So in theory you could get it running on one of your ebay micro stm32f103 boards (note: not tried yet). This would provide an alternative to the stlink programmer debugger.

I think its best feature is that it presents itself as a serial device that talks the GDB Remote Serial Protocol device. This means you don't need openocd or the texanne stlink stuff to talk to it. Even better is that it is just a CDC_ACM device so you don't need special os drivers to interface to it. It shows up as a COMX: on windows or a /dev/ttyACMx on linux. Using arm-none-eabi-gdb -ex 'target remote /dev/ttyACM0" Blink.cpp.elf and you can load and debug your stm32 arduino programs. This also makes it easier to have a consistent debugger / programmer interface across different OS platforms.

You can read more about it here:

https://github.com/blacksphere/blackmagic/wiki

-rick
Last edited by Rick Kimball on Tue Apr 28, 2015 2:18 pm, edited 2 times in total.
-rick

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

Re: How about setting up debugging with BlackMagic Probe

Post by Rick Kimball » Tue Apr 28, 2015 1:58 pm

BTW: @roger, you might want to look at its DFU code to see how they deal with reset after loading new firmware
-rick

bobc
Posts: 20
Joined: Mon Apr 27, 2015 11:20 pm

Re: How about setting up debugging with BlackMagic Probe

Post by bobc » Thu Apr 30, 2015 10:52 pm

I looked at BMP before, it was (and still is) too expensive in my book. Ok, I appreciate hardware & development costs money, and even OSS engineers have to pay the bills.

But I can get a very nice $20 JTAG adapter and use it with emblocks, which all works out of the box.

I have been looking at creating a cross-programmer (using a spare target board as a programmer). The McHck guys have achieved that (solution specific to Freescale K20). Erich Styger is also looking into it, probably also K20 specific though.

Mbed have some code for OpenSDA, it's in a state of flux though. It would involve a lot of re-inventing of the wheel though, and would make little difference in price (is all that effort worth $15?), and not really add any value over other offerings.

My conclusion here is that open source debugging (openocd, bmp etc) is a nice to have, but proprietary solutions are a more practical alternative. It's hard enough getting a robust application API going!

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

Re: How about setting up debugging with BlackMagic Probe

Post by Rick Kimball » Fri May 01, 2015 12:06 am

Now that I re-read what I wrote it appears that I'm promoting the BMP hardware. I wasn't trying to do that. Actually, I was trying to highlight that those $4 ebay chinese board and the BMP software would make a nice SWD programmer / debugger.

I compiled and loaded the opensource BMP firmware on an STM32F4 Discovery Board and used that to successfully program and debug with a few different ARM chips the NXP LPC1114 and LPC812 and an STM32F051. The STM32F4 firmware platform is already part of the source code. It is just a matter of compiling and loading it and then connecting some wires to your stm32 board. I've also installed BMP firmware on a TI stellaris board. That one also works and there is a fork of the BMP code you can download and install.

I find the idea of using the $4 clones and the BMP software to make a self sourced programmer / debugger the epitome of opensource being taken to its full potential. Sorry if I confused people with my first post.

-rick
Last edited by Rick Kimball on Fri May 01, 2015 12:42 pm, edited 3 times in total.
-rick

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

Re: How about setting up debugging with BlackMagic Probe

Post by RogerClark » Fri May 01, 2015 1:50 am

Rick,

I have a STLink clone and also a JTag programmer (Clone).

I looked at BMP some time ago, but I agree with @bobc in that, the official BMP was too expensive for me.

I know that @ahull has stlink working with GDB command line interface, and I will look at the link you sent me to the stand alone Exclipse / GDB package

I'll also look at the BMP clones, as if they are only $4 its worth buying one, just in case....

I looked at integrating JTag into the repo, but there seem to be various different manufacturers,
Also, I couldn't get my JTAG to successfully upload and run a sketch. This is possibly because its a clone and may not even work correctly, but I've not had time to verify even whether my JTag is even uploading the code.

What I think will be almost a game changer is in circuit debugging. Trying to debug using Serial.print is painful.

I wonder what the IDE team were intending to do with the Zero, as even now the publicity material has things about in circuit debugging.

Edit.

Rick, can you send a link to one of those clones. I can't find any :-(
Last edited by RogerClark on Fri May 01, 2015 2:06 am, edited 1 time in total.

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

Re: How about setting up debugging with BlackMagic Probe

Post by Rick Kimball » Fri May 01, 2015 2:04 am

bobc wrote:I looked at BMP before, it was (and still is) too expensive in my book. Ok, I appreciate hardware & development costs money, and even OSS engineers have to pay the bills.
I agree completely
bobc wrote:My conclusion here is that open source debugging (openocd, bmp etc) is a nice to have, but proprietary solutions are a more practical alternative. It's hard enough getting a robust application API going!
I also agree with this. It is kind of fun to use an stlink device to debug an stm32 chip you are running another debugger on. Very James Taylorish:

"looking in my rear view mirror,I saw myself the next car back, looking in the rear view mirror,looking at your self looking into your rear view mirror... "
-rick

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

Re: How about setting up debugging with BlackMagic Probe

Post by Rick Kimball » Fri May 01, 2015 3:40 am

RogerClark wrote:Rick, can you send a link to one of those clones. I can't find any :-(
No clones. I guess I'm really blowing the explanation of this stuff.

BMP firmware is available as open source software. People have installed it on all kinds of different boards. They take the contributed platform source, compile it, and install it on non BMP hardware. Here are some links to some of the more popular boards people use to run BMP:

o the stm32f4 discovery
http://embdev.net/articles/STM_Discover ... agic_Probe
https://github.com/blacksphere/blackmag ... 4discovery

o low cost discovery boards (basically reflashing the stm32f103c8 chip on the programming side of the board and replacing it with
http://embdev.net/articles/STM_Discover ... agic_Probe
https://github.com/blacksphere/blackmag ... rms/swlink

o the Texas Instrument stellaris launchpad
http://forum.43oh.com/topic/7107-black- ... launchpad/
https://github.com/blacksphere/blackmag ... forms/tm4c

What I was trying to say is that the platform swlink should basically work without doing too much work. The programming side of all the development boards from ST is the same as ones on our clone boards (stm32f103c8) . The $4 stm32f103c8t6 ebay minimum development boards should work as a low cost device for use with this source code https://github.com/blacksphere/blackmag ... rms/swlink

I haven't actually done it yet as I only have one ebay board. I'm waiting on some more to arrive. When they do I'll give it a try. Also, to paraphrase @ bobc "it is better to use proprietary hardware you know works and save yourself time and frustration". I mention the BMP source code only for people who want a deeper understanding of the ARM SWD debugging. It is very accessible and shows how anyone can bootstrap their hardware debugging setup.

-rick
Last edited by Rick Kimball on Fri May 01, 2015 12:43 pm, edited 2 times in total.
-rick

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

Re: How about setting up debugging with BlackMagic Probe

Post by RogerClark » Fri May 01, 2015 4:06 am

Rick

Thanks for those links.

It was a little unclear how I compile https://github.com/blacksphere/blackmag ... orms/stm32

The top level makefile doesnt seem to have specific targets
So I don't quite understand what its compiling, i.e the BMP firmware or something else

umm.

I'll have to take another look

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

Re: How about setting up debugging with BlackMagic Probe

Post by Rick Kimball » Fri May 01, 2015 4:25 am

make PROBE_HOST=blah

where blah is one of the directories in blackmagic/src/platforms such as f4discovery or native or stlink or or swlink or tm4c

I think the stm32 directory is used by all the stm32 target platforms.
Last edited by Rick Kimball on Fri May 01, 2015 4:27 am, edited 1 time in total.
-rick

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

Re: How about setting up debugging with BlackMagic Probe

Post by RogerClark » Fri May 01, 2015 4:26 am

Thanks

I'll try later...

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest