Setup

Install Dependencyes

sudo apt update

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

Next, install the host tools Zephyr needs to configure and build applications. The instructions below use the recommended package manager for each operating system so the tools are available from your terminal.

The current minimum required versions for the main dependencies are:

ToolMin. Version
CMake3.20.5
Python3.12
Devicetree compiler1.4.6

Setup Python virtual environment

  • Create workspace

    mkdir workspace
    cd workspace
    
  • check Python version

    python3 --version
    

    if python version is less then 3.12.3 then you need to install python version >= 3.12.3.

    you can follow update-python.md

  • Create a new virtual environment

    NOTE: if default python version is not >= 3.12.3 and you installed latest python but not added to system default then you need to modify below python command with python3.xx bsed on your version.

    python3.12 -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.

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

Install West

pip install west

Get the Zephyr source code:

west init ./
west update

Export a Zephyr CMake package

This allows CMake to automatically load boilerplate code required for building Zephyr applications.

west zephyr-export

Install Python dependencies using

west packages pip --install

Install Zephyr SDK

This will install toolchain

for stm32

west sdk install arm-zephyr-eabi

Reference


©2023-2024 rculock.com