Skip to content

STM32 Toolchain

Tim Brewis edited this page May 5, 2022 · 15 revisions

STM32CubeIDE

STM32CubeIDE is available on most platforms here. (VS Code is preferable!).

VS Code

macOS

Install Homebrew (if not already installed):

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Install stlink (ST command line tools) and (optionally) open-ocd (open on-chip debugger) via Homebrew:

brew update
brew install stlink
brew install open-ocd

Install the arm-none-eabi toolchain (embedded ARM compiler + tools), available here. By default it installs to /Applications/ARM/bin, add this to your path in ~/.zshrc or ~/.bashrc:

export PATH="/Applications/ARM/bin:$PATH"

Download the installer for the STM32CubeMX MCU configuration editor, available here. Run the installer, which will probably immediately crash. To fix this run the following command to clear all file attributes -c for every file in the app package recursively -r (replacing <version> with the latest version of the app):

sudo xattr -cr ~/Downloads/en.stm32cubemx-mac_v<version>/SetupSTM32CubeMX-<version>.app/

⚠️ If you launch this app the normal way by opening STM32CubeMX.app, code generation will not work. Instead, launch the executable directly from the command line:

/Applications/STMicroelectronics/STM32CubeMX.app/Contents/MacOs/STM32CubeMX

To save time, add it as an alias or to your path:

alias cubemx="/Applications/STMicroelectronics/STM32CubeMX.app/Contents/MacOs/STM32CubeMX"

Linux

Install with your package manager:

  • make
  • arm-none-eabi-gcc
  • arm-none-eabi-binutils

Install also:

  • STM32CubeMX, available here.
  • stlink (from the .rpm or .deb), available here

Optional:

  • openocd