Skip to main content
News

STM32Cube further facilitates code development with Clang/LLVM support

Related products:STM32 MPUs
  • August 6, 2025
  • 0 replies
  • 11 views
STM32Cube further facilitates code development with Clang/LLVM support
Theodore

Clang/LLVM toolchain project overview

For over a decade ST has offered GNU tools for STM32 as the free, reference toolchain when developing STM32 applications. It is well supported across the complete STM32Cube ecosystem and will continue to be maintained by ST.

The Clang/LLVM toolchain will over time offer STM32 developers better code density and execution speed. This release is a first step on the journey towards better toolchain performance and increased STM32Cube ecosystem integration. The toolchain will be supported within STM32CubeMX and with STM32Cube for Visual Studio Code.

This release provides a first version of the ST Arm Clang toolchain built on the Arm LLVM source tree. It allows early adopters to try a toolchain with a similar performance compared to today’s GCC. It offers more sanity checkers, more optimized C libraries, while compiler benchmark figures will come later.

Further to this initial release, developers can expect two additional steps:

  • Feedback collection  
    Early adopters will be provided the opportunity to share feedback, allowing ST to finetune the toolchain and ensure its level of integration across the STM32Cube ecosystem meets expectations. 
  • Toolchain optimization 
    ST will adjust the toolchain with the aim to improve code density and execution speed.

Embracing a step-by-step approach ensures that we set priorities in the development phase, in accordance with developer feedback. The ST Arm Clang flavor will soon provide example projects, and STM32CubeMX and STM32Cube for Visual Studio Code will help STM32 developers get started in the meantime. 

What the ST Arm Clang toolchain offers

ST Arm Clang is a new C/C++ toolchain for STM32 development, which is built on the modern LLVM compiler infrastructure and the Arm Toolchain for Embedded.

This new LLVM-based toolchain provides developers with a more efficient, flexible, and future-proof development environment while maintaining compatibility with existing projects.

ST Arm Clang is designed as a drop-in replacement for the GNU tools for STM32, minimizing disruption for developers transitioning to it. However, several minor incompatibilities or divergent features may exist due to the differences in the underlying infrastructure. To ease this transition, we provide two versions of the toolchain:

  • Hybrid toolchain: only the C/C++ LLVM Clang compiler and the integrated assembler are used to compile the code into object files (local applications, HAL, etc.). The final binary is built using the tools and libraries from the existing GNU tools for STM32 (GNU Binutils linker, C/C++ libraries, and runtime). This hybrid version is ideal for developers looking to test or leverage Clang's compilation while retaining the familiar GNU linking and runtime environment. Both toolchains (Clang and GCC) should be installed on your system, and link-time optimization (LTO) is not available in this mode.
  • Full LLVM toolchain: this version offers the complete long-term LLVM-based solution (Clang compiler, LLVM linker and runtime) with updated libraries, such as Picolibc or LLVM libc++. It benefits from the combined effort from the LLVM community, as well as Arm and ST research and development teams to reach optimal support, performance, and code-size on STM32 devices. The toolchain offers two distinct C library implementations, allowing developers to choose based on their project priorities or device resources: Newlib for performance and Picolibc for code size.

STM32CubeMX support 

The STM32CubeMX version 6.15 introduces support for ST Arm Clang. More specifically, STM32CubeMX generates projects for the hybrid flavor of the ST Arm Clang toolchain. This will allow STM32 developers to quickly try their existing GCC projects with ST Arm Clang toolchain without having to write a new linker script or consider incompatibilities between Newlib and Picolibc. 

Selecting the combination of CMake and ST Arm Clang will create a project targeting the hybrid toolchain:Picture2.png

If users wish to switch from the hybrid to the full LLVM flavor, they can do so inside STM32Cube for Visual Studio Code , following the explanations below.

STM32Cube for Visual Studio Code

Developers can choose between two options to start a project within the STM32Cube ecosystem.

  1. Use STM32CubeMX to generate a configurable project
  2. Use STM32Cube for Visual Studio Code to generate an empty project

This tutorial is based on the assumption that a project was created with STM32CubeMX as shown in the previous chapter.