STM32Bridge - STM32CubeMX to PlatformIO Migration Tool
A comprehensive CLI utility to automate the migration of STM32CubeMX projects to PlatformIO with full FreeRTOS support.
📦 Installation
From PyPI (Recommended)
pip install stm32bridge
Development Installation
git clone https://github.com/jobenas/stm32bridge.git
cd stm32bridge
pip install -e .
# For testing and development
pip install -r requirements-dev.txt
# Or install specific dependency groups
pip install -e .[test] # Testing dependencies
pip install -e .[dev] # Development tools
pip install -e .[pdf] # PDF processing (optional)
pip install -e .[build] # Build tools
From Local Wheel
# Build and install from source
git clone https://github.com/jobenas/stm32bridge.git
cd stm32bridge
pip install build
python -m build
pip install dist/stm32bridge-1.0.0-py3-none-any.whl
Prerequisites
- Python 3.8 or higher
- PlatformIO Core (automatically checked and installed if needed)
- Git (for some FreeRTOS library dependencies)
🚀 Features
- Complete Project Migration: Analyzes STM32CubeMX projects and creates fully configured PlatformIO projects
- FreeRTOS Support: Automatic FreeRTOS library integration with CMSIS-OS v2 compatibility
- Build Verification: Integrated build testing with automatic dependency resolution
- Editor Integration: Open migrated projects directly in your favorite code editor
- Board Detection: Automatic MCU and board detection with extensive board mapping
- Flexible Configuration: Support for custom boards, FreeRTOS configurations, and build options
📁 Project Structure
stm32bridge/
├── main.py # CLI entry point
├── stm32bridge/
│ ├── __init__.py # Package initialization
│ ├── constants.py # MCU families and board mappings
│ ├── exceptions.py # Custom exceptions
│ ├── core/ # Core migration logic
│ │ ├── analyzer.py # STM32CubeMX project analysis
│ │ ├── generator.py # PlatformIO project generation
│ │ └── migrator.py # File migration and adaptation
│ ├── utils/ # Utility modules
│ │ ├── build.py # Build verification and dependency management
│ │ ├── editor.py # Code editor integration
│ │ ├── platformio.py # PlatformIO command execution
│ │ └── boards.py # Board detection utilities
│ └── cli/ # CLI command implementations
│ ├── migrate.py # Migration command
│ ├── analyze.py # Analysis command
│ └── list_boards.py # Board listing command
└── stm32bridge.py # Legacy monolithic version (for reference)
🛠️ Installation
Prerequisites
- Python 3.8+
- PlatformIO Core (installed via pip or standalone)
Install STM32Bridge
# Clone the repository
git clone <repository-url>
cd stm32bridge
# Install in development mode
pip install -e .
# For development with all dependencies
pip install -r requirements-dev.txt
# Or install specific dependency groups
pip install -e .[test] # Testing dependencies
pip install -e .[dev] # Development tools
pip install -e .[pdf] # PDF processing (optional)
📖 Usage
Basic Migration
# Migrate a project with automatic board detection
stm32bridge migrate my_stm32_project my_platformio_project
# Specify a specific board
stm32bridge migrate my_stm32_project my_platformio_project --board nucleo_l432kc
# Windows example
stm32bridge migrate C:\Projects\MySTM32Project C:\Projects\MyPlatformIOProject --board nucleo_f401re
# Linux/Mac example
stm32bridge migrate ~/projects/my_stm32_project ~/projects/my_platformio_project --board disco_f407vg
Advanced Options
# Migrate with build verification
stm32bridge migrate my_stm32_project my_platformio_project --board nucleo_l432kc --build
# Migrate and open in VS Code
stm32bridge migrate my_stm32_project my_platformio_project --board nucleo_l432kc --open
# Use different editor
stm32bridge migrate my_stm32_project my_platformio_project --board nucleo_l432kc --open --editor code
# Force overwrite existing directory
stm32bridge migrate my_stm32_project my_platformio_project --force
FreeRTOS Options
# Use framework FreeRTOS instead of external library
stm32bridge migrate my_stm32_project my_platformio_project --no-freertos
# Completely disable FreeRTOS migration
stm32bridge migrate my_stm32_project my_platformio_project --disable-freertos
# Use PlatformIO framework's built-in FreeRTOS
stm32bridge migrate my_stm32_project my_platformio_project --framework-freertos
Analysis and Information
# Analyze project without migration
stm32bridge analyze my_stm32_project
# List supported boards
stm32bridge list-boards
# Get help
stm32bridge --help
stm32bridge migrate --help
🔧 Supported Features
MCU Families
- STM32F0, F1, F2, F3, F4, F7
- STM32G0, G4
- STM32H7
- STM32L0, L1, L4, L5
- STM32U5
- STM32WB
FreeRTOS Integration
- Automatic FreeRTOS library detection and integration
- CMSIS-OS v2 compatibility layer
- Custom FreeRTOS configuration preservation
- Support for timers, event groups, and other FreeRTOS features
Build System
- Complete PlatformIO configuration generation
- Automatic dependency resolution
- Build verification with memory usage reporting
- Support for custom build flags and configurations
Development Tools
- VS Code, VSCodium, Sublime Text, Atom, Vim support
- STLink upload and debug configuration
- Serial monitor setup
- Custom board definitions
🎯 Example Workflow
- Generate STM32CubeMX Project: Create your project with Makefile toolchain
- Analyze:
python main.py analyze /path/to/projectto verify compatibility - Migrate:
python main.py migrate /path/to/project /path/to/output --board nucleo_l432kc --build --open - Develop: Your PlatformIO project is ready with full build and debug support!
🐛 Troubleshooting
Common Issues
- Build Failures: Use
--buildflag to get detailed error analysis and automatic fixes - Missing Dependencies: Tool automatically installs required Python packages (GitPython, etc.)
- FreeRTOS Issues: Try
--no-freertosor--framework-freertosflags - Board Detection: Use
python main.py list-boardsto find the correct board name
Debug Options
- Use
python main.py analyzeto validate project structure - Check PlatformIO installation:
pio --version - Verify board support:
pio boards | grep <your-mcu>
🤝 Contributing
The codebase is now well-organized and modular:
- Core Logic: Add new features in
stm32bridge/core/ - Utilities: Add helper functions in
stm32bridge/utils/ - CLI Commands: Add new commands in
stm32bridge/cli/ - Configuration: Update constants in
stm32bridge/constants.py
📄 License
MIT License - see LICENSE file for details.
🙏 Acknowledgments
- PlatformIO team for the excellent embedded development platform
- STMicroelectronics for STM32CubeMX
- FreeRTOS community for real-time OS support
Metadata
Release files for stm32bridge 1.3.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| stm32bridge-1.3.3.tar.gz | 42.6 kB | Without provenance | Details for stm32bridge-1.3.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| stm32bridge-1.3.3-py3-none-any.whl | Python 3 | none | any | Details for stm32bridge-1.3.3-py3-none-any.whl |
Total release size: 88.2 kB
Release files / stm32bridge-1.3.3.tar.gz
| Download URL | stm32bridge-1.3.3.tar.gz |
|---|---|
| Size | 42.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e02b357a87656e530af4bcb95425addb3f2a2307e0a38d5ae2071b9bc81e72c4
|
|
BLAKE2b-256 checksum How to use checksums |
dff979c7fc9b153b3c20d4fabf3bcc096a700b82f61fca17f612f8f1ac8b5203
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.11
|
Release files / stm32bridge-1.3.3-py3-none-any.whl
| Download URL | stm32bridge-1.3.3-py3-none-any.whl |
|---|---|
| Size | 45.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
98c23b5c87cdcc0f21f9b5e605e826c604aa431177a0194e9d11a05499b6b85f
|
|
BLAKE2b-256 checksum How to use checksums |
a8b6f3a2b76e51a375750a89b7bb510a828b1c498b635a926316ca90ec68b19f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.11
|
Security for stm32bridge 1.3.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.