Introduction
This is the Zephyr page for Sparrow Hawk. Zephyr runs on the Cortex-R52 core of R-Car V4H. U-Boot loads zephyr.bin to the memory and starts the core.
Software Version List
| Software | Version |
|---|---|
| Zephyr | v4.4.0 |
How to Build
This guide covers Ubuntu version 24.04 LTS and later.
- Build script(build-zephyr.sh)
#!/usr/bin/env bash set -e echo "=== Updating and upgrading system packages ===" sudo apt update sudo apt -y upgrade echo "=== Installing dependencies ===" sudo apt -y install --no-install-recommends \ git \ cmake \ ninja-build \ gperf \ ccache \ dfu-util \ device-tree-compiler \ wget \ python3-dev \ python3-venv \ python3-tk \ xz-utils \ file \ make \ gcc \ gcc-multilib \ g++-multilib \ libsdl2-dev \ libmagic1 echo "=== Setting up Zephyr workspace ===" mkdir -p ~/work/zephyr cd ~/work/zephyr echo "=== Creating Python virtual environment ===" python3 -m venv .venv echo "=== Activating Python virtual environment ===" source .venv/bin/activate echo "=== Installing west tool ===" pip install --upgrade pip pip install west echo "=== Fetching Zephyr source (v4.4.0) ===" mkdir -p zephyrproject git clone --depth=1 --branch v4.4.0 https://github.com/zephyrproject-rtos/zephyr zephyrproject/zephyr west init -l zephyrproject/zephyr cd zephyrproject # Fetch only the modules required for this board (cmsis*, Cortex-R headers) west config manifest.project-filter -- -.*,+cmsis.* west update --narrow -o=--depth=1 west zephyr-export west packages pip --install echo "=== Installing Python dependencies ===" pip install -r zephyr/scripts/requirements.txt echo "=== Installing Zephyr SDK ===" west sdk install -t arm-zephyr-eabi echo "=== Building sample application ===" cd zephyr west build -b sparrowhawk_rcar_v4h/r8a779g0/r52 samples/hello_world -p always echo "=== Setup and build completed successfully ===" - Execute the following command
chmod +x build-zephyr.sh ./build-zephyr.sh- The zephyr.bin will be generated under ~/work/zephyr/zephyrproject/zephyr/build/zephyr/zephyr.bin.
This guide covers Windows 11.
- Build script(build-zephyr.ps1)
echo "=== Install dependencies ===" winget install --scope user Kitware.CMake winget install ` Ninja-build.Ninja ` oss-winget.gperf ` Python.Python.3.12 ` Git.Git ` oss-winget.dtc ` wget ` 7zip.7zip echo "=== Reload PATH to use the installed tools ===" $env:Path = [Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [Environment]::GetEnvironmentVariable("Path", "User") $env:Path += ";C:\Program Files\7-Zip" echo "=== Create a new virtual environment ===" mkdir -Force "$HOME\work\zephyr" cd "$HOME\work\zephyr" py -3.12 -m venv zephyrproject\.venv zephyrproject\.venv\Scripts\Activate.ps1 pip install west echo "=== Get Zephyr and install Python dependencies ===" git clone --depth=1 --branch v4.4.0 https://github.com/zephyrproject-rtos/zephyr zephyrproject\zephyr west init -l zephyrproject\zephyr cd zephyrproject # Fetch only the modules required for this board (cmsis*, Cortex-R headers) west config manifest.project-filter -- '-.*,+cmsis.*' west update --narrow -o=--depth=1 west zephyr-export echo "=== Install required Python packages ===" python -m pip install @((west packages pip) -split ' ') cd zephyr west sdk install -t arm-zephyr-eabi echo "=== Building sample application ===" west build -b sparrowhawk_rcar_v4h/r8a779g0/r52 samples/hello_world -p always echo "=== Setup and build completed successfully ==="- If prompted by Windows during the installation, enter administrator credentials if required, then click “Yes” to continue.
- Execute the following command
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass .\build-zephyr.ps1- The zephyr.bin will be generated under $HOME\work\zephyr\zephyrproject\zephyr\build\zephyr\zephyr.bin
Setup the console terminal
Connect a USB cable from your PC to the CN4 USB port. Two serial devices appear (two /dev/ttyUSBx on Linux, two COM ports on Windows). Both devices are used during the boot process.
- Lower-numbered /dev/ttyUSBx or COM port (HSCIF0): U-Boot console. Use it to load zephyr.bin and to run it.
- Higher-numbered /dev/ttyUSBx or COM port (HSCIF1): Zephyr console. Zephyr outputs logs on it.
Use the following serial settings for both devices:
Speed: 921600
Data: 8 bits
Parity: None
Stop bits: 1
How to Load zephyr.bin to Sparrow Hawk
Connect the terminal software to the lower-numbered /dev/ttyUSBx or COM port (HSCIF0), then power on the Sparrow Hawk board. Press any key while “Hit any key to stop autoboot:” is displayed to enter the U-Boot shell, and execute the following commands.
setenv ipaddr <board.ip>
setenv serverip <tftp.server.ip>
tftp 0x40040000 zephyr.bin
Copy zephyr.bin to the microSD card, which already has the Yocto/Debian (rootfs) written, and insert it into the Sparrow Hawk board.
sudo mount /dev/sdxX /mnt
sudo cp ~/work/zephyr/zephyrproject/zephyr/build/zephyr/zephyr.bin /mnt/
sudo umount /mnt
ext4load mmc 0 0x40040000 /zephyr.bin
Copy zephyr.bin to a new microSD card, which has no Yocto/Debian (rootfs) written, and insert it into the Sparrow Hawk board.
sudo fdisk -l
sudo fdisk /dev/sdx
sudo mkfs.ext4 /dev/sdxX
sudo mount /dev/sdxX /mnt
sudo cp ~/work/zephyr/zephyrproject/zephyr/build/zephyr/zephyr.bin /mnt/
sudo umount /mnt
ext4load mmc 0 0x40040000 /zephyr.bin
This guide covers Tera Term version 5.0.
Transfer zephyr.bin from a host PC over the serial console using Tera Term and XMODEM.
loadx 0x40040000
File → Transfer → XMODEM → Send
Select zephyr.bin, enable the "1K" option, and start the transfer.
How to Run
rproc init
rproc load 0 0x40040000 ${filesize}
rproc start 0
If the following output appears on the higher-numbered /dev/ttyUSBx or COM port (HSCIF1), the operation is successful.
*** Booting Zephyr OS build v4.4.0 ***
Hello World! sparrowhawk_rcar_v4h/r8a779g0/r52
Note:
- If no output is observed, check that the correct /dev/ttyUSBx or COM port is selected.