Summer Internship 2025 at IIT
Jodhpur
-Under Prof. Nitin Bhatia
Report: Languages Used for STM32
Microcontroller Development
Submitted by
-Aryan Soni
-Aditya Narayan
Tiwari
The STM32 family of microcontrollers, developed by
STMicroelectronics, is based on the ARM Cortex-M cores and
widely used in embedded systems, IoT, robotics, automotive,
and industrial applications. Development on STM32 MCUs
typically involves low-level hardware control, real-time
performance considerations, and integration with peripheral
1. C
Supported IDEs:
STM32CubeIDE
Keil MDK
IAR Embedded Workbench
PlatformIO (with VS Code)
System Workbench for STM32 (SW4STM32)
Setup Method:
STM32CubeIDE:
Download and install from STMicroelectronics website (free, requires account).
Create a new project, select STM32 MCU/board, configure peripherals in STM32CubeMX.
Write C code using STM32CubeHAL or CMSIS, compile, and flash via ST-LINK.
Keil MDK:
Install Keil MDK (free for STM32F0/G0/L0 up to 32 KB).
Create a project, select STM32 MCU, add STM32CubeHAL or CMSIS libraries.
Write C code, compile, and flash using ST-LINK or ULINK debugger.
IAR Embedded Workbench:
Install IAR (free version limited to 32 KB for some STM32 series).
Create a project, select STM32 MCU, import STM32CubeHAL libraries.
Write C code, build, and flash via ST-LINK or I-Jet debugger.
PlatformIO:
Install PlatformIO extension in VS Code, add STM32 board support.
Create a project with platform = ststm32, write C code with STM32CubeHAL.
Build and upload using ST-LINK.
SW4STM32:
Install System Workbench (free, Eclipse-based).
Create a project, select STM32 MCU, import STM32CubeHAL libraries.
Write C code, compile, and flash via ST-LINK.
2. C++
Supported IDEs:
STM32CubeIDE
Keil MDK
IAR Embedded Workbench
PlatformIO (with VS Code)
SW4STM32
Setup Method:
STM32CubeIDE:
Same as C, but enable C++ in project settings (add .cpp files, configure linker for
C++).
Write C++ code (e.g., classes for peripherals), compile, and flash via ST-LINK.
Keil MDK:
Create a C++ project, select STM32 MCU, include STM32CubeHAL libraries.
Write C++ code, ensure C++ runtime support, compile, and flash via ST-LINK.
IAR Embedded Workbench:
Create a C++ project, select STM32 MCU, import STM32CubeHAL.
Write C++ code, configure for C++ standard library, build, and flash via ST-LINK.
PlatformIO:
Same as C, but add build_flags = -lstdc++ in platformio.ini for C++ support.
Write C++ code, build, and upload via ST-LINK.
SW4STM32:
Create a C++ project, select STM32 MCU, include STM32CubeHAL.
Write C++ code, configure toolchain for C++, compile, and flash via ST-LINK
3. Assembly
Supported IDEs:
STM32CubeIDE
Keil MDK
IAR Embedded Workbench
PlatformIO (with VS Code)
Setup Method:
STM32CubeIDE:
Create a C project, add .s files for ARM Thumb/Thumb-2 assembly.
Write assembly code (e.g., for interrupt handlers), compile with GNU ARM
assembler.
Flash via ST-LINK.
Keil MDK:
Create a project, select STM32 MCU, add .s files for assembly.
Write ARM assembly code, compile, and flash via ST-LINK or ULINK.
IAR Embedded Workbench:
Create a project, select STM32 MCU, add .s files.
Write ARM assembly, build, and flash via ST-LINK or I-Jet
PlatformIO:
Create an STM32 project, add .s files for assembly.
Write ARM Thumb assembly, build with GNU ARM toolchain, and upload via ST-
LINK.
4. MicroPython
Supported IDEs:
Thonny IDE
VS Code (with Pymakr or MicroPython extensions)
Any terminal emulator (e.g., PuTTY, miniterm)
Setup Method:
Thonny IDE:
Install Thonny (free, cross-platform).
Flash MicroPython firmware to STM32 board using dfu-util or
STM32CubeProgrammer.
Connect STM32 via USB, write MicroPython scripts, and run via Thonny’s REPL.
VS Code:
Install VS Code with Pymakr or MicroPython extension.
Flash MicroPython firmware to STM32 using dfu-util or STM32CubeProgrammer.
Write scripts, upload to STM32, and interact via REPL.
Terminal Emulator:
Flash MicroPython firmware to STM32.
Use a terminal (e.g., PuTTY) to connect via USB serial.
Write and run MicroPython scripts in REPL or save to board’s filesystem.
5. Rust
Supported IDEs:
PlatformIO (with VS Code)
VS Code (with Rust Analyzer)
STM32CubeIDE (with Rust plugin, less common)
Setup Method:
PlatformIO:
Install PlatformIO in VS Code, add platform = ststm32.
Install Rust toolchain (rustup target add thumbv7em-none-eabihf for STM32).
Create a project, add stm32-rs or embassy crates, write Rust code, build, and flash
via ST-LINK
VS Code:
Install Rust (rustup), Rust Analyzer extension, and cargo for STM32.
Create a project with cargo, add STM32 HAL crates (e.g., stm32f4xx-hal).
Build with cargo build --release, flash using probe-rs or ST-LINK.
STM32CubeIDE:
Install Rust plugin, set up Rust toolchain.
Create a Rust project, integrate STM32 HAL crates.
Write Rust code, compile, and flash via ST-LINK.
Notes
STM32CubeIDE is the most versatile, supporting C, C++, Assembly, and (with plugins)
Rust, and is free with comprehensive STM32 support.
MicroPython requires flashing specific firmware to the STM32 board, available from
the MicroPython website or ST’s repositories.
Rust and Ada require additional toolchains (Rust, GNAT) and have smaller STM32
communities, so setup may be more complex.