aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2023-04-11 16:20:08 +0000
committerGitHub <[email protected]>2023-04-11 16:20:08 +0000
commit5c42ca13bd207c5923cb36e1454f3f838582b6cb (patch)
tree1590a4fe498356a404be65b370dafd7dbdc0cfb8
parent813bba200f1a068a47bc6d9eafc74a190ffb0316 (diff)
parentf426c477479c0e0972156209eb0116c7a9eeedb8 (diff)
Merge #1353
1353: Add empty test binary for riscv r=Dirbaio a=royb3 As discussed with `@Dirbaio,` this empty test binary should cause a build to fail when it is not possible to build or link a riscv binary. Co-authored-by: Roy Buitenhuis <[email protected]>
-rwxr-xr-xci.sh1
-rw-r--r--tests/riscv32/.cargo/config.toml5
-rw-r--r--tests/riscv32/Cargo.toml46
-rw-r--r--tests/riscv32/build.rs8
-rw-r--r--tests/riscv32/memory.x14
-rw-r--r--tests/riscv32/src/bin/empty.rs16
6 files changed, 90 insertions, 0 deletions
diff --git a/ci.sh b/ci.sh
index f81b34c05..1b3fac8bc 100755
--- a/ci.sh
+++ b/ci.sh
@@ -124,6 +124,7 @@ cargo batch \
124 --- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32u585ai --out-dir out/tests/iot-stm32u585ai \ 124 --- build --release --manifest-path tests/stm32/Cargo.toml --target thumbv7em-none-eabi --features stm32u585ai --out-dir out/tests/iot-stm32u585ai \
125 --- build --release --manifest-path tests/rp/Cargo.toml --target thumbv6m-none-eabi --out-dir out/tests/rpi-pico \ 125 --- build --release --manifest-path tests/rp/Cargo.toml --target thumbv6m-none-eabi --out-dir out/tests/rpi-pico \
126 --- build --release --manifest-path tests/nrf/Cargo.toml --target thumbv7em-none-eabi --out-dir out/tests/nrf52840-dk \ 126 --- build --release --manifest-path tests/nrf/Cargo.toml --target thumbv7em-none-eabi --out-dir out/tests/nrf52840-dk \
127 --- build --release --manifest-path tests/riscv32/Cargo.toml --target riscv32imac-unknown-none-elf \
127 $BUILD_EXTRA 128 $BUILD_EXTRA
128 129
129 130
diff --git a/tests/riscv32/.cargo/config.toml b/tests/riscv32/.cargo/config.toml
new file mode 100644
index 000000000..58299b54e
--- /dev/null
+++ b/tests/riscv32/.cargo/config.toml
@@ -0,0 +1,5 @@
1[target.riscv32imac-unknown-none-elf]
2runner = "true"
3
4[build]
5target = "riscv32imac-unknown-none-elf"
diff --git a/tests/riscv32/Cargo.toml b/tests/riscv32/Cargo.toml
new file mode 100644
index 000000000..885776ae6
--- /dev/null
+++ b/tests/riscv32/Cargo.toml
@@ -0,0 +1,46 @@
1[package]
2edition = "2021"
3name = "embassy-riscv-tests"
4version = "0.1.0"
5license = "MIT OR Apache-2.0"
6
7[dependencies]
8critical-section = { version = "1.1.1", features = ["restore-state-bool"] }
9embassy-sync = { version = "0.1.0", path = "../../embassy-sync" }
10embassy-executor = { version = "0.1.0", path = "../../embassy-executor", features = ["arch-riscv32", "nightly", "executor-thread"] }
11embassy-time = { version = "0.1.0", path = "../../embassy-time" }
12embassy-futures = { version = "0.1.0", path = "../../embassy-futures" }
13
14riscv-rt = "0.11"
15riscv = { version = "0.10", features = ["critical-section-single-hart"] }
16
17
18[profile.dev]
19debug = 2
20debug-assertions = true
21opt-level = 's'
22overflow-checks = true
23
24[profile.release]
25codegen-units = 1
26debug = 2
27debug-assertions = false
28incremental = false
29lto = "fat"
30opt-level = 's'
31overflow-checks = false
32
33# do not optimize proc-macro crates = faster builds from scratch
34[profile.dev.build-override]
35codegen-units = 8
36debug = false
37debug-assertions = false
38opt-level = 0
39overflow-checks = false
40
41[profile.release.build-override]
42codegen-units = 8
43debug = false
44debug-assertions = false
45opt-level = 0
46overflow-checks = false
diff --git a/tests/riscv32/build.rs b/tests/riscv32/build.rs
new file mode 100644
index 000000000..e4a26c4a1
--- /dev/null
+++ b/tests/riscv32/build.rs
@@ -0,0 +1,8 @@
1use std::error::Error;
2
3fn main() -> Result<(), Box<dyn Error>> {
4 println!("cargo:rustc-link-arg-bins=-Tmemory.x");
5 println!("cargo:rustc-link-arg-bins=-Tlink.x");
6
7 Ok(())
8}
diff --git a/tests/riscv32/memory.x b/tests/riscv32/memory.x
new file mode 100644
index 000000000..316d577d4
--- /dev/null
+++ b/tests/riscv32/memory.x
@@ -0,0 +1,14 @@
1MEMORY
2{
3 ROM : ORIGIN = 0x80000000, LENGTH = 0x00020000
4 RAM : ORIGIN = 0x84000000, LENGTH = 0x00008000
5}
6
7REGION_ALIAS("REGION_TEXT", ROM);
8REGION_ALIAS("REGION_RODATA", ROM);
9REGION_ALIAS("REGION_DATA", RAM);
10REGION_ALIAS("REGION_BSS", RAM);
11REGION_ALIAS("REGION_HEAP", RAM);
12REGION_ALIAS("REGION_STACK", RAM);
13
14_stack_start = ORIGIN(RAM) + LENGTH(RAM) - 4;
diff --git a/tests/riscv32/src/bin/empty.rs b/tests/riscv32/src/bin/empty.rs
new file mode 100644
index 000000000..1874caec4
--- /dev/null
+++ b/tests/riscv32/src/bin/empty.rs
@@ -0,0 +1,16 @@
1#![no_std]
2#![no_main]
3#![feature(type_alias_impl_trait)]
4
5use embassy_executor::Spawner;
6
7#[panic_handler]
8fn panic(_info: &core::panic::PanicInfo) -> ! {
9 loop {}
10}
11
12#[embassy_executor::main]
13async fn main(_spawner: Spawner) {
14 // Don't do anything, just make sure it compiles.
15 loop {}
16}