License and README completion

This commit is contained in:
2025-11-12 18:41:01 +00:00
parent 944643f6bd
commit d63867ea0b
2 changed files with 55 additions and 8 deletions

View File

@@ -1,12 +1,32 @@
# MX Converter
# MX Convert
MX Converter is a tool to convert Cube MX generated projects to the ISTSAT-2 repository structure.
MX Convert is a tool to convert Cube MX generated projects to the ISTSAT-2 repository structure.
## Notice
This guide and the MX Converter were built with the goal of cleanly separating STM generated code from application code. As such, files produced by Cube MX are treated as disposable, and any code in said files is likely to be lost. This applies to C files, header files, CMakeLists and possibly more. Do not include any code of your own in the MX files.
This guide and the MX Convert were built with the goal of cleanly separating STM generated code from application code. As such, files produced by Cube MX are treated as disposable, and any code in said files is likely to be lost. This applies to C files, header files, CMakeLists and possibly more. Do not include any code of your own in the MX files.
When adapting existing code for use with MX Converter, make sure to back up the original code and to double check all code is present in the final version of your project.
When adapting existing code for use with MX Convert, make sure to back up the original code and to double check all code is present in the final version of your project.
## Installation
MX Convert can be installed via pipx or pip. The pipx method is recommended as it will not mess with your system packages.
### pipx method
First ensure you have pipx installed and the PATH variable set adequately:
- On Ubuntu/Debian based distros use `sudo apt install pipx && pipx ensurepath`
- On Arch Linux use `sudo pacman -S python-pipx && pipx ensurepath`
- On Fedora/Red hat based distros use `sudo dnf install pipx && pipx ensurepath`
Then installation is as simple as running `pipx install git+https://git.didas72.com/didas/mx-convert.git`.
You can later update MX Convert with `pipx update mx-convert`.
### pip method
To install with pip you can simply run `pip install git+https://git.didas72.com/didas/mx-convert.git`.
And to update use `pip install --upgrade git+https://git.didas72.com/didas/mx-convert.git`.
## Cube MX Configuration
@@ -24,17 +44,23 @@ Code Generator > Backup previously generated files when re-generating | UNSET
Code Generator > Keep User Code when re-generating | UNSET
Code Generator > Delete previously generated files when not re-generated | SET
## Project Creation
## Usage
### Project Creation
The project creation process differs somewhat from creating a standard MX project.
1. Start with the creation of a project folder, from now on called ROOT. This will NOT be the destination of the code generation nor the `.ioc` file.
1. Open the CubeMX program, select the board or MCU, setup the hardware as needed and configure the project as described before. Save the project, navigating to the ROOT folder, and name the project 'CubeMX'. This will create a new directory where generated code and the ioc will reside.
1. Open the Cube MX program, select the board or MCU, setup the hardware as needed and configure the project as described before. Save the project, navigating to the ROOT folder, and name the project 'cubemx'. This will create a new directory where generated code and the ioc will reside.
1. Follow the Code generation / IOC Update guide.
## Code generation / IOC Update
### Code generation / IOC Update
After project creation of after modifying the IOC, code generation needs to be invoked. Assuming Cube MX is open with the relevant IOC:
1. Save the project and press 'Generate Code'. Any existing code will be **deleted**, and the new code will be placed in the previously created CubeMX folder.
1. TODO: Define how to use the CMakeLists generator
1. In a terminal, navigate to the ROOT folder and run `mx-convert cubemx`. This will ask for confirmation to delete files and generate the CMakeLists.txt files.
### The remaining work
After code generation and convertion, a more manual part of project setup remains. MX Convert only prepares code for integration with CMake projects, the base CMake should be built around the cubemx folder, and it's setup is outside the scope of this tool and guide.