Skip to content

Open-CMSIS-Pack/Zephyr-ST

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Zephyr-ST (Work in Progress)

This repository contains an exemplary CMSIS solution file that can be used to build two Zephyr basic examples on ST development boards. It can be easily adapted to other boards or examples. It uses Zephyr's west build system to create the executable file for an application and the Arm CMSIS Debugger to flash download and run the image on the target hardware.

Quick start

  1. Make sure that your host OS is up-to-date.
  2. Install the following dependencies using your favorite package manager:
    • Cmake (min. version 3.20.5)
    • Python (min. version 3.10)
  3. Clone this repository onto your machine.
  4. Install Zephyr on your machine (refer to Linux and macOS/Windows).
  5. Work with the example

Zephyr installation

This chapter contains installation instructions for Linux and macOS and Windows).

Linux and macOS

  • In your home directory, create a zephyrproject directory and change into it:

    mkdir zephyrproject
    cd zephyrproject
  • Create a new virtual environment:

    python3 -m venv .venv
  • Activate the virtual environment:

    source .venv/bin/activate

    Once activated, your shell will be prefixed with (.venv). The virtual environment can be deactivated at any time by running deactivate.

  • Install west:

    pip install west
  • Get the standard Zephyr source code:

    west init
    west update
  • Install Python dependencies using west packages:

    west packages pip --install
  • Set the ZEPHYR_BASE environment variable to the /zephyrproject/zephyr folder:

    Linux

    (echo; echo 'export ZEPHYR_BASE="/home/.../zephyrproject/zephyr"') >> ~/.bashrc
    source ~/.bashrc

    Make sure to restart the VS Code.

    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.

Windows

  • Open a cmd.exe terminal window as a regular user.

  • Create a zephyrproject directory and change into it:

    mkdir zephyrproject
    cd zephyrproject
  • Create a new virtual environment:

    python -m venv .venv
  • Activate the virtual environment:

    .venv\Scripts\activate.bat

    Once activated your shell will be prefixed with (.venv). The virtual environment can be deactivated at any time by running deactivate.

Note

Remember to activate the virtual environment every time you start working.

  • Install west:

    pip install west
  • Get the standard Zephyr source code:

    west init
    west update
  • Install Python dependencies using west packages.

    west packages pip --install
  • Set the ZEPHYR_BASE environment variable to C:\...\zephyrproject\zephyr in Environment Variables.

  • Make sure to restart the VS Code.

Examples Description

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.

Work with the example

  1. Open the cloned repository's folder in VS Code.
  2. In the CMSIS view, click on ..., use Select Active Solution from workspace, and choose an option.
  3. Press the Manage Solution Settings button. In the dialog, select the target board and application.
  4. Press the Build solution button to build the example.
  5. Press the "Build solution" button to build the example.
  6. Start the CMSIS Debugger.

About

Zephyr examples for STMicroelectronics STM32 based boards

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •