This project is based off of the Zephyr Example Application and implements a T3 Forest Topology.
- Install host dependencies has per Zephyr's Getting Started
- Install Zephyr SDK
Note: There is probably no need to follow the Zephyr and Python dependencies
instructions because Zephyr gets installed when running the west update
command locally.
-
Once Zephyr is properly installed, initialize and update the West Workspace. This step is usually done once or everytime the
west.yml
manifest file changes. The manifest file is used to express the project's dependencies.west init -l west update west zephyr-export
-
If it's the first time building Zephyr code on your machine, you will need to install Zephyr's Python dependencies.
pip3 install -r ../zephyr-external/zephyr/scripts/requirements.txt
-
From this directory, build the code:
west build -d build/nucleo_f439zi -b nucleo_f439zi -p always apps/zenoh-session-restart
Note: the
-d
option specifies the output build directory and can be set to whatever directory you want. The only caveat is that at the moment thewest_flash_all.sh
script expects the build directories to bebuild/<board>
. If you want to change the output build directory, this will affect the build directory option for some of the commands explained in the following sections and you'll have to do flash the "manual" way (ie: usewest flash
).Note2: This repository contains a board definition for the Nucleo-F439zi but it is essentially identical to the Zephyr defined Nucleo-F429zi. It is only present because the hardware we actually use is the F439zi and we don't need the Crypto/Hash Processor at the moment.
Flashing is also done through west
but has a two different approaches depending on the number
or boards that you have connected to your computer:
The simplest method is to use west_flash_all.sh
as it works well wether you have one or multiple
nucleo
boards:
./west_flash_all.sh
Reminder: This script expect the output build directory to be build/<board>
This require some extra steps if you have multiple boards but allows you to provide any build directory if that's your current situation.
-
One board connected to your computer:
west flash -d build/nucleo_f439zi
Change the build directory if needed.
-
Many boards connected to your computer:
Getting a list of the connected boards:
pyocd list
This will give a list of unique IDs for the ST-Link that are on the Nucleo boards, not the STM32 chip.
Flashing the board:
west flash -d build/nucleo_f439zi -r openocd --cmd-pre-init 'adapter serial <STLINK_SERIAL_NUM>'
Zephyr provide a gdb debug interface through the west
command. It is possible to debug
or attach
to an already running piece of code. The command is similar to the west flash
command but with
debug
or attach
instead of flash
-
One board connected to your computer:
west <debug|attach> -d <build dir>
Change the build directory if needed.
-
Many boards connected to your computer:
Flashing the board:
west <debug|attach> -d <build dir> -r openocd --cmd-pre-init 'adapter serial <STLINK_SERIAL_NUM>'
Zephyr provides a menuconfig
interface to change the OS configuration similar to buildroot
.
The input of the config is stored in prj.conf
and various config overlays you provide. To view
that menu based on the board you are building for:
west build -d <build dir> -b <board> -t menuconfig
The recommended workflow is to use menuconfig
to search for configs and their dependencies. Once
you found the dependency you want to turn on or off, add it to the project's prj.conf
. It can also
be useful to make changes through menuconfig
and then press [D]
to Save minimal config
. Note
the file that it gets saved to (typically build/nucleo_g474re/zephyr/kconfig/defconfig
) and copy
paste to your project's prj.conf
.