This is the Wiki for the Zephyr support for Renesas R-Car Gen3 embedded Cortex-R7. Refer to the R-Car page for information about Renesas’ R-Car SoC family.
This wiki describes the current support of H3ULCB Cortex-R7 on Zephyr from multiple sources. You will also find a step by step tutorial on how to prepare your Ubuntu host then build and test Zephyr OS on an R-Car Gen3 board.
Important: It is important to understand that the Zephyr port has been designed to be executed exclusively on the Cortex-R7 that exists in some of the R-Car Gen3 boards.There is no plan to replace other software such as U-Boot or Linux that are running on the A57/53 cores by Zephyr.
This tutorial is based on the official Zephyr 2.6 guide, commands are appended here to allow you a quick copy and paste. You can also follow the installation steps (1 to 4) directly from the official guide here.
This guide only supports Ubuntu but the official one also describes steps for macOS and windows. This tutorial is based on Zephyr 2.6 version and is using the Iot.bzh’s Renesas 2.6 BSP in order to provide a much more user friendly tutorial.
You can see Zephyr 2.6’s H3ULCB supported features here.
First, update your host:
sudo apt update sudo apt upgrade
Then, install the required dependencies:
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
Please also make sure that your default cmake is version 3.13.1 or higher and check here if you have minimal version for needed tools.
Get Zephyr and install Python dependencies
In order to clone Zephyr, you should first install the West tool, a swiss-army knife command line tool used by the Zephyr project for the whole process from cloning sources to flashing a board.
pip3 install --user -U west echo 'export PATH=~/.local/bin:"$PATH"' >> ~/.bashrc source ~/.bashrc
Clone the complete Zephyr project, use Iot.bzh’s latest Renesas BSP and update all the project:
cd ~ west init -m https://github.com/iotbzh/zephyr.git --manifest-rev renesas-v2.6 ~/zephyrproject cd ~/zephyrproject west update
Export a Zephyr CMake package:
Then, install the Python dependencies:
pip3 install --user -r ~/zephyrproject/zephyr/scripts/requirements.txt
Install a toolchain
To build Zephyr OS binaries, you need a cross-toolchain. The Zephyr OS project provides all the binary files you need to build your project.
cd ~ wget https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.12.4/zephyr-sdk-0.12.4-x86_64-linux-setup.run chmod a+x ./zephyr-sdk-0.12.4-x86_64-linux-setup.run ./zephyr-sdk-0.12.4-x86_64-linux-setup.run -- -d ~/zephyr-sdk-0.12.4
Then, apply the provided udev rule allowing the flash of most Zephyr boards:
sudo cp ~/zephyr-sdk-0.12.4/sysroots/x86_64-pokysdk-linux/usr/share/openocd/contrib/60-openocd.rules /etc/udev/rules.d sudo udevadm control --reload
Now you are ready to build your first Zephyr project programs, we are going to start with a bunch of basic demos:
- Button demo is receiving button input (SW3 input button).
- Blinky demo is making a LED blink (LED4 output LED).
- Openamp demo is making Zephyr and Linux kernel communicate, thanks to openAMP.
cd ~/zephyrproject/zephyr west build -p auto -b rcar_h3ulcb_cr7 samples/basic/blinky --build-dir build-h3ulcb-blinky west build -p auto -b rcar_h3ulcb_cr7 samples/basic/button --build-dir build-h3ulcb-button west build -p auto -b rcar_h3ulcb_cr7 samples/subsys/ipc/openamp_rsc_table --build-dir build-h3ulcb-openamp
Build a custom app
As an example, we will clone the zephyr-shell demo that we prepared to demonstrate all the currently supported features for R-Car Gen3 H3ULCB on Zephyr.
You can clone your app anywhere on your host, for the clarity of this tutorial, we will store apps near to the Zephyr sources:
mkdir ~/zephyrproject/user_app cd ~/zephyrproject/user_app git clone https://github.com/iotbzh/zephyr-shell.git
Then, you can build it at the same location as demos previously built:
cd ~/zephyrproject/zephyr west build -b rcar_h3ulcb_cr7 ../user_app/zephyr-shell --build-dir build-h3ulcb-zephyr-shell
Now that your binaries are ready, it’s time to prepare your hardware setup allowing you to flash the program you just built.
First, the BSP we are using is currently only supporting the Olimex ARM-USB-OCD-H JTAG probe, we then encourage you to use this probe to flash H3ULCB board.
Depending on the hardware configuration you use, you will not need the same setup:
ULCB: To connect the JTAG probe to a ULCB board, you will need a TET SICA20I2P adapter. You will then be able to connect your probe to the CN3 JTAG connector of the board. Unless your CN10 connector is welded, secondary UART is not available on this board.
ULCB+KF: When connected to a Kingfisher board, you can use JTAG and access secondary UART. You are able to access the secondary UART through KF CN4 connector (be careful, the pinout of the connector depends on your KF revision). See “Know issues” to be sure that your Kingfisher revision let you use the JTAG connector.
If you are able to access the secondary UART (depending on yor hardware setup), you can link your host to it with a USB-TTL adapter with 115200 8N1 settings.
Deploy a Zephyr binary on board
Now that your hardware setup is ready, you are able to flash any of your Zephyr binary:
cd ~/zephyrproject/zephyr/build-h3ulcb-blinky #or cd ~/zephyrproject/zephyr/build-h3ulcb-button #or cd ~/zephyrproject/zephyr/build-h3ulcb-openamp west flash
cd ~/zephyrproject/zephyr/build-h3ulcb-zehyr-shell west flash
Tutorial on how to use the zephyr-shell demo can be seen in the Readme here.
The Cortex R7 is then powered and is running your app.