This directory contains a number of examples to understand the system:
Each example contains a readme file explaining what it is showing.
Each example is built with xmake, which first requires a configure step in the terminal:
$ cd {example_dir} $ xmake config --sdk={path-to-cheriot-llvm-tools} -P .
If you are using the dev container then the --sdk
flag will be --sdk=/cheriot-tools/
.
You can pass some additional flags to this step.
-m {debug,release}
will switch between debug and release builds.--debug-{allocator,scheduler,loader}={y,n}
will enable verbose output for the specified core RTOS component.--board={board name}
to compile for a target other than the default (the interpreter generated from the formal model).Next, build the firmware image with:
$ xmake -P . -v
The -v
(verbose) flag is optional but an xmake bug prevents the objdump output from being generated if it is not specified. You will then end up with a firmware image and a .dump
file containing the objdump output in build/cheriot/cheriot/{debug,release}
. The penultimate two status lines of the output will be something like:
[ 95%]: linking firmware build/cheriot/cheriot/debug/producer-consumer [ 95%]: Creating firmware dump build/cheriot/cheriot/debug/producer-consumer.dump
The first of these tells you the path to the firmware image, the second the location of the dump file that is a (somewhat) human-readable version of the same file.
By default, the examples are built targeting the interpreter that is generated from the Sail formal model of the ISA. This is the gold model, so anything that runs there should run on any compliant implementation. This interpreter includes an ELF loader and so can run the examples directly, for example:
$ cheriot_sim -V ./build/cheriot/cheriot/debug/producer-consumer
Where debug
is the value that you passed to the -m
flag (debug
is the default and the path that ends in producer-consumer
is the path from the build output.