A Python package for parsing IOC files and generating C++ code.
Project description
libxr is a Python package designed to automate embedded system development by parsing .ioc files and generating C++
code. It significantly reduces manual effort in STM32CubeMX-based projects.
🌟 Features
- Automatic
.iocparsing: Extracts GPIO, peripherals (UART, SPI, I2C, etc.), and DMA configurations. - C++ code generation: Generates fully functional STM32-compatible code.
- STM32CubeMX & FreeRTOS support: Works seamlessly with STM32 and CMake build systems.
- Automated Git management: Initializes repositories and creates
.gitignorefiles. - CMake automation: Generates
CMakeLists.txtfor STM32 projects.
📥 Installation
Install via pip
pip install libxr
Install from source
git clone https://github.com/Jiu-xiao/LibXR_CppCodeGenerator.git
cd LibXR_CppCodeGenerator
pip install -e .
📌 API Reference
This command automates STM32CubeMX project setup, including:
- Parsing
.iocfiles and generating JSON configuration. - Generating C++ code.
- Modifying STM32 interrupt handlers.
- Creating
CMakeLists.txtwith Clang support (if enabled). - Initializing Git and setting up
.gitignore. - Adding the
LibXRsubmodule if missing.
Usage:
libxr_config_stm32_project [-h] -d DIRECTORY [-t TERMINAL] [-c]
Required arguments:
-d, --directory(str): Path to the STM32CubeMX project.
Optional arguments:
-t, --terminal(str): Specifies the terminal device source.-c, --clang: Enables Clang support for compilation.
libxr_parse_ioc
Parses the .ioc file in the specified directory and extracts peripheral configurations into a JSON file.
Usage:
libxr_parse_ioc [-h] -d DIRECTORY [-o OUTPUT]
Required arguments:
-d, --directory(str): Path to the STM32CubeMX project directory.
libxr_generate_code
Generates C++ code from the parsed .ioc JSON configuration and saves an additional JSON file for further
modifications.
Usage:
libxr_generate_code [-h] -i INPUT [-o OUTPUT]
Required arguments:
-i, --input(str): Path to the JSON file generated bylibxr_parse_ioc.
Outputs:
app_main.cpp: Generated STM32 C++ source file.libxr_config.json: Stores configuration options such as DMA buffer sizes, terminal settings, and peripheral mappings.
libxr_generate_stm32_it
Modifies STM32 _it.c interrupt handler files to include necessary callback functions.
Usage:
libxr_generate_stm32_it [-h] input_dir
Required arguments:
input_dir(str): Path to the STM32CubeMX project source directory.
libxr_generate_stm32_cmake_clang
Generates gcc-arm-none-eabi.cmake for STM32 projects using Clang.
Usage:
libxr_generate_stm32_cmake_clang [-h] input_dir
Required arguments:
input_dir(str): Path to the STM32CubeMX project.
libxr_generate_stm32_cmake
Generates LibXR.CMake for STM32 projects using LibXR.
Usage:
libxr_generate_stm32_cmake [-h] input_dir
Required arguments:
input_dir(str): Path to the STM32CubeMX project.
.IOC file requirements
- STM32CubeMX: The
.iocfile must be generated using STM32CubeMX. - CMake: The project must be built using CMake.
- DMA: UART, SPI and I2C must have DMA enabled.
🛠️ Contributing
We welcome community contributions! See our contribution guidelines for details.
Ways to contribute:
- 📝 Submit pull requests for new features or bug fixes.
- 🔍 Review pull requests from other contributors.
- 🐛 Report issues and suggest improvements.
- 📖 Write documentation and tutorials.
- 🎨 Design graphics for branding and promotions.
For detailed guidelines, visit our contributing page.
📄 License
libxr is licensed under the Apache-2.0 license. See the LICENSE file for more details.
🔗 Resources
- Project Homepage: GitHub
- Documentation: Online Docs
- Issue Tracker: Report Issues
- Source Code: GitHub Repository
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file libxr-0.1.2.tar.gz.
File metadata
- Download URL: libxr-0.1.2.tar.gz
- Upload date:
- Size: 22.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ada8b7e119d1e098f90b95c1df9f0bf69d419ced0dae9a77688739760f9b5053
|
|
| MD5 |
c941d974083a113493ff352629f4c912
|
|
| BLAKE2b-256 |
90fed8dafedade449cf38f59e862d6c8ec5eb57e5b331bc76785c1915913df4a
|
Provenance
The following attestation bundles were made for libxr-0.1.2.tar.gz:
Publisher:
python-publish.yml on Jiu-xiao/LibXR_CppCodeGenerator
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
libxr-0.1.2.tar.gz -
Subject digest:
ada8b7e119d1e098f90b95c1df9f0bf69d419ced0dae9a77688739760f9b5053 - Sigstore transparency entry: 182942101
- Sigstore integration time:
-
Permalink:
Jiu-xiao/LibXR_CppCodeGenerator@7b94e7ee5aea9c0d8264ed029a4d886c322b69f2 -
Branch / Tag:
refs/tags/V0.1.2 - Owner: https://github.com/Jiu-xiao
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@7b94e7ee5aea9c0d8264ed029a4d886c322b69f2 -
Trigger Event:
release
-
Statement type:
File details
Details for the file libxr-0.1.2-py3-none-any.whl.
File metadata
- Download URL: libxr-0.1.2-py3-none-any.whl
- Upload date:
- Size: 23.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1d8100adb7612ff0fe201c67bc2f35981ff2c02d80286ac6eef06a212bff74f2
|
|
| MD5 |
23ccc691ff72190f750e20f56f74dd04
|
|
| BLAKE2b-256 |
f3d55d5eafafc7b496e4fe717a4db12cb33cd5f3e3474f14aba205f30262797d
|
Provenance
The following attestation bundles were made for libxr-0.1.2-py3-none-any.whl:
Publisher:
python-publish.yml on Jiu-xiao/LibXR_CppCodeGenerator
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
libxr-0.1.2-py3-none-any.whl -
Subject digest:
1d8100adb7612ff0fe201c67bc2f35981ff2c02d80286ac6eef06a212bff74f2 - Sigstore transparency entry: 182942109
- Sigstore integration time:
-
Permalink:
Jiu-xiao/LibXR_CppCodeGenerator@7b94e7ee5aea9c0d8264ed029a4d886c322b69f2 -
Branch / Tag:
refs/tags/V0.1.2 - Owner: https://github.com/Jiu-xiao
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@7b94e7ee5aea9c0d8264ed029a4d886c322b69f2 -
Trigger Event:
release
-
Statement type: