A professional, modular, and power-optimized startup template for the STM32F746ZG (Cortex-M7) microcontroller. This project implements a robust system lifecycle management, deterministic FSM architecture, and dual-mode execution (RTOS and Bare-Metal).
- Centralized Lifecycle: State-machine driven transitions (Init, Running, Sleep, Fault).
- Dual Mode Support: Seamlessly switch between CMSIS-RTOS V2 (FreeRTOS) and Bare-Metal deployments.
- Power Optimization: Integrated FreeRTOS Tickless Idle and manual STOP mode management.
- Hardware Abstraction: Clean separation between BSP, Drivers, and Application layers.
- Professional Documentation: Minimalist Doxygen standard applied across the entire codebase.
The NUCLEO-F746ZG board features an ARM® Cortex®-M7 core with 1MB Flash and 320KB RAM.
- Connectivity: Integrated Ethernet, USB OTG, and ST-LINK/V2-1 debugger.
- User Interface: 3 User LEDs (Green, Blue, Red) and 1 User Button.
- Power: Flexible options via USB VBUS (5V), E5V, or VIN (7V-12V).
- CMake: Download and add to system PATH.
- Python: Required for toolchain and third-party scripts.
- Serial Terminal: (e.g., PuTTY, TeraTerm) configured for 115200 baud, 8N1.
Install ARM GCC, Ninja, and OpenOCD into the toolchain/ folder:
python scripts/setup_toolchain.pyInstall required third-party libraries (FreeRTOS, CMSIS, HAL) into the third_party/ folder:
python scripts/setup_third_party.pyUse the provided scripts for multi-mode compilation. These scripts automatically handle local paths and environment variables.
# Bare-Metal Development (Debug)
.\scripts\build.bat --development --bare-metal --debug
# RTOS Production (Release)
.\scripts\build.bat --production --rtos --release# Bare-Metal Development (Debug)
./scripts/build.sh --development --bare-metal --debug
# RTOS Production (Release)
./scripts/build.sh --production --rtos --release- Connect the board via the CN1 (ST-LINK) Micro-USB port.
- Run the flash script from the project root:
Or for Linux/macOS:
./scripts/flash.bat
./scripts/flash.sh
The project includes pre-configured .vscode settings for seamless hardware debugging.
- Recommended Extension: Install Cortex-Debug (marus25).
- Launch: Press F5 and select your configuration (
RTOSorBare-metal). VS Code will build, flash, and halt atmain()automatically.
src/system: Core OS services, state machine, and lifecycle management.src/api: OS-agnostic hardware abstraction layer.src/bsp: Board-specific support (GPIO, UART, ADC, ISR dispatching).src/driver: Peripheral-specific logic (e.g., Ambient light/LED drivers).src/app: High-level application tasks and logic.src/target: Hardware configuration (Linker scripts, Startup files, HAL configuration).src/util: Utility functions and helpers (Reserved for future use; currently empty).
All public APIs use the Doxygen standard in header files. Source files maintain a minimalist approach by documenting only internal entities and keeping function bodies comment-free for maximum readability.
Created by Yasin GOZUBUYUK
