STM32F103C8T6 ARM STM32 Minimum System Development Board

September 5, 2020

libmaple -- my Hot tips

I went through a fair bit of frustration when I started working with libmaple and trying to run code on my STM32F103 boards (aka blue pills). Here are some tips that will save you a lot of time.

(1) The BOARD led is on pin 14, not 33 or whatever, so edit the file wirish/boards/maple_mini/include/board/board.h and change the following lines.

(2) Edit the Makefile and change the following two lines. This will give you default builds that will work for the blue pill and download via a STlink V2 by simple typing "make".

##BOARD ?= maple
BOARD ?= maple_mini
##MEMORY_TARGET ?= flash
MEMORY_TARGET ?= jtag

(3) If you are using an STlink, as I am, add these lines to the Makefile so you can type "make burn". Either that or modify the "make install" entry already provided.

# This is what we expect
OCDCFG = -f /usr/share/openocd/scripts/interface/stlink-v2.cfg -f /usr/share/openocd/scripts/target/stm32f1x.cfg
# Some newer chips are shipping with a idcode of 0x2ba01477, this will make them work.
#OCDCFG = -f /usr/share/openocd/scripts/interface/stlink-v2.cfg -f /usr/share/openocd/scripts/target/cs32f1x.cfg

burn:
        openocd $(OCDCFG) -c "program build/maple_mini.elf verify reset exit"

(4) You must move the BOOT0 jumper to position 1, hit reset, then type "make burn" to load new code. Then put the jumper back and hit reset to run it. I don't know why. My own bare metal demos can be loaded without moving the jumper. Not being aware of this can lead to a lot of confusion and wasted time.

(5) The Serial1 port (which I like to use for a console) is on pins A9 and A10, not on pins B6 and B7.


Feedback? Questions? Drop me a line!

Tom's Computer Info / tom@mmto.org