This post originated from an RSS feed registered with Python Buzz
by Aaron Brady.
Original Post: Program 'Hello World' to an STM32F103C8, without an ST-Link
Feed Title: insom.me.uk
Feed URL: http://feeds2.feedburner.com/insommeuk
Feed Description: Posts related to using Python. Some tricks and tips, observations, hacks, and the Brand New Things.
He’s done the hard work of carving the neccessary include files out of ST’s
SDK, and wraps the whole thing up in an easy to use Makefile. Great!
I made one little tweak (for Ubuntu Xenial support), and it all builds
smoothly.
He’s included an openocd.cfg config file, but I don’t have an ST-Link device
to load the output with. Luckily, you can kind of smush the instructions
Jean-Claude Wippler put together to upload your program.
Grab stm32loader from
GitHub.
Put BOOT0 in the 1 position, and BOOT1 in the 0 position. Reset your board
and run the following to upload the .bin that make generated to 0x80000000.
lappy:~/Repo/stm32f103c8-blink aaron$ python stm32loader.py -a 0x08000000 \
-g 0x08000000 -p /dev/ttyUSB0 -e -w bin/blink.bin
Bootloader version 22
Chip id: 0x410 (STM32 Medium-density)
Write 256 bytes at 0x8000000
Write 256 bytes at 0x8000100
Write 256 bytes at 0x8000200
Write 256 bytes at 0x8000300
Write 256 bytes at 0x8000400
Write 256 bytes at 0x8000500
Write 256 bytes at 0x8000600
Write 256 bytes at 0x8000700
Write 256 bytes at 0x8000800
Write 256 bytes at 0x8000900
Write 256 bytes at 0x8000A00
Write 256 bytes at 0x8000B00
And you’re done! I can confirm that I have a blinking LED on port PB0.