Skip to content

Instantly share code, notes, and snippets.

@JamesHagerman
Last active December 7, 2023 18:12
Show Gist options
  • Save JamesHagerman/c177392502752d2a4717aca237bb213c to your computer and use it in GitHub Desktop.
Save JamesHagerman/c177392502752d2a4717aca237bb213c to your computer and use it in GitHub Desktop.
The BPM is basically the best flashing tool for STM32/ARM chips. Get the hex file for whatever you're flashing (build it, download it, whatever), then follow these directions.

Black Magic Probe - Firmware Flashing

The BPM is basically the best flashing tool for STM32/ARM chips. Get the hex file for whatever you're flashing (build it, download it, whatever), then follow these directions.

Install compiler

First install the arm compiler:

sudo add-apt-repository ppa:team-gcc-arm-embedded/ppa
sudo apt-get update
sudo apt-get install gcc-arm-embedded

Handle udev rules

Or just run as sudo...

Install the firmware using the Black Magic Probe

Once the toolchain is installed and the code and bootloader are compiled, you can hook the probe up directly to your device and use gdb to flash the code to the module.

Once you're hooked up, start up the ARM gdb and scan for the device.

Follow these steps to get everything working:

% arm-none-eabi-gdb
[...]
(gdb) target extended-remote /dev/ttyACM0
(gdb) monitor swdp_scan
(gdb) attach 1
(gdb) set mem inaccessible-by-default off
(gdb) load build/clouds_bootloader/clouds_bootloader.hex
[...]
(gdb) load build/clouds/clouds.hex
[...]
(gdb) quit

After running the final load, you should see the module blink through it's bootup and then turn off all of it's LEDs.

Unplug the programmer, power cycle the module, and make sure it boots up by blinking it's leds!

You should have a working module now!

More notes on the Black Magic Probe:

getting started: https://github.com/blacksphere/blackmagic/wiki/Getting-Started

Useful commands (and debugging help): https://github.com/blacksphere/blackmagic/wiki/Useful-GDB-commands

.gdbinit

GDB will use any .gdbinit files it finds in the current directory. For the BMP, @kbob uses this:

target extended-remote /dev/cu.usbmodemBDEAA9F1
monitor swdp_scan
attach 1
set confirm off
set mem inaccessible-by-default off
define lc
load
continue
end
define lr
load
run
end

Flashing 1bitsy Examples

The examples often can use the flash target via make flash. Just make sure you've got udev rules set up right or whatever...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment