September 17, 2016

The hard facts: STM32F103C8T6 ARM STM32 Minimum System Development Boards

After almost a year away from these little boards, I am back at it again and working up an "executive course" in using these devices.

How to burn code with openOCD

So, suppose you go to my github repository and download one of the examples. You type "make" (after going through whatever you need to do to get a compiler and toolchain setup) and you will get something like "blink.bin" that you want to flash into a unit. Here is how you do it. So, the STM unit is powered from the ST-Link device, which seems just fine. It doesn't seem to matter where the jumpers are on the STM unit when you do this, but you will need to put them both to zero to run the code.

This is a much simpler process than I used to use, thanks to the openocd "program" facility (that is a built in script to do just what I want). I used to have to open two terminal windows, run openocd in one and a telnet window in the other and remember commands. The stuff in the Makefile that does this is:

OCDCFG = -f /usr/share/openocd/scripts/interface/stlink-v2.cfg -f /usr/share/openocd/scripts/target/stm32f1x.cfg
flash:
	openocd $(OCDCFG) -c "program blink.bin verify reset exit 0x08000000"
These paths are correct on my Fedora system. Note that it not only verifies the code, but also resets the board to run the new code.
Feedback? Questions? Drop me a line!

Tom's Computer Info / [email protected]