Use Tock's QEMU instead of our own QEMU. I also switched to using `cargo clean` in the Makefile rather than manually removing `target/` and `Cargo.lock`, as that seems like a more correct and maintainable design.
diff --git a/.gitignore b/.gitignore index 798463e..ae858ab 100644 --- a/.gitignore +++ b/.gitignore
@@ -1,4 +1,3 @@ -/build /Cargo.lock /layout.ld /platform
diff --git a/Cargo.toml b/Cargo.toml index ee68117..0016e7a 100644 --- a/Cargo.toml +++ b/Cargo.toml
@@ -58,6 +58,7 @@ debug = true [workspace] +exclude = [ "tock" ] members = [ "codegen", "core",
diff --git a/Makefile b/Makefile index ae326fb..cf1a305 100644 --- a/Makefile +++ b/Makefile
@@ -41,18 +41,11 @@ cargo install elf2tab --version 0.4.0 cargo install stack-sizes -# Downloads a version of QEMU with patches needed to support Tock on HiFive. -# Builds QEMU and installs it into build/. +# Sets up QEMU in the tock/ directory. We use Tock's QEMU which may contain +# patches to better support boards that Tock supports. .PHONY: setup-qemu setup-qemu: - mkdir -p build - cd build && \ - git clone https://github.com/alistair23/qemu.git \ - -b riscv-tock.next --depth 1 && \ - cd qemu && \ - ./configure --prefix=$(CURDIR)/build \ - --target-list=arm-softmmu,riscv32-softmmu && \ - $(MAKE) install + $(MAKE) -C tock emulation-setup # Builds a Tock kernel for the HiFive board for use by QEMU tests. .PHONY: kernel-hifive @@ -62,7 +55,7 @@ # Runs the libtock_test tests in QEMU on a simulated HiFive board. .PHONY: test-qemu-hifive -test-qemu-hifive: kernel-hifive +test-qemu-hifive: kernel-hifive setup-qemu PLATFORM=hifive1 cargo rrv32imac --example libtock_test --features=alloc \ --features=__internal_disable_gpio_in_integration_test cargo run -p test-runner @@ -136,5 +129,5 @@ .PHONY: clean clean: - rm -rf target - rm Cargo.lock + cargo clean + $(MAKE) -C tock clean
diff --git a/test-runner/src/main.rs b/test-runner/src/main.rs index b08d97b..e297e8e 100644 --- a/test-runner/src/main.rs +++ b/test-runner/src/main.rs
@@ -14,7 +14,7 @@ async fn perform_tests() -> Result<(), Box<dyn std::error::Error>> { let mut failed_tests = Vec::new(); - let tests = Command::new("build/bin/qemu-system-riscv32") + let tests = Command::new("tock/tools/qemu/riscv32-softmmu/qemu-system-riscv32") .arg("-M") .arg("sifive_e,revb=true") .arg("-kernel")