chore: build and test shenanigans
This commit is contained in:
parent
b3ca9eeabf
commit
e2bc777410
6 changed files with 34 additions and 11 deletions
|
@ -1,15 +1,10 @@
|
||||||
[build]
|
|
||||||
# target = "thumbv6m-none-eabi"
|
|
||||||
|
|
||||||
[test]
|
|
||||||
target = "x86_64-unknown-linux-gnu"
|
|
||||||
|
|
||||||
[target.thumbv6m-none-eabi]
|
[target.thumbv6m-none-eabi]
|
||||||
runner = 'probe-rs run --chip STM32L053R8'
|
runner = 'probe-rs run --chip STM32L053R8'
|
||||||
|
|
||||||
|
|
||||||
[alias]
|
[alias]
|
||||||
target = "thumbv6m-none-eabi"
|
arun = "run --target thumbv6m-none-eabi"
|
||||||
|
atest = "test --target x86_64-unknown-linux-gnu"
|
||||||
cflash = "flash --chip STM32L053R8"
|
cflash = "flash --chip STM32L053R8"
|
||||||
|
|
||||||
[env]
|
[env]
|
||||||
|
|
|
@ -15,6 +15,10 @@ defmt = { version = "1.0.1" }
|
||||||
defmt-rtt = { version = "1.0.0" }
|
defmt-rtt = { version = "1.0.0" }
|
||||||
panic-probe = { version = "0.3", features = ["print-defmt"] }
|
panic-probe = { version = "0.3", features = ["print-defmt"] }
|
||||||
|
|
||||||
|
[features]
|
||||||
|
default = ["buildscript"]
|
||||||
|
buildscript = []
|
||||||
|
|
||||||
[profile.release]
|
[profile.release]
|
||||||
debug = "full" # those are not on the board
|
debug = "full" # those are not on the board
|
||||||
|
|
||||||
|
|
9
build.rs
9
build.rs
|
@ -1,5 +1,8 @@
|
||||||
fn main() {
|
fn main() {
|
||||||
println!("cargo::rerun-if-changed=Cargo.toml");
|
#[cfg(feature = "buildscript")]
|
||||||
println!("cargo::rustc-link-arg=-Tlink.x");
|
{
|
||||||
println!("cargo::rustc-link-arg=-Tdefmt.x");
|
println!("cargo::rerun-if-changed=Cargo.toml");
|
||||||
|
println!("cargo::rustc-link-arg=-Tlink.x");
|
||||||
|
println!("cargo::rustc-link-arg=-Tdefmt.x");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,23 @@
|
||||||
|
use crate::Crc;
|
||||||
|
|
||||||
|
struct CrcDev;
|
||||||
|
impl Crc for CrcDev {
|
||||||
|
type Input = [u8];
|
||||||
|
type Checksum = [u8; Self::CHECKSUM_LEN];
|
||||||
|
const CHECKSUM_LEN: usize = 4;
|
||||||
|
|
||||||
|
fn process(data: &Self::Input) -> Self::Checksum {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn it_works() {
|
fn it_works() {
|
||||||
assert_eq!(2 + 2, 4);
|
let data = [0, 1, 2, 3, 4, 5, 6];
|
||||||
|
assert_eq!(CrcDev::process(&data), [1, 2, 3, 4])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#![no_std]
|
||||||
|
|
||||||
mod crc_32;
|
mod crc_32;
|
||||||
pub use crc_32::*;
|
pub use crc_32::*;
|
||||||
|
|
||||||
|
|
5
scripts/test_crc.sh
Executable file
5
scripts/test_crc.sh
Executable file
|
@ -0,0 +1,5 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# I'm using a bash script because if i set the target in .cargo/config.toml
|
||||||
|
# i can't build for x86_64 anymore, which means I can't run the unit tests.
|
||||||
|
TARGET="x86_64-unknown-linux-gnu"
|
||||||
|
cargo test --target $TARGET -p crc --no-default-features
|
Loading…
Add table
Reference in a new issue