Skip to content

STM32f4 Zephyr


Test setting up a Zephyr project for STM32F429I-DISCO dev board

Setup Windows dev env

Create a new virtual environment

# Setup python virtual env
cd $HOME
python -m venv zephyrproject\.venv

Install west and Zephyr dependencies

# Install west
pip install west

# Get Zephyr sources
west init zephyrproject
cd zephyrproject
west update

# Setup Zephyr requirements
west zephyr-export
pip install -r $HOME\zephyrproject\zephyr\scripts\requirements.txt

Install Zephyr

# It is recommended to extract the Zephyr SDK bundle to home dir
cd $HOME

# Disable progress bar, which slows down the download for some reason
$ProgressPreference = 'SilentlyContinue'

# Download zephyr SDK bundle
Invoke-WebRequest -Uri "" -OutFile "zephyr-sdk-0.16.5-1_windows-x86_64.7z"

# Extract SDK
7z x zephyr-sdk-0.16.5-1_windows-x86_64.7z

# Setup SDK
cd zephyr-sdk-0.16.5-1

Build example project

# Activate dev env
cd zephyrproject
cd zephyr

# Build blinky example
west build -p always -b stm32f429i_disc1 .\samples\basic\blinky\


# Install On-Chip Debugger
choco install openocd

# OR download and install STM32CubeProgrammer

# Flash the device using openocd. Note that RESET button must be briefly
# held down once the following command is given and immediately released,
# when the program executes
west flash

# OR flash the device using stm32cubeprogrammer
west flash --runner stm32cubeprogrammer


# To debug using GDB. 
# Note: stm32cubeprogrammer doesn't seem to support debugging
west debug

# Example debugging blinky
(gdb) break main.c:38
(gdb) continue
 -> LED goes on
(gdb) continue
 -> LED goes off

LED blinking

Serial port

# This is also outputted to the serial port
LED state: ON
LED state: OFF
LED state: ON
LED state: OFF

putty.exe -> Serial -> COM3 -> 115200 baud


# List module metadata
west list
west list --format "{name} {path} {revision}" net-tools

# Erase disk when flashing the app
west flash --erase

# Open kernel config GUI tool
west build --target guiconfig

# Connect to running debugger without flashing
west attach

# Start GDB server and open a socket for external debuggers
west debugserver


# Build and flash shell
west build -p always -b stm32f429i_disc1 .\samples\subsys\shell\shell_module\
west flash

# putty.exe -> Serial -> COM3 -> 115200 baud
uart:~$ help

# Also tried to get samples/subsys/shell/fs working but having difficulties with
# the storage:
error: 'DT_N_NODELABEL_storage_partition_PARTITION_ID' undeclared here

# Tried adding to dts\arm\st\f4\stm32f429.dtsi:
storage_partition: partition@8000000 {
    label = "storage";
    reg = <0x08000000 0x200000>;

# It does seem to do something but doesn't fix the issue. Instead giving a new error:
error: 'DT_N_S_soc_S_partition_8000000_PARTITION_ID' undeclared here (not in a function); did
you mean 'DT_N_S_soc_S_partition_8000000_PARENT'?

SOC flash map Doc writer


See the full getting started guide:

STM32F429I-DISCO specific Zephyr page

STM32F429I-DISCO overview, pinout etc.

STM32F429I-DISCO datasheet

STM32F429ZIT6 datasheet

Zephyr demos