Skip to content

Installation Guides

In-depht installation guide: docs.zephyrproject

Board docs: nucleo_f767zi

If you have STM32CubeProgrammer PATH problems, you can use OpenOCD instead.

Quick Installation

Linux and MacOS in terminal

Install script using curl

curl -O https://raw.githubusercontent.com/UiASub/K2-Zephyr/main/install_zephyr.sh
chmod +x install_zephyr.sh
./install_zephyr.sh

use ./install_zephyr.sh -h to see help

Windows in CMD or Powershell (Admin)

Install script using powershell

You will need winget to install dependencies.

powershell -NoProfile -ExecutionPolicy Bypass -Command "Invoke-WebRequest https://raw.githubusercontent.com/UiASub/K2-Zephyr/main/install_zephyr.ps1 -OutFile install_zephyr.ps1"
# Use script:
powershell -ExecutionPolicy Bypass -File install_zephyr.ps1

Default install path is $HOME\zephyrproject

Edit default Zephyr Path with -ZephyrPath Example:

# Use script:
powershell -ExecutionPolicy Bypass -File install_zephyr.ps1 -ZephyrPath "C:\Users\you\zephyrproject"

Manual Installation

Windows | Ubuntu | MacOS


Windows

Windows: Use winget then run this in ps or cmd:

winget install Kitware.CMake Ninja-build.Ninja oss-winget.gperf Python.Python.3.12 Git.Git oss-winget.dtc wget 7zip.7zip STMicroelectronics.STM32CubeProgrammer

You may need to add the 7zip and STM32CubeProgrammer installation folders to your PATH.

Get Zephyr and install Python dependencies in Windows

in Powershell on Windows:

cd $Env:HOMEPATH
python -m venv zephyrproject\.venv
zephyrproject\.venv\Scripts\Activate.ps1
pip install west==1.5.0
west init zephyrproject
cd zephyrproject
west update
west zephyr-export
west packages pip --install
cd $Env:HOMEPATH\zephyrproject\zephyr
west sdk install --version 0.17.2

Ubuntu

Ubuntu: Use apt:

sudo apt install --no-install-recommends git cmake ninja-build gperf \
  ccache dfu-util device-tree-compiler wget python3.12 python3.12-dev python3.12-venv python3-tk \
  xz-utils file make gcc gcc-multilib g++-multilib libsdl2-dev libmagic1 openocd

Note: Linux users can install STM32CubeProgrammer manually from STMicroelectronics for faster flashing. OpenOCD (installed above) works as an alternative.

verify:

cmake --version
python3 --version
dtc --version

Get Zephyr and install Python dependencies in Ubuntu

Using pip on Linux:

python3.12 -m venv ~/zephyrproject/.venv
source ~/zephyrproject/.venv/bin/activate
pip install west==1.5.0
west init ~/zephyrproject
cd ~/zephyrproject
west update
west zephyr-export
west packages pip --install
cd ~/zephyrproject/zephyr
west sdk install --version 0.17.2

Or using uv:

cd ~/zephyrproject
uv venv --python 3.12
source .venv/bin/activate
uv pip install west==1.5.0
west init ~/zephyrproject
west update
west zephyr-export
west packages pip --install
cd ~/zephyrproject/zephyr
west sdk install --version 0.17.2

MacOS

MacOS: Use Homebrew

brew install cmake ninja gperf python@3.12 ccache qemu dtc libmagic wget
brew install --cask stm32cubeprogrammer

Get Zephyr and install Python dependencies in Mac

Using pip on MacOS:

python3.12 -m venv ~/zephyrproject/.venv
source ~/zephyrproject/.venv/bin/activate
pip install west==1.5.0
west init ~/zephyrproject
cd ~/zephyrproject
west update
west zephyr-export
west packages pip --install
cd ~/zephyrproject/zephyr
west sdk install --version 0.17.2

Or using uv:

cd ~/zephyrproject
uv venv --python 3.12
source .venv/bin/activate
uv pip install west==1.5.0
west init ~/zephyrproject
west update
west zephyr-export
west packages pip --install
cd ~/zephyrproject/zephyr
west sdk install --version 0.17.2

STM32CubeProgrammer PATH (if installed from ST website)

If you install STM32CubeProgrammer from ST's website, the installer may not add the CLI tools to your PATH.

If west flash doesn't find STM32CubeProgrammer, you can add it manually.

  • macOS (example):

  • Find the installed CLI binary (common name: STM32_Programmer_CLI).

which STM32_Programmer_CLI || find / -name STM32_Programmer_CLI -type f 2>/dev/null
  1. Add its directory to your shell profile (example path below, adjust to match the location you discovered):
echo 'export PATH="/Applications/STMicroelectronics/STM32Cube/STM32CubeProgrammer/STM32CubeProgrammer.app/Contents/Resources/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc
  • Linux (example):

  • Find the installed CLI binary (common name: STM32_Programmer_CLI).

which STM32_Programmer_CLI || find / -name STM32_Programmer_CLI -type f 2>/dev/null
  1. Add its directory to your shell profile (example path below, adjust to match the location you discovered):
echo 'export PATH="/opt/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
  • Windows (example — use the exact install path you have; PowerShell example):

Open System Properties -> Environment Variables and add the STM32CubeProgrammer bin directory to your PATH, or use PowerShell:

setx PATH "$env:PATH;C:\Program Files\STMicroelectronics\STM32Cube\STM32CubeProgrammer\bin"

After adding the path, re-open your shell (or sign out & sign back in on Windows) so west flash can detect the STM32CubeProgrammer CLI.

OpenOCD

To explicitly use OpenOCD:

west flash --runner openocd

Monitor serial (115200 baud):

# Linux
minicom -D /dev/ttyACM0 -b 115200

# macOS
minicom -D /dev/tty.usbmodem* -b 115200
# or use screen
screen /dev/tty.usbmodem* 115200