Step 2 : Get Zephyr and install Python dependencies

  • In this program, you are going to learn

  • How to ?

Topics in this section,

  • Make sure current dir is $HOME

$ cd $HOME
  • Use apt to install Python venv package:

$ sudo apt install python3-venv
  • Create a new virtual environment:

$ python3 -m venv ~/zephyrproject/.venv
  • Activate the virtual environment:

$ source ~/zephyrproject/.venv/bin/activate
  • See the command prompt changed, indicating that it is virtual environment

(.venv) test:~$
  • Install west:

(.venv) test:~$ pip install west
  • Get the Zephyr source code:

(.venv) test:~$ west init ~/zephyrproject
(.venv) test:~$ cd ~/zephyrproject
(.venv) test:~$ west update
  • Export a Zephyr CMake package. This allows CMake to automatically load boilerplate code required for building Zephyr applications.

(.venv) test:~$ west zephyr-export
  • Zephyr’s scripts/requirements.txt file declares additional Python dependencies. Install them with pip.

(.venv) test:~$ pip install -r ~/zephyrproject/zephyr/scripts/requirements.txt