This repository contains a basic STM32F4xx project that blinks an LED on the Nucleo-64 STM32F401RE board by polling a timer. The main prupose of the project is to demonstrate how to compile all of the required sources using a Makefile, this includes the STM32F4 HAL.
The contents of this repository are derived from the HAL generated by the STMCubeMX IDE. I did the following:
- Generated a working CubeMX project to blink the LED using TIM2 on the Nucleo board.
- Examined the build output produced by CubeMX.
- Copied all source files (less some project configuration files) into this directory.
- Re-arranged the directory structure to be a bit more sensible.
- Wrote a Makefile to mimick the build procedure determined from (2).
See my earlier project for details on installing the required toolchain: STM32F4-Basic. There is also a related blink project that uses the HAL_Delay
function to blink the LED, this requires fewer source files since it does not need an additional timer.
To build this code run: make
To clean the project run: make clean
To upload/flash the resulting executable to the microcontroller run: make flash
Its easy to combine them all into one command: make clean all flash