Skip to main content

Milestone 1

Project Configuration

This section describes the environment setup and Git repositories for the development work described in the RP016 project. Development is assumed to take place on an x86 64 build host machine. The instructions below will automatically download a cross toolchain appropriate to the build host.

The project uses Buildroot as an umbrella project to allow the acquisition, build and test of all components to be easily accomplished and reproduced by others.

The environment is based on the components below:

  • OpenSBI
  • OP-TEE
  • u-Boot
  • Linux kernel
  • QEMU

Repositories

RISCstar maintains the following Git trees and topic branches for the project on the RISE Gitlab:


Building the Software and the Test Environment

Get Buildroot source code:

git clone https://gitlab.com/riseproject/riscv-optee/buildroot.git -b rp016_m1

Configure Buildroot:

cd buildroot
make qemu_riscv64_virt_optee_defconfig

Build:

make -j$(nproc)

To avoid building errors due to outdated Buildroot native CMakeLists.txt files, if you have a CMAKE version > 3.30 on your host, build with:

make -j$(nproc) CMAKE\*POLICY_VERSION_MINIMUM=3.5

This will build all of the required components. All build artifacts can be found under output/build.


Running OP-TEE Xtest on Linux

Start QEMU and launch the kernel:

./output/images/start-qemu.sh

When the following output appears on the console, QEMU is waiting for a pending connection.

QEMU 10.1.92 monitor - type 'help' for more information
qemu-system-riscv64: -serial tcp:127.0.0.1:64320,server: info:
QEMU waiting for connection on:
disconnected:tcp:127.0.0.1:64320,server=on

Connect to QEMU via another console by using telnet to port 64320 on the host running QEMU.:

telnet localhost 64320

The openSBI and u-Boot logs will appear on the new console, while the OP-TEE logs will appear on the original console.

After launching the kernel, run Xtest, the OP-TEE test suite.

xtest

Running Bare-Metal SBI Demo Application

The application is designed to operate as an S-mode payload, obtaining services from openSBI through the ECALL extension.

The SBI ECALL interface is implemented, and currently provides public APIs that support the following EXT IDs and FIDs:

  • SBI_EXT_0_1_CONSOLE_PUTCHAR
  • SBI_EXT_BASE (GET_SPEC_VERSION, GET_IMP_ID, GET_IMP_VERSION)
  • SBI_EXT_TIME (SET_TIMER)

Run this app with openSBI's fw_jump at M-mode as follows:

./output/images/start-qemu-bm.sh

The openSBI logs will be displayed on the console, and the following logs are expected at the end:

Welcome to OpenSBI bare-metal app!
SBI Spec Version: 3.0
SBI Implementation: OpenSBI
OpenSBI Version: 1.6
Init timer successfully 10000000 ticks/s