1.1. Preparing Development Host
The NAVQ+ kit or any other Linux PC can be used as a development host for building Zephyr and installing it on the target board.
1.1.1. Using NAVQ+ as a Development Host
The SD card can be used to store the Zephyr SDK and source code; about 16 GB of free space is required. For example, create the new mmcblk1p3
partition on the SD card:
user@imx8mpnavq:~$ sudo fdisk -l /dev/mmcblk1 Disk /dev/mmcblk1: 29.12 GiB, 31266439168 bytes, 61067264 sectors ... Device Boot Start End Sectors Size Id Type /dev/mmcblk1p1 * 16384 186775 170392 83.2M c W95 FAT32 (LBA) /dev/mmcblk1p2 196608 23464009 23267402 11.1G 83 Linux /dev/mmcblk1p3 23464010 61067263 37603254 17.9G 83 Linux
Create the ext4 filesystem on the partition and the work
directory on it, using the following commands:
sudo mkfs.ext4 /dev/mmcblk1p3 sudo mkdir /mnt/sdcard sudo mount /dev/mmcblk1p3 /mnt/sdcard sudo chmod uga+rw /mnt/sdcard ln -s /mnt/sdcard/work ~
Download J-Link Software for Linux ARM (64-bit DEB Installer):
user@imx8mpnavq:~$ mkdir work/zephyr_tools user@imx8mpnavq:~$ cd work/zephyr_tools user@imx8mpnavq:~/work/zephyr_tools$ ls -l JLink_Linux_V792g_arm64.deb -rwxrwx--- 1 user user 36169184 Oct 6 15:43 JLink_Linux_V792g_arm64.deb
Install J-Link Software:
user@imx8mpnavq:~/work/zephyr_tools$ sudo dpkg -i JLink_Linux_V792g_arm64.deb ... OK
Download Zephyr SDK for Linux AArch64:
user@imx8mpnavq:~/work/zephyr_tools$ wget https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.16.3/zephyr-sdk-0.16.3_linux-aarch64_minimal.tar.xz ... 2023-10-06 18:12:49 (2.42 MB/s) - ‘zephyr-sdk-0.16.3_linux-aarch64_minimal.tar.xz’ saved [39188792/39188792] user@imx8mpnavq:~/work/zephyr_tools$ ls -l zephyr-sdk-0.16.3_linux-aarch64_minimal.tar.xz -rw-rw-r-- 1 user user 39188792 Sep 23 02:45 zephyr-sdk-0.16.3_linux-aarch64_minimal.tar.xz
Extract the Zephyr SDK bundle archive:
user@imx8mpnavq:~/work/zephyr_tools$ tar xf zephyr-sdk-0.16.3_linux-aarch64_minimal.tar.xz
Run the Zephyr SDK bundle setup script (the arm-zephyr-eabi
toolchain should be enough to start with):
user@imx8mpnavq:~/work/zephyr_tools$ cd zephyr-sdk-0.16.3/ user@imx8mpnavq:~/work/zephyr_tools/zephyr-sdk-0.16.3$ ./setup.sh ... Install toolchains for all targets [y/n]? n Install 'aarch64-zephyr-elf' toolchain [y/n]? n Install 'arc64-zephyr-elf' toolchain [y/n]? n Install 'arc-zephyr-elf' toolchain [y/n]? n Install 'arm-zephyr-eabi' toolchain [y/n]? y Install 'microblazeel-zephyr-elf' toolchain [y/n]? n Install 'mips-zephyr-elf' toolchain [y/n]? n Install 'nios2-zephyr-elf' toolchain [y/n]? n Install 'riscv64-zephyr-elf' toolchain [y/n]? n Install 'sparc-zephyr-elf' toolchain [y/n]? n Install 'x86_64-zephyr-elf' toolchain [y/n]? n Install 'xtensa-dc233c_zephyr-elf' toolchain [y/n]? n Install 'xtensa-espressif_esp32_zephyr-elf' toolchain [y/n]? n Install 'xtensa-espressif_esp32s2_zephyr-elf' toolchain [y/n]? n Install 'xtensa-espressif_esp32s3_zephyr-elf' toolchain [y/n]? n Install 'xtensa-intel_ace15_mtpm_zephyr-elf' toolchain [y/n]? n Install 'xtensa-intel_tgl_adsp_zephyr-elf' toolchain [y/n]? n Install 'xtensa-mtk_mt8195_adsp_zephyr-elf' toolchain [y/n]? n Install 'xtensa-nxp_imx_adsp_zephyr-elf' toolchain [y/n]? n Install 'xtensa-nxp_imx8m_adsp_zephyr-elf' toolchain [y/n]? n Install 'xtensa-nxp_rt500_adsp_zephyr-elf' toolchain [y/n]? n Install 'xtensa-sample_controller_zephyr-elf' toolchain [y/n]? n Install host tools [y/n]? y Register Zephyr SDK CMake package [y/n]? y ... All done.
Install west
:
user@imx8mpnavq:~/work/zephyr_tools$ pip install west ...
Restart the shell so that the PATH
variable includes /home/user/.local/bin
:
user@imx8mpnavq:~$ echo $PATH /home/user/.local/bin:...
1.1.2. Using Linux PC as a Development Host
Set up a command-line Zephyr development environment on a Linux PC as described in the Zephyr Project documentation:
https://docs.zephyrproject.org/latest/develop/getting_started/index.html
This includes the following items:
Installation of the Linux host dependencies (CMake, Python, Devicetree compiler).
Installation of the Zephyr’s meta-tool named “west”.
Installation of the Zephyr Software Development Kit (SDK) containing toolchains for each of Zephyr’s supported architectures, which include a compiler, assembler, linker and other programs required to build Zephyr applications.
1.2. Getting Zephyr Source Code
Emcraft maintains the fork of the Zephyr source code on GitHub:
https://github.com/EmcraftSystems/zephyr
It will be used for the following purposes:
Add Emcraft custom applications (
zephyr/emcraft/app/*
).Support Emcraft custom boards and extend support of other boards (
zephyr/boards/*
).Add or replace the Zephyr modules via the west manifest file (
zephyr/west.yml
).Implement various enhancements in the existing code.
The Emcraft release branches are named “emcraft-vX.Y.Z-branch
" in this repository.
Use the following command to get the Emcraft X.Y.Z release of the Zephyr code:
west init zephyrproject -m https://github.com/EmcraftSystems/zephyr --mr emcraft-vX.Y.Z-branch
After that, proceed with getting Zephyr and installing Python dependencies, as described in the Zephyr Project documentation:
https://docs.zephyrproject.org/latest/develop/getting_started/index.html
Note that Emcraft may need to add or replace some modules used by Zephyr. In this case, the source code of the modules will be maintained by Emcraft on GitHub, and the corresponding records in the west manifest file will be adjusted. The corresponding repositories will be picked up automatically by the “west update
" command.