PyMakeX
A Python-powered build system for MCU firmware development, built on top of SCons. Compile C/C++ source code for arm riscv, and other common microcontrollers with ease.
Features
- Multi-Toolchain Support — Use armgcc, LLVM/Clang, or armclang to compile your firmware.
- Modular Third-Party Integration — Pre-built modules for FreeRTOS, LVGL, FatFS, EasyLogger, CherryUSB, FreeModbus, and more.
- Incremental Builds — Analyzes which files need rebuilding and compiles only what changed.
- Multi-Processing Build — Parallel compilation with configurable job count (
-j). - Ninja Backend — Optional Ninja build mode for faster builds (
-nor--ninja). - Compilation Database — Generate
compile_commands.jsonfor IDE support and static analysis (--compiledb). - Build Cache — Cache compiled objects to speed up rebuilds (
--cache). - Dry-Run Mode — Preview what would be built without actually compiling (
--dry-run). - Party System — Organize third-party library flags and configurations in reusable "party" modules.
Installation
pip install pymakex
For development dependencies:
pip install pymakex[dev]
Quick Start
- Create a
Makefile.pyin your project root:
import pymakex
# Define your toolchain
pymakex.Toolchain("armgcc")
# Add your source files
pymakex.Sources([
"src/main.c",
"src/gpio.c",
"src/uart.c",
])
# Include third-party libraries via parties
pymakex.Party("FreeRTOS")
pymakex.Party("LVGL")
pymakex.Party("FatFS")
# Build the firmware
pymakex.Program("firmware.elf")
- Run the build:
pymakex -f Makefile.py
CLI Usage
pymakex [options]
Options:
-f, --file FILE Build script to execute (default: Makefile.py)
-j, --jobs N Number of parallel jobs (default: 1)
-m, --mode MODE Build mode: ninja | build | compiledb | cache | dryrun
-n, --ninja [update] Use Ninja build backend
-c, --clean Clean all build artifacts
--compiledb Generate compile_commands.json
--cache [update] Enable build cache
--dry-run Preview build without executing
-s, --silent Suppress non-error output
--verbose Show detailed build information
-l, --logger LEVEL Log level: 0=quiet, 1=verbose, 2=debug
-t, --toml PATH Specify TOML configuration file
-p, --party PATH Specify party file path
-v, --version Show version
Aliases
The following commands are equivalent:
pymake -f Makefile.py
pymakex -f Makefile.py
pymkx -f Makefile.py
Supported Toolchains
| Toolchain | Description |
|---|---|
armgcc |
ARM GNU GCC Toolchain |
llvm_clang |
LLVM/Clang for ARM |
armclang |
ARM Compiler 6 (armclang) |
Supported Third-Party Libraries (Parties)
| Module | Description |
|---|---|
FreeRTOS |
Real-time operating system |
LVGL |
Lightweight graphics library |
FatFS |
FAT/exFAT file system |
EasyLogger |
Embedded logging library |
CherryUSB |
USB device/host stack |
FreeModbus |
Modbus protocol stack |
FreeLWIP |
Lightweight TCP/IP stack |
HALDrivers |
MCU HAL drivers |
STDDrivers |
Standard peripheral drivers |
Build Workflow
- PyMakeX runs your
Makefile.pyscript in a subprocess. - The script defines parties, sources, targets, and build commands.
- Output marked with
##PYMAKE##is captured to build the task graph. - The task graph is analyzed to determine which files need rebuilding.
- Builds are executed in parallel (when
-j > 1).
License
MIT License — see the LICENSE file for details.
Metadata
Release files for PyMakeX 0.5.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pymakex-0.5.2-py3-none-any.whl | Python 3 | none | any | Details |
Release files / pymakex-0.5.2-py3-none-any.whl
| Download URL | pymakex-0.5.2-py3-none-any.whl |
|---|---|
| Size | 182.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d16174667348b38b1be986bb1d49d812425502fa596d7502b696ba862802b750
|
|
BLAKE2b-256 checksum How to use checksums |
1b3cda0cf41c66c20a68b3f7974a7045c75cdf828b3abc5055725fda22068f88
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.6
|