layout | title | parent | grand_parent |
---|---|---|---|
post |
Windows |
1.1 Installation |
Lesson 1: Zephyr Setup |
NOTE: Please follow either following instructions or refer to official instructions.
-
Install Chololatey Run
Get-ExecutionPolicy
. If it returnsRestricted
, then runSet-ExecutionPolicy AllSigned
orSet-ExecutionPolicy Bypass -Scope Process
.Now, run the following command:
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
If you don't see any errors, you are ready to use
Chocolatey
! Typechoco
orchoco -?
to verify you can use it. -
Open a command prompt (cmd.exe) as an Administrator (press the Windows key, type “cmd.exe” in the prompt, then right-click the result and choose “Run as Administrator”).
-
Optionally disable global confirmation to avoid having to confirm installation of individual programs:
choco feature enable -n allowGlobalConfirmation
- Install CMake:
choco install cmake --installargs 'ADD_CMAKE_TO_PATH=System'
- Install the rest of the tools:
choco install git python ninja dtc-msys2 gperf
- Install
vs_BuildTools
Download & install https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2022 (this is current version as of 07/04/2022, use whatever is latest)
Select following options during installation:
- Close the Administrator command prompt window.
-
West is zephyr's multi-purpose tool, that lets you easily get the zephyr project source code, instead of manually cloning the Zephyr repos along with west itself.
Run following command.
pip3 install west
Open a new command line and run following command to check if West was correctly installed:
pip3 check west
-
If you have issues with West, please follow the Troubleshooting West guide.
Following steps may run for serveral minutes, depending upon your network bandwidth, be patient. You should see command prompt being udpated with status, it should not stay idle.
NOTE: You can rename zephyrproject
to anything you wish/like.
west init zephyrproject
cd zephyrproject
west update
Install additioanl python packages required by Zephyr in cmd.exe
prompt.
pip3 install -r zephyr/scripts/requirements.txt
-
Download GNU ARM Embedded build
- For my raspberry pi pico board, I downloaded
AArch32 bare-metal target (arm-none-eabi)
- For my raspberry pi pico board, I downloaded
-
Configure the environment variables needed to inform Zephyr build system to use this toolchain:
- Set
ZEPHYR_TOOLCHAIN_VARIANT
tognuarmemb
. - Set
GNUARMEMB_TOOLCHAIN_PATH
to the toolchain installation directory - E.g.:
set ZEPHYR_TOOLCHAIN_VARIANT=gnuarmemb set GNUARMEMB_TOOLCHAIN_PATH=C:\gnu_arm_embedded
- Set
- Go to your
cd %homepath%\zephyrproject\zephyr
- Run following command to build with verbose (
-v
) and cleaning any previous build files (--prestine
)
west -v build -b rpi_pico samples\hello_world --pristine
OR
- Run following command to build WITHOUT verbose and cleaning any previous build files (
--prestine
)
west build -b rpi_pico samples\hello_world --pristine
A succesful build looks like this:
- Go to your
cd %homepath%\zephyrproject\zephyr
- Run following command to build with verbose (
-v
) and cleaning any previous build files (--prestine
)
west -v build -b rpi_pico samples\basic\blinky --pristine
OR
- Run following command to build WITHOUT verbose and cleaning any previous build files (
--prestine
)
west build -b rpi_pico samples\basic\blinky --pristine
A succesful build looks like this:
cd %homepath%\zephyrproject\zephyr\samples\basic\blinky
west flash