This commit is contained in:
2025-11-12 18:16:44 +00:00
commit 944643f6bd
4 changed files with 240 additions and 0 deletions

40
README.md Normal file
View File

@@ -0,0 +1,40 @@
# MX Converter
MX Converter 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.
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.
## Cube MX Configuration
For simplicity of development of this tool and for uniformity across different firmware projects, the same configuration should be used when creating the projects with Cube MX.
All the relevant settings are under the 'Project Manager' tab and should be set as listed below. Any unspecified settings can be set to whatever is most convinient.
Setting | Value
-- | --
Project > Do not generate the main() | SET
Project > Toolchain / IDE | 'CMake'
Code Generator > STM32Cube MCU packages and embedded software packages | 'Copy only necessary library files'
Code Generator > Generate peripheral initialization as a pair of '.c/.h' files per peripheral | UNSET
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
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. Follow the Code generation / IOC Update guide.
## 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