Skip to content

Commit 61f3250

Browse files
authored
Merge pull request #58 from kaspar030/std
feat: initial std support
2 parents 9dd53bb + baf37a0 commit 61f3250

File tree

16 files changed

+562
-37
lines changed

16 files changed

+562
-37
lines changed

Cargo.toml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ categories = ["embedded", "no-std", "development-tools::testing"]
1212
default-target = "riscv32imac-unknown-none-elf"
1313

1414
[dependencies]
15-
semihosting = { version = "0.1.7", features = ["args"] }
15+
semihosting = { version = "0.1.7", features = ["args"], optional = true }
1616
embedded-test-macros = { version = "0.6.0", path = "./macros" }
1717
serde = { version = "1.0.193", default-features = false, features = ["derive"] }
1818
serde-json-core = { version = "0.5.1" }
@@ -25,7 +25,13 @@ embassy-executor = { version = "0.7.0", optional = true, default-features = fals
2525

2626

2727
[features]
28-
default = ["panic-handler"]
28+
default = ["semihosting", "panic-handler"]
29+
30+
# use semihosting (for embedded targets)
31+
semihosting = ["dep:semihosting"]
32+
33+
# use std functionality
34+
std = []
2935

3036
# defines a panic-handler which will invoke `semihosting::process::abort()` on panic
3137
panic-handler = []
@@ -38,10 +44,7 @@ log = ["dep:log"]
3844

3945
# Enables async test and init functions using embassy-executor.
4046
# Note: You need to enable at least one executor feature on embassy unless you are using the `external-executor` feature
41-
embassy = [
42-
"embedded-test-macros/embassy",
43-
"dep:embassy-executor",
44-
]
47+
embassy = ["embedded-test-macros/embassy", "dep:embassy-executor"]
4548

4649
# you will use your own executor by setting it via the `tasks` macro, e.g. `#[embedded_test::tests(executor = esp_hal::embassy::executor::thread::Executor::new())]`
4750
external-executor = ["embedded-test-macros/external-executor"]

build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ macro_rules! assert_unique_features {
2222
fn main() -> Result<(), Box<dyn Error>> {
2323
assert_unique_features!("log", "defmt");
2424
assert_unique_features!("ariel-os", "external-executor");
25+
assert_unique_features!("std", "semihosting");
2526

2627
let out = &PathBuf::from(env::var("OUT_DIR")?);
2728
let linker_script = fs::read_to_string("embedded-test.x")?;

examples/std/.cargo/config.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[build]
2+
# The repository level `.cargo/config.toml` sets an embedded target, which we
3+
# want to override here. Unfortunately there is no `host target triple`, so
4+
# this is hard-coded to x86_64 Linux here. This needs changing on other
5+
# platforms.
6+
target = "x86_64-unknown-linux-gnu"
7+
[target."x86_64-unknown-linux-gnu"]
8+
runner = "embedded-test-std-runner"

examples/std/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/target

examples/std/Cargo.lock

Lines changed: 317 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)