Sonata simulator run through xmake
Instead of having a separate section to run examples in CI, this is now
done in xmake instead using the newly created sonata-simulator board
file.
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 01cf3c3..5036f0d 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -20,8 +20,9 @@
build-flags: --debug-loader=y --debug-scheduler=y --debug-allocator=y -m debug
- build-type: release
build-flags: --debug-loader=n --debug-scheduler=n --debug-allocator=n -m release --stack-usage-check-allocator=y --stack-usage-check-scheduler=y
- - board: sonata-prerelease
+ - board: sonata-simulator
build-type: release
+ build-flags: --debug-loader=n --debug-scheduler=n --debug-allocator=n -m release --stack-usage-check-allocator=y --stack-usage-check-scheduler=y --testing-model-output=y
sonata: true
fail-fast: false
runs-on: ubuntu-latest
@@ -54,8 +55,6 @@
xmake
done
- name: Run examples
- # Currently xmake run tries to run Sonata on FPGA.
- if: ${{ !matrix.sonata }}
run: |
set -e
for example_dir in $PWD/examples/*/; do
@@ -63,16 +62,6 @@
echo Running $example_dir
xmake run
done
- - name: Sonata simulator examples
- if: ${{ matrix.sonata }}
- run: |
- set -e
- for example_dir in $PWD/examples/*/; do
- directory=$(basename $example_dir)
- elf_name=${directory##*.}
- echo Running $elf_name
- scripts/run-sonata-sim.sh $example_dir/build/cheriot/cheriot/${{ matrix.build-type }}/$elf_name scripts/model_output/sonata-simulator/examples/$elf_name.txt
- done
- name: Build benchmarks
run: |
set -e
diff --git a/sdk/xmake.lua b/sdk/xmake.lua
index 0f26d6e..07a37c5 100644
--- a/sdk/xmake.lua
+++ b/sdk/xmake.lua
@@ -51,6 +51,17 @@
stackCheckOption("allocator")
stackCheckOption("scheduler")
+function testCheckOption(name)
+ option("testing-" .. name)
+ set_default(false)
+ set_description("Enable testing feature " .. name .. ". Do not enable this in builds that don't produce a UART log!")
+ set_showmenu(true)
+ set_category("Debugging")
+ option_end()
+end
+
+testCheckOption("model-output")
+
-- Force -Oz irrespective of build config. At -O0, we blow out our stack and
-- require much stronger alignment.
set_optimize("Oz")
@@ -284,7 +295,18 @@
local directory = path.directory(firmware)
firmware = path.filename(firmware)
local run = function(simulator)
- os.execv(simulator, { firmware }, { curdir = directory })
+ local simargs = { firmware }
+ if get_config("testing-model-output") then
+ modeldir = path.join(scriptdir,
+ "..",
+ "scripts",
+ "model_output",
+ path.basename(target:values("board")),
+ "examples")
+ local modelout = path.join(modeldir, firmware .. ".txt")
+ simargs[#simargs+1] = modelout
+ end
+ os.execv(simulator, simargs, { curdir = directory })
end
-- Try executing the simulator from the sdk directory, if it's there.
local tools_directory = config.get("sdk")