Spark Logic

Black Magic Probe on an stm32f103c8

Rick Kimball Sat May 16, 2015 1:08 am

11/07/2017 – I attached a binary that can be loaded onto your blue pill in this post: viewtopic.php?f=37&t=2801

12/3/2016 – You can now contribute to developers of the Black Magic Probe project (which isn’t me) using paypal. Find and click the paypal contribute button here: https://github.com/blacksphere/blackmagic

12/8/2016 – Instead of using this port of Black Magic Probe, it is a lot easier to just compile the PROBE_HOST=stlink and load that onto your bluepill. The bluepill hardware is the same as the stlink v1/v2 hardware. Just follow the steps from the Black Magic Probe software for building and installing the BMP stlink platform. The advantage being, you will get the latest BMP version and you will be able to update future versions just using the USB cable on the bluepill with a program called usb-util. The posts in this thread can be thought of as an interesting read on my journey from bluepill newbie to a somewhat proficient users of it.

The Black Magic Probe is a modern, in-application programmer and debugging software for embedded microprocessors. It allows you to see what is going on ‘inside’ an application running on an embedded microprocessor while it executes. It is able to control and examine the state of the target microprocessor using a JTAG or SWD (Serial Wire debugging) port and on-chip debug logic provided by the microprocessor. The probe connects to a host computer using a standard USB interface. The user is able to control exactly what happens using the GNU source level debugging software, GDB. Read more about it here: https://github.com/blacksphere/blackmagic/wiki

However, the stm32duino crowd here will find the open source Black Magic firmware more appealing than the hardware. The Black Magic Probe firmware can be loaded onto the low cost stm32c8t6 boards you find on eBay. You can then use that clone board with BMP firmware to take the place of an ST-Link programmer. Once the BMP firmware is loaded on a clone board, it provides the ability to upload to the flash of another target board. It does this using a gdb server built into the BMP firmware. This allows for hardware debugging using just arm-none-eabi-gdb without any host server code.

I started with the latest github version of the Black Magic Probe software and added platform support for the stm32f103c8t6 boards you find on ebay. I call it the ‘jc66_coreboard’ platform, as that is the label printed on the silk screen. Any board with the same pin outs should work (See Red Pill Blue Pill post for more info about the hardware). The new platform is based mostly on the already existing stlink platform source with changes to support the different hardware pin outs and features.

The ebay “Red Pill” board loaded with the Black Magic Probe firmware acting like a programmer:
Image
by Rick Kimball, on Flickr

Target board (another “Red Pill” board) connections from the “Red Pill” BMP programmer:
Image

I’ve attached a zip file containing the blackmagic.bin file, the blackmagic elf file, and patch file for the source. ( NOTE: I will fork BMP github code and create a branch with the source changes). For now, just download and unpack the zip and then upload the bin or elf file to your jc66_coreboard.

If you want to build the source yourself, do something like the following:
$ git clone https://github.com/blacksphere/blackmagic
Cloning into 'blackmagic'...
remote: Counting objects: 3463, done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3463 (delta 0), reused 0 (delta 0), pack-reused 3461
Receiving objects: 100% (3463/3463), 1.70 MiB | 0 bytes/s, done.
Resolving deltas: 100% (2331/2331), done.
Checking connectivity... done.
$ cd blackmagic
$ unzip ../bmp_jc66_coreboard.zip
Archive: ../bmp_jc66_coreboard.zip
inflating: blackmagic
inflating: blackmagic.bin
inflating: bmp_jc66_coreboard.patch
$ patch -p1 <bmp_jc66_coreboard.patch
patching file src/Makefile
patching file src/command.c
patching file src/platforms/common/cdcacm.c
patching file src/platforms/jc66_coreboard/Makefile.inc
patching file src/platforms/jc66_coreboard/Readme
patching file src/platforms/jc66_coreboard/jc66_coreboard.png
patching file src/platforms/jc66_coreboard/platform.c
patching file src/platforms/jc66_coreboard/platform.h
$ make
$ cd src
$ make install # assuming it go OK, you will have to change the path for the st-write utility to match your system

Replies

madias Thu May 21, 2015 10:12 pm

I agree, most sellers are using “symbol photos”, but most of them have a big stock on the same boards.
Maybe it would help to post your “good board” sellers here?

RogerClark Thu May 21, 2015 11:15 pm

Matthias

We could try the list of good sellers, but its possible they change stock, and don’t get the boards they think they get.

I had an issue I posted about with a “CC Debugger” clone, and the seller had 100% rating and had sold 8 others and no complains, but mine didnt have any firmware :-(

strawberrymaker Mon May 25, 2015 10:54 am

Dont know if you already looked it up, but the internal resistors are 40K (30-50k), so yeah, bit higher.

~Straw

Rick Kimball Mon May 25, 2015 12:25 pm

Did you find a schematic for that board? @strawberrymaker?

strawberrymaker Mon May 25, 2015 1:01 pm

For the Probe? Internal resistance is from the 103×8 datasheet.
~Straw

Rick Kimball Mon May 25, 2015 1:27 pm

You have me way confused. I’m not using the Blacksphere hardware. I’m using this board .. Just took a picture:

Imagebluepill_top by Rick Kimball, on Flickr

Imagebluepill_bottom by Rick Kimball, on Flickr

R10 .. is a 10k .. that is connected to VCC and PA12 (USBDP+)

the hole next to C6 is PA12.

Has anyone seen that voltage regulator before (U1) ? It seems puny.

-rick

strawberrymaker Mon May 25, 2015 1:49 pm

Oh sorry, Didnt understand it. I have the blue pill and the big one which Roger uses too, guess Theres no need to make a New picture. Currently not available, will take a look at both pcbs when im back.

Dont know who is making U1, but i think its a 150mah one, (also Seen on arduino pro mini?)

~

martinayotte Mon May 25, 2015 2:35 pm

Rick Kimball wrote:Has anyone seen that voltage regulator before (U1) ? It seems puny.

Rick Kimball Mon May 25, 2015 2:36 pm

I updated the firmware and source files on the first post.

I also added a picture of the stm32c8t6 “Red Pill” board I’m using as the Black Magic Probe hardware and how you connect it to a target device. Re-reading what I originally wrote, it wasn’t obvious in the first few paragraphs which hardware I was using. Hopefully, you can see that now with pictures.

-rick

victor_pv Thu May 28, 2015 3:19 am

Rick can an st-link clone be used for Black Magic?
I am waiting on one to arrive. Would be great if I can swap the fw to a Black Magic, but I still don’t have it so I don’t even know what pins it uses.

EDIT: I see you are including the source, so hopefully the pins can be changed. I’ll check that pins are connected in the st-link clone once I get it.

RogerClark Thu May 28, 2015 4:08 am

Victor

I think the main issue with flashing BMP onto an STLink is access to the pins in order to program it.

My STLink looks like this

Image

I can see 4 through holes, which may be for reflashing, as one of the wholes seems to have a track to PA14 which is SWD Clock.

As they are more expensive than the BluePill / red pill board and also don’t have access to PA9 and PA10 for USB Serial via the BMP’s own usb to serial driver, I’m not sure its worth buying one.

I know that Andy has a different STLink (in a box), so I wonder if that one is any better.
I think he has this one

Image

Personally I’m going to flash BMP onto the Red Pill and use that.

ahull Thu May 28, 2015 10:52 am

victor_pv wrote:Rick can an st-link clone be used for Black Magic?
I am waiting on one to arrive. Would be great if I can swap the fw to a Black Magic, but I still don’t have it so I don’t even know what pins it uses.

EDIT: I see you are including the source, so hopefully the pins can be changed. I’ll check that pins are connected in the st-link clone once I get it.

victor_pv Thu May 28, 2015 1:21 pm

RogerClark wrote:Victor

I think the main issue with flashing BMP onto an STLink is access to the pins in order to program it.

My STLink looks like this

Image

I can see 4 through holes, which may be for reflashing, as one of the wholes seems to have a track to PA14 which is SWD Clock.

As they are more expensive than the BluePill / red pill board and also don’t have access to PA9 and PA10 for USB Serial via the BMP’s own usb to serial driver, I’m not sure its worth buying one.

I know that Andy has a different STLink (in a box), so I wonder if that one is any better.
I think he has this one

Image

Personally I’m going to flash BMP onto the Red Pill and use that.

Rick Kimball Thu May 28, 2015 1:51 pm

Funny .. while I think the BMP is the bee’s knees : ) .. I’d never sacrifice a working ST Link V2 to BMP :)… A V1 .. in a heart beat a V2.1 never ..

victor_pv Thu May 28, 2015 2:24 pm

Rick Kimball wrote:Funny .. while I think the BMP is the bee’s knees : ) .. I’d never sacrifice a working ST Link V2 to BMP :)… A V1 .. in a heart beat a V2.1 never ..

Rick Kimball Thu May 28, 2015 2:37 pm

I find it amusing that the whole stm32f103 environment has a red vs blue battle :)

victor_pv Thu May 28, 2015 3:14 pm

Until some chinese clone shows up with a yellow or black PCB… ;)

martinayotte Thu May 28, 2015 8:15 pm

From the link above, it seems that there are 4 pins too, so it probably there. (I didn’t received mine yet, maybe next week …)

Image

Sign in to reply