aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/riscv32/.cargo/config.toml9
-rw-r--r--tests/riscv32/Cargo.toml46
-rw-r--r--tests/riscv32/memory.x14
-rw-r--r--tests/riscv32/src/bin/empty.rs16
4 files changed, 85 insertions, 0 deletions
diff --git a/tests/riscv32/.cargo/config.toml b/tests/riscv32/.cargo/config.toml
new file mode 100644
index 000000000..1ffb0305d
--- /dev/null
+++ b/tests/riscv32/.cargo/config.toml
@@ -0,0 +1,9 @@
1[target.riscv32imac-unknown-none-elf]
2runner = "true"
3rustflags = [
4 "-C", "link-arg=-Tmemory.x",
5 "-C", "link-arg=-Tlink.x",
6]
7
8[build]
9target = "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/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..d5a55c84f
--- /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}