Back to Registry
View Author Profile
Official Verified
stm32-cubemx
STM32CubeMX CLI operations for configuring pins, peripherals, DMA, interrupts, and generating code. Use cases: (1) Add/modify STM32 peripheral configuration (2) Configure USART/SPI/I2C/ADC/TIM peripherals (3) Set up DMA and interrupts (4) Generate CMake/GCC project code. Default target MCU: STM32F103C8Tx.
skill-install — Terminal
Install via CLI (Recommended)
clawhub install openclaw/skills/skills/aidankong/stm32-cubemxOr
STM32CubeMX CLI Operations
Environment Setup
# STM32CubeMX path (modify based on your installation)
CUBEMX=/path/to/STM32CubeMX/STM32CubeMX
# Project path (adjust for your project)
PROJECT_DIR=/path/to/your/project
IOC_FILE=$PROJECT_DIR/your_project.ioc
SCRIPT_FILE=$PROJECT_DIR/cube_headless.txt
Core Workflow
1. Modify IOC config file → 2. Run CLI to generate code → 3. CMake build verification
Step 1: Modify IOC File
Edit the .ioc file to add/modify peripheral configuration.
Key Configuration Sections:
Mcu.IP0=XXX- Peripheral IP list,Mcu.IPNbis the countMcu.Pin0=PAx- Pin list,Mcu.PinsNbis the countXXX.Signal=YYY- Pin signal mappingProjectManager.functionlistsort- Initialization function list
Step 2: Generate Code
# Headless mode (recommended)
$CUBEMX -q $SCRIPT_FILE
# Script file content
cat > $SCRIPT_FILE << 'EOF'
config load /path/to/your/project/your_project.ioc
project generate
exit
EOF
Step 3: Build Verification
cd $PROJECT_DIR
rm -rf build/Debug
cmake --preset Debug
cmake --build build/Debug
CLI Command Reference
| Command | Purpose | Example |
|---|---|---|
config load <path> | Load IOC configuration | config load /path/to/project.ioc |
config save <path> | Save IOC configuration | config save /path/to/project.ioc |
project generate | Generate complete project | project generate |
project toolchain <name> | Set toolchain | project toolchain CMake |
project path <path> | Set project path | project path /path/to/project |
project name <name> | Set project name | project name MyProject |
load <mcu> | Load MCU | load STM32F103C8Tx |
setDriver <IP> <HAL|LL> | Set driver type | setDriver ADC LL |
exit | Exit program | exit |
Common Peripheral Configuration Templates
USART + DMA
See references/USART_DMA.md for detailed configuration
# Add IP
Mcu.IP6=USART2
Mcu.IPNb=7
# Pin configuration
PA2.Signal=USART2_TX
PA3.Signal=USART2_RX
# USART2 parameters
USART2.BaudRate=115200
USART2.Dmaenabledrx=1
USART2.Dmaenabledtx=1
# DMA configuration
Dma.Request0=USART2_RX
Dma.Request1=USART2_TX
Dma.USART2_RX.0.Instance=DMA1_Channel6
Dma.USART2_TX.1.Instance=DMA1_Channel7
# Interrupts
NVIC.USART2_IRQn=true\:0\:0\:false\:false\:true\:true\:true\:true
ADC Acquisition
# Add ADC1
Mcu.IP0=ADC1
# ADC configuration
ADC1.Channel-1\#ChannelRegularConversion=ADC_CHANNEL_5
ADC1.Rank-1\#ChannelRegularConversion=1
ADC1.SamplingTime-1\#ChannelRegularConversion=ADC_SAMPLETIME_1CYCLE_5
ADC1.NbrOfConversionFlag=1
ADC1.master=1
# Pin
PA5.Signal=ADCx_IN5
SH.ADCx_IN5.0=ADC1_IN5,IN5
TIM PWM
# TIM3 configuration
TIM3.Channel-PWM\ Generation1\ CH1=PWM_CHANNEL1
TIM3.Channel-PWM\ Generation2\ CH2=PWM_CHANNEL2
TIM3.IPParametersWithoutCheck=Prescaler,Period
# Pins
PA6.Signal=TIM3_CH1
PA7.Signal=TIM3_CH2
Metadata
AI Skill Finder
Not sure this is the right skill?
Describe what you want to build — we'll match you to the best skill from 16,000+ options.
Find the right skill Add to Configuration
Paste this into your clawhub.json to enable this plugin.
{
"plugins": {
"official-aidankong-stm32-cubemx": {
"enabled": true,
"auto_update": true
}
}
}Safety NoteClawKit audits metadata but not runtime behavior. Use with caution.