內容目錄
5. WSL2 嵌入式工程-Zephyr篇
雖然官網說 WSL因爲 裝置無法燒錄不建議用 WSL,但我們可以用 usbipd連接 USB 裝置了,剩下的工作同 Ubuntu,不必再為 Windows安裝奇奇怪怪的東西了。。。
22.04 前的 Ubuntu 要添加 apt 源:
wget https://apt.kitware.com/kitware-archive.sh
sudo bash kitware-archive.sh
編譯環境:
sudo apt-get install --no-install-recommends git cmake ninja-build gperf \
ccache dfu-util device-tree-compiler wget \
python3-dev python3-pip python3-setuptools python3-tk python3-wheel xz-utils file libpython3.8-dev \
make gcc gcc-multilib g++-multilib libsdl2-dev libmagic1
安裝 cmake:
sudo snap install cmake --classic
取得 zephyrSDK:
(current stable version: v0.15.2): 我放在 ~/.local 下(參考官網建議notes)。
cd ~/.local
# (see notes)
wget https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.15.2/zephyr-sdk-0.15.2_linux-x86_64.tar.gz
wget -O - https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.15.2/sha256.sum | shasum --check --ignore-missing
tar xvf zephyr-sdk-0.15.2_linux-x86_64.tar.gz
cd zephyr-sdk-0.15.2
./setup.sh
# If you want to uninstall the SDK, remove the directory where you installed it。If you relocate the SDK directory, you need to re-run the setup script.
It is recommended to extract the Zephyr SDK bundle at one of the following locations:
$HOME$HOME/.local$HOME/.local/opt$HOME/bin/opt/usr/localThe Zephyr SDK bundle archive contains the
zephyr-sdk-0.15.2directory and,when extracted under$HOME,the resulting installation path will be `$HOME/zephyr-sdk-0.15.2.If you install the Zephyr SDK outside any of these locations,you must register the Zephyr SDK in the CMake package registry by running the setup script,or set
ZEPHYR_SDK_INSTALL_DIRto point to the Zephyr SDK installation directory.
安裝 West與 Zephyr Source Code:
- Install west,and make sure
~/.local/binis on yourPATHenvironment variable:pip3 install --user -U west echo 'export PATH=~/.local/bin:"$PATH"' >> ~/.bashrc source ~/.bashrc - Get the Zephyr source code:
west init ~/zephyrproject cd ~/zephyrproject west update - Export a Zephyr CMake package。This allows CMake to automatically load boilerplate code required for building Zephyr applications.
west zephyr-export - Zephyr’s
scripts/requirements.txtfile declares additional Python dependencies。Install them withpip3.pip3 install --user -r ~/zephyrproject/zephyr/scripts/requirements.txt
【未整理完,待修改。。。】
留言