From 19d43b1b2ccd0cf24eb42f81ca8e6e247c3842bb Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 25 Jan 2023 01:40:44 +0100 Subject: [PATCH 01/20] Extend scheduler and tests 1. `reset` and `release_telecommands`: Add store handling to avoid memory leaks 2. Add first documentation 3. Add `new_with_current_time` method. --- .idea/runConfigurations/Test_satrs_core.xml | 19 ++ satrs-core/src/pus/scheduling.rs | 222 +++++++++++--------- 2 files changed, 147 insertions(+), 94 deletions(-) create mode 100644 .idea/runConfigurations/Test_satrs_core.xml diff --git a/.idea/runConfigurations/Test_satrs_core.xml b/.idea/runConfigurations/Test_satrs_core.xml new file mode 100644 index 0000000..fe5e4da --- /dev/null +++ b/.idea/runConfigurations/Test_satrs_core.xml @@ -0,0 +1,19 @@ + + + + \ No newline at end of file diff --git a/satrs-core/src/pus/scheduling.rs b/satrs-core/src/pus/scheduling.rs index 3205a59..ec2744c 100644 --- a/satrs-core/src/pus/scheduling.rs +++ b/satrs-core/src/pus/scheduling.rs @@ -1,12 +1,20 @@ -use crate::pool::StoreAddr; +use crate::pool::{PoolProvider, StoreAddr, StoreError}; use alloc::collections::btree_map::{Entry, Range}; +use alloc::vec; +use alloc::vec::Vec; use core::time::Duration; use spacepackets::time::UnixTimestamp; use std::collections::BTreeMap; +#[cfg(feature = "std")] use std::time::SystemTimeError; -use std::vec; -use std::vec::Vec; +/// This is the core data structure for scheduling PUS telecommands with [alloc] support. +/// +/// The ECSS standard specifies that the PUS scheduler can be enabled and disabled. +/// A disabled scheduler should still delete commands where the execution time has been reached +/// but should not release them to be executed. +/// +/// Currently, sub-schedules and groups are not supported. #[derive(Debug)] pub struct PusScheduler { tc_map: BTreeMap>, @@ -16,6 +24,14 @@ pub struct PusScheduler { } impl PusScheduler { + /// Create a new PUS scheduler. + /// + /// # Arguments + /// + /// * `init_current_time` - The time to initialize the scheduler with. + /// * `time_margin` - This time margin is used when inserting new telecommands into the + /// schedule. If the release time of a new telecommand is earlier than the time margin + /// added to the current time, it will not be inserted into the schedule. pub fn new(init_current_time: UnixTimestamp, time_margin: Duration) -> Self { PusScheduler { tc_map: Default::default(), @@ -25,6 +41,13 @@ impl PusScheduler { } } + /// Like [Self::new], but sets the `init_current_time` parameter to the current system time. + #[cfg(feature = "std")] + #[cfg_attr(doc_cfg, doc(cfg(feature = "std")))] + pub fn new_with_current_init_time(time_margin: Duration) -> Result { + Ok(Self::new(UnixTimestamp::from_now()?, time_margin)) + } + pub fn num_scheduled_telecommands(&self) -> u64 { let mut num_entries = 0; for entries in &self.tc_map { @@ -45,9 +68,25 @@ impl PusScheduler { self.enabled = false; } - pub fn reset(&mut self) { + /// This will disable the scheduler and clear the schedule as specified in 6.11.4.4. + /// Be careful with this command as it will delete all the commands in the schedule. + /// + /// The holding store for the telecommands needs to be passed so all the stored telecommands + /// can be deleted to avoid a memory leak. If at last one deletion operation fails, the error + /// will be returned but the method will still try to delete all the commands in the schedule. + pub fn reset(&mut self, store: &mut impl PoolProvider) -> Result<(), StoreError> { self.enabled = false; + let mut deletion_ok = Ok(()); + for tc_lists in &mut self.tc_map { + for tc in tc_lists.1 { + let res = store.delete(*tc); + if res.is_err() { + deletion_ok = res; + } + } + } self.tc_map.clear(); + deletion_ok } pub fn update_time(&mut self, current_time: UnixTimestamp) { @@ -84,27 +123,42 @@ impl PusScheduler { Ok(()) } - pub fn release_telecommands(&mut self, mut releaser: R) { + /// Utility method which calls [Self::telecommands_to_release] and then calls a releaser + /// closure for each telecommand which should be released. This function will also delete + /// the telecommands from the holding store after calling the release closure. + pub fn release_telecommands( + &mut self, + mut releaser: R, + store: &mut impl PoolProvider, + ) -> Result { let tcs_to_release = self.telecommands_to_release(); + let mut released_tcs = 0; + let mut store_error = Ok(()); for tc in tcs_to_release { for addr in tc.1 { releaser(self.enabled, addr); + released_tcs += 1; + let res = store.delete(*addr); + if res.is_err() { + store_error = res; + } } } self.tc_map.retain(|k, _| k > &self.current_time); + store_error + .map(|_| released_tcs) + .map_err(|e| (released_tcs, e)) } } #[cfg(test)] mod tests { - use crate::pool::StoreAddr; + use crate::pool::{LocalPool, PoolCfg, PoolProvider, StoreAddr}; use crate::pus::scheduling::PusScheduler; - use spacepackets::ecss::PacketTypeCodes::UnsignedInt; + use alloc::vec::Vec; use spacepackets::time::UnixTimestamp; - use std::sync::mpsc; - use std::sync::mpsc::{channel, Receiver, TryRecvError}; use std::time::Duration; - use std::vec::Vec; + #[allow(unused_imports)] use std::{println, vec}; #[test] @@ -118,44 +172,33 @@ mod tests { #[test] fn reset() { + let mut pool = LocalPool::new(PoolCfg::new(vec![(10, 32), (5, 64)])); let mut scheduler = PusScheduler::new(UnixTimestamp::new_only_seconds(0), Duration::from_secs(5)); - let worked = scheduler.insert_tc( - UnixTimestamp::new_only_seconds(100), - StoreAddr { - pool_idx: 0, - packet_idx: 1, - }, - ); + let first_addr = pool.add(&[0, 1, 2]).unwrap(); + let worked = scheduler.insert_tc(UnixTimestamp::new_only_seconds(100), first_addr.clone()); assert!(worked); - let worked = scheduler.insert_tc( - UnixTimestamp::new_only_seconds(200), - StoreAddr { - pool_idx: 0, - packet_idx: 2, - }, - ); + let second_addr = pool.add(&[2, 3, 4]).unwrap(); + let worked = scheduler.insert_tc(UnixTimestamp::new_only_seconds(200), second_addr.clone()); assert!(worked); - let worked = scheduler.insert_tc( - UnixTimestamp::new_only_seconds(300), - StoreAddr { - pool_idx: 0, - packet_idx: 2, - }, - ); + let third_addr = pool.add(&[5, 6, 7]).unwrap(); + let worked = scheduler.insert_tc(UnixTimestamp::new_only_seconds(300), third_addr.clone()); assert!(worked); assert_eq!(scheduler.num_scheduled_telecommands(), 3); assert!(scheduler.is_enabled()); - scheduler.reset(); + scheduler.reset(&mut pool).expect("deletion of TCs failed"); assert!(!scheduler.is_enabled()); assert_eq!(scheduler.num_scheduled_telecommands(), 0); + assert!(!pool.has_element_at(&first_addr).unwrap()); + assert!(!pool.has_element_at(&second_addr).unwrap()); + assert!(!pool.has_element_at(&third_addr).unwrap()); } #[test] @@ -205,69 +248,66 @@ mod tests { assert_eq!(scheduler.current_time(), &time); } + fn common_check( + enabled: bool, + store_addr: &StoreAddr, + expected_store_addrs: Vec, + counter: &mut usize, + ) { + assert_eq!(enabled, true); + assert!(expected_store_addrs.contains(store_addr)); + *counter += 1; + } #[test] fn release_basic() { + let mut pool = LocalPool::new(PoolCfg::new(vec![(10, 32), (5, 64)])); let mut scheduler = PusScheduler::new(UnixTimestamp::new_only_seconds(0), Duration::from_secs(5)); - scheduler.insert_tc( - UnixTimestamp::new_only_seconds(100), - StoreAddr { - pool_idx: 0, - packet_idx: 1, - }, - ); + let first_addr = pool.add(&[2, 2, 2]).unwrap(); + scheduler.insert_tc(UnixTimestamp::new_only_seconds(100), first_addr); - scheduler.insert_tc( - UnixTimestamp::new_only_seconds(200), - StoreAddr { - pool_idx: 0, - packet_idx: 2, - }, - ); + let second_addr = pool.add(&[5, 6, 7]).unwrap(); + scheduler.insert_tc(UnixTimestamp::new_only_seconds(200), second_addr); let mut i = 0; let mut test_closure_1 = |boolvar: bool, store_addr: &StoreAddr| { - assert_eq!(boolvar, true); - assert_eq!( - store_addr, - &StoreAddr { - pool_idx: 0, - packet_idx: 1, - } - ); - i += 1; + common_check(boolvar, store_addr, vec![first_addr], &mut i); }; // test 1: too early, no tcs scheduler.update_time(UnixTimestamp::new_only_seconds(99)); - scheduler.release_telecommands(&mut test_closure_1); + scheduler + .release_telecommands(&mut test_closure_1, &mut pool) + .expect("deletion failed"); // test 2: exact time stamp of tc, releases 1 tc scheduler.update_time(UnixTimestamp::new_only_seconds(100)); - scheduler.release_telecommands(&mut test_closure_1); + let mut released = scheduler + .release_telecommands(&mut test_closure_1, &mut pool) + .expect("deletion failed"); + assert_eq!(released, 1); + assert!(!pool.has_element_at(&first_addr).unwrap()); // test 3, late timestamp, release 1 overdue tc let mut test_closure_2 = |boolvar: bool, store_addr: &StoreAddr| { - assert_eq!(boolvar, true); - assert_eq!( - store_addr, - &StoreAddr { - pool_idx: 0, - packet_idx: 2, - } - ); - i += 1; + common_check(boolvar, store_addr, vec![second_addr], &mut i); }; scheduler.update_time(UnixTimestamp::new_only_seconds(206)); - scheduler.release_telecommands(&mut test_closure_2); + released = scheduler + .release_telecommands(&mut test_closure_2, &mut pool) + .expect("deletion failed"); + assert_eq!(released, 1); + assert!(!pool.has_element_at(&second_addr).unwrap()); //test 4: no tcs left - scheduler.release_telecommands(&mut test_closure_2); + scheduler + .release_telecommands(&mut test_closure_2, &mut pool) + .expect("deletion failed"); // check that 2 total tcs have been released assert_eq!(i, 2); @@ -275,50 +315,44 @@ mod tests { #[test] fn release_multi_with_same_time() { + let mut pool = LocalPool::new(PoolCfg::new(vec![(10, 32), (5, 64)])); let mut scheduler = PusScheduler::new(UnixTimestamp::new_only_seconds(0), Duration::from_secs(5)); - scheduler.insert_tc( - UnixTimestamp::new_only_seconds(100), - StoreAddr { - pool_idx: 0, - packet_idx: 1, - }, - ); + let first_addr = pool.add(&[2, 2, 2]).unwrap(); + scheduler.insert_tc(UnixTimestamp::new_only_seconds(100), first_addr); - scheduler.insert_tc( - UnixTimestamp::new_only_seconds(100), - StoreAddr { - pool_idx: 0, - packet_idx: 1, - }, - ); + let second_addr = pool.add(&[2, 2, 2]).unwrap(); + scheduler.insert_tc(UnixTimestamp::new_only_seconds(100), second_addr); let mut i = 0; let mut test_closure = |boolvar: bool, store_addr: &StoreAddr| { - assert_eq!(boolvar, true); - assert_eq!( - store_addr, - &StoreAddr { - pool_idx: 0, - packet_idx: 1, - } - ); - i += 1; + common_check(boolvar, store_addr, vec![first_addr, second_addr], &mut i); }; // test 1: too early, no tcs scheduler.update_time(UnixTimestamp::new_only_seconds(99)); - scheduler.release_telecommands(&mut test_closure); + let mut released = scheduler + .release_telecommands(&mut test_closure, &mut pool) + .expect("deletion failed"); + assert_eq!(released, 0); // test 2: exact time stamp of tc, releases 2 tc scheduler.update_time(UnixTimestamp::new_only_seconds(100)); - scheduler.release_telecommands(&mut test_closure); + released = scheduler + .release_telecommands(&mut test_closure, &mut pool) + .expect("deletion failed"); + assert_eq!(released, 2); + assert!(!pool.has_element_at(&first_addr).unwrap()); + assert!(!pool.has_element_at(&second_addr).unwrap()); //test 3: no tcs left - scheduler.release_telecommands(&mut test_closure); + released = scheduler + .release_telecommands(&mut test_closure, &mut pool) + .expect("deletion failed"); + assert_eq!(released, 0); // check that 2 total tcs have been released assert_eq!(i, 2); From 36e63bc9a9a12bde1c9251409a376bb8eb616881 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 25 Jan 2023 10:43:11 +0100 Subject: [PATCH 02/20] closure returns a boolean whether to del or not --- satrs-core/src/pus/scheduling.rs | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/satrs-core/src/pus/scheduling.rs b/satrs-core/src/pus/scheduling.rs index ec2744c..58ae535 100644 --- a/satrs-core/src/pus/scheduling.rs +++ b/satrs-core/src/pus/scheduling.rs @@ -126,21 +126,30 @@ impl PusScheduler { /// Utility method which calls [Self::telecommands_to_release] and then calls a releaser /// closure for each telecommand which should be released. This function will also delete /// the telecommands from the holding store after calling the release closure. - pub fn release_telecommands( + /// + /// # Arguments + /// + /// * `releaser` - Closure where the first argument is whether the scheduler is enabled and + /// the second argument is the store address. This closure should return whether the + /// command should be deleted. + /// * `store` - The holding store of the telecommands. + pub fn release_telecommands bool>( &mut self, mut releaser: R, - store: &mut impl PoolProvider, + tc_store: &mut impl PoolProvider, ) -> Result { let tcs_to_release = self.telecommands_to_release(); let mut released_tcs = 0; let mut store_error = Ok(()); for tc in tcs_to_release { for addr in tc.1 { - releaser(self.enabled, addr); + let should_delete = releaser(self.enabled, addr); released_tcs += 1; - let res = store.delete(*addr); - if res.is_err() { - store_error = res; + if should_delete { + let res = tc_store.delete(*addr); + if res.is_err() { + store_error = res; + } } } } @@ -273,6 +282,7 @@ mod tests { let mut i = 0; let mut test_closure_1 = |boolvar: bool, store_addr: &StoreAddr| { common_check(boolvar, store_addr, vec![first_addr], &mut i); + true }; // test 1: too early, no tcs @@ -294,6 +304,7 @@ mod tests { // test 3, late timestamp, release 1 overdue tc let mut test_closure_2 = |boolvar: bool, store_addr: &StoreAddr| { common_check(boolvar, store_addr, vec![second_addr], &mut i); + true }; scheduler.update_time(UnixTimestamp::new_only_seconds(206)); @@ -328,6 +339,7 @@ mod tests { let mut i = 0; let mut test_closure = |boolvar: bool, store_addr: &StoreAddr| { common_check(boolvar, store_addr, vec![first_addr, second_addr], &mut i); + true }; // test 1: too early, no tcs From 7a2d518a8c77688a45b63a6f6f25a307227efbb0 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 25 Jan 2023 10:52:24 +0100 Subject: [PATCH 03/20] docs fixes --- satrs-core/src/pus/mod.rs | 13 +++++++------ satrs-core/src/pus/scheduling.rs | 10 +++++++++- satrs-core/src/pus/verification.rs | 2 +- satrs-core/src/seq_count.rs | 2 +- 4 files changed, 18 insertions(+), 9 deletions(-) diff --git a/satrs-core/src/pus/mod.rs b/satrs-core/src/pus/mod.rs index 6bbc165..d0c1964 100644 --- a/satrs-core/src/pus/mod.rs +++ b/satrs-core/src/pus/mod.rs @@ -1,8 +1,4 @@ -//! All PUS support modules -//! -//! Currenty includes: -//! -//! 1. PUS Verification Service 1 module inside [verification]. Requires [alloc] support. +//! # PUS support modules #[cfg(feature = "alloc")] use downcast_rs::{impl_downcast, Downcast}; #[cfg(feature = "alloc")] @@ -19,6 +15,9 @@ pub mod hk; pub mod scheduling; pub mod verification; +#[cfg(feature = "alloc")] +pub use alloc_mod::*; + #[derive(Debug, Clone)] pub enum EcssTmErrorWithSend { /// Errors related to sending the verification telemetry to a TM recipient @@ -65,7 +64,7 @@ pub trait EcssTmSenderCore: Send { } #[cfg(feature = "alloc")] -pub mod alloc_mod { +mod alloc_mod { use super::*; /// Extension trait for [EcssTmSenderCore]. @@ -78,6 +77,8 @@ pub mod alloc_mod { /// /// [DynClone] allows cloning the trait object as long as the boxed object implements /// [Clone]. + #[cfg(feature = "alloc")] + #[cfg_attr(doc_cfg, doc(cfg(feature = "alloc")))] pub trait EcssTmSender: EcssTmSenderCore + Downcast + DynClone {} /// Blanket implementation for all types which implement [EcssTmSenderCore] and are clonable. diff --git a/satrs-core/src/pus/scheduling.rs b/satrs-core/src/pus/scheduling.rs index 58ae535..2f91483 100644 --- a/satrs-core/src/pus/scheduling.rs +++ b/satrs-core/src/pus/scheduling.rs @@ -1,3 +1,4 @@ +//! # PUS Service 11 Scheduling Module use crate::pool::{PoolProvider, StoreAddr, StoreError}; use alloc::collections::btree_map::{Entry, Range}; use alloc::vec; @@ -10,7 +11,14 @@ use std::time::SystemTimeError; /// This is the core data structure for scheduling PUS telecommands with [alloc] support. /// -/// The ECSS standard specifies that the PUS scheduler can be enabled and disabled. +/// It is assumed that the actual telecommand data is stored in a separate TC pool offering +/// a [crate::pool::PoolProvider] API. This data structure just tracks the store addresses and their +/// release times and offers a convenient API to insert and release telecommands and perform +/// other functionality specified by the ECSS standard in section 6.11. The time is tracked +/// as a [spacepackets::time::UnixTimestamp] but the only requirement to the timekeeping of +/// the user is that it is convertible to that timestamp. +/// +/// The standard also specifies that the PUS scheduler can be enabled and disabled. /// A disabled scheduler should still delete commands where the execution time has been reached /// but should not release them to be executed. /// diff --git a/satrs-core/src/pus/verification.rs b/satrs-core/src/pus/verification.rs index 8fba721..96c1073 100644 --- a/satrs-core/src/pus/verification.rs +++ b/satrs-core/src/pus/verification.rs @@ -1,4 +1,4 @@ -//! # PUS Verification Service 1 Module +//! # PUS Service 1 Verification Module //! //! This module allows packaging and sending PUS Service 1 packets. It is conforming to section //! 8 of the PUS standard ECSS-E-ST-70-41C. diff --git a/satrs-core/src/seq_count.rs b/satrs-core/src/seq_count.rs index 6871491..b299756 100644 --- a/satrs-core/src/seq_count.rs +++ b/satrs-core/src/seq_count.rs @@ -9,7 +9,7 @@ pub use stdmod::*; /// /// The core functions are not mutable on purpose to allow easier usage with /// static structs when using the interior mutability pattern. This can be achieved by using -/// [Cell], [RefCell] or atomic types. +/// [Cell], [core::cell::RefCell] or atomic types. pub trait SequenceCountProviderCore { fn get(&self) -> Raw; From 42b2ed486f09158d2c498b1bdbc108ca45e33100 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 25 Jan 2023 20:37:28 +0100 Subject: [PATCH 04/20] remove spacepackets submodule --- .gitmodules | 3 --- spacepackets | 1 - 2 files changed, 4 deletions(-) delete mode 160000 spacepackets diff --git a/.gitmodules b/.gitmodules index 36a814b..e69de29 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +0,0 @@ -[submodule "spacepackets"] - path = spacepackets - url = https://egit.irs.uni-stuttgart.de/rust/spacepackets.git diff --git a/spacepackets b/spacepackets deleted file mode 160000 index a268903..0000000 --- a/spacepackets +++ /dev/null @@ -1 +0,0 @@ -Subproject commit a268903105ced2280abbd7df528063b324df4a6d From b217654d73291f2373632de7dcfd027caab4f634 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 25 Jan 2023 21:06:29 +0100 Subject: [PATCH 05/20] update README --- README.md | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 3c951e3..750b28f 100644 --- a/README.md +++ b/README.md @@ -4,15 +4,29 @@ sat-rs launchpad This is the prototyping repository for the initial version of a Rust Flight Software Framework. -Currently, it contains the following major subcrates: +Its primary goal is to provide re-usable components to write on-board software for remote +systems like rovers or satellites. It is specifically written for the special requirements +for these systems. -1. The [`spacepackets`](https://egit.irs.uni-stuttgart.de/rust/spacepackets) crate which contains - basic ECSS and CCSDS packet protocol implementations. -2. The [`satrs-core`](https://egit.irs.uni-stuttgart.de/rust/satrs-launchpad/src/branch/main/satrs-core) - crate containing the core components of sat-rs -3. The [`satrs-example`](https://egit.irs.uni-stuttgart.de/rust/satrs-launchpad/src/branch/main/satrs-example) - crate which shows a simple example on-board software using various sat-rs components. +# Overview -The [`satrs-example-stm32f3-disco`](https://egit.irs.uni-stuttgart.de/rust/satrs-example-stm32f3-disco) -crate contains an example of how components can be used in a bare-metal system with constrained -resources. +This project currently contains following crates: + +* [`satrs-core`](https://egit.irs.uni-stuttgart.de/rust/satrs-launchpad/src/branch/main/satrs-core): + Core components of sat-rs +* [`satrs-example`](https://egit.irs.uni-stuttgart.de/rust/satrs-launchpad/src/branch/main/satrs-example): + Example of a simple example on-board software using various sat-rs components which can be run + on a host computer or on any system with a standard runtime like a Raspberry Pi. +* [`satrs-example-stm32f3-disco`](https://egit.irs.uni-stuttgart.de/rust/satrs-example-stm32f3-disco) + :Example of a simple example on-board software using sat-rs components on a bare-metal system + with constrained resources. + +# Related projects + + In addition to the crates in this repository, the sat-rs project also maintains several + other libraries. + + * [`spacepackets`](https://egit.irs.uni-stuttgart.de/rust/spacepackets): Basic ECSS and CCSDS + packet protocol implementations. This repository is re-expored in the + [`satrs-core`](https://egit.irs.uni-stuttgart.de/rust/satrs-launchpad/src/branch/main/satrs-core) + crate. From 5a760e444d95410cfa496ac989e01e915e76d3fa Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 25 Jan 2023 21:27:50 +0100 Subject: [PATCH 06/20] README update --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 750b28f..15b69b9 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ for these systems. This project currently contains following crates: * [`satrs-core`](https://egit.irs.uni-stuttgart.de/rust/satrs-launchpad/src/branch/main/satrs-core): - Core components of sat-rs + Core components of sat-rs. * [`satrs-example`](https://egit.irs.uni-stuttgart.de/rust/satrs-launchpad/src/branch/main/satrs-example): Example of a simple example on-board software using various sat-rs components which can be run on a host computer or on any system with a standard runtime like a Raspberry Pi. From 1061ab52870cfe065d35f5e2e746824c1a76576a Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 25 Jan 2023 21:29:04 +0100 Subject: [PATCH 07/20] update README --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 15b69b9..f3140e5 100644 --- a/README.md +++ b/README.md @@ -17,8 +17,8 @@ This project currently contains following crates: * [`satrs-example`](https://egit.irs.uni-stuttgart.de/rust/satrs-launchpad/src/branch/main/satrs-example): Example of a simple example on-board software using various sat-rs components which can be run on a host computer or on any system with a standard runtime like a Raspberry Pi. -* [`satrs-example-stm32f3-disco`](https://egit.irs.uni-stuttgart.de/rust/satrs-example-stm32f3-disco) - :Example of a simple example on-board software using sat-rs components on a bare-metal system +* [`satrs-example-stm32f3-disco`](https://egit.irs.uni-stuttgart.de/rust/satrs-example-stm32f3-disco): + Example of a simple example on-board software using sat-rs components on a bare-metal system with constrained resources. # Related projects From fa83ba0da097458156dc3bea040ed8cc0342f38c Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 25 Jan 2023 21:32:39 +0100 Subject: [PATCH 08/20] add sat-rs mib subcrate in README --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index f3140e5..89767e4 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,8 @@ This project currently contains following crates: * [`satrs-example`](https://egit.irs.uni-stuttgart.de/rust/satrs-launchpad/src/branch/main/satrs-example): Example of a simple example on-board software using various sat-rs components which can be run on a host computer or on any system with a standard runtime like a Raspberry Pi. +* [`satrs-mib`](https://egit.irs.uni-stuttgart.de/rust/satrs-launchpad/src/branch/main/satrs-mib): + Components to build a mission information base from the on-board software directly. * [`satrs-example-stm32f3-disco`](https://egit.irs.uni-stuttgart.de/rust/satrs-example-stm32f3-disco): Example of a simple example on-board software using sat-rs components on a bare-metal system with constrained resources. From 3d12e1477a46d0d56e7c72afa3510b010ecb3795 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 25 Jan 2023 21:34:35 +0100 Subject: [PATCH 09/20] add README and changelog for satrs-mib --- satrs-mib/CHANGELOG.md | 9 +++++++++ satrs-mib/README.md | 2 ++ 2 files changed, 11 insertions(+) create mode 100644 satrs-mib/CHANGELOG.md create mode 100644 satrs-mib/README.md diff --git a/satrs-mib/CHANGELOG.md b/satrs-mib/CHANGELOG.md new file mode 100644 index 0000000..68e54a2 --- /dev/null +++ b/satrs-mib/CHANGELOG.md @@ -0,0 +1,9 @@ +Change Log +======= + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](http://keepachangelog.com/) +and this project adheres to [Semantic Versioning](http://semver.org/). + +# [unreleased] diff --git a/satrs-mib/README.md b/satrs-mib/README.md new file mode 100644 index 0000000..ac5a5b4 --- /dev/null +++ b/satrs-mib/README.md @@ -0,0 +1,2 @@ +satrs-mib +========= From d9d6cf5ff8d0aa7d7a7f2f62aea907677a40fcf7 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 25 Jan 2023 21:37:02 +0100 Subject: [PATCH 10/20] add license, ntoice files and CHANGElog where missing --- satrs-example/CHANGELOG.md | 9 ++ satrs-example/LICENSE-APACHE | 201 +++++++++++++++++++++++++++++++++++ satrs-example/NOTICE | 1 + satrs-mib/LICENSE-APACHE | 201 +++++++++++++++++++++++++++++++++++ satrs-mib/NOTICE | 3 + 5 files changed, 415 insertions(+) create mode 100644 satrs-example/CHANGELOG.md create mode 100644 satrs-example/LICENSE-APACHE create mode 100644 satrs-example/NOTICE create mode 100644 satrs-mib/LICENSE-APACHE create mode 100644 satrs-mib/NOTICE diff --git a/satrs-example/CHANGELOG.md b/satrs-example/CHANGELOG.md new file mode 100644 index 0000000..68e54a2 --- /dev/null +++ b/satrs-example/CHANGELOG.md @@ -0,0 +1,9 @@ +Change Log +======= + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](http://keepachangelog.com/) +and this project adheres to [Semantic Versioning](http://semver.org/). + +# [unreleased] diff --git a/satrs-example/LICENSE-APACHE b/satrs-example/LICENSE-APACHE new file mode 100644 index 0000000..16fe87b --- /dev/null +++ b/satrs-example/LICENSE-APACHE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/satrs-example/NOTICE b/satrs-example/NOTICE new file mode 100644 index 0000000..c5f7ef2 --- /dev/null +++ b/satrs-example/NOTICE @@ -0,0 +1 @@ +This software contains code developed at the University of Stuttgart. diff --git a/satrs-mib/LICENSE-APACHE b/satrs-mib/LICENSE-APACHE new file mode 100644 index 0000000..16fe87b --- /dev/null +++ b/satrs-mib/LICENSE-APACHE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/satrs-mib/NOTICE b/satrs-mib/NOTICE new file mode 100644 index 0000000..2c878e5 --- /dev/null +++ b/satrs-mib/NOTICE @@ -0,0 +1,3 @@ +Workspace for the satrs framework development. + +This software contains code developed at the University of Stuttgart's Institute of Space Systems. From d92b386374f47406940af7287ee7e2f28082ceae Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 25 Jan 2023 21:39:35 +0100 Subject: [PATCH 11/20] update all NOTICE files --- NOTICE | 2 -- satrs-core/NOTICE | 2 +- satrs-example/NOTICE | 2 +- satrs-mib/NOTICE | 2 -- 4 files changed, 2 insertions(+), 6 deletions(-) diff --git a/NOTICE b/NOTICE index 2c878e5..717a583 100644 --- a/NOTICE +++ b/NOTICE @@ -1,3 +1 @@ -Workspace for the satrs framework development. - This software contains code developed at the University of Stuttgart's Institute of Space Systems. diff --git a/satrs-core/NOTICE b/satrs-core/NOTICE index c5f7ef2..717a583 100644 --- a/satrs-core/NOTICE +++ b/satrs-core/NOTICE @@ -1 +1 @@ -This software contains code developed at the University of Stuttgart. +This software contains code developed at the University of Stuttgart's Institute of Space Systems. diff --git a/satrs-example/NOTICE b/satrs-example/NOTICE index c5f7ef2..717a583 100644 --- a/satrs-example/NOTICE +++ b/satrs-example/NOTICE @@ -1 +1 @@ -This software contains code developed at the University of Stuttgart. +This software contains code developed at the University of Stuttgart's Institute of Space Systems. diff --git a/satrs-mib/NOTICE b/satrs-mib/NOTICE index 2c878e5..717a583 100644 --- a/satrs-mib/NOTICE +++ b/satrs-mib/NOTICE @@ -1,3 +1 @@ -Workspace for the satrs framework development. - This software contains code developed at the University of Stuttgart's Institute of Space Systems. From feb5d199b7cee7ea9eaf67b26f3e2afff74abaaa Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 25 Jan 2023 21:40:30 +0100 Subject: [PATCH 12/20] add small note --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 89767e4..b719fff 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,8 @@ This project currently contains following crates: Example of a simple example on-board software using sat-rs components on a bare-metal system with constrained resources. +Each project has its own `CHANGELOG.md`. + # Related projects In addition to the crates in this repository, the sat-rs project also maintains several From 9e314a83760ebf6e4f82a4660c2b6a0ab88fe9d4 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 25 Jan 2023 21:41:33 +0100 Subject: [PATCH 13/20] ignore Cargo.lock --- .gitignore | 1 + Cargo.lock | 951 ----------------------------------------------------- 2 files changed, 1 insertion(+), 951 deletions(-) delete mode 100644 Cargo.lock diff --git a/.gitignore b/.gitignore index 10a3411..70a1972 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ /target +/Cargo.lock /.idea/* !/.idea/runConfigurations diff --git a/Cargo.lock b/Cargo.lock deleted file mode 100644 index cb4f81e..0000000 --- a/Cargo.lock +++ /dev/null @@ -1,951 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "ahash" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf6ccdb167abbf410dcb915cabd428929d7f6a04980b54a11f26a39f1c7f7107" -dependencies = [ - "cfg-if", - "once_cell", - "version_check", -] - -[[package]] -name = "android_system_properties" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" -dependencies = [ - "libc", -] - -[[package]] -name = "array-init" -version = "0.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23589ecb866b460d3a0f1278834750268c607e8e28a1b982c907219f3178cd72" -dependencies = [ - "nodrop", -] - -[[package]] -name = "atomic-polyfill" -version = "0.1.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3ff7eb3f316534d83a8a2c3d1674ace8a5a71198eba31e2e2b597833f699b28" -dependencies = [ - "critical-section", -] - -[[package]] -name = "autocfg" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" - -[[package]] -name = "base64" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" - -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "bstr" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba3569f383e8f1598449f1a423e72e99569137b47740b1da11ef19af3d5c3223" -dependencies = [ - "lazy_static", - "memchr", - "regex-automata", - "serde", -] - -[[package]] -name = "bumpalo" -version = "3.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535" - -[[package]] -name = "bus" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80cb4625f5b60155ff1018c9d4ce2e38bf5ae3e5780dfab9fa68bb44a6b751e2" -dependencies = [ - "crossbeam-channel", - "num_cpus", - "parking_lot_core", -] - -[[package]] -name = "byteorder" -version = "1.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" - -[[package]] -name = "cc" -version = "1.0.78" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a20104e2335ce8a659d6dd92a51a767a0c062599c73b343fd152cb401e828c3d" - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "chrono" -version = "0.4.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16b0a3d9ed01224b22057780a37bb8c5dbfe1be8ba48678e7bf57ec4b385411f" -dependencies = [ - "iana-time-zone", - "num-integer", - "num-traits", - "serde", - "winapi", -] - -[[package]] -name = "cobs" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67ba02a97a2bd10f4b59b25c7973101c79642302776489e030cd13cdab09ed15" - -[[package]] -name = "codespan-reporting" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" -dependencies = [ - "termcolor", - "unicode-width", -] - -[[package]] -name = "core-foundation-sys" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" - -[[package]] -name = "crc" -version = "3.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53757d12b596c16c78b83458d732a5d1a17ab3f53f2f7412f6fb57cc8a140ab3" -dependencies = [ - "crc-catalog", -] - -[[package]] -name = "crc-catalog" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cace84e55f07e7301bae1c519df89cdad8cc3cd868413d3fdbdeca9ff3db484" - -[[package]] -name = "critical-section" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6548a0ad5d2549e111e1f6a11a6c2e2d00ce6a3dafe22948d67c2b443f775e52" - -[[package]] -name = "crossbeam-channel" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2dd04ddaf88237dc3b8d8f9a3c1004b506b54b3313403944054d23c0870c521" -dependencies = [ - "cfg-if", - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-utils" -version = "0.8.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fb766fa798726286dbbb842f174001dab8abc7b627a1dd86e0b7222a95d929f" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "csv" -version = "1.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22813a6dc45b335f9bade10bf7271dc477e81113e89eb251a0bc2a8a81c536e1" -dependencies = [ - "bstr", - "csv-core", - "itoa 0.4.8", - "ryu", - "serde", -] - -[[package]] -name = "csv-core" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b2466559f260f48ad25fe6317b3c8dac77b5bdb5763ac7d9d6103530663bc90" -dependencies = [ - "memchr", -] - -[[package]] -name = "cxx" -version = "1.0.87" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b61a7545f753a88bcbe0a70de1fcc0221e10bfc752f576754fa91e663db1622e" -dependencies = [ - "cc", - "cxxbridge-flags", - "cxxbridge-macro", - "link-cplusplus", -] - -[[package]] -name = "cxx-build" -version = "1.0.87" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f464457d494b5ed6905c63b0c4704842aba319084a0a3561cdc1359536b53200" -dependencies = [ - "cc", - "codespan-reporting", - "once_cell", - "proc-macro2", - "quote", - "scratch", - "syn", -] - -[[package]] -name = "cxxbridge-flags" -version = "1.0.87" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43c7119ce3a3701ed81aca8410b9acf6fc399d2629d057b87e2efa4e63a3aaea" - -[[package]] -name = "cxxbridge-macro" -version = "1.0.87" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65e07508b90551e610910fa648a1878991d367064997a596135b86df30daf07e" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "delegate" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "082a24a9967533dc5d743c602157637116fc1b52806d694a5a45e6f32567fcdd" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "dissimilar" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "210ec60ae7d710bed8683e333e9d2855a8a56a3e9892b38bad3bb0d4d29b0d5e" - -[[package]] -name = "downcast-rs" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" - -[[package]] -name = "dyn-clone" -version = "1.0.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9b0705efd4599c15a38151f4721f7bc388306f61084d3bfd50bd07fbca5cb60" - -[[package]] -name = "embed-doc-image" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af36f591236d9d822425cb6896595658fa558fcebf5ee8accac1d4b92c47166e" -dependencies = [ - "base64", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "glob" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" - -[[package]] -name = "hash32" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0c35f58762feb77d74ebe43bdbc3210f09be9fe6742234d573bacc26ed92b67" -dependencies = [ - "byteorder", -] - -[[package]] -name = "hashbrown" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" -dependencies = [ - "ahash", -] - -[[package]] -name = "heapless" -version = "0.7.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db04bc24a18b9ea980628ecf00e6c0264f3c1426dac36c00cb49b6fbad8b0743" -dependencies = [ - "atomic-polyfill", - "hash32", - "rustc_version", - "serde", - "spin", - "stable_deref_trait", -] - -[[package]] -name = "hermit-abi" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" -dependencies = [ - "libc", -] - -[[package]] -name = "iana-time-zone" -version = "0.1.53" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64c122667b287044802d6ce17ee2ddf13207ed924c712de9a66a5814d5b64765" -dependencies = [ - "android_system_properties", - "core-foundation-sys", - "iana-time-zone-haiku", - "js-sys", - "wasm-bindgen", - "winapi", -] - -[[package]] -name = "iana-time-zone-haiku" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0703ae284fc167426161c2e3f1da3ea71d94b21bedbcc9494e92b28e334e3dca" -dependencies = [ - "cxx", - "cxx-build", -] - -[[package]] -name = "itoa" -version = "0.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" - -[[package]] -name = "itoa" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440" - -[[package]] -name = "js-sys" -version = "0.3.60" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49409df3e3bf0856b916e2ceaca09ee28e6871cf7d9ce97a692cacfdb2a25a47" -dependencies = [ - "wasm-bindgen", -] - -[[package]] -name = "lazy_static" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" - -[[package]] -name = "libc" -version = "0.2.139" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" - -[[package]] -name = "link-cplusplus" -version = "1.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecd207c9c713c34f95a097a5b029ac2ce6010530c7b49d7fea24d977dede04f5" -dependencies = [ - "cc", -] - -[[package]] -name = "lock_api" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df" -dependencies = [ - "autocfg", - "scopeguard", -] - -[[package]] -name = "log" -version = "0.4.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "maybe-uninit" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" - -[[package]] -name = "memchr" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" - -[[package]] -name = "nodrop" -version = "0.1.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" - -[[package]] -name = "num-integer" -version = "0.1.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" -dependencies = [ - "autocfg", - "num-traits", -] - -[[package]] -name = "num-traits" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" -dependencies = [ - "autocfg", -] - -[[package]] -name = "num_cpus" -version = "1.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" -dependencies = [ - "hermit-abi", - "libc", -] - -[[package]] -name = "once_cell" -version = "1.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66" - -[[package]] -name = "parking_lot_core" -version = "0.9.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba1ef8814b5c993410bb3adfad7a5ed269563e4a2f90c41f5d85be7fb47133bf" -dependencies = [ - "cfg-if", - "libc", - "redox_syscall", - "smallvec 1.10.0", - "windows-sys", -] - -[[package]] -name = "paste" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d01a5bd0424d00070b0098dd17ebca6f961a959dead1dbcbbbc1d1cd8d3deeba" - -[[package]] -name = "postcard" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c2b180dc0bade59f03fd005cb967d3f1e5f69b13922dad0cd6e047cb8af2363" -dependencies = [ - "cobs", - "heapless", - "serde", -] - -[[package]] -name = "proc-macro2" -version = "1.0.50" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ef7d57beacfaf2d8aee5937dab7b7f28de3cb8b1828479bb5de2a7106f2bae2" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "quote" -version = "1.0.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "redox_syscall" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" -dependencies = [ - "bitflags", -] - -[[package]] -name = "regex-automata" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" - -[[package]] -name = "rustc_version" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" -dependencies = [ - "semver", -] - -[[package]] -name = "ryu" -version = "1.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde" - -[[package]] -name = "satrs-core" -version = "0.1.0-alpha.0" -dependencies = [ - "bus", - "crossbeam-channel", - "delegate", - "downcast-rs", - "dyn-clone", - "embed-doc-image", - "hashbrown", - "heapless", - "num-traits", - "once_cell", - "paste", - "postcard", - "serde", - "serde_json", - "spacepackets 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "zerocopy", -] - -[[package]] -name = "satrs-example" -version = "0.1.0" -dependencies = [ - "crossbeam-channel", - "csv", - "delegate", - "satrs-core", - "satrs-mib", - "zerocopy", -] - -[[package]] -name = "satrs-mib" -version = "0.1.0" -dependencies = [ - "csv", - "satrs-core", - "satrs-mib-codegen", - "serde", - "serde-hex", -] - -[[package]] -name = "satrs-mib-codegen" -version = "0.1.0" -dependencies = [ - "proc-macro2", - "quote", - "satrs-core", - "satrs-mib", - "syn", - "trybuild", -] - -[[package]] -name = "scopeguard" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" - -[[package]] -name = "scratch" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddccb15bcce173023b3fedd9436f882a0739b8dfb45e4f6b6002bee5929f61b2" - -[[package]] -name = "semver" -version = "1.0.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58bc9567378fc7690d6b2addae4e60ac2eeea07becb2c64b9f218b53865cba2a" - -[[package]] -name = "serde" -version = "1.0.152" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde-hex" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca37e3e4d1b39afd7ff11ee4e947efae85adfddf4841787bfa47c470e96dc26d" -dependencies = [ - "array-init", - "serde", - "smallvec 0.6.14", -] - -[[package]] -name = "serde_derive" -version = "1.0.152" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "serde_json" -version = "1.0.91" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "877c235533714907a8c2464236f5c4b2a17262ef1bd71f38f35ea592c8da6883" -dependencies = [ - "itoa 1.0.5", - "ryu", - "serde", -] - -[[package]] -name = "smallvec" -version = "0.6.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b97fcaeba89edba30f044a10c6a3cc39df9c3f17d7cd829dd1446cab35f890e0" -dependencies = [ - "maybe-uninit", -] - -[[package]] -name = "smallvec" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" - -[[package]] -name = "spacepackets" -version = "0.5.1" -dependencies = [ - "chrono", - "crc", - "delegate", - "num-traits", - "postcard", - "serde", - "zerocopy", -] - -[[package]] -name = "spacepackets" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cfb97faa84378b4fe2f92021a95d3acce523df4673ce46636f1eff82013843f" -dependencies = [ - "chrono", - "crc", - "delegate", - "num-traits", - "serde", - "zerocopy", -] - -[[package]] -name = "spin" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f6002a767bff9e83f8eeecf883ecb8011875a21ae8da43bffb817a57e78cc09" -dependencies = [ - "lock_api", -] - -[[package]] -name = "stable_deref_trait" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" - -[[package]] -name = "syn" -version = "1.0.107" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "termcolor" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "toml" -version = "0.5.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" -dependencies = [ - "serde", -] - -[[package]] -name = "trybuild" -version = "1.0.76" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ed2c57956f91546d4d33614265a85d55c8e1ab91484853a10335894786d7db6" -dependencies = [ - "dissimilar", - "glob", - "once_cell", - "serde", - "serde_derive", - "serde_json", - "termcolor", - "toml", -] - -[[package]] -name = "unicode-ident" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc" - -[[package]] -name = "unicode-width" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" - -[[package]] -name = "version_check" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wasm-bindgen" -version = "0.2.83" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eaf9f5aceeec8be17c128b2e93e031fb8a4d469bb9c4ae2d7dc1888b26887268" -dependencies = [ - "cfg-if", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.83" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c8ffb332579b0557b52d268b91feab8df3615f265d5270fec2a8c95b17c1142" -dependencies = [ - "bumpalo", - "log", - "once_cell", - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.83" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "052be0f94026e6cbc75cdefc9bae13fd6052cdcaf532fa6c45e7ae33a1e6c810" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.83" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.83" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f" - -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-util" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" -dependencies = [ - "winapi", -] - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "windows-sys" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" -dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.42.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.42.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7" - -[[package]] -name = "windows_i686_gnu" -version = "0.42.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640" - -[[package]] -name = "windows_i686_msvc" -version = "0.42.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.42.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.42.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.42.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd" - -[[package]] -name = "zerocopy" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "332f188cc1bcf1fe1064b8c58d150f497e697f49774aa846f2dc949d9a25f236" -dependencies = [ - "byteorder", - "zerocopy-derive", -] - -[[package]] -name = "zerocopy-derive" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6505e6815af7de1746a08f69c69606bb45695a17149517680f3b2149713b19a3" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] From 8a939f4430725512b3066387fdd8f3287bb152bc Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 25 Jan 2023 22:18:32 +0100 Subject: [PATCH 14/20] add satrx-example for stm32f3-disco here --- satrs-example-stm32f3-disco/.gitignore | 3 + .../.vscode/.gitignore | 2 + .../.vscode/extensions.json | 12 + .../.vscode/launch.json | 66 ++ .../.vscode/openocd-helpers.tcl | 17 + .../.vscode/settings_default.json | 3 + .../.vscode/tasks.json | 20 + satrs-example-stm32f3-disco/Cargo.lock | 762 ++++++++++++++++++ satrs-example-stm32f3-disco/Cargo.toml | 59 ++ satrs-example-stm32f3-disco/README.md | 75 ++ satrs-example-stm32f3-disco/build.rs | 18 + satrs-example-stm32f3-disco/jlink.gdb | 10 + satrs-example-stm32f3-disco/memory.x | 33 + satrs-example-stm32f3-disco/openocd.cfg | 12 + satrs-example-stm32f3-disco/openocd.gdb | 40 + .../pyclient/.gitignore | 7 + .../pyclient/def_tmtc_conf.json | 4 + satrs-example-stm32f3-disco/pyclient/main.py | 307 +++++++ .../pyclient/requirements.txt | 2 + satrs-example-stm32f3-disco/src/blinky.rs | 78 ++ satrs-example-stm32f3-disco/src/main.rs | 604 ++++++++++++++ 21 files changed, 2134 insertions(+) create mode 100644 satrs-example-stm32f3-disco/.gitignore create mode 100644 satrs-example-stm32f3-disco/.vscode/.gitignore create mode 100644 satrs-example-stm32f3-disco/.vscode/extensions.json create mode 100644 satrs-example-stm32f3-disco/.vscode/launch.json create mode 100644 satrs-example-stm32f3-disco/.vscode/openocd-helpers.tcl create mode 100644 satrs-example-stm32f3-disco/.vscode/settings_default.json create mode 100644 satrs-example-stm32f3-disco/.vscode/tasks.json create mode 100644 satrs-example-stm32f3-disco/Cargo.lock create mode 100644 satrs-example-stm32f3-disco/Cargo.toml create mode 100644 satrs-example-stm32f3-disco/README.md create mode 100644 satrs-example-stm32f3-disco/build.rs create mode 100644 satrs-example-stm32f3-disco/jlink.gdb create mode 100644 satrs-example-stm32f3-disco/memory.x create mode 100644 satrs-example-stm32f3-disco/openocd.cfg create mode 100644 satrs-example-stm32f3-disco/openocd.gdb create mode 100644 satrs-example-stm32f3-disco/pyclient/.gitignore create mode 100644 satrs-example-stm32f3-disco/pyclient/def_tmtc_conf.json create mode 100644 satrs-example-stm32f3-disco/pyclient/main.py create mode 100644 satrs-example-stm32f3-disco/pyclient/requirements.txt create mode 100644 satrs-example-stm32f3-disco/src/blinky.rs create mode 100644 satrs-example-stm32f3-disco/src/main.rs diff --git a/satrs-example-stm32f3-disco/.gitignore b/satrs-example-stm32f3-disco/.gitignore new file mode 100644 index 0000000..767b60e --- /dev/null +++ b/satrs-example-stm32f3-disco/.gitignore @@ -0,0 +1,3 @@ +/target +/itm.txt +/.cargo/config* diff --git a/satrs-example-stm32f3-disco/.vscode/.gitignore b/satrs-example-stm32f3-disco/.vscode/.gitignore new file mode 100644 index 0000000..3cdd741 --- /dev/null +++ b/satrs-example-stm32f3-disco/.vscode/.gitignore @@ -0,0 +1,2 @@ +/settings.json +/.cortex-debug.* diff --git a/satrs-example-stm32f3-disco/.vscode/extensions.json b/satrs-example-stm32f3-disco/.vscode/extensions.json new file mode 100644 index 0000000..dd3369c --- /dev/null +++ b/satrs-example-stm32f3-disco/.vscode/extensions.json @@ -0,0 +1,12 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations. + // Extension identifier format: ${publisher}.${name}. Example: vscode.csharp + + // List of extensions which should be recommended for users of this workspace. + "recommendations": [ + "rust-lang.rust", + "marus25.cortex-debug", + ], + // List of extensions recommended by VS Code that should not be recommended for users of this workspace. + "unwantedRecommendations": [] +} \ No newline at end of file diff --git a/satrs-example-stm32f3-disco/.vscode/launch.json b/satrs-example-stm32f3-disco/.vscode/launch.json new file mode 100644 index 0000000..f9e65f2 --- /dev/null +++ b/satrs-example-stm32f3-disco/.vscode/launch.json @@ -0,0 +1,66 @@ +{ + /* + * Requires the Rust Language Server (RLS) and Cortex-Debug extensions + * https://marketplace.visualstudio.com/items?itemName=rust-lang.rust + * https://marketplace.visualstudio.com/items?itemName=marus25.cortex-debug + */ + "version": "0.2.0", + "configurations": [ + { + /* Launches debug session for currently open example */ + "type": "cortex-debug", + "request": "launch", + "name": "Debug", + "servertype": "openocd", + "cwd": "${workspaceRoot}", + "preLaunchTask": "cargo build", + "runToEntryPoint": "true", + "executable": "./target/thumbv7em-none-eabihf/debug/satrs-example-stm32f3-disco", + "preLaunchCommands": ["break rust_begin_unwind"], + "device": "STM32F303VCT6", + "configFiles": [ + "${workspaceRoot}/.vscode/openocd-helpers.tcl", + "interface/stlink.cfg", + "target/stm32f3x.cfg" + ], + "svdFile": "${env:HOME}/.svd/STM32F303.svd", + "swoConfig": { + "enabled": true, + "cpuFrequency": 8000000, + "swoFrequency": 2000000, + "source": "probe", + "decoders": [ + { "type": "console", "label": "ITM", "port": 0 } + ] + } + }, + { + /* Launches debug session for currently open example */ + "type": "cortex-debug", + "request": "launch", + "name": "Release", + "servertype": "openocd", + "cwd": "${workspaceRoot}", + "preLaunchTask": "cargo build", + "runToEntryPoint": "true", + "executable": "./target/thumbv7em-none-eabihf/release/satrs-example-stm32f3-disco", + "preLaunchCommands": ["break rust_begin_unwind"], + "device": "STM32F303VCT6", + "configFiles": [ + "${workspaceRoot}/.vscode/openocd-helpers.tcl", + "interface/stlink.cfg", + "target/stm32f3x.cfg" + ], + "svdFile": "${env:HOME}/.svd/STM32F303.svd", + "swoConfig": { + "enabled": true, + "cpuFrequency": 8000000, + "swoFrequency": 2000000, + "source": "probe", + "decoders": [ + { "type": "console", "label": "ITM", "port": 0 } + ] + } + } + ] +} \ No newline at end of file diff --git a/satrs-example-stm32f3-disco/.vscode/openocd-helpers.tcl b/satrs-example-stm32f3-disco/.vscode/openocd-helpers.tcl new file mode 100644 index 0000000..4da6f7e --- /dev/null +++ b/satrs-example-stm32f3-disco/.vscode/openocd-helpers.tcl @@ -0,0 +1,17 @@ +# +# Cortex-Debug extension calls this function during initialization. You can copy this +# file, modify it and specifyy it as one of the config files supplied in launch.json +# preferably at the beginning. +# +# Note that this file simply defines a function for use later when it is time to configure +# for SWO. +# +set USE_SWO 0 +proc CDSWOConfigure { CDCPUFreqHz CDSWOFreqHz CDSWOOutput } { + # Alternative option: Pipe ITM output into itm.txt file + # tpiu config internal itm.txt uart off $CDCPUFreqHz + + # Default option so SWO display of VS code works. + tpiu config internal $CDSWOOutput uart off $CDCPUFreqHz $CDSWOFreqHz + itm port 0 on +} diff --git a/satrs-example-stm32f3-disco/.vscode/settings_default.json b/satrs-example-stm32f3-disco/.vscode/settings_default.json new file mode 100644 index 0000000..e78c4ec --- /dev/null +++ b/satrs-example-stm32f3-disco/.vscode/settings_default.json @@ -0,0 +1,3 @@ +{ + "cortex-debug.gdbPath.linux": "gdb-multiarch" +} diff --git a/satrs-example-stm32f3-disco/.vscode/tasks.json b/satrs-example-stm32f3-disco/.vscode/tasks.json new file mode 100644 index 0000000..200a837 --- /dev/null +++ b/satrs-example-stm32f3-disco/.vscode/tasks.json @@ -0,0 +1,20 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=733558 + // for the documentation about the tasks.json format + "version": "2.0.0", + "tasks": [ + { + "label": "cargo build", + "type": "shell", + "command": "~/.cargo/bin/cargo", // note: full path to the cargo + "args": [ + "build" + ], + "group": { + "kind": "build", + "isDefault": true + } + }, + + ] +} \ No newline at end of file diff --git a/satrs-example-stm32f3-disco/Cargo.lock b/satrs-example-stm32f3-disco/Cargo.lock new file mode 100644 index 0000000..e8d9f02 --- /dev/null +++ b/satrs-example-stm32f3-disco/Cargo.lock @@ -0,0 +1,762 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "accelerometer" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a4586d95cb0695e748760c9a751141eebb68265b1b20392a0f14db608679f7a" +dependencies = [ + "micromath", +] + +[[package]] +name = "atomic-polyfill" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3ff7eb3f316534d83a8a2c3d1674ace8a5a71198eba31e2e2b597833f699b28" +dependencies = [ + "critical-section", +] + +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[package]] +name = "bare-metal" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5deb64efa5bd81e31fcd1938615a6d98c82eafcbcd787162b6f63b91d6bac5b3" +dependencies = [ + "rustc_version 0.2.3", +] + +[[package]] +name = "bare-metal" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8fe8f5a8a398345e52358e18ff07cc17a568fbca5c6f73873d3a62056309603" + +[[package]] +name = "bitfield" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46afbd2983a5d5a7bd740ccb198caf5b82f45c40c09c0eed36052d91cb92e719" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bxcan" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b13b4b2ea9ab2ba924063ebb86ad895cb79f4a79bf90f27949eb20c335b30f9" +dependencies = [ + "bitflags", + "nb 1.0.0", + "vcell", +] + +[[package]] +name = "byteorder" +version = "1.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" + +[[package]] +name = "cast" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c24dab4283a142afa2fdca129b80ad2c6284e073930f964c3a1293c225ee39a" +dependencies = [ + "rustc_version 0.4.0", +] + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "chrono" +version = "0.4.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16b0a3d9ed01224b22057780a37bb8c5dbfe1be8ba48678e7bf57ec4b385411f" +dependencies = [ + "num-integer", + "num-traits", +] + +[[package]] +name = "cortex-m" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70858629a458fdfd39f9675c4dc309411f2a3f83bede76988d81bf1a0ecee9e0" +dependencies = [ + "bare-metal 0.2.5", + "bitfield", + "embedded-hal", + "volatile-register", +] + +[[package]] +name = "cortex-m-rt" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6d3328b8b5534f0c90acd66b68950f2763b37e0173cac4d8b4937c4a80761f9" +dependencies = [ + "cortex-m-rt-macros", +] + +[[package]] +name = "cortex-m-rt-macros" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f6f3e36f203cfedbc78b357fb28730aa2c6dc1ab060ee5c2405e843988d3c7" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "cortex-m-rtic" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6b82f1c39acd6c3a35c2013b6110c20f5bc534522791fabadeed49ccada2dce" +dependencies = [ + "bare-metal 1.0.0", + "cortex-m", + "cortex-m-rtic-macros", + "heapless", + "rtic-core", + "rtic-monotonic", + "version_check", +] + +[[package]] +name = "cortex-m-rtic-macros" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e8e9645ef54bec1cf70ac33e9bf9566e6507ab5b41ae6baf3735662194e8607" +dependencies = [ + "proc-macro-error", + "proc-macro2", + "quote", + "rtic-syntax", + "syn", +] + +[[package]] +name = "critical-section" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6548a0ad5d2549e111e1f6a11a6c2e2d00ce6a3dafe22948d67c2b443f775e52" + +[[package]] +name = "darling" +version = "0.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0dd3cd20dc6b5a876612a6e5accfe7f3dd883db6d07acfbf14c128f61550dfa" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a784d2ccaf7c98501746bf0be29b2022ba41fd62a2e622af997a03e9f972859f" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "darling_macro" +version = "0.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7618812407e9402654622dd402b0a89dff9ba93badd6540781526117b92aab7e" +dependencies = [ + "darling_core", + "quote", + "syn", +] + +[[package]] +name = "embedded-dma" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "994f7e5b5cb23521c22304927195f236813053eb9c065dd2226a32ba64695446" +dependencies = [ + "stable_deref_trait", +] + +[[package]] +name = "embedded-hal" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35949884794ad573cf46071e41c9b60efb0cb311e3ca01f7af807af1debc66ff" +dependencies = [ + "nb 0.1.3", + "void", +] + +[[package]] +name = "embedded-time" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7a4b4d10ac48d08bfe3db7688c402baadb244721f30a77ce360bd24c3dffe58" +dependencies = [ + "num", +] + +[[package]] +name = "enumset" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19be8061a06ab6f3a6cf21106c873578bf01bd42ad15e0311a9c76161cb1c753" +dependencies = [ + "enumset_derive", +] + +[[package]] +name = "enumset_derive" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03e7b551eba279bf0fa88b83a46330168c1560a52a94f5126f892f0b364ab3e0" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "fugit" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ab17bb279def6720d058cb6c052249938e7f99260ab534879281a95367a87e5" +dependencies = [ + "gcd", +] + +[[package]] +name = "gcd" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4b1b088ad0a967aa29540456b82fc8903f854775d33f71e9709c4efb3dfbfd2" + +[[package]] +name = "generic-array" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "667f6ea017b297ec65b8a108c6e9ad6879460721fb3b6b23abf690970147fc28" +dependencies = [ + "typenum", +] + +[[package]] +name = "generic-array" +version = "0.14.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bff49e947297f3312447abdca79f45f4738097cc82b06e72054d2223f601f1b9" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "hash32" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0c35f58762feb77d74ebe43bdbc3210f09be9fe6742234d573bacc26ed92b67" +dependencies = [ + "byteorder", +] + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + +[[package]] +name = "heapless" +version = "0.7.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db04bc24a18b9ea980628ecf00e6c0264f3c1426dac36c00cb49b6fbad8b0743" +dependencies = [ + "atomic-polyfill", + "hash32", + "rustc_version 0.4.0", + "spin", + "stable_deref_trait", +] + +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + +[[package]] +name = "indexmap" +version = "1.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399" +dependencies = [ + "autocfg", + "hashbrown", +] + +[[package]] +name = "itm_logger" +version = "0.1.3-pre.0" +dependencies = [ + "cortex-m", + "log", +] + +[[package]] +name = "lock_api" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "lsm303dlhc" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e5d1a5c290951321d1b0d4a40edd828537de9889134a0e67c5146542ae57706" +dependencies = [ + "cast", + "embedded-hal", + "generic-array 0.11.2", +] + +[[package]] +name = "micromath" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc4010833aea396656c2f91ee704d51a6f1329ec2ab56ffd00bfd56f7481ea94" +dependencies = [ + "generic-array 0.14.6", +] + +[[package]] +name = "nb" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "801d31da0513b6ec5214e9bf433a77966320625a37860f910be265be6e18d06f" +dependencies = [ + "nb 1.0.0", +] + +[[package]] +name = "nb" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "546c37ac5d9e56f55e73b677106873d9d9f5190605e41a856503623648488cae" + +[[package]] +name = "num" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b7a8e9be5e039e2ff869df49155f1c06bd01ade2117ec783e56ab0932b67a8f" +dependencies = [ + "num-complex", + "num-integer", + "num-iter", + "num-rational", + "num-traits", +] + +[[package]] +name = "num-complex" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "747d632c0c558b87dbabbe6a82f3b4ae03720d0646ac5b7b4dae89394be5f2c5" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-integer" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +dependencies = [ + "autocfg", + "num-traits", +] + +[[package]] +name = "num-iter" +version = "0.1.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-rational" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12ac428b1cb17fce6f731001d307d351ec70a6d202fc2e60f7d4c5e42d8f4f07" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" +dependencies = [ + "autocfg", +] + +[[package]] +name = "panic-itm" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d577d97d1b31268087b6dddf2470e6794ef5eee87d9dca7fcd0481695391a4c" +dependencies = [ + "cortex-m", +] + +[[package]] +name = "paste" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d01a5bd0424d00070b0098dd17ebca6f961a959dead1dbcbbbc1d1cd8d3deeba" + +[[package]] +name = "proc-macro-error" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +dependencies = [ + "proc-macro-error-attr", + "proc-macro2", + "quote", + "syn", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +dependencies = [ + "proc-macro2", + "quote", + "version_check", +] + +[[package]] +name = "proc-macro2" +version = "1.0.49" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57a8eca9f9c4ffde41714334dee777596264c7825420f521abc92b5b5deb63a5" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "rtcc" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3623619ce77c09a7d87cf7c61c5c887b9c7dee8805f66af6c4aa5824be4d9930" +dependencies = [ + "chrono", +] + +[[package]] +name = "rtic-core" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9369355b04d06a3780ec0f51ea2d225624db777acbc60abd8ca4832da5c1a42" + +[[package]] +name = "rtic-monotonic" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb8b0b822d1a366470b9cea83a1d4e788392db763539dc4ba022bcc787fece82" + +[[package]] +name = "rtic-syntax" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ad3ae243dd8d0a1b064615f664d4fa7e63929939074c564cbe5efdc4c503065" +dependencies = [ + "indexmap", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "rustc_version" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" +dependencies = [ + "semver 0.9.0", +] + +[[package]] +name = "rustc_version" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +dependencies = [ + "semver 1.0.16", +] + +[[package]] +name = "sat-rs-example-stm32f-disco" +version = "0.1.0" +dependencies = [ + "cortex-m", + "cortex-m-rt", + "cortex-m-rtic", + "embedded-hal", + "enumset", + "heapless", + "itm_logger", + "panic-itm", + "stm32f3-discovery", + "stm32f3xx-hal", + "systick-monotonic", +] + +[[package]] +name = "scopeguard" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" + +[[package]] +name = "semver" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" +dependencies = [ + "semver-parser", +] + +[[package]] +name = "semver" +version = "1.0.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58bc9567378fc7690d6b2addae4e60ac2eeea07becb2c64b9f218b53865cba2a" + +[[package]] +name = "semver-parser" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" + +[[package]] +name = "slice-group-by" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03b634d87b960ab1a38c4fe143b508576f075e7c978bfad18217645ebfdfa2ec" + +[[package]] +name = "spin" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f6002a767bff9e83f8eeecf883ecb8011875a21ae8da43bffb817a57e78cc09" +dependencies = [ + "lock_api", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + +[[package]] +name = "stm32-usbd" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6c94998f166d66b210a164648a0b7866428d8f1e0740bf8a4c5edd89d4750c1" +dependencies = [ + "cortex-m", + "usb-device", + "vcell", +] + +[[package]] +name = "stm32f3" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "265cda62ac13307414de4aca58dbbbd8038ddba85cffbb335823aa216f2e3200" +dependencies = [ + "bare-metal 1.0.0", + "cortex-m", + "cortex-m-rt", + "vcell", +] + +[[package]] +name = "stm32f3-discovery" +version = "0.8.0-pre.0" +dependencies = [ + "accelerometer", + "cortex-m", + "cortex-m-rt", + "lsm303dlhc", + "stm32f3xx-hal", + "switch-hal", +] + +[[package]] +name = "stm32f3xx-hal" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e422c5c044e8f3a068b1e14b83c071449e27c9d4bc0e24f972b552d79f2be03" +dependencies = [ + "bare-metal 1.0.0", + "bxcan", + "cfg-if", + "cortex-m", + "cortex-m-rt", + "embedded-dma", + "embedded-hal", + "embedded-time", + "enumset", + "nb 1.0.0", + "paste", + "rtcc", + "slice-group-by", + "stm32-usbd", + "stm32f3", + "void", +] + +[[package]] +name = "switch-hal" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90a4adc8cbd1726249b161898e48e0f3f1ce74d34dc784cbbc98fba4ed283fbf" +dependencies = [ + "embedded-hal", +] + +[[package]] +name = "syn" +version = "1.0.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "systick-monotonic" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67fb822d5c615a0ae3a4795ee5b1d06381c7faf488d861c0a4fa8e6a88d5ff84" +dependencies = [ + "cortex-m", + "fugit", + "rtic-monotonic", +] + +[[package]] +name = "typenum" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" + +[[package]] +name = "unicode-ident" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc" + +[[package]] +name = "usb-device" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f6cc3adc849b5292b4075fc0d5fdcf2f24866e88e336dd27a8943090a520508" + +[[package]] +name = "vcell" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77439c1b53d2303b20d9459b1ade71a83c716e3f9c34f3228c00e6f185d6c002" + +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" + +[[package]] +name = "void" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" + +[[package]] +name = "volatile-register" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ee8f19f9d74293faf70901bc20ad067dc1ad390d2cbf1e3f75f721ffee908b6" +dependencies = [ + "vcell", +] diff --git a/satrs-example-stm32f3-disco/Cargo.toml b/satrs-example-stm32f3-disco/Cargo.toml new file mode 100644 index 0000000..dec4cab --- /dev/null +++ b/satrs-example-stm32f3-disco/Cargo.toml @@ -0,0 +1,59 @@ +[package] +name = "satrs-example-stm32f3-disco" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +cortex-m = "0.7" +cortex-m-rt = "0.7" +embedded-hal = "0.2.6" +cortex-m-rtic = "1.0" +enumset = "1.0" +heapless = "0.7" +systick-monotonic = "1.0" + +[dependencies.cobs] +git = "https://github.com/robamu/cobs.rs.git" +branch = "all_features" +default-features = false + +[dependencies.panic-itm] +version = "0.4" + +[dependencies.itm_logger] +git = "https://github.com/robamu/itm_logger.rs.git" +branch = "all_features" +version = "0.1.3-alpha.0" + +[dependencies.stm32f3xx-hal] +git = "https://github.com/robamu/stm32f3xx-hal" +version = "0.10.0-alpha.0" +features = ["stm32f303xc", "rt", "enumset"] +branch = "all_features" +# Can be used in workspace to develop and update HAL +# path = "../stm32f3xx-hal" + +[dependencies.stm32f3-discovery] +git = "https://github.com/robamu/stm32f3-discovery" +version = "0.8.0-alpha.0" +branch = "all_features" +# Can be used in workspace to develop and update BSP +# path = "../stm32f3-discovery" + +[dependencies.satrs-core] +git = "https://egit.irs.uni-stuttgart.de/rust/satrs-core.git" +version = "0.1.0-alpha.0" +default-features = false + +# this lets you use `cargo fix`! +# [[bin]] +# name = "stm32f3-blinky" +# test = false +# bench = false + +[profile.release] +codegen-units = 1 # better optimizations +debug = true # symbols are nice and they don't increase the size on Flash +lto = true # better optimizations diff --git a/satrs-example-stm32f3-disco/README.md b/satrs-example-stm32f3-disco/README.md new file mode 100644 index 0000000..9e98f05 --- /dev/null +++ b/satrs-example-stm32f3-disco/README.md @@ -0,0 +1,75 @@ +sat-rs example for the STM32F3-Discovery board +======= + +This example application shows how the [sat-rs framework](https://egit.irs.uni-stuttgart.de/rust/satrs-launchpad) +can be used on an embedded target. It also shows how a relatively simple OBSW could be built when no +standard runtime is available. It uses [RTIC](https://rtic.rs/1/book/en/) as the concurrency +framework. + +The STM32F3-Discovery device was picked because it is a cheap Cortex-M4 based device which is also +used by the [Rust Embedded Book](https://docs.rust-embedded.org/book/intro/hardware.html) and the +[Rust Discovery](https://docs.rust-embedded.org/discovery/f3discovery/) book as an introduction +to embedded Rust. + +## Preparing Rust and the repository + +Building an application requires the `thumbv7em-none-eabihf` cross-compiler toolchain. +If you have not installed it yet, you can do so with + +```sh +rustup target add thumbv7em-none-eabihf +``` + +A default `.cargo` config file is provided for this project, but needs to be copied to have +the correct name. This is so that the config file can be updated or edited for custom needs +without being tracked by git. + +```sh +cp def_config.toml config.toml +``` + +The configuration file will also set the target so it does not always have to be specified with +the `--target` argument. + +## Building + +After that, assuming that you have a `.cargo/config.toml` setting the correct build target, +you can simply build the application with + +```sh +cargo build +``` + +## Flashing and Debugging from the command line + +TODO + +## Debugging with VS Code + +The STM32F3-Discovery comes with an on-board ST-Link so all that is required to flash and debug +the board is a Mini-USB cable. The code in this repository was debugged using `openocd` +and the VS Code [`Cortex-Debug` plugin](https://marketplace.visualstudio.com/items?itemName=marus25.cortex-debug). + +Some sample configuration files for VS Code were provided as well. You can simply use `Run` and `Debug` +to automatically rebuild and flash your application. + +The `tasks.json` and `launch.json` files are generic and you can use them immediately by opening +the folder in VS code or adding it to a workspace. + +If you would like to use a custom GDB application, you can specify the gdb binary in the following +configuration variables in your `settings.json`: + +- `"cortex-debug.gdbPath"` +- `"cortex-debug.gdbPath.linux"` +- `"cortex-debug.gdbPath.windows"` +- `"cortex-debug.gdbPath.osx"` + +## Commanding with Python + +When the SW is running on the Discovery board, you can command the MCU via a serial interface, +using COBS encoded CCSDS packets. + +TODO: + - How and where to connect serial interface on the MCU + - How to set up Python venv (or at least strongly recommend it) and install deps + - How to copy `def_tmtc_conf.json` to `tmtc_conf.json` and adapt it for custom serial port diff --git a/satrs-example-stm32f3-disco/build.rs b/satrs-example-stm32f3-disco/build.rs new file mode 100644 index 0000000..98f603e --- /dev/null +++ b/satrs-example-stm32f3-disco/build.rs @@ -0,0 +1,18 @@ +use std::env; +use std::fs::File; +use std::io::Write; +use std::path::PathBuf; + +fn main() { + // Put the linker script somewhere the linker can find it + let out = &PathBuf::from(env::var_os("OUT_DIR").unwrap()); + File::create(out.join("memory.x")) + .unwrap() + .write_all(include_bytes!("memory.x")) + .unwrap(); + println!("cargo:rustc-link-search={}", out.display()); + + // Only re-run the build script when memory.x is changed, + // instead of when any part of the source code changes. + println!("cargo:rerun-if-changed=memory.x"); +} diff --git a/satrs-example-stm32f3-disco/jlink.gdb b/satrs-example-stm32f3-disco/jlink.gdb new file mode 100644 index 0000000..8eeed7c --- /dev/null +++ b/satrs-example-stm32f3-disco/jlink.gdb @@ -0,0 +1,10 @@ +target extended-remote localhost:2331 + +monitor reset + +# *try* to stop at the user entry point (it might be gone due to inlining) +break main + +load + +continue diff --git a/satrs-example-stm32f3-disco/memory.x b/satrs-example-stm32f3-disco/memory.x new file mode 100644 index 0000000..a3a5787 --- /dev/null +++ b/satrs-example-stm32f3-disco/memory.x @@ -0,0 +1,33 @@ +/* Linker script for the STM32F303VCT6 */ +MEMORY +{ + /* NOTE 1 K = 1 KiBi = 1024 bytes */ + FLASH : ORIGIN = 0x08000000, LENGTH = 256K + RAM : ORIGIN = 0x20000000, LENGTH = 40K +} + +/* This is where the call stack will be allocated. */ +/* The stack is of the full descending type. */ +/* You may want to use this variable to locate the call stack and static + variables in different memory regions. Below is shown the default value */ +/* _stack_start = ORIGIN(RAM) + LENGTH(RAM); */ + +/* You can use this symbol to customize the location of the .text section */ +/* If omitted the .text section will be placed right after the .vector_table + section */ +/* This is required only on microcontrollers that store some configuration right + after the vector table */ +/* _stext = ORIGIN(FLASH) + 0x400; */ + +/* Example of putting non-initialized variables into custom RAM locations. */ +/* This assumes you have defined a region RAM2 above, and in the Rust + sources added the attribute `#[link_section = ".ram2bss"]` to the data + you want to place there. */ +/* Note that the section will not be zero-initialized by the runtime! */ +/* SECTIONS { + .ram2bss (NOLOAD) : ALIGN(4) { + *(.ram2bss); + . = ALIGN(4); + } > RAM2 + } INSERT AFTER .bss; +*/ diff --git a/satrs-example-stm32f3-disco/openocd.cfg b/satrs-example-stm32f3-disco/openocd.cfg new file mode 100644 index 0000000..466c033 --- /dev/null +++ b/satrs-example-stm32f3-disco/openocd.cfg @@ -0,0 +1,12 @@ +# Sample OpenOCD configuration for the STM32F3DISCOVERY development board + +# Depending on the hardware revision you got you'll have to pick ONE of these +# interfaces. At any time only one interface should be commented out. + +# Revision C (newer revision) +source [find interface/stlink.cfg] + +# Revision A and B (older revisions) +# source [find interface/stlink-v2.cfg] + +source [find target/stm32f3x.cfg] diff --git a/satrs-example-stm32f3-disco/openocd.gdb b/satrs-example-stm32f3-disco/openocd.gdb new file mode 100644 index 0000000..0ba0c09 --- /dev/null +++ b/satrs-example-stm32f3-disco/openocd.gdb @@ -0,0 +1,40 @@ +target extended-remote :3333 + +# print demangled symbols +set print asm-demangle on + +# set backtrace limit to not have infinite backtrace loops +set backtrace limit 32 + +# detect unhandled exceptions, hard faults and panics +break DefaultHandler +break HardFault +break rust_begin_unwind +# # run the next few lines so the panic message is printed immediately +# # the number needs to be adjusted for your panic handler +# commands $bpnum +# next 4 +# end + +# *try* to stop at the user entry point (it might be gone due to inlining) +break main + +# monitor arm semihosting enable + +# # send captured ITM to the file itm.fifo +# # (the microcontroller SWO pin must be connected to the programmer SWO pin) +# # 8000000 must match the core clock frequency +monitor tpiu config internal itm.txt uart off 8000000 + +# # OR: make the microcontroller SWO pin output compatible with UART (8N1) +# # 8000000 must match the core clock frequency +# # 2000000 is the frequency of the SWO pin +# monitor tpiu config external uart off 8000000 2000000 + +# # enable ITM port 0 +monitor itm port 0 on + +load + +# start the process but immediately halt the processor +stepi diff --git a/satrs-example-stm32f3-disco/pyclient/.gitignore b/satrs-example-stm32f3-disco/pyclient/.gitignore new file mode 100644 index 0000000..a0c9366 --- /dev/null +++ b/satrs-example-stm32f3-disco/pyclient/.gitignore @@ -0,0 +1,7 @@ +/venv +/log +/.idea/* +!/.idea/runConfigurations + +/seqcnt.txt +/tmtc_conf.json diff --git a/satrs-example-stm32f3-disco/pyclient/def_tmtc_conf.json b/satrs-example-stm32f3-disco/pyclient/def_tmtc_conf.json new file mode 100644 index 0000000..5665681 --- /dev/null +++ b/satrs-example-stm32f3-disco/pyclient/def_tmtc_conf.json @@ -0,0 +1,4 @@ +{ + "com_if": "serial_cobs", + "serial_baudrate": 115200 +} \ No newline at end of file diff --git a/satrs-example-stm32f3-disco/pyclient/main.py b/satrs-example-stm32f3-disco/pyclient/main.py new file mode 100644 index 0000000..a5fa9cd --- /dev/null +++ b/satrs-example-stm32f3-disco/pyclient/main.py @@ -0,0 +1,307 @@ +#!/usr/bin/env python3 +"""Example client for the sat-rs example application""" +import enum +import struct +import sys +import time +from typing import Optional, cast + +import tmtccmd +from spacepackets.ecss import PusTelemetry, PusTelecommand, PusVerificator +from spacepackets.ecss.pus_17_test import Service17Tm +from spacepackets.ecss.pus_1_verification import UnpackParams, Service1Tm + +from tmtccmd import CcsdsTmtcBackend, TcHandlerBase, ProcedureParamsWrapper +from tmtccmd.core.base import BackendRequest +from tmtccmd.pus import VerificationWrapper +from tmtccmd.tm import CcsdsTmHandler, SpecificApidHandlerBase +from tmtccmd.com_if import ComInterface +from tmtccmd.config import ( + default_json_path, + SetupParams, + TmTcCfgHookBase, + TmtcDefinitionWrapper, + CoreServiceList, + OpCodeEntry, + params_to_procedure_conversion, +) +from tmtccmd.config.com_if import SerialCfgWrapper +from tmtccmd.config import PreArgsParsingWrapper, SetupWrapper +from tmtccmd.logging import get_console_logger +from tmtccmd.logging.pus import ( + RegularTmtcLogWrapper, + RawTmtcTimedLogWrapper, + TimedLogWhen, +) +from tmtccmd.tc import ( + TcQueueEntryType, + ProcedureWrapper, + TcProcedureType, + FeedWrapper, + SendCbParams, + DefaultPusQueueHelper, +) +from tmtccmd.tm.pus_5_event import Service5Tm +from tmtccmd.util import FileSeqCountProvider, PusFileSeqCountProvider +from tmtccmd.util.obj_id import ObjectIdDictT + +from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter + +LOGGER = get_console_logger() + +EXAMPLE_PUS_APID = 0x02 + + +class SatRsConfigHook(TmTcCfgHookBase): + def __init__(self, json_cfg_path: str): + super().__init__(json_cfg_path=json_cfg_path) + + def assign_communication_interface(self, com_if_key: str) -> Optional[ComInterface]: + from tmtccmd.config.com_if import ( + create_com_interface_default, + create_com_interface_cfg_default, + ) + + cfg = create_com_interface_cfg_default( + com_if_key=com_if_key, + json_cfg_path=self.cfg_path, + space_packet_ids=None, + ) + if cfg is None: + raise ValueError( + f"No valid configuration could be retrieved for the COM IF with key {com_if_key}" + ) + if cfg.com_if_key == "serial_cobs": + cfg = cast(SerialCfgWrapper, cfg) + cfg.serial_cfg.serial_timeout = 0.5 + return create_com_interface_default(cfg) + + def get_tmtc_definitions(self) -> TmtcDefinitionWrapper: + from tmtccmd.config.globals import get_default_tmtc_defs + + defs = get_default_tmtc_defs() + srv_5 = OpCodeEntry() + srv_5.add("0", "Event Test") + defs.add_service( + name=CoreServiceList.SERVICE_5.value, + info="PUS Service 5 Event", + op_code_entry=srv_5, + ) + srv_17 = OpCodeEntry() + srv_17.add("0", "Ping Test") + defs.add_service( + name=CoreServiceList.SERVICE_17_ALT, + info="PUS Service 17 Test", + op_code_entry=srv_17, + ) + srv_3 = OpCodeEntry() + defs.add_service( + name=CoreServiceList.SERVICE_3, + info="PUS Service 3 Housekeeping", + op_code_entry=srv_3, + ) + return defs + + def perform_mode_operation(self, tmtc_backend: CcsdsTmtcBackend, mode: int): + LOGGER.info("Mode operation hook was called") + pass + + def get_object_ids(self) -> ObjectIdDictT: + from tmtccmd.config.objects import get_core_object_ids + + return get_core_object_ids() + + +class PusHandler(SpecificApidHandlerBase): + def __init__( + self, + verif_wrapper: VerificationWrapper, + printer: FsfwTmTcPrinter, + raw_logger: RawTmtcTimedLogWrapper, + ): + super().__init__(EXAMPLE_PUS_APID, None) + self.printer = printer + self.raw_logger = raw_logger + self.verif_wrapper = verif_wrapper + + def handle_tm(self, packet: bytes, _user_args: any): + try: + tm_packet = PusTelemetry.unpack(packet) + except ValueError as e: + LOGGER.warning("Could not generate PUS TM object from raw data") + LOGGER.warning(f"Raw Packet: [{packet.hex(sep=',')}], REPR: {packet!r}") + raise e + service = tm_packet.service + dedicated_handler = False + if service == 1: + tm_packet = Service1Tm.unpack(data=packet, params=UnpackParams(1, 2)) + res = self.verif_wrapper.add_tm(tm_packet) + if res is None: + LOGGER.info( + f"Received Verification TM[{tm_packet.service}, {tm_packet.subservice}] " + f"with Request ID {tm_packet.tc_req_id.as_u32():#08x}" + ) + LOGGER.warning( + f"No matching telecommand found for {tm_packet.tc_req_id}" + ) + else: + self.verif_wrapper.log_to_console(tm_packet, res) + self.verif_wrapper.log_to_file(tm_packet, res) + dedicated_handler = True + if service == 3: + LOGGER.info("No handling for HK packets implemented") + LOGGER.info(f"Raw packet: 0x[{packet.hex(sep=',')}]") + pus_tm = PusTelemetry.unpack(packet) + if pus_tm.subservice == 25: + if len(pus_tm.source_data) < 8: + raise ValueError("No addressable ID in HK packet") + json_str = pus_tm.source_data[8:] + dedicated_handler = True + if service == 5: + tm_packet = Service5Tm.unpack(packet) + if service == 17: + tm_packet = Service17Tm.unpack(packet) + dedicated_handler = True + if tm_packet.subservice == 2: + self.printer.file_logger.info("Received Ping Reply TM[17,2]") + LOGGER.info("Received Ping Reply TM[17,2]") + else: + self.printer.file_logger.info( + f"Received Test Packet with unknown subservice {tm_packet.subservice}" + ) + LOGGER.info( + f"Received Test Packet with unknown subservice {tm_packet.subservice}" + ) + if tm_packet is None: + LOGGER.info( + f"The service {service} is not implemented in Telemetry Factory" + ) + tm_packet = PusTelemetry.unpack(packet) + self.raw_logger.log_tm(tm_packet) + if not dedicated_handler and tm_packet is not None: + self.printer.handle_long_tm_print(packet_if=tm_packet, info_if=tm_packet) + + +def make_addressable_id(target_id: int, unique_id: int) -> bytes: + byte_string = bytearray(struct.pack("!I", target_id)) + byte_string.extend(struct.pack("!I", unique_id)) + return byte_string + + +class TcHandler(TcHandlerBase): + def __init__( + self, + seq_count_provider: FileSeqCountProvider, + verif_wrapper: VerificationWrapper, + ): + super(TcHandler, self).__init__() + self.seq_count_provider = seq_count_provider + self.verif_wrapper = verif_wrapper + self.queue_helper = DefaultPusQueueHelper( + queue_wrapper=None, + seq_cnt_provider=seq_count_provider, + ) + + def send_cb(self, send_params: SendCbParams): + entry_helper = send_params.entry + if entry_helper.is_tc: + if entry_helper.entry_type == TcQueueEntryType.PUS_TC: + pus_tc_wrapper = entry_helper.to_pus_tc_entry() + pus_tc_wrapper.pus_tc.seq_count = ( + self.seq_count_provider.get_and_increment() + ) + self.verif_wrapper.add_tc(pus_tc_wrapper.pus_tc) + raw_tc = pus_tc_wrapper.pus_tc.pack() + LOGGER.info(f"Sending {pus_tc_wrapper.pus_tc}") + send_params.com_if.send(raw_tc) + elif entry_helper.entry_type == TcQueueEntryType.LOG: + log_entry = entry_helper.to_log_entry() + LOGGER.info(log_entry.log_str) + + def queue_finished_cb(self, helper: ProcedureWrapper): + if helper.proc_type == TcProcedureType.DEFAULT: + def_proc = helper.to_def_procedure() + LOGGER.info( + f"Queue handling finished for service {def_proc.service} and " + f"op code {def_proc.op_code}" + ) + + def feed_cb(self, helper: ProcedureWrapper, wrapper: FeedWrapper): + q = self.queue_helper + q.queue_wrapper = wrapper.queue_wrapper + if helper.proc_type == TcProcedureType.DEFAULT: + def_proc = helper.to_def_procedure() + service = def_proc.service + op_code = def_proc.op_code + if ( + service == CoreServiceList.SERVICE_17 + or service == CoreServiceList.SERVICE_17_ALT + ): + q.add_log_cmd("Sending PUS ping telecommand") + return q.add_pus_tc(PusTelecommand(service=17, subservice=1)) + + +def main(): + tmtccmd.init_printout(False) + hook_obj = SatRsConfigHook(json_cfg_path=default_json_path()) + parser_wrapper = PreArgsParsingWrapper() + parser_wrapper.create_default_parent_parser() + parser_wrapper.create_default_parser() + parser_wrapper.add_def_proc_args() + post_args_wrapper = parser_wrapper.parse(hook_obj) + params = SetupParams() + proc_wrapper = ProcedureParamsWrapper() + if post_args_wrapper.use_gui: + post_args_wrapper.set_params_without_prompts(params, proc_wrapper) + else: + post_args_wrapper.set_params_with_prompts(params, proc_wrapper) + params.apid = EXAMPLE_PUS_APID + setup_args = SetupWrapper( + hook_obj=hook_obj, setup_params=params, proc_param_wrapper=proc_wrapper + ) + # Create console logger helper and file loggers + tmtc_logger = RegularTmtcLogWrapper() + printer = FsfwTmTcPrinter(tmtc_logger.logger) + raw_logger = RawTmtcTimedLogWrapper(when=TimedLogWhen.PER_HOUR, interval=1) + verificator = PusVerificator() + verification_wrapper = VerificationWrapper(verificator, LOGGER, printer.file_logger) + # Create primary TM handler and add it to the CCSDS Packet Handler + tm_handler = PusHandler(verification_wrapper, printer, raw_logger) + ccsds_handler = CcsdsTmHandler(generic_handler=None) + ccsds_handler.add_apid_handler(tm_handler) + + # Create TC handler + seq_count_provider = PusFileSeqCountProvider() + tc_handler = TcHandler(seq_count_provider, verification_wrapper) + tmtccmd.setup(setup_args=setup_args) + init_proc = params_to_procedure_conversion(setup_args.proc_param_wrapper) + tmtc_backend = tmtccmd.create_default_tmtc_backend( + setup_wrapper=setup_args, + tm_handler=ccsds_handler, + tc_handler=tc_handler, + init_procedure=init_proc, + ) + tmtccmd.start(tmtc_backend=tmtc_backend, hook_obj=hook_obj) + try: + while True: + state = tmtc_backend.periodic_op(None) + if state.request == BackendRequest.TERMINATION_NO_ERROR: + sys.exit(0) + elif state.request == BackendRequest.DELAY_IDLE: + LOGGER.info("TMTC Client in IDLE mode") + time.sleep(3.0) + elif state.request == BackendRequest.DELAY_LISTENER: + time.sleep(0.8) + elif state.request == BackendRequest.DELAY_CUSTOM: + if state.next_delay.total_seconds() <= 0.4: + time.sleep(state.next_delay.total_seconds()) + else: + time.sleep(0.4) + elif state.request == BackendRequest.CALL_NEXT: + pass + except KeyboardInterrupt: + sys.exit(0) + + +if __name__ == "__main__": + main() diff --git a/satrs-example-stm32f3-disco/pyclient/requirements.txt b/satrs-example-stm32f3-disco/pyclient/requirements.txt new file mode 100644 index 0000000..d9a7ac1 --- /dev/null +++ b/satrs-example-stm32f3-disco/pyclient/requirements.txt @@ -0,0 +1,2 @@ +tmtccmd == 4.0.0a0 +# -e git+https://github.com/robamu-org/tmtccmd.git@main#egg=tmtccmd diff --git a/satrs-example-stm32f3-disco/src/blinky.rs b/satrs-example-stm32f3-disco/src/blinky.rs new file mode 100644 index 0000000..eefdbfe --- /dev/null +++ b/satrs-example-stm32f3-disco/src/blinky.rs @@ -0,0 +1,78 @@ +#![no_std] +#![no_main] + +extern crate panic_itm; + +use cortex_m_rt::entry; + +use stm32f3_discovery::stm32f3xx_hal::delay::Delay; +use stm32f3_discovery::stm32f3xx_hal::{pac, prelude::*}; +use stm32f3_discovery::leds::Leds; +use stm32f3_discovery::switch_hal::{OutputSwitch, ToggleableOutputSwitch}; + +#[entry] +fn main()-> ! { + let dp = pac::Peripherals::take().unwrap(); + let mut rcc = dp.RCC.constrain(); + let cp = cortex_m::Peripherals::take().unwrap(); + let mut flash = dp.FLASH.constrain(); + let clocks = rcc.cfgr.freeze(&mut flash.acr); + let mut delay = Delay::new(cp.SYST, clocks); + + let mut gpioe = dp.GPIOE.split(&mut rcc.ahb); + let mut leds = Leds::new( + gpioe.pe8, + gpioe.pe9, + gpioe.pe10, + gpioe.pe11, + gpioe.pe12, + gpioe.pe13, + gpioe.pe14, + gpioe.pe15, + &mut gpioe.moder, + &mut gpioe.otyper + ); + let delay_ms = 200u16; + loop { + leds.ld3.toggle().ok(); + delay.delay_ms(delay_ms); + leds.ld3.toggle().ok(); + delay.delay_ms(delay_ms); + + //explicit on/off + leds.ld4.on().ok(); + delay.delay_ms(delay_ms); + leds.ld4.off().ok(); + delay.delay_ms(delay_ms); + + leds.ld5.on().ok(); + delay.delay_ms(delay_ms); + leds.ld5.off().ok(); + delay.delay_ms(delay_ms); + + leds.ld6.on().ok(); + delay.delay_ms(delay_ms); + leds.ld6.off().ok(); + delay.delay_ms(delay_ms); + + leds.ld7.on().ok(); + delay.delay_ms(delay_ms); + leds.ld7.off().ok(); + delay.delay_ms(delay_ms); + + leds.ld8.on().ok(); + delay.delay_ms(delay_ms); + leds.ld8.off().ok(); + delay.delay_ms(delay_ms); + + leds.ld9.on().ok(); + delay.delay_ms(delay_ms); + leds.ld9.off().ok(); + delay.delay_ms(delay_ms); + + leds.ld10.on().ok(); + delay.delay_ms(delay_ms); + leds.ld10.off().ok(); + delay.delay_ms(delay_ms); + } +} diff --git a/satrs-example-stm32f3-disco/src/main.rs b/satrs-example-stm32f3-disco/src/main.rs new file mode 100644 index 0000000..8762cbf --- /dev/null +++ b/satrs-example-stm32f3-disco/src/main.rs @@ -0,0 +1,604 @@ +#![no_std] +#![no_main] +extern crate panic_itm; + +use rtic::app; + +use heapless::{ + mpmc::Q16, + pool, + pool::singleton::{Box, Pool}, +}; +#[allow(unused_imports)] +use itm_logger::{debug, info, logger_init, warn}; +use satrs_core::spacepackets::{ecss::PusPacket, tm::PusTm}; +use satrs_core::{ + pus::{EcssTmErrorWithSend, EcssTmSenderCore}, + seq_count::SequenceCountProviderCore, +}; +use stm32f3xx_hal::dma::dma1; +use stm32f3xx_hal::gpio::{PushPull, AF7, PA2, PA3}; +use stm32f3xx_hal::pac::USART2; +use stm32f3xx_hal::serial::{Rx, RxEvent, Serial, SerialDmaRx, SerialDmaTx, Tx, TxEvent}; +use systick_monotonic::{fugit::Duration, Systick}; + +const UART_BAUD: u32 = 115200; +const BLINK_FREQ_MS: u64 = 1000; +const TX_HANDLER_FREQ_MS: u64 = 20; +const MIN_DELAY_BETWEEN_TX_PACKETS_MS: u16 = 5; +const MAX_TC_LEN: usize = 200; +const MAX_TM_LEN: usize = 200; +pub const PUS_APID: u16 = 0x02; + +type TxType = Tx>>; +type RxType = Rx>>; +type MsDuration = Duration; +type TxDmaTransferType = SerialDmaTx<&'static [u8], dma1::C7, TxType>; +type RxDmaTransferType = SerialDmaRx<&'static mut [u8], dma1::C6, RxType>; + +// This is the predictable maximum overhead of the COBS encoding scheme. +// It is simply the maximum packet lenght dividied by 254 rounded up. +const COBS_TC_OVERHEAD: usize = (MAX_TC_LEN + 254 - 1) / 254; +const COBS_TM_OVERHEAD: usize = (MAX_TM_LEN + 254 - 1) / 254; + +const TC_BUF_LEN: usize = MAX_TC_LEN + COBS_TC_OVERHEAD; +const TM_BUF_LEN: usize = MAX_TC_LEN + COBS_TM_OVERHEAD; + +// This is a static buffer which should ONLY (!) be used as the TX DMA +// transfer buffer. +static mut DMA_TX_BUF: [u8; TM_BUF_LEN] = [0; TM_BUF_LEN]; +// This is a static buffer which should ONLY (!) be used as the RX DMA +// transfer buffer. +static mut DMA_RX_BUF: [u8; TC_BUF_LEN] = [0; TC_BUF_LEN]; + +static TX_REQUESTS: Q16<(Box, usize)> = Q16::new(); + +const TC_POOL_SLOTS: usize = 12; +const TM_POOL_SLOTS: usize = 12; +use core::sync::atomic::{AtomicU16, Ordering}; + +pub struct SeqCountProviderAtomicRef { + atomic: AtomicU16, + ordering: Ordering, +} + +impl SeqCountProviderAtomicRef { + pub const fn new(ordering: Ordering) -> Self { + Self { + atomic: AtomicU16::new(0), + ordering, + } + } +} + +impl SequenceCountProviderCore for SeqCountProviderAtomicRef { + fn get(&self) -> u16 { + self.atomic.load(self.ordering) + } + + fn increment(&self) { + self.atomic.fetch_add(1, self.ordering); + } + + fn get_and_increment(&self) -> u16 { + self.atomic.fetch_add(1, self.ordering) + } +} + +static SEQ_COUNT_PROVIDER: SeqCountProviderAtomicRef = + SeqCountProviderAtomicRef::new(Ordering::Relaxed); + +// Otherwise, warnings because of heapless pool macro. +#[allow(non_camel_case_types)] +mod poolmod { + use super::*; + // Must hold full TC length including COBS overhead. + pool!(TC: [u8; TC_BUF_LEN]); + // Only encoded at the end, so no need to account for COBS overhead. + pool!(TM: [u8; MAX_TM_LEN]); +} + +pub struct TxIdle { + tx: TxType, + dma_channel: dma1::C7, +} + +#[derive(Debug)] +pub enum TmStoreError { + StoreFull, + StoreSlotsTooSmall, +} + +impl From for EcssTmErrorWithSend { + fn from(value: TmStoreError) -> Self { + Self::SendError(value) + } +} + +pub struct TmSender { + mem_block: Option>, + ctx: &'static str, +} + +impl TmSender { + pub fn new(mem_block: Box, ctx: &'static str) -> Self { + Self { + mem_block: Some(mem_block), + ctx, + } + } +} + +impl EcssTmSenderCore for TmSender { + type Error = TmStoreError; + + fn send_tm( + &mut self, + tm: PusTm, + ) -> Result<(), satrs_core::pus::EcssTmErrorWithSend> { + let mem_block = self.mem_block.take(); + if mem_block.is_none() { + panic!("send_tm should only be called once"); + } + let mut mem_block = mem_block.unwrap(); + if tm.len_packed() > MAX_TM_LEN { + return Err(EcssTmErrorWithSend::SendError( + TmStoreError::StoreSlotsTooSmall, + )); + } + tm.write_to_bytes(mem_block.as_mut_slice()) + .map_err(|e| EcssTmErrorWithSend::EcssTmError(e.into()))?; + info!(target: self.ctx, "Sending TM[{},{}] with size {}", tm.service(), tm.subservice(), tm.len_packed()); + TX_REQUESTS + .enqueue((mem_block, tm.len_packed())) + .map_err(|_| TmStoreError::StoreFull)?; + Ok(()) + } +} + +pub enum UartTxState { + // Wrapped in an option because we need an owned type later. + Idle(Option), + // Same as above + Transmitting(Option), +} + +#[app(device = stm32f3xx_hal::pac, peripherals = true, dispatchers = [TIM20_BRK, TIM20_UP, TIM20_TRG_COM])] +mod app { + use super::*; + use core::slice::Iter; + use cortex_m::iprintln; + use satrs_core::pus::verification::FailParams; + use satrs_core::pus::verification::VerificationReporterCore; + use satrs_core::spacepackets::{ + ecss::EcssEnumU16, + tc::PusTc, + time::cds::P_FIELD_BASE, + tm::{PusTm, PusTmSecondaryHeader}, + CcsdsPacket, SpHeader, + }; + #[allow(unused_imports)] + use stm32f3_discovery::leds::Direction; + use stm32f3_discovery::leds::Leds; + use stm32f3xx_hal::prelude::*; + use stm32f3xx_hal::Toggle; + + use stm32f3_discovery::switch_hal::OutputSwitch; + #[allow(dead_code)] + type SerialType = Serial>, PA3>)>; + + #[shared] + struct Shared { + tx_transfer: UartTxState, + rx_transfer: Option, + } + + #[local] + struct Local { + leds: Leds, + last_dir: Direction, + verif_reporter: VerificationReporterCore, + curr_dir: Iter<'static, Direction>, + } + + #[monotonic(binds = SysTick, default = true)] + type MonoTimer = Systick<1000>; + + #[init(local = [ + tc_pool_mem: [u8; TC_BUF_LEN * TC_POOL_SLOTS] = [0; TC_BUF_LEN * TC_POOL_SLOTS], + tm_pool_mem: [u8; MAX_TM_LEN * TM_POOL_SLOTS] = [0; MAX_TM_LEN * TM_POOL_SLOTS] + ])] + fn init(mut cx: init::Context) -> (Shared, Local, init::Monotonics) { + let mut rcc = cx.device.RCC.constrain(); + + let mono = Systick::new(cx.core.SYST, 8_000_000); + logger_init(); + let mut flash = cx.device.FLASH.constrain(); + let clocks = rcc + .cfgr + .use_hse(8.MHz()) + .sysclk(8.MHz()) + .pclk1(8.MHz()) + .freeze(&mut flash.acr); + // setup ITM output + iprintln!( + &mut cx.core.ITM.stim[0], + "Starting sat-rs demo application for the STM32F3-Discovery" + ); + let mut gpioe = cx.device.GPIOE.split(&mut rcc.ahb); + // Assign memory to the pools. + poolmod::TC::grow(cx.local.tc_pool_mem); + poolmod::TM::grow(cx.local.tm_pool_mem); + + let verif_reporter = VerificationReporterCore::new(PUS_APID).unwrap(); + + let leds = Leds::new( + gpioe.pe8, + gpioe.pe9, + gpioe.pe10, + gpioe.pe11, + gpioe.pe12, + gpioe.pe13, + gpioe.pe14, + gpioe.pe15, + &mut gpioe.moder, + &mut gpioe.otyper, + ); + let mut gpioa = cx.device.GPIOA.split(&mut rcc.ahb); + // USART2 pins + let mut pins = ( + // TX pin: PA2 + gpioa + .pa2 + .into_af_push_pull(&mut gpioa.moder, &mut gpioa.otyper, &mut gpioa.afrl), + // RX pin: PA3 + gpioa + .pa3 + .into_af_push_pull(&mut gpioa.moder, &mut gpioa.otyper, &mut gpioa.afrl), + ); + pins.1.internal_pull_up(&mut gpioa.pupdr, true); + let mut usart2 = Serial::new( + cx.device.USART2, + pins, + UART_BAUD.Bd(), + clocks, + &mut rcc.apb1, + ); + usart2.configure_rx_interrupt(RxEvent::Idle, Toggle::On); + // This interrupt is enabled to re-schedule new transfers in the interrupt handler immediately. + usart2.configure_tx_interrupt(TxEvent::TransmissionComplete, Toggle::On); + + let dma1 = cx.device.DMA1.split(&mut rcc.ahb); + let (tx_serial, mut rx_serial) = usart2.split(); + + // This interrupt is immediately triggered, clear it. It will only be reset + // by the hardware when data is received on RX (RXNE event) + rx_serial.clear_event(RxEvent::Idle); + let rx_transfer = rx_serial.read_exact(unsafe { DMA_RX_BUF.as_mut_slice() }, dma1.ch6); + info!(target: "init", "Spawning tasks"); + blink::spawn().unwrap(); + serial_tx_handler::spawn().unwrap(); + ( + Shared { + tx_transfer: UartTxState::Idle(Some(TxIdle { + tx: tx_serial, + dma_channel: dma1.ch7, + })), + rx_transfer: Some(rx_transfer), + }, + Local { + leds, + last_dir: Direction::North, + curr_dir: Direction::iter(), + verif_reporter, + }, + init::Monotonics(mono), + ) + } + + #[task(local = [leds, curr_dir, last_dir])] + fn blink(cx: blink::Context) { + let toggle_leds = |dir: &Direction| { + let leds = cx.local.leds; + let last_led = leds.for_direction(*cx.local.last_dir); + last_led.off().ok(); + let led = leds.for_direction(*dir); + led.on().ok(); + *cx.local.last_dir = *dir; + }; + + match cx.local.curr_dir.next() { + Some(dir) => { + toggle_leds(dir); + } + None => { + *cx.local.curr_dir = Direction::iter(); + toggle_leds(cx.local.curr_dir.next().unwrap()); + } + } + blink::spawn_after(MsDuration::from_ticks(BLINK_FREQ_MS)).unwrap(); + } + + #[task( + shared = [tx_transfer], + local = [] + )] + fn serial_tx_handler(mut cx: serial_tx_handler::Context) { + if let Some((buf, len)) = TX_REQUESTS.dequeue() { + cx.shared.tx_transfer.lock(|tx_state| match tx_state { + UartTxState::Idle(tx) => { + //debug!(target: "serial_tx_handler", "bytes: {:x?}", &buf[0..len]); + // Safety: We only copy the data into the TX DMA buffer in this task. + // If the DMA is active, another branch will be taken. + let mut_tx_dma_buf = unsafe { &mut DMA_TX_BUF }; + // 0 sentinel value as start marker + mut_tx_dma_buf[0] = 0; + // Should never panic, we accounted for the overhead. + // Write into transfer buffer directly, no need for intermediate + // encoding buffer. + let encoded_len = cobs::encode(&buf[0..len], &mut mut_tx_dma_buf[1..]); + // 0 end marker + mut_tx_dma_buf[encoded_len + 1] = 0; + //debug!(target: "serial_tx_handler", "Sending {} bytes", encoded_len + 2); + //debug!("sent: {:x?}", &mut_tx_dma_buf[0..encoded_len + 2]); + let tx_idle = tx.take().unwrap(); + // Transfer completion and re-scheduling of new TX transfers will be done + // by the IRQ handler. + let transfer = tx_idle + .tx + .write_all(&mut_tx_dma_buf[0..encoded_len + 2], tx_idle.dma_channel); + *tx_state = UartTxState::Transmitting(Some(transfer)); + // The memory block is automatically returned to the pool when it is dropped. + } + UartTxState::Transmitting(_) => { + // This is a SW configuration error. Only the ISR which + // detects transfer completion should be able to spawn a new + // task, and that ISR should set the state to IDLE. + panic!("invalid internal tx state detected") + } + }) + } else { + cx.shared.tx_transfer.lock(|tx_state| { + if let UartTxState::Idle(_) = tx_state { + serial_tx_handler::spawn_after(MsDuration::from_ticks(TX_HANDLER_FREQ_MS)) + .unwrap(); + } + }); + } + } + + #[task( + local = [ + stamp_buf: [u8; 7] = [0; 7], + decode_buf: [u8; MAX_TC_LEN] = [0; MAX_TC_LEN], + src_data_buf: [u8; MAX_TM_LEN] = [0; MAX_TM_LEN], + verif_reporter + ], + )] + fn serial_rx_handler( + cx: serial_rx_handler::Context, + received_packet: Box, + rx_len: usize, + ) { + let tgt: &'static str = "serial_rx_handler"; + cx.local.stamp_buf[0] = P_FIELD_BASE; + info!(target: tgt, "Received packet with {} bytes", rx_len); + let decode_buf = cx.local.decode_buf; + let packet = received_packet.as_slice(); + let mut start_idx = None; + for (idx, byte) in packet.iter().enumerate() { + if *byte != 0 { + start_idx = Some(idx); + break; + } + } + if start_idx.is_none() { + warn!( + target: tgt, + "decoding error, can only process cobs encoded frames, data is all 0" + ); + return; + } + let start_idx = start_idx.unwrap(); + match cobs::decode(&received_packet.as_slice()[start_idx..], decode_buf) { + Ok(len) => { + info!(target: tgt, "Decoded packet length: {}", len); + let pus_tc = PusTc::from_bytes(decode_buf); + let verif_reporter = cx.local.verif_reporter; + match pus_tc { + Ok((tc, tc_len)) => handle_tc( + tc, + tc_len, + verif_reporter, + cx.local.src_data_buf, + cx.local.stamp_buf, + tgt, + ), + Err(e) => { + warn!(target: tgt, "Error unpacking PUS TC: {}", e); + } + } + } + Err(_) => { + warn!( + target: tgt, + "decoding error, can only process cobs encoded frames" + ) + } + } + } + + fn handle_tc( + tc: PusTc, + tc_len: usize, + verif_reporter: &mut VerificationReporterCore, + src_data_buf: &mut [u8; MAX_TM_LEN], + stamp_buf: &[u8; 7], + tgt: &'static str, + ) { + info!( + target: tgt, + "Found PUS TC [{},{}] with length {}", + tc.service(), + tc.subservice(), + tc_len + ); + + let token = verif_reporter.add_tc(&tc); + if tc.apid() != PUS_APID { + warn!(target: tgt, "Received tc with unknown APID {}", tc.apid()); + let sendable = verif_reporter + .acceptance_failure( + src_data_buf, + token, + &SEQ_COUNT_PROVIDER, + FailParams::new(stamp_buf, &EcssEnumU16::new(0), None), + ) + .unwrap(); + let mem_block = poolmod::TM::alloc().unwrap().init([0u8; MAX_TM_LEN]); + let mut sender = TmSender::new(mem_block, tgt); + if let Err(e) = + verif_reporter.send_acceptance_failure(sendable, &SEQ_COUNT_PROVIDER, &mut sender) + { + warn!(target: tgt, "Sending acceptance failure failed: {:?}", e.0); + }; + return; + } + let sendable = verif_reporter + .acceptance_success(src_data_buf, token, &SEQ_COUNT_PROVIDER, stamp_buf) + .unwrap(); + + let mem_block = poolmod::TM::alloc().unwrap().init([0u8; MAX_TM_LEN]); + let mut sender = TmSender::new(mem_block, tgt); + let accepted_token = match verif_reporter.send_acceptance_success( + sendable, + &SEQ_COUNT_PROVIDER, + &mut sender, + ) { + Ok(token) => token, + Err(e) => { + warn!(target: "serial_rx_handler", "Sending acceptance success failed: {:?}", e.0); + return; + } + }; + + if tc.service() == 17 { + if tc.subservice() == 1 { + let sendable = verif_reporter + .start_success(src_data_buf, accepted_token, &SEQ_COUNT_PROVIDER, stamp_buf) + .unwrap(); + let mem_block = poolmod::TM::alloc().unwrap().init([0u8; MAX_TM_LEN]); + let mut sender = TmSender::new(mem_block, tgt); + let started_token = match verif_reporter.send_start_success( + sendable, + &SEQ_COUNT_PROVIDER, + &mut sender, + ) { + Ok(token) => token, + Err(e) => { + warn!(target: tgt, "Sending acceptance success failed: {:?}", e.0); + return; + } + }; + info!( + target: tgt, + "Received PUS ping telecommand, sending ping reply TM[17,2]" + ); + let mut sp_header = + SpHeader::tc_unseg(PUS_APID, SEQ_COUNT_PROVIDER.get(), 0).unwrap(); + let sec_header = PusTmSecondaryHeader::new_simple(17, 2, stamp_buf); + let ping_reply = PusTm::new(&mut sp_header, sec_header, None, true); + let mut mem_block = poolmod::TM::alloc().unwrap().init([0u8; MAX_TM_LEN]); + let reply_len = ping_reply.write_to_bytes(mem_block.as_mut_slice()).unwrap(); + if TX_REQUESTS.enqueue((mem_block, reply_len)).is_err() { + warn!(target: tgt, "TC queue full"); + return; + } + SEQ_COUNT_PROVIDER.increment(); + let sendable = verif_reporter + .completion_success(src_data_buf, started_token, &SEQ_COUNT_PROVIDER, stamp_buf) + .unwrap(); + let mem_block = poolmod::TM::alloc().unwrap().init([0u8; MAX_TM_LEN]); + let mut sender = TmSender::new(mem_block, tgt); + if let Err(e) = verif_reporter.send_step_or_completion_success( + sendable, + &SEQ_COUNT_PROVIDER, + &mut sender, + ) { + warn!(target: tgt, "Sending completion success failed: {:?}", e.0); + } + } else { + // TODO: Invalid subservice + } + } + } + + #[task(binds = DMA1_CH6, shared = [rx_transfer])] + fn rx_dma_isr(mut cx: rx_dma_isr::Context) { + cx.shared.rx_transfer.lock(|rx_transfer| { + let rx_ref = rx_transfer.as_ref().unwrap(); + if rx_ref.is_complete() { + let uart_rx_owned = rx_transfer.take().unwrap(); + let (buf, c, rx) = uart_rx_owned.stop(); + // The received data is transferred to another task now to avoid any processing overhead + // during the interrupt. There are multiple ways to do this, we use a memory pool here + // to do this. + let mut mem_block = poolmod::TC::alloc() + .expect("allocating memory block for rx failed") + .init([0u8; TC_BUF_LEN]); + // Copy data into memory pool. + mem_block.copy_from_slice(buf); + *rx_transfer = Some(rx.read_exact(buf, c)); + // Only send owning pointer to pool memory and the received packet length. + serial_rx_handler::spawn(mem_block, TC_BUF_LEN) + .expect("spawning rx handler task failed"); + // If this happens, there is a high chance that the maximum packet length was + // exceeded. Circular mode is not used here, so data might be missed. + warn!( + "rx transfer with maximum length {}, might miss data", + TC_BUF_LEN + ); + } + }); + } + + #[task(binds = USART2_EXTI26, shared = [rx_transfer, tx_transfer])] + fn serial_isr(mut cx: serial_isr::Context) { + cx.shared.tx_transfer.lock(|tx_state| match tx_state { + UartTxState::Idle(_) => (), + UartTxState::Transmitting(transfer) => { + let transfer_ref = transfer.as_ref().unwrap(); + if transfer_ref.is_complete() { + let transfer = transfer.take().unwrap(); + let (_, dma_channel, tx) = transfer.stop(); + *tx_state = UartTxState::Idle(Some(TxIdle { tx, dma_channel })); + serial_tx_handler::spawn_after(MsDuration::from_ticks( + MIN_DELAY_BETWEEN_TX_PACKETS_MS.into(), + )) + .unwrap(); + } + } + }); + cx.shared.rx_transfer.lock(|rx_transfer| { + let rx_transfer_ref = rx_transfer.as_ref().unwrap(); + // Received a partial packet. + if rx_transfer_ref.is_event_triggered(RxEvent::Idle) { + let rx_transfer_owned = rx_transfer.take().unwrap(); + let (buf, ch, mut rx, rx_len) = rx_transfer_owned.stop_and_return_received_bytes(); + // The received data is transferred to another task now to avoid any processing overhead + // during the interrupt. There are multiple ways to do this, we use a memory pool here + // to do this. + let mut mem_block = poolmod::TC::alloc() + .expect("allocating memory block for rx failed") + .init([0u8; TC_BUF_LEN]); + // Copy data into memory pool. + mem_block[0..rx_len as usize].copy_from_slice(&buf[0..rx_len as usize]); + rx.clear_event(RxEvent::Idle); + // Only send owning pointer to pool memory and the received packet length. + serial_rx_handler::spawn(mem_block, rx_len as usize) + .expect("spawning rx handler task failed"); + *rx_transfer = Some(rx.read_exact(buf, ch)); + } + }); + } +} From cf80afb431bee2a1112537d23ed7e189d943d55d Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 25 Jan 2023 22:20:12 +0100 Subject: [PATCH 15/20] add license file --- satrs-example-stm32f3-disco/LICENSE-APACHE | 201 +++++++++++++++++++++ satrs-example-stm32f3-disco/NOTICE | 1 + 2 files changed, 202 insertions(+) create mode 100644 satrs-example-stm32f3-disco/LICENSE-APACHE create mode 100644 satrs-example-stm32f3-disco/NOTICE diff --git a/satrs-example-stm32f3-disco/LICENSE-APACHE b/satrs-example-stm32f3-disco/LICENSE-APACHE new file mode 100644 index 0000000..16fe87b --- /dev/null +++ b/satrs-example-stm32f3-disco/LICENSE-APACHE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/satrs-example-stm32f3-disco/NOTICE b/satrs-example-stm32f3-disco/NOTICE new file mode 100644 index 0000000..717a583 --- /dev/null +++ b/satrs-example-stm32f3-disco/NOTICE @@ -0,0 +1 @@ +This software contains code developed at the University of Stuttgart's Institute of Space Systems. From b793e2996260208ef0fd90eddd8209f13d3225f0 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 25 Jan 2023 23:01:24 +0100 Subject: [PATCH 16/20] add workspace member --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index aa7ec58..8301c31 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,5 +4,5 @@ members = [ "satrs-core", "satrs-mib", "satrs-example", - "spacepackets", + "satrs-example-stm32f3-disco", ] From 820e2239e2f61db16ea3f88d67a8c3d25389b191 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 25 Jan 2023 23:03:31 +0100 Subject: [PATCH 17/20] remove archive.rs --- archive.rs | 82 ------------------------------------------------------ 1 file changed, 82 deletions(-) delete mode 100644 archive.rs diff --git a/archive.rs b/archive.rs deleted file mode 100644 index a9bdce0..0000000 --- a/archive.rs +++ /dev/null @@ -1,82 +0,0 @@ - -/* -pub mod deku { - pub use ccsds_spacepacket::PrimaryHeader as SpHeader; - use crate::sp::{self, PacketId, PacketSequenceCtrl}; - use crate::sp::{CcsdsPrimaryHeader, PacketType, SequenceFlags}; - - impl CcsdsPrimaryHeader for SpHeader { - fn from_composite_fields(packet_id: PacketId, psc: PacketSequenceCtrl, data_len: u16, version: Option) -> Self { - let mut version_to_set = 0b000; - if let Some(version) = version { - version_to_set = version; - } - let packet_type = match packet_id.ptype { - PacketType::Tm => ccsds_spacepacket::types::PacketType::Data, - PacketType::Tc => ccsds_spacepacket::types::PacketType::Command - }; - let sec_header_flag = match packet_id.sec_header_flag { - true => ccsds_spacepacket::types::SecondaryHeaderFlag::Present, - false => ccsds_spacepacket::types::SecondaryHeaderFlag::NotPresent - }; - let sequence_flags = match psc.seq_flags { - SequenceFlags::ContinuationSegment => ccsds_spacepacket::types::SeqFlag::Continuation, - SequenceFlags::FirstSegment => ccsds_spacepacket::types::SeqFlag::FirstSegment, - SequenceFlags::LastSegment => ccsds_spacepacket::types::SeqFlag::LastSegment, - SequenceFlags::Unsegmented => ccsds_spacepacket::types::SeqFlag::Unsegmented - }; - SpHeader { - version: version_to_set, - packet_type, - sec_header_flag, - app_proc_id: packet_id.apid, - sequence_flags, - sequence_count: psc.ssc, - data_length: data_len - } - } - - #[inline] - fn version(&self) -> u8 { - self.version - } - - #[inline] - fn packet_id(&self) -> PacketId { - PacketId { - ptype: PacketType::try_from(self.packet_type as u8).unwrap(), - apid: self.app_proc_id, - sec_header_flag: self.sec_header_flag as u8 != 0 - } - } - - #[inline] - fn psc(&self) -> PacketSequenceCtrl { - PacketSequenceCtrl { - seq_flags: SequenceFlags::try_from(self.sequence_flags as u8).unwrap(), - ssc: self.sequence_count - } - } - - #[inline] - fn data_len(&self) -> u16 { - self.data_length - } - } - - sph_from_other!(SpHeader, sp::srd::SpHeader); - sph_from_other!(SpHeader, sp::zc::SpHeader); -} -*/ - -/* -#[test] -fn test_deser_to_raw_packed_deku() { - let sp_header = SpHeader::tc(0x42, 12).expect("Error creating SP header"); - // TODO: Wait with these tests until KubOS merged - // https://github.com/KubOS-Preservation-Group/ccsds-spacepacket/pull/14 - let _deku_header = - deku::SpHeader::try_from(sp_header).expect("Error creating Deku Sp Header"); - // deku_header.to_bytes().unwrap(); -} - */ From 8cb2eada17611d9580a2adaf8ca3e7f30eea4870 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 25 Jan 2023 23:04:32 +0100 Subject: [PATCH 18/20] remove spacepackets run configs --- .idea/runConfigurations/Run_spacepackets.xml | 19 ------------------- .idea/runConfigurations/Test_spacepackets.xml | 18 ------------------ 2 files changed, 37 deletions(-) delete mode 100644 .idea/runConfigurations/Run_spacepackets.xml delete mode 100644 .idea/runConfigurations/Test_spacepackets.xml diff --git a/.idea/runConfigurations/Run_spacepackets.xml b/.idea/runConfigurations/Run_spacepackets.xml deleted file mode 100644 index 32f8a84..0000000 --- a/.idea/runConfigurations/Run_spacepackets.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/runConfigurations/Test_spacepackets.xml b/.idea/runConfigurations/Test_spacepackets.xml deleted file mode 100644 index aa53e5d..0000000 --- a/.idea/runConfigurations/Test_spacepackets.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - \ No newline at end of file From dd41326f1e530dafb63f5f2ace15c40af2f53ab2 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 25 Jan 2023 23:08:25 +0100 Subject: [PATCH 19/20] small README tweak --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index b719fff..22019e6 100644 --- a/README.md +++ b/README.md @@ -27,8 +27,7 @@ Each project has its own `CHANGELOG.md`. # Related projects - In addition to the crates in this repository, the sat-rs project also maintains several - other libraries. + In addition to the crates in this repository, the sat-rs project also maintains other libraries. * [`spacepackets`](https://egit.irs.uni-stuttgart.de/rust/spacepackets): Basic ECSS and CCSDS packet protocol implementations. This repository is re-expored in the From 2bdbabf47e1f80a8d7ab05b22fa1a9acfeeb036a Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 26 Jan 2023 00:52:24 +0100 Subject: [PATCH 20/20] exclude stm32f3 example from workspace --- Cargo.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 8301c31..c9d35a8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,5 +4,8 @@ members = [ "satrs-core", "satrs-mib", "satrs-example", +] + +exclude = [ "satrs-example-stm32f3-disco", ]