OpenTitan Earl Grey

Overview

The OpenTitan Earl Grey chip is a low-power secure microcontroller that is designed for several use cases requiring hardware security. The OpenTitan Github [2] page contains HDL code, utilities, and documentation relevant to the chip.

Hardware

  • RV32IMCB RISC-V “Ibex” core

  • 128kB main SRAM

  • Fixed-frequency and AON timers

  • 32 x GPIO

  • 4 x UART

  • 3 x I2C

  • 2 x SPI host

  • 1 x SPI device

  • Various security peripherals

Detailed specification is on the OpenTitan Earl Grey Chip Datasheet [1].

Supported Features

The opentitan_earlgrey board supports the hardware features listed below.

on-chip / on-board
Feature integrated in the SoC / present on the board.
2 / 2
Number of instances that are enabled / disabled.
Click on the label to see the first instance of this feature in the board/SoC DTS files.
vnd,foo
Compatible string for the Devicetree binding matching the feature.
Click on the link to view the binding documentation.

opentitan_earlgrey@0.0.0/opentitan target

On-target memory for this board target: 128 KiB of RAM, 1 MiB of Flash.

Type

Location

Description

Compatible

CPU

on-chip

LowRISC Ibex RISC-V core1

lowrisc,ibex

Interrupt controller

on-chip

RISC-V CPU interrupt controller1

riscv,cpu-intc

on-chip

SiFive RISCV-V platform-local interrupt controller1

sifive,plic-1.0.0

MTD

on-chip

Flash node1

soc-nv-flash

Power management

on-chip

OpenTitan power management1

lowrisc,opentitan-pwrmgr

Serial controller

on-chip

OpenTitan UART1

lowrisc,opentitan-uart

SPI

on-chip

OpenTitan SPI controller2

lowrisc,opentitan-spi

Timer

on-chip

RISC-V Machine Timer.1

riscv,machine-timer

Watchdog

on-chip

OpenTitan Always-On Timer, version 1.01

lowrisc,opentitan-aontimer

opentitan_earlgrey@1.0.0/opentitan target

On-target memory for this board target: 128 KiB of RAM, 1 MiB of Flash.

Type

Location

Description

Compatible

CPU

on-chip

LowRISC Ibex RISC-V core1

lowrisc,ibex

Interrupt controller

on-chip

RISC-V CPU interrupt controller1

riscv,cpu-intc

on-chip

SiFive RISCV-V platform-local interrupt controller1

sifive,plic-1.0.0

MTD

on-chip

Flash node1

soc-nv-flash

Power management

on-chip

OpenTitan power management1

lowrisc,opentitan-pwrmgr

Serial controller

on-chip

OpenTitan UART1

lowrisc,opentitan-uart

SPI

on-chip

OpenTitan SPI controller2

lowrisc,opentitan-spi

Timer

on-chip

RISC-V Machine Timer.1

riscv,machine-timer

Watchdog

on-chip

OpenTitan Always-On Timer, version 2.0.01

lowrisc,opentitan-aontimer-2.0.0

Programming and Debugging

The opentitan_earlgrey board supports the runners and associated west commands listed below.

flash debug

First, build and install Verilator as described in the OpenTitan Verilator Setup [3] guide .

Board Revisions

The board revision selects the OpenTitan hardware version:

Revision

OpenTitan hardware

1.0.0 (default)

earlgrey_1.0.0 branch

0.0.0

master @ 6a3c2e98, which has the same hardware as the Earlgrey-M2.5.x releases

Revision 0.0.0 has an older AON timer register map, a different watchdog bark interrupt ID and fewer PLIC interrupt sources. To build for it, use opentitan_earlgrey@0.0.0 as the board.

Building and Flashing

Here is an example for building the Hello World application. The following steps were tested on the OpenTitan earlgrey_1.0.0 branch @ ccd5f716a1 with Verilator 5.052. That branch is frozen against Verilator 4.210, so the Verilator 5 fix from OpenTitan master commit af9262c4c0 (--no-timing for the AST power-good models) must be cherry-picked on top of it.

# From the root of the zephyr repository
west build -b opentitan_earlgrey samples/hello_world

Build the simulation binary, the test ROM and the OTP image in the OpenTitan repository:

cd $OT_HOME
./bazelisk.sh build //hw:verilator \
  //sw/device/lib/testing/test_rom:test_rom_sim_verilator \
  //hw/ip/otp_ctrl/data:img_rma

The OpenTitan Vchip_sim_tb tool can take the Zephyr .elf as input and place it in simulated flash bank 0. The OpenTitan test ROM will then run in simulation, read the manifest header from simulated flash, and begin executing Zephyr from the entry point. Use bazel cquery --output=files <target> to find the exact output paths; they look like this:

$OT_HOME/bazel-out/k8-fastbuild/bin/hw/build.verilator_real/sim-verilator/Vchip_sim_tb \
--meminit=rom,$OT_HOME/bazel-out/k8-fastbuild-ST-<hash>/bin/sw/device/lib/testing/test_rom/test_rom_sim_verilator.39.scr.vmem \
--meminit=otp,$OT_HOME/bazel-out/k8-fastbuild/bin/hw/ip/otp_ctrl/data/img_rma.24.vmem \
--meminit=flash0,$ZEPHYR_PATH/build/zephyr/zephyr.elf

UART output (also written to uart0.log in the working directory):

I00001 test_rom.c:158] kBuildInfo: scm_revision=54697461
I00002 test_rom.c:230] Test ROM complete, jumping to flash (addr: 20000400)!
*** Booting Zephyr OS build v4.5.0-663-g3526ef7d2cbc ***
Hello World! opentitan_earlgrey/opentitan

For revision 0.0.0, build Zephyr with opentitan_earlgrey@0.0.0 and the same OpenTitan targets on master @ 6a3c2e98. That simulator loads the test ROM with -r and names the flash region flash:

$OT_HOME/bazel-bin/hw/build.verilator_real/sim-verilator/Vchip_sim_tb --verbose-mem-load \
-r $OT_HOME/bazel-out/k8-fastbuild-ST-<hash>/bin/sw/device/lib/testing/test_rom/test_rom_sim_verilator.39.scr.vmem \
--meminit=otp,$OT_HOME/bazel-out/k8-fastbuild/bin/hw/ip/otp_ctrl/data/img_rma.24.vmem \
--meminit=flash,$ZEPHYR_PATH/build/zephyr/zephyr.elf

References