aboutsummaryrefslogtreecommitdiff
path: root/examples/esp32c3/runner.sh
diff options
context:
space:
mode:
authorHenrik Tjäder <henrik@tjaders.com>2024-04-10 20:35:14 +0200
committerGitHub <noreply@github.com>2024-04-10 18:35:14 +0000
commite4cc5fd17b8a2df332af0ee25c8bd7092e66afb0 (patch)
treed3d5129e727b884ef4f07aabbfe32e0c6d3d12b1 /examples/esp32c3/runner.sh
parent420ca5105809430f18114abc6b72ca3b09e93943 (diff)
CI: Add ESP32-C3 QEMU support (#914)
* CI: ESP32-C3: QEMU support * CI: ESP32C3: Script for preparing and running * CI: gitignore qemu.log * ESP32-C3: Example sw_and_hw output
Diffstat (limited to 'examples/esp32c3/runner.sh')
-rwxr-xr-xexamples/esp32c3/runner.sh29
1 files changed, 29 insertions, 0 deletions
diff --git a/examples/esp32c3/runner.sh b/examples/esp32c3/runner.sh
new file mode 100755
index 0000000..8b61068
--- /dev/null
+++ b/examples/esp32c3/runner.sh
@@ -0,0 +1,29 @@
+#!/bin/bash
+
+if [ $# -eq 0 ]
+ then
+ echo "No arguments supplied! Provide path to ELF as argument"
+fi
+
+outputfilenamecargo=$1
+outputfilename="$outputfilenamecargo".bin
+
+logfile=qemu.log
+
+qemuexec=qemu-system-riscv32
+
+# Building ESP32-C3 image
+espflash save-image --chip esp32c3 --merge "$outputfilenamecargo" "$outputfilename" 1>&2
+
+# Get stats
+esptool.py image_info --version 2 "$outputfilename" 1>&2
+
+# Run in QEMU
+$qemuexec -nographic -monitor tcp:127.0.0.1:55555,server,nowait -icount 3 -machine esp32c3 -drive file="$outputfilename",if=mtd,format=raw -serial file:"$logfile" &
+
+# Let it run
+sleep 3s
+
+# Kill QEMU nicely by sending 'q' (quit) over tcp
+echo q | nc -N 127.0.0.1 55555
+cat "$logfile"