|
STM32 RTOS 0.2.3
Bare-metal preemptive RTOS for STM32F446RE
|
A preemptive RTOS for the STM32F446RE (Cortex-M4F), written from scratch on direct register access. There is no HAL, LL or CMSIS device header: every register struct is derived from the reference manuals and mapped to its address.
API reference: https://ka5j.github.io/stm32_rtos/ (generated by Doxygen and published from main at each release).
| Read | For |
|---|---|
| Architecture | Layers, boot sequence, clock tree, memory map |
| Design notes | Why the conventions are what they are |
| Contributing | Conventions, documentation style, workflow |
| Versioning | Version policy and release procedure |
| Security | Reporting, threat model, CI trust boundaries |
| Changelog | What changed in each release |
This table is the single source of truth for project status.
| Layer | Status |
|---|---|
| Boot (soc/stm32f446/: startup, linker script) | Done |
| Registers (arch/cortex-m4/, soc/stm32f446/) | Done: 4 core and 10 chip peripherals |
| Drivers (drivers/) | GPIO, RCC, Flash, PWR, UART, NVIC, SysTick, Fault, EXTI, IWDG, WWDG |
| Board support (board/nucleo-f446re/) | 180 MHz clock bring-up (bspClockInit()); pin mapping not started |
| Kernel and RTOS API | Not started |
| Peripheral API | Not started |
| Application (app/) | main() is an empty loop |
| Tooling (build, lint, tests, docs, CI) | Done |
Hardware: the drivers, bspClockInit() and the fault handler pass the on-target smoke test (make smoke-flash) on a NUCLEO-F446RE, in debug and release builds. On the host, drivers and the BSP have 100% line and branch coverage. UART receive is not checked on the board, since it needs a sender, and main() is still an empty loop. See Host testing and its limits.
Known limitations:
| Tool | Needed for | Notes |
|---|---|---|
| Arm GNU Toolchain | building, make debug | CI uses 15.2.rel1 |
| GNU Make, a host cc | everything; make test, make coverage | |
| OpenOCD, nc | make flash, erase, debug | |
| clang-format 18 | make format-check | Other versions can format differently from CI; make warns, and finds Homebrew's keg-only llvm@18 by itself |
| cppcheck 2.13.0 | make lint | Other versions report different MISRA findings; scripts/install_cppcheck.sh builds 2.13.0 without sudo and make lint uses it automatically |
| Doxygen 1.18.0, Graphviz | make docs | Distribution packages are usually too old; without Graphviz the diagrams are silently dropped |
| gcovr 8.8 | make coverage | Needs Python 3.10 or newer |
| codespell 2.4.3 | make spell | CI runs it; pip install --require-hashes -r scripts/ci/requirements.txt installs CI's exact gcovr and codespell |
On macOS: brew install llvm@18 cppcheck doxygen graphviz gcovr.
References used throughout the code:
Read Contributing before changing code.
| Command | What it does |
|---|---|
| make / make all | Build the firmware (BUILD=release for -O2) and print its size |
| make size | Print flash and RAM use of the built ELF |
| make flash | Build if needed, program and verify over ST-LINK, then reset |
| make erase | Mass-erase the chip |
| make debug | Start OpenOCD, attach GDB, load the ELF and halt at reset |
| make smoke | Build the on-target smoke test, build/smoke.elf |
| make stack-usage | List each function's stack frame from the last build, deepest first |
| make smoke-flash | Flash the smoke test; it reports PASS/FAIL on the VCP (115200 8N1) |
| make test | Build and run the host unit tests, plus the vector-table and test-registration checks; SANITIZE=1 adds ASan and UBSan |
| make coverage | Run the tests instrumented; fail below 100% line or branch coverage of drivers/ and board/ |
| make lint | cppcheck with the MISRA C:2012 addon; fail on any finding |
| make all ANALYZE=1 | Also run GCC's static analyzer (-fanalyzer); fail on any finding |
| make spell | codespell over code, comments and docs (settings in .codespellrc) |
| make format | Apply .clang-format |
| make format-check | Fail if any file needs formatting |
| make docs | Generate docs/html/; fail on any Doxygen warning |
| make check-version | Fail if the Doxyfile and CHANGELOG versions disagree (TAG=vX.Y.Z also checks a tag) |
| make check-pr | Run CI's pull-request file checks against BASE (default origin/develop) |
| make hooks | Point git at the tracked pre-commit hook |
| make clean | Remove build/ and docs/html/ |
| make re | clean, then all |
MIT, see LICENSE.