Libopencm3 blink template, simplified for only bluepill/stm32f1 target as a base template for stm32f1 projects
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Jan Koppe cad43301a4
simplify makefiles
3 years ago
libopencm3@e04f10e591 libopencm3: update library to latest 3 years ago
.gitignore simplify makefiles 3 years ago
.gitmodules we're going to need some code. 4 years ago
LICENSE Start repository with statement of intents :) 4 years ago
Makefile simplify makefiles 3 years ago readme: first steps on the flashing hairball 4 years ago
cortex-m-generic.ld Basic example of autogeneration of blinkies 4 years ago
ld.stm32.basic ld: stm32: drop ram to 2k. 4 years ago
main.c simplify makefiles 3 years ago


This repository contains miniblink examples for any and all boards we can find.

It is intended to be a basic starting point for people who want to test that their compiler toolchain, flash programming and/or debugger are all working as expected.

It contains only basic blinky examples, one for each board. If you are looking for full examples that setup complicated clocks, or use onboard peripherals, you are in the wrong place.


Just run make.

If necessary, this will checkout and build the libopencm3 repository, and then generate a blinky for every known board in the bin directory.

If you want to see exactly what it did, run make V=1


Unfortunately, flashing these examples is a very openended task. Below are some examples that might be helpful, but this is not an exhaustive list.

Using OpenOCD

OpenOCD can support a multitude of debug interfaces and targets. Unfortunately this makes it's config more verbose than some tools.

The general form is

$ openocd -f interface/<your debugger>.cfg -f target/<your target>.cfg \ 
     -c "program file.elf verify reset exit"

For boards with integrated debuggers, you can sometimes shortcut with a "board.cfg" file instead.

$ CMD="program ${ELF_FILE} verify reset exit"
$ openocd -f interface/stlink.cfg -f target/stm32f1x.cfg -c "${CMD}"
$ openocd -f board/stm32l4discovery.cfg -c "${CMD}"

st-flash or st-util can be used with STM32 targets only, with STLink debugger hardware.

$ st-flash write path/to/yourfile.bin 0x800000

Next steps

If you are looking for more complicated examples, the Original libopencm3-examples is still relevant, though it's not well maintained, particularly for newer hardware.

Other places to look are the USB Gadget-Zero Tests are also good at testing your USB hardware. You may also find interesting pieces at and there's also a showcase listed on