A template for building STM32F0 ARM projects with GCC logo

A template for building STM32F0 ARM projects with GCC

Free

STM32F0 Discovery GCC template for command-line builds

FreeFree tier
Type
Open Source

About A template for building STM32F0 ARM projects with GCC

This GitHub repository provides a basic template for building STM32F0 Discovery board projects using the GNU Compiler Collection (GCC) toolchain, specifically arm-none-eabi-gcc. It is designed for developers who prefer working in a text editor and command-line environment over using an Integrated Development Environment (IDE). The template includes a Makefile structure that automates the building of the STM32F0xx standard peripheral library, custom linker scripts (to avoid restrictive copyright from STM's default script), device-specific startup files, and support for flashing via OpenOCD. It is based on a similar template for the STM32F4 Discovery board and allows easy upgrades of the peripheral library by preserving its original folder structure. The repository contains subdirectories for libraries, source code, include files, and OpenOCD configuration.

Key Features

No IDE required; develop in any text editor and build from command line
Makefile automatically builds STM32F0xx standard peripheral library
Custom linker scripts provided as an alternative to STM's restrictive default script
OpenOCD configuration included for flashing the board ('make program')
Subfolders for libraries, device files, source, includes, and extras
Abstracted library and extra folders for reuse across multiple projects
Based on STM32F0 Discovery firmware package (STM32F0xx_StdPeriph_Lib_V1.0.0)
Startup file and system clock configuration included

Pros & Cons

Pros
  • Free and open source under standard GitHub terms
  • Eliminates vendor IDE lock-in and allows use of any editor
  • Easy to integrate peripheral library upgrades by copying over new STM releases
  • Custom linker scripts avoid restrictive copyright issues present in STM's default
  • OpenOCD flashing support enables simple programming with 'make program'
Cons
  • Specifically targets STM32F05xx series (STM32F0 Discovery board) only
  • Requires manual installation of arm-none-eabi-gcc toolchain and OpenOCD with stlink
  • Not actively maintained (repository shows limited recent activity)
  • Limited documentation beyond the README file

Best For

Embedded developers wanting to program STM32F0 Discovery board without an IDEHobbyists or professionals preferring command-line toolchains like GCCQuick-start for learning STM32F0 development with minimal setupProjects that need a lightweight, open-source build system for STM32F0xx microcontrollers

FAQ

What toolchain is needed for this template?
The template requires the arm-none-eabi-gcc toolchain (e.g., Code Sourcery G++:Lite Edition).
How do I flash the compiled binary to the board?
Install OpenOCD with stlink enabled, then run 'make program' from the repository root directory. Ensure the OPENOCD_BOARD_DIR constant in the Makefile points to your OpenOCD board configuration.
Can I reuse this template for multiple projects?
Yes, the library and extra folders can be abstracted to a common location. Adjust the STD_PERIPH_LIB and OPENOCD_PROC_FILE variables in the Makefile to point to their new paths.
What is the difference between the custom linker scripts and STM's default?
The custom linker scripts in Device/ldscripts are provided to avoid the unreasonably restrictive copyright assertion included in STM's original stm32_flash.ld script.