Building the Firmware
PHYTEC provides firmware for the phyCORE-RT1170 based on the Zephyr Project - an open-source real-time operating system (RTOS) designed for resource-constrained devices. This section walks you through setting up your development environment and building the example firmware for the phyCORE-RT1170 Development Kit. Once built, the firmware can be used as a foundation for further development.
If you prefer not to build the software yourself or want to evaluate the development kit quickly, you can use one of the available Pre-Built Binaries.
Requirements
Before you begin, ensure the following system requirements are met:
Ubuntu 20.04 LTS (or newer), 64-bit, with root privileges * Virtual environments such as VMWare Workstation, VMWare Player, or VirtualBox are supported
At least 10 GB of free disk space
Active internet connection
Host Setup
Install the required host packages for Zephyr:
sh-host:~$ sudo apt 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 \
make gcc gcc-multilib g++-multilib libsdl2-dev libmagic1
Installing the Zephyr SDK
For a minimal setup, download the SDK for only the required ARM32
target:
sh-host:~$ cd ~
sh-host:~$ wget https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.17.0/zephyr-sdk-0.17.0_linux-x86_64_minimal.tar.xz
sh-host:~$ wget -O - https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.17.0/sha256.sum | shasum --check --ignore-missing
sh-host:~$ tar xvf zephyr-sdk-0.17.0_linux-x86_64_minimal.tar.xz
Enter the extracted SDK directory and run the setup script:
sh-host:~$ cd zephyr-sdk-0.17.0
sh-host:~$ ./setup.sh -c -h -t arm-zephyr-eabi
Install the udev rules required for OpenOCD:
sh-host:~$ sudo cp ~/zephyr-sdk-0.17.0/sysroots/x86_64-pokysdk-linux/usr/share/openocd/contrib/60-openocd.rules /etc/udev/rules.d
sh-host:~$ sudo udevadm control --reload
Git Setup
If you haven’t already configured Git on your host, run the following:
sh-host:~$ git config --global user.email "[email protected]"
sh-host:~$ git config --global user.name "Your Name"
Note
New to Git? Check out the official guide: https://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup
Source Directory Setup
Create a dedicated directory for your Zephyr-based firmware development and navigate into it:
sh-host:~$ mkdir -p ~/BSP-Zephyr-RT1170-ALPHA1/
sh-host:~$ cd ~/BSP-Zephyr-RT1170-ALPHA1/
Create a Python virtual environment and install the required tools:
sh-host:~$ virtualenv .venv
sh-host:~$ source .venv/bin/activate
sh-host:~$ pip install west pyelftools pyocd
Clone the Zephyr example repository for the phyCORE-RT1170 and initialize all necessary submodules, including Zephyr and the NXP HAL:
sh-host:~$ west init -m https://github.com/phytec/zephyr-phytec-rt1170-examples --mr v4.0.0-phy2 .
sh-host:~$ west update
sh-host:~$ west zephyr-export
Building the Example Firmware
Before building, source the Zephyr environment script:
sh-host:~$ source zephyr/zephyr-env.sh
Note
Remember to activate the Python virtual environment and source the Zephyr environment script each time you open a new terminal.
To build the default firmware for the Cortex-M7 core:
sh-host:~$ west build -p auto -b phyboard_atlas/mimxrt1176/cm7 zephyr-phytec-rt1170-examples/app
To target the Cortex-M4 core instead, change the board name to phyboard_atlas/mimxrt1176/cm4
.
Optional: Enable the Zephyr shell or debugging features by specifying additional configuration files:
sh-host:~$ west build -p auto -b phyboard_atlas/mimxrt1176/cm7 zephyr-phytec-rt1170-examples/app -- -DEXTRA_CONF_FILE="shell.conf debug.conf"
See chapter Flashing with JTAG to learn how to flash the firmware.