diff --git a/crates/algorithms/.cargo/config.toml b/crates/algorithms/.cargo/config.toml new file mode 100755 index 0000000..2ee3037 --- /dev/null +++ b/crates/algorithms/.cargo/config.toml @@ -0,0 +1,13 @@ +[build] +target = "x86_64-unknown-linux-gnu" + +[alias] +abuild = "build --target thumbv6m-none-eabi" +atest = "test --target x86_64-unknown-linux-gnu" +abench = "bench --target x86_64-unknown-linux-gnu" +acheck = "check --target x86_64-unknown-linux-gnu" +aclippy = "clippy --target thumbv6m-none-eabi" +cflash = "flash --chip STM32L053R8" + +[env] +DEFMT_LOG = "trace" # sets the log level to trace diff --git a/crates/algorithms/build.rs b/crates/algorithms/build.rs index 53f2a08..2f02505 100755 --- a/crates/algorithms/build.rs +++ b/crates/algorithms/build.rs @@ -17,7 +17,7 @@ fn main() { .status() .expect("could not cleanup old algorithms-c files"); } - #[cfg(target_os = "linux")] + #[cfg(not(target_os = "windows"))] { std::process::Command::new("ceedling") .arg("clobber") @@ -28,7 +28,7 @@ fn main() { #[cfg(target_os = "windows")] let mut cmd = std::process::Command::new("ceedling.bat"); - #[cfg(target_os = "linux")] + #[cfg(not(target_os = "windows"))] let mut cmd = std::process::Command::new("ceedling"); cmd.arg("release"); @@ -36,11 +36,11 @@ fn main() { let pw = env("CARGO_CFG_TARGET_POINTER_WIDTH"); let os = env("CARGO_CFG_TARGET_OS"); - if arch == "arm" && pw == "32" && os == "none" { + if arch == "arm" && pw == "32" && os == "none" && !cfg!(test) { cmd.env("CC", "arm-none-eabi-gcc") .env("AR", "arm-none-eabi-ar") .env("CC_FLAGS", "-march=armv6-m"); - } else if os == "linux" || os == "windows" { + } else if os == "linux" || os == "windows" || cfg!(test) { cmd.env("CC", "gcc").env("AR", "ar"); } else { panic!("Unsupported build target") @@ -52,7 +52,7 @@ fn main() { .status() .expect("could not make c stuff"); if !status.success() { - panic!("make returned an error") + panic!("ceedling returned an error") } let cwd = std::env::current_dir().unwrap().display().to_string(); let libpath_s = format!("{cwd}/algorithms-c/build/artifacts/release/libalgorithms.a");