Preparing Linux Development Host for Building Zephyr

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. 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:

Download Zephyr SDK for Linux AArch64:

Extract the Zephyr SDK bundle archive:

Run the Zephyr SDK bundle setup script (the arm-zephyr-eabi toolchain should be enough to start with):

Install west:

Restart the shell so that the PATH variable includes /home/user/.local/bin:

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:

  1. Installation of the Linux host dependencies (CMake, Python, Devicetree compiler).

  2. Installation of the Zephyr’s meta-tool named “west”.

  3. 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.

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:

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.