Zephyr examples for STMicroelectronics STM32 based boards. The debug launch.json file has been adapted to load the ELF image built by the Zephyr West tool debugged by the CMSIS-Debugger extension.
| Example name | Description |
|---|---|
| blinky | A standard Zephyr basic example that blinks an LED forever using the Zephyr GPIO API by configuring a pin as output and toggling it in a loop. |
| threads | A standard Zephyr basic example that spawns multiple compile-time threads that blink LEDs with different periods and report status via a FIFO to a print thread. |
For more information about each example, please see the official Zephyr example repository.
- Install dependencies to your PC:
- python3
- python3-pip
- Install west and pyelftools with this command:
python3 -m pip install west pyelftools jsonschema
- Verify the west installation by running:
west --version
- In case you see the error
west: command not found, add the west.exe in PATH if reqired.
- In case you see the error
More details can be found in Zephyr Getting Started Guide.
-
Open the folder ./Zephyr-ST in VS code.
-
In Terminal, initialize and update the Zephyr workspace, if none exists:
mkdir -p zephyrproject west init ./zephyrproject cd ./zephyrproject west update -
To use the west tools for projects located in different folders, set the
ZEPHYR_BASEenvironment variable to the ./Zephyr-ST/zephyrproject/zephyr folder:For Ubuntu:
(echo; echo 'export ZEPHYR_BASE="/home/.../zephyrproject/zephyr"') >> ~/.bashrc source ~/.bashrc
- Make sure to restart the VS Code.
For MacOS:
(echo; echo 'export ZEPHYR_BASE="/usr/.../zephyrproject/zephyr"') >> ~/.zshrc source ~/.zshrc
- Make sure to fully quit VS Code, not just close the window. Otherwise, the changes won’t be applied.
For Windows:
- Set
ZEPHYR_BASEtoC:/.../Zephyr-Workspace/zephyrin Environment Variables, and restart the VS Code.
-
Press the "Select Active Solution from workspace" button to choose the project you want to work on.
-
Press the "Build solution" button to build the example.
-
Start the CMSIS Debugger.