Bare metal programming of the STM32F3Discovery board


The STM32F3Discovery board is a low cost board incorporating an STM32F303VCT6 microcontroller (72MHz, floating point Cortex M4 core), an accelerometer, compass, gyroscope and magnetometer. This is an amazing board. The processor is powerful and complex - just about at the edge of a bare-metal approach (at least for me anyway). The accelerometer, compass and gyro could potentially be used in a dead-reckoning navigation, inertial guidance system or even just a fancy game controller. I have put together a header file which is (mostly) tested against the board peripherals. A simple linker script and makefile are provided.

Build requirements

These programs were built using the arm-gcc compiler available at:
They were debugged using openocd and minicom
You will most likely have to adjust the location of the library file in the Makefile for the examples to suit your directory layout.


Blinky: This simple example simply blinks the board LED's. blinky.tar.gz
Serial: This example shows you how to use the UART. serial.tar.gz
PWM: This example generates 4 different PWM signals pwm.tar.gz
Accelerometer: This example interfaces to the acceleromter/compass and sends data back over a serial link. accelerometer.tar.gz
Gyro: This example interfaces to the gyroscope and sends data back over a serial link. gyro.tar.gz

Further reading

Other microcontroller examples are in Bare-metal ARM home
Further information: email frank DOT duignan AT dit DOT ie