A GUI tool to convert Keil MDK projects (.uvprojx) to CMake projects, enabling development with modern toolchains and IDEs.
- Automatic Project Parsing: Parse Keil
.uvprojxfiles and extract source files, include paths, defines, and memory configuration - Scatter File Conversion: Convert Keil scatter files (
.sct) to GNU linker scripts (.ld)- Built-in rule-based converter for common patterns
- AI-powered conversion using OpenAI or Anthropic APIs for complex scatter files
- Multiple Toolchain Support:
- GCC ARM (
arm-none-eabi-gcc) - ST ARM Clang toolchain
- Generate both toolchains simultaneously
- GCC ARM (
- Flexible Output Modes:
- In-place: Generate CMake files alongside the existing Keil project (shares source files)
- Standalone: Copy all sources to a new directory, creating an independent CMake project
┌──────────────────────────────────────────────────────────────┐
│ MDK2CMake Converter │
├──────────────────────────────────────────────────────────────┤
│ Keil Project File (.uvprojx): [________________] [Browse] │
│ Output Directory: [________________] [Browse] │
│ │
│ ┌─ Project Settings ─────────────────────────────────────┐ │
│ │ Target: [Target_1 ▼] │ │
│ │ SCT File: [stm32f103.sct ▼] │ │
│ │ Toolchain: ○ GCC ○ ST ARM Clang ● Both │ │
│ └────────────────────────────────────────────────────────┘ │
│ │
│ ┌─ Output Options ───────────────────────────────────────┐ │
│ │ Output Mode: ● In-place ○ Standalone │ │
│ │ Startup File (.s): [________________] [Browse] │ │
│ └────────────────────────────────────────────────────────┘ │
│ │
│ ┌─ SCT Conversion ───────────────────────────────────────┐ │
│ │ Method: ● Built-in Rules ○ AI API │ │
│ └────────────────────────────────────────────────────────┘ │
│ │
│ [Convert] [Clear Log] [Exit] │
└──────────────────────────────────────────────────────────────┘
- Python 3.10+
- Jinja2
- httpx (for AI-powered SCT conversion)
- Clone the repository:
git clone https://github.com/yourusername/mdk2cmake.git
cd mdk2cmake- Create a virtual environment and install dependencies:
# Using uv (recommended)
uv venv
.venv\Scripts\activate # Windows
source .venv/bin/activate # Linux/macOS
uv pip install jinja2 httpx
# Or using pip
python -m venv .venv
.venv\Scripts\activate # Windows
source .venv/bin/activate # Linux/macOS
pip install jinja2 httpxpython run.py
# or
python -m src.main- Click Browse to select your Keil project file (
.uvprojx) - Select the output directory
- Choose the target configuration and SCT file
- Select the toolchain(s) you want to generate
- Choose output mode (In-place or Standalone)
- Provide a GNU-format startup file (
.s) - this must be obtained separately as Keil uses a different assembly syntax - Click Convert
| Item | Description |
|---|---|
.uvprojx file |
Your Keil MDK project file |
Startup file (.s) |
GNU assembler format startup file for your MCU (Keil's startup files use ARM assembler syntax and are not compatible) |
output_dir/
├── CMakeLists.txt # Main CMake configuration
├── CMakePresets.json # CMake presets for easy building
├── cmake/
│ ├── gcc-arm-none-eabi.cmake # GCC toolchain file
│ └── starm-clang.cmake # ST ARM Clang toolchain file
├── ld/
│ └── linker.ld # Generated GNU linker script
└── startup/
└── startup.s # Your provided startup file
cd output_dir
# Configure with GCC toolchain
cmake --preset gcc-debug
# or
cmake --preset gcc-release
# Configure with ST ARM Clang toolchain
cmake --preset clang-debug
# or
cmake --preset clang-release
# Build
cmake --build build/gcc-debugThe built-in converter handles common scatter file patterns:
- Single load region with FLASH and RAM execution regions
- Standard memory sections (
.text,.data,.bss, etc.)
For complex scatter files, you can use AI APIs:
- Select AI API in the SCT Conversion section
- Choose your API provider (OpenAI or Anthropic)
- Enter your API key
- The converter will use the AI to generate an appropriate linker script
src/
├── main.py # Application entry point
├── config.py # Configuration constants
├── models.py # Data models (KeilProject, KeilTarget, etc.)
├── gui/
│ └── main_window.py # Tkinter GUI
├── parsers/
│ ├── uvprojx_parser.py # Parse .uvprojx XML files
│ └── sct_parser.py # Parse .sct scatter files
├── converters/
│ ├── sct_to_ld.py # Rule-based SCT to LD conversion
│ └── sct_to_ld_ai.py # AI-powered SCT to LD conversion
├── generators/
│ ├── cmake_generator.py # Generate CMake project files
│ └── templates/ # Jinja2 templates
│ ├── CMakeLists.txt.j2
│ ├── CMakePresets.json.j2
│ ├── gcc-arm-none-eabi.cmake.j2
│ └── starm-clang.cmake.j2
└── utils/
├── logger.py # Logging configuration
└── path_utils.py # Path utilities
- Startup Files: Keil uses ARM assembler syntax which differs from GNU assembler. You need to provide a compatible GNU-format startup file
- Complex Scatter Files: Some advanced scatter file features may not be fully supported by the built-in converter. Use AI conversion for complex cases
- Compiler-Specific Code: Code using ARM Compiler-specific extensions may need modification to work with GCC/Clang
Contributions are welcome! Please feel free to submit a Pull Request.
MIT License - See LICENSE for details.
- Keil MDK for the
.uvprojxproject format - CMake community for the cross-platform build system
- GNU ARM Embedded Toolchain