Skip to content

feat: initial std support #58

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ categories = ["embedded", "no-std", "development-tools::testing"]
default-target = "riscv32imac-unknown-none-elf"

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


[features]
default = ["panic-handler"]
default = ["semihosting", "panic-handler"]

# use semihosting (for embedded targets)
semihosting = ["dep:semihosting"]

# use std functionality
std = []

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

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

# 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())]`
external-executor = ["embedded-test-macros/external-executor"]
Expand Down
1 change: 1 addition & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ macro_rules! assert_unique_features {
fn main() -> Result<(), Box<dyn Error>> {
assert_unique_features!("log", "defmt");
assert_unique_features!("ariel-os", "external-executor");
assert_unique_features!("std", "semihosting");

let out = &PathBuf::from(env::var("OUT_DIR")?);
let linker_script = fs::read_to_string("embedded-test.x")?;
Expand Down
8 changes: 8 additions & 0 deletions examples/std/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[build]
# The repository level `.cargo/config.toml` sets an embedded target, which we
# want to override here. Unfortunately there is no `host target triple`, so
# this is hard-coded to x86_64 Linux here. This needs changing on other
# platforms.
target = "x86_64-unknown-linux-gnu"
[target."x86_64-unknown-linux-gnu"]
runner = "embedded-test-std-runner"
1 change: 1 addition & 0 deletions examples/std/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/target
317 changes: 317 additions & 0 deletions examples/std/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading