meta data for this page
  •  

Setup a example zephyr project with west

West is the “swiss army knife” of the Zephyr project and helps to configure, build, flash and debug your Zephyr application. Here are some steps which show how to overcome the hurdles.

Preconditions

First install west as user with the python installer and add the execution path to your PATH environment variable of your shell config file:

guest:~$ pip3 install --user west
guest:~$ echo 'PATH=$PATH:~/.local/bin' >> ~/.bashrc
Test: As user you should be able to invoke west in the $CWD:
guest:~$ west --version
West bootstrapper version: v0.4.0 (/home/guest/.local/lib/python3.7/site-packages/west/_bootstrap)


Get Zephyr OS and friends

Now clone and update west and zephyr repositories into the directory zephyrproject by the use of west:

guest:~$ west init zephyrproject
guest:~$ cd zephyrproject
guest:~/zephyrproject$ west update

Install Python packages required by Zephyr:

guest:~/zephyrproject$ pip3 install --user -r zephyr/scripts/requirements.txt

Setup toolchain

Next step is to install the GNU ARM Embedded Toolchain supported by Eclipse described here.

guest:~$ echo 'ZEPHYR_TOOLCHAIN_VARIANT=gnuarmemb' >> ~/.bashrc
guest:~$ echo 'GNUARMEMB_TOOLCHAIN_PATH=~/opt/xPacks/@gnu-mcu-eclipse/arm-none-eabi-gcc/8.2.1-1.7.1/.content/bin' >> ~/.bashrc

Please note that different version of the toolchain (here 8.2.1-1.7.1) could be installed, so adjust the path for GNUARMEMB_TOOLCHAIN_PATH accordingly. After reopening the shell all the variables should be set. A few prefered settings of west like a pristine build directory before building could be applied by:

guest:~ cd ~/zephyrproject/zephyr
guest:~/zephyrproject/zephyr$ west config build.pristine auto

Build

Now it's time to build a sample application for the Olimexino board. The build directory to be used is ~/zephyrproject/zephyr/build:

guest:~/zephyrproject/zephyr$ source zephyr-env.sh
guest:~/zephyrproject/zephyr$ west build -p -b olimexino_stm32 samples/hello_world -G'Eclipse CDT4 - Ninja'

Flash

Before flashing or debugging anything, the Segger Jlink Debugger should be installed as described here. After connecting the debugger properly to the Olimexino and the PC, it is time to flash the generated binary to the board by west:

guest:~/zephyrproject/zephyr$ west flash --runner jlink

Debug

To start a simple gdb console session:

guest:~/zephyrproject/zephyr$ west debug --runner jlink

Please create another page for creating build and debug project in eclipse west build -p -b olimexino_stm32 samples/hello_world -G'Eclipse CDT4 - Ninja' In Eclipse import project “Existing Projects into Workspace”.