This is a simple bare-metal project template for the STM32F4 Discovery board. It is based on:
- Install gcc-arm-embedded and make sure the arm-none-eabi-*-commands are in your path
- Install OpenOCD
The STM32F4 Discovery board is an inexpensive evaluation board for the STM32F407VG chips. You might want to keep copies of these documents around:
- RM0090: STM32F4xx Advanced ARM-based 32-bit MCUs Reference Manual
- STM32F407xx Technical Datasheet
- UM1472: STM32F4 High-Performance Discovery Board User Manual
First, you need to grab and compile a copy of libopencm3:
$ git submodule init
$ git submodule update
$ cd libopencm3
$ make
This will compile the library. Afterwards, change into the src directory and build the example:
$ cd ../src
$ make
Connect your STM32-Discovery board and run
$ make flash
to upload the binary into the microcontroller. In order to see the USART output,
connect a 3V3 TTL adaptor to PA2 (USART2_TX). You can use screen
to see the output:
$ screen /dev/ttyUSB0 115200
Currently, the example uses USART2. The other USART ports can also be used, for example:
- USART1: PB6, PB7
- USART6: PC6, PC7 Note: If you use the STM32F4 Expansion board, the UART6 should be mapped to the serial port of this board. However, I wasn't able to get this running. Attaching an FTDI USB-TTL-Adapter works fine for these pins.
The template has been tested on the following host systems:
- Ubuntu Linux 14.04
- Mac OS Mavericks