From 933230126e65ab872092ca58785197c526257f11 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 16 Aug 2022 02:15:57 +0200 Subject: [PATCH] tested cross-compilation --- Cargo.toml | 11 +++++------ src/lib.rs | 9 +++++++-- src/time.rs | 4 ++++ 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 4b6d4cb..9f31276 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,18 +12,17 @@ categories = ["aerospace", "aerospace::space-protocols", "no-std", "hardware-sup # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -num = "0.4" -serde = { version = "1.0.142", features = ["derive"] } +num = { version = "0.4", default-features = false } +serde = { version = "1.0.142", default-features = false, features = ["derive"] } zerocopy = "0.6.1" crc = "3.0.0" delegate = "0.7.0" -chrono = "0.4.20" +chrono = { version = "0.4.20", default-features = false } [dev-dependencies.postcard] version = "1.0.1" -features = ["use-std"] [features] default = ["alloc"] -std = ["postcard/use-std"] -alloc = ["serde/alloc"] +std = ["chrono/std", "chrono/clock", "postcard/use-std"] +alloc = ["serde/alloc", "chrono/alloc", "postcard/alloc"] diff --git a/src/lib.rs b/src/lib.rs index e61e3a0..9c87618 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -512,11 +512,15 @@ pub mod zc { mod tests { use crate::SpHeader; use crate::{ - packet_type_in_raw_packet_id, zc, CcsdsPacket, CcsdsPrimaryHeader, PacketId, + packet_type_in_raw_packet_id, zc, CcsdsPacket, PacketId, PacketSequenceCtrl, PacketType, SequenceFlags, }; use alloc::vec; - use postcard::{from_bytes, to_stdvec}; + use postcard::from_bytes; + #[cfg(feature = "std")] + use postcard::to_stdvec; + #[cfg(feature = "std")] + use crate::CcsdsPrimaryHeader; #[test] fn test_seq_flag_helpers() { @@ -599,6 +603,7 @@ mod tests { } #[test] + #[cfg(feature = "std")] fn test_serde_sph() { let sp_header = SpHeader::tc(0x42, 12, 0).expect("Error creating SP header"); assert_eq!(sp_header.ccsds_version(), 0b000); diff --git a/src/time.rs b/src/time.rs index eb68a48..ae1f067 100644 --- a/src/time.rs +++ b/src/time.rs @@ -2,6 +2,10 @@ use crate::{PacketError, SizeMissmatch}; use chrono::{DateTime, TimeZone, Utc}; +#[allow(unused_imports)] +#[cfg(not(feature = "std"))] +use num::traits::float::FloatCore; + use crate::time::CcsdsTimeCodes::Cds; #[cfg(feature = "std")] use std::time::{SystemTime, SystemTimeError};