Reverse Engineering Remote Control Power Sockets - Part 5: Setting up a development environment for the STM32F0DISCOVERY

The STM32F0DISCOVERY is a cheap STM32F0 (ARM® Cortex®-M0-based) evaluation board. It is the second target of choice to controll a 433 MHz transmitter in order to switch cheap remote controlled power outlets.

You might want to read the following posts before you continue:

libopencm3

libopencm3 is a free/libre/open-source (LGPL v3, or later) firmware library for various ARM Cortex-M microcontrollers. It comes along with various examples and makes it very easy to do the first steps in embedded programming.

Toolchain

In order to be able to compile libopencm3, you'll need an appropriate cross-toolchain for the ARM platform:

yay -S gcc-arm-none-eabi-bin-92 arm-none-eabi-gdb opencocd stlink

libopencm3-examples

Let's initially build all examples along with libopencm3:

git clone https://github.com/libopencm3/libopencm3-examples
cd libopencm3-examples/
git submodule init
git submodule update
make

Finally connect the STM32F0DISCOVERY via the Mini-USB connectors to your development host and run the following command to flash the miniblink example to the target:

cd examples/stm32/f0/stm32f0-discovery/miniblink/
make flash

Or to flash with stlink instead of OpenOCD:

make miniblink.stlink-flash

You'll hopefully see the green LED flashing now.