Bare-metal FreeRTOS firmware for atmospheric monitoring on STM32 microcontrollers. No HAL, no vendor SDK — all peripheral access via direct register writes.
- Cloning the Repository
- Installing Dependencies
- Installing FreeRTOS Kernel
- Repository Structure
- Makefile Reference
- Project Documentation
git clone https://github.com/TanOfAllCodes/airmo.git
cd airmoThe only required toolchain is the ARM GCC cross-compiler and the ST-Link flash utility.
On Ubuntu / Debian:
sudo apt update
sudo apt install gcc-arm-none-eabi binutils-arm-none-eabi stlink-toolsOn Arch Linux:
sudo pacman -S arm-none-eabi-gcc arm-none-eabi-binutils stlinkOn macOS (Homebrew):
brew install stlink
brew install --cask gcc-arm-embeddedVerify the toolchain is available:
arm-none-eabi-g++ --version
st-flash --versionFreeRTOS is not included in the repository (it is listed in .gitignore). A setup script is provided to clone it:
cd rstm32
bash setup_freertos.shThis clones FreeRTOS/FreeRTOS-Kernel into rstm32/FreeRTOS-Kernel/ at shallow depth. The script is idempotent — running it again when the directory already exists is safe.
airmo/
├── README.md ← This file
├── TECHNICAL.md ← Hardware, sensors, and system design
├── PROJECT.md ← Project Overview
├── arch.pdf ← System architecture diagram
├── bom.xlsx ← Bill of materials
└── rstm32/ ← Firmware project root
├── Makefile ← Multi-target build system
├── setup_freertos.sh ← FreeRTOS Kernel clone script
├── FreeRTOS-Kernel/ ← Vendored FreeRTOS (cloned by setup script)
├── targets/ ← Board-specific files
│ ├── STM32F07X/
│ │ ├── target.h ← RCC + GPIOC register map
│ │ ├── stm32f07x.ld ← Linker script (128K flash / 16K RAM)
│ │ └── FreeRTOSConfig.h ← 8 MHz, 12KB heap, Cortex-M0 NVIC
│ └── STM32H753/
│ ├── target.h ← RCC + GPIOB + ETH register map
│ ├── stm32h753.ld ← Linker script (2MB flash / 1MB RAM)
│ └── FreeRTOSConfig.h ← 400 MHz, 64KB heap, FPU, Cortex-M7 NVIC
└── src/
├── main.cpp ← Reset handler, vector table, task creation
├── modules/ ← Hardware drivers (one class per peripheral)
│ ├── blink4s/ ← GPIO driver for onboard LEDs (F07X)
│ ├── i2c/ ← Shared I2C bus driver
│ ├── gnss/ ← GNSS receiver (u-blox, I2C 0x42)
│ ├── imu/ ← IMU — accel + gyro (LSM6DSO, I2C 0x6A)
│ ├── thermal_humidity/ ← Temp + humidity (SHT4x, I2C 0x44)
│ ├── barometer/ ← Pressure + temp (BMP3xx, I2C 0x76)
│ ├── aerosol/ ← Particulate matter (SPS30, I2C 0x69)
│ ├── solar/ ← Solar irradiance + UV (VEML6075, I2C 0x10)
│ ├── infrared/ ← IR thermometer (MLX90614, I2C 0x5A)
│ └── ethernet/ ← ETH MAC + LAN8742A PHY driver (H753 only)
└── services/ ← Application-level FreeRTOS tasks
├── ledring/ ← LED animation service (F07X only)
├── sensors/ ← Polls all 7 sensors at 1 Hz
└── telemetry/ ← TCP telemetry at 100 ms (H753 only)
All commands are run from inside the rstm32/ directory:
cd rstm32The TARGET variable selects the board. The default is STM32F07X.
TARGET |
Board | Core | Flash / RAM |
|---|---|---|---|
STM32F07X |
STM32F072 Discovery | Cortex-M0 | 128 KB / 16 KB |
STM32H753 |
STM32H753ZI Nucleo-144 | Cortex-M7 | 2 MB / 1 MB |
Pass it on the command line to override the default:
make TARGET=STM32F07X # explicit (same as default)
make TARGET=STM32H753 # Nucleo-144make # Build for STM32F07X (default)
make TARGET=STM32H753 # Build for STM32H753Compiled objects and the final ELF/BIN are written to build/<TARGET>/. Dependency files (.d) are generated automatically for incremental rebuilds.
The flash target erases the device, writes the binary, and resets the MCU so it starts immediately:
make flash # Build + erase + flash STM32F07X
make flash TARGET=STM32H753 # Build + erase + flash STM32H753Requires st-flash and an ST-Link probe connected to the board. The flash address is 0x08000000 for both targets.
make clean # Delete the entire build/ directory
make clear # Erase flash only (no build)
make info # Print current target configurationmake info output example (for F07X):
TARGET = STM32F07X
CPU_FLAGS = -mcpu=cortex-m0 -mthumb
FREERTOS_PORT = GCC/ARM_CM0
LDSCRIPT = targets/STM32F07X/stm32f07x.ld
BUILD_DIR = build/STM32F07X
FLASH_ADDR = 0x08000000
HAS_ETHERNET = 0
The build system enables features based on the selected target:
| Feature | Macro | Enabled for |
|---|---|---|
| LED ring animation | HAS_RING=1 |
STM32F07X |
| Ethernet + TCP telemetry | HAS_ETHERNET=1 |
STM32H753 |
These are passed as preprocessor defines and gate both source file inclusion (in the Makefile) and code paths (via #if HAS_RING / #if HAS_ETHERNET in main.cpp).
| Document | Description |
|---|---|
PROJECT.md |
Project overview, preliminary analysis, sensor selection |
TECHNICAL.md |
Hardware overview, microcontroller specs, sensor datasheets, FreeRTOS task architecture, telemetry protocol |
arch.pdf |
System architecture diagram |
bom.xlsx |
Bill of materials |