The Black Magic Probe (BMP) is agreat debugging tool for ARM Cortex µCs. This is a description of how to createone using a low-cost “Blue Pill” board.
Eclipse gcc-arm-none-eabi free download. DEPRECATED GNU ARM Eclipse These plug-ins provide build and debug extensions for Eclipse CDT (C/C Development Tools) for 32/6.
The BMP can upload firmware to a wide range of µCs over JTAG or SWD, aswell as connect to a serial port for simple communication. It also supports
gdb debugging, e.g. single-stepping, breakpoints, and examining memory.
The BMP is supported byPlatformIo, my go-to tool forall embedded µC development (see example at end): BMP + PIO = an amazing combo!
Here is a target Blue Pill (left), being prepared for use with a BMP (right):
This simple 4-pin female header “adapter” allows uploads and debugging. Forserial, 6 pins are needed. For RESET / SWO, 2 more pins must be connected.
The 8-pin header layout is compatible with the 6-pin header on a “HyTiny” board, another low-costSTM32F103 board (fromHaoyu):
It’s a somewhat arbitrary choice, but as good as any - most boards differ intheir pin choices anyway. One solution will be described further down below.
![]()
There is no 5V power on the header, to avoid accidental damage. Only 3.3V, withlimited current capability (around 50 mA). Boards which need more current orother voltages have to be powered in other ways.
Chicken-and-egg
The problem with turning a Blue Pill (BP) into a Black Magic Probe (BMP) is thatthere’s no convenient way to program that BP until you have a BMP! Thesolution chosen here, is to get an (equally cheap) “ST-Link” clone, which hasfar less functionality than a BMP but makes a very useful fallback option: Antares autotune 7.08 demo mac.
If all else fails, that ST-Link can also help restore a broken or damaged BMP.
The plan
Here are the steps needed to reach that magical setup which the BMP offers:
And for completeness, since BMP’s µC support continues to evolve: Neje dk-8-kz user manual.
Texane’s “stlink”
The stlink utility by user “texane” onGitHub, is an open source tool for STM’s “ST-Link” hardware,of which there are several generations by now.
ST-Link V2 is based on the common STM32F103 µC and has been widely cloned forquite some time now. It’s very easy to find “ST-Link sticks” on eBay and onChinese sites (they all come from China anyway).
Unfortunately, these ST-Links don’t expose their serial port UART pins, so theycan’t be turned into a BMP without losing some of its most useful features. Butthey can be used to re-program a Blue Pill, which is the next best option.
See the README forWin/Mac/Linux installation instructions. It’s very easy.
BMP firmware
There are two approaches to getting the BMP firmware: lazy and long-term. The lazyoption is to download the build files I’ve collected here:
This is a perfectly usable snapshot, but it may not be the very latest version.
The long-term way is to clone the BMP repository and build the firmwareyourself. This allows building updates with a simple
git pull . This approachis easy if you have the “arm-gcc-embedded” toolchain installed and in yourPATH.
Upload to the Blue Pill
The firware consists of two pieces:
Both need to be uploaded, and that’s where the
stlink utility comes in:
After the first upload, one LED on the BP will be blinking. When the second isdone, both LEDs will be on. At this point, the ST-Link can be disconnected,and the Blue Pill is now running as a new Black Magic Probe.
The BMP code extends past 64 kB, which conflicts with the STM32F103C8 µCs onBlue Pills, as they reportedly only contain 64 kB of flash memory. In reality,all BPs have 128 kB flash (maybe not quite in spec, who knows). The solution isto force the upload anyway, hence the
--flash flag.
Once setup and plugged in, the BMP will appear as a USB device: Microsoft edge download accelerator.
Solder the header
Parallels desktop 12 for mac. The last step is to create some sort of mechanical structure to connect an 8-pinheader (or whatever other convention you want to adopt). Here’s an idea,which takes advantage of the fact that most connections are on one side: Microsoft excel deposit slip template.
This mounts a small protoype board (a JeePlug in this case) on top.
The connections are as follows (see also thisREADME):
Where P2 is the 4-pin SWD header, and P3/P4 are the two rows of 20-pins.
Upgrade a BMP via DFU
As mentioned earlier, the firmware in the BP consists of two parts: a DFU bootloader, and the BMP software itself.
DFU stands for Device FirmwareUpgrade and is a standardmechanism for uploading new code to a µC over USB. Many more modern µCsinclude this mechanism in ROM, but on older STM32F103 it’s part of the BMPfirmware.
The BP can be put in DFU mode by changing a jumper and then plugging it in:
Now the BMP will show
(Upgrade) in its USB device name:
The board wil power up with a rapidly-blinking LED to indicate DFUmode. Go to the directory with upgraded firmware and run
dfu-util asfollows:
This utility uses
-D (download?) to upload to the BP - very confusing!
Download facebook videos free mac. The homepage for the open-source
dfu-util is onSourceForge. On MacOS, it can be installedusing HomeBrew, i.e. brew install dfu-util .
After the upgrade, the jumper must be moved back to its default “0” position.
The DFU mechanism can be tricky if more DFU-enabled devices are currentlypresent, in which case an easier solution may be to revert to using an ST-Link andsimply reflashing the firware as described before.
Pluggable variations
Since each board from different vendors seems to use another convention,no single header choice is going to suffice. One way of addressing this, is witha “socket + plug” system, with - yet another! - interconnect convention. Whatwe need is a connector with 8 . 12 pins, and various short cables which plug inand end in the proper board connector:
Here with a small selection of home-fabricated / hot-glued cable plugs:
The “connector” is based on “machined-pin IC sockets”. These have round pins,with the special property that the pins coming out will easily fit in anothersocket. By soldering wires to a second socket, we create a plug. But there aremore ways to combine these:
The left one can be used to add pins to the bottom of a protoboard PCB, and theright one allows using only once side, when dual-in-line is not needed.
The pinout of the main socket attached to the Blue Pill supports arange of plugs using just 8 of the pins. The extra pins are useful to supportfull JTAG, for example. In the example above, a 16-pin socket was used, but 14pins would have been more than enough.
Total video converter for android free download apk. Here is the selected pinout so far, with 5 pins still unused on a 16-DIP:
The 8-DIP pinout is sufficient for SWD, RESET, serial, and 3.3V or 5V power.
With good-quality machined-pin headers, these home-made connectorsare surprisingly robust (with the help of hot glue) and easy to insert andremove. Some custom PCBs would be nice … maybe some day.
Example project with BMP
Here is a complete example of how to use this Black Magic Probe to uploadfirmware to a HyTiny, and view output sent over the serial port. I’m usingMacOS, PlatformIO, and the JeeH library, butapart from USB device names (COM, /dev/ttyUSB, etc), this should carry over toany platform & dev setup.
1. PlatformIO
PlatformIO can be used on thecmd-line or asIDE plugin.Pick your poison. It’s a Python script which wraps up everything, includinggetting all the tools and toolchains needed. I’ll use the command-line mode asexample here.
How To Download Gccarmnoneeabi Macbook Pro
On MacOS, the command-line “core” version of PlatformIO can be installed with aone-liner, using Homebrew:
brew install platformio .
2. Project setup
We need to create a folder with two files in it: a projectfile and a source file:
That’s it, but the project file needs some clarification if you’re new to PIO:
Install Gcc-arm-none-eabi Mac3. Build
Build with
pio run (if using the command line, else in the IDE). The firsttime, a lot of output will be generated, something like:
The next time around, fetching tools and libraries will be skipped.
4. Upload
This is done with
pio run -t upload (which also rebuilds, if needed):
Download Gcc-arm-none-eabi5. Serial I/O
The serial communication takes place on a second port: Game pacuan kuda pcs.
One dot every half second, as expected.
How To Use Gcc-arm-none-eabi
The fact that the BMP uses separate ports for JTAG and serial can be veryconvenient, because that serial connection can be left running in a separatewindow, while we build and upload code changes as needed.
Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
December 2020
Categories |