From e654c317ea099130e39b9e4320cf36176fe9af91 Mon Sep 17 00:00:00 2001 From: Jonas Schneider-Bensch Date: Thu, 31 Oct 2024 16:02:10 +0100 Subject: [PATCH 1/7] Platform-specifics trait --- libcrux-iot-testutil/src/lib.rs | 29 +++++++++++++++---------- libcrux-iot-testutil/src/platform.rs | 25 +++++++++++++++++++++ libcrux-iot-testutil/tests/run_tests.rs | 1 + libcrux-testbench/src/mldsa.rs | 2 +- libcrux-testbench/src/mlkem.rs | 2 +- 5 files changed, 45 insertions(+), 14 deletions(-) create mode 100644 libcrux-iot-testutil/src/platform.rs diff --git a/libcrux-iot-testutil/src/lib.rs b/libcrux-iot-testutil/src/lib.rs index 16da016..143e40d 100644 --- a/libcrux-iot-testutil/src/lib.rs +++ b/libcrux-iot-testutil/src/lib.rs @@ -29,6 +29,8 @@ mod events; mod logger; +pub mod platform; + pub use events::*; pub use logger::defmt_logger::DefmtInfoLogger; pub use logger::vec_logger::VecLogger; @@ -65,7 +67,7 @@ where E: Display, { /// Returns whether the test configuration is set to skip the test case. - pub fn is_skipped(&self, config: &TestConfig) -> bool { + pub fn is_skipped(&self, config: &TestConfig

) -> bool { let all_tests_should_run = config.only_names.is_empty(); let test_is_selected = config.only_names.contains(&self.name); @@ -97,15 +99,15 @@ where /// If the configuration permits, runs the test case as a benchmark. Logs the /// appropriate messages, and returns the error returned by the test. - pub fn benchmark(&self, logger: &mut L, run_id: u32, state: &S) -> Result { + pub fn benchmark(&self, config: &TestConfig

, logger: &mut L, run_id: u32, state: &S) -> Result { logger.log_event(TestUtilEvent::Benchmark(BenchmarkEvent::Run { name: String::from(self.name), run_id, })); - let cycles_start = cortex_m::peripheral::DWT::cycle_count(); + let cycles_start = config.platform.cycle_count(); let result = core::hint::black_box((self.test_fn)(logger, state)); - let cycles_end = cortex_m::peripheral::DWT::cycle_count(); + let cycles_end = config.platform.cycle_count(); let cycles = cycles_end - cycles_start; match &result { @@ -146,10 +148,10 @@ impl<'a, L: EventLogger, E: Display, S> TestSuite<'a, L, E, S> { /// returns the first error, wrapped in [`ErrorReport::EarlyAbort`]. /// Otherwise it runs all tests and, if errors were encountered, returns the /// vector of all errors wrapped in [`ErrorReport::Combined`]. - pub fn run( + pub fn run( &self, logger: &mut L, - config: &TestConfig<'a>, + config: &TestConfig<'a, P>, state: &S, ) -> Result<(), ErrorReport> where @@ -191,15 +193,16 @@ impl<'a, L: EventLogger, E: Display, S> TestSuite<'a, L, E, S> { /// set, it returns the first error, wrapped in [`ErrorReport::EarlyAbort`]. /// Otherwise it runs all tests and, if errors were encountered, returns the /// vector of all errors wrapped in [`ErrorReport::Combined`]. - pub fn benchmark( + pub fn benchmark( &self, logger: &mut L, - config: &TestConfig<'a>, + config: &TestConfig<'a, P>, state: &S, ) -> Result, ErrorReport> where E: Display + Debug, { + config.platform.init(); logger.log_event(TestUtilEvent::Launch(LaunchEvent { core_freq: config.core_freq, name: self.name.to_string(), @@ -218,7 +221,7 @@ impl<'a, L: EventLogger, E: Display, S> TestSuite<'a, L, E, S> { } for run_id in 0..config.benchmark_runs { - let result = test_case.benchmark(logger, run_id, state); + let result = test_case.benchmark(config,logger, run_id, state); if config.early_abort { cycle_infos.push(( @@ -246,7 +249,8 @@ impl<'a, L: EventLogger, E: Display, S> TestSuite<'a, L, E, S> { #[derive(Debug)] /// The test config contains information on the system and settings that control /// how the tests are run. -pub struct TestConfig<'a> { +pub struct TestConfig<'a, P: platform::Platform> { + pub platform: P, /// The core frequency used when benchmarking, so we can reconstruct the actual time passed /// of running the benchmark. pub core_freq: u32, @@ -283,9 +287,9 @@ impl Display for ErrorReport { } } -impl<'a> TestConfig<'a> { +impl<'a, P: platform::Platform> TestConfig<'a, P> { /// Parses a config string. - pub fn parse_config(core_freq: u32, config: &'a str) -> Result { + pub fn parse_config(platform: P, core_freq: u32, config: &'a str) -> Result { let mut early_abort = false; let mut only_names = vec![]; let mut benchmark_runs = 5; @@ -320,6 +324,7 @@ impl<'a> TestConfig<'a> { } Ok(Self { + platform, core_freq, only_names, early_abort, diff --git a/libcrux-iot-testutil/src/platform.rs b/libcrux-iot-testutil/src/platform.rs new file mode 100644 index 0000000..065743f --- /dev/null +++ b/libcrux-iot-testutil/src/platform.rs @@ -0,0 +1,25 @@ +/// A trait capturing platform specific details +pub trait Platform { + /// Initialize cycle counters and other peripherals. + fn init(&self); + + /// Return a cycle count, assuming the cycle counter has been initialized. + fn cycle_count(&self) -> u32; +} + +/// The Cortex-M specific implementation details. +pub struct CortexM; + +impl Platform for CortexM { + + fn init(&self) { + use cortex_m::peripheral::Peripherals; + let mut peripherals = Peripherals::take().unwrap(); + peripherals.DCB.enable_trace(); + peripherals.DWT.enable_cycle_counter(); + } + + fn cycle_count(&self) -> u32 { + cortex_m::peripheral::DWT::cycle_count() + } +} diff --git a/libcrux-iot-testutil/tests/run_tests.rs b/libcrux-iot-testutil/tests/run_tests.rs index ad030e1..823ed79 100644 --- a/libcrux-iot-testutil/tests/run_tests.rs +++ b/libcrux-iot-testutil/tests/run_tests.rs @@ -41,6 +41,7 @@ fn run_tests_no_early_abort() { let test_suite = TestSuite::new("suite for testing", &cases); let test_config = TestConfig { + platform: platform::CortexM, core_freq: 25_000_000, only_names: vec!["test_pass", "test_log", "test_error"], early_abort: false, diff --git a/libcrux-testbench/src/mldsa.rs b/libcrux-testbench/src/mldsa.rs index 9c09d5f..2511cf8 100644 --- a/libcrux-testbench/src/mldsa.rs +++ b/libcrux-testbench/src/mldsa.rs @@ -58,7 +58,7 @@ fn bench_verify(_l: &mut L, state: &MLDSABenchState) -> Result<( Ok(()) } -pub fn run_benchmarks(test_config: TestConfig) { +pub fn run_benchmarks(test_config: TestConfig

) { // set up the test suite let test_cases = [ TestCase::new("bench_keygen", bench_keygen), diff --git a/libcrux-testbench/src/mlkem.rs b/libcrux-testbench/src/mlkem.rs index e86fb85..2fc23ab 100644 --- a/libcrux-testbench/src/mlkem.rs +++ b/libcrux-testbench/src/mlkem.rs @@ -54,7 +54,7 @@ fn bench_decaps(_l: &mut L, state: &MlKemBenchState) -> Result<( Ok(()) } -pub fn run_benchmarks(test_config: TestConfig) { +pub fn run_benchmarks(test_config: TestConfig

) { // set up the test suite let test_cases = [ TestCase::new("bench_keygen", bench_keygen), From 1b52f52bd95b48a80e36685205a9bfec7a924f33 Mon Sep 17 00:00:00 2001 From: Jonas Schneider-Bensch Date: Thu, 31 Oct 2024 16:07:20 +0100 Subject: [PATCH 2/7] Update board crates --- libcrux-nrf52810/src/bin/mldsa.rs | 5 +---- libcrux-nrf52810/src/bin/mlkem.rs | 5 +---- libcrux-nrf52832/src/bin/mldsa.rs | 5 +---- libcrux-nrf52832/src/bin/mlkem.rs | 5 +---- libcrux-nrf52840/src/bin/mldsa.rs | 5 +---- libcrux-nrf52840/src/bin/mlkem.rs | 5 +---- libcrux-nrf5340/src/bin/mldsa.rs | 5 +---- libcrux-nrf5340/src/bin/mlkem.rs | 7 ++----- 8 files changed, 9 insertions(+), 33 deletions(-) diff --git a/libcrux-nrf52810/src/bin/mldsa.rs b/libcrux-nrf52810/src/bin/mldsa.rs index 4838699..bd21853 100644 --- a/libcrux-nrf52810/src/bin/mldsa.rs +++ b/libcrux-nrf52810/src/bin/mldsa.rs @@ -22,14 +22,11 @@ fn main() -> ! { const HEAP_SIZE: usize = 1024; static mut HEAP_MEM: [MaybeUninit; HEAP_SIZE] = [MaybeUninit::uninit(); HEAP_SIZE]; unsafe { HEAP.init(addr_of_mut!(HEAP_MEM) as usize, HEAP_SIZE) } - - let mut peripherals = Peripherals::take().unwrap(); - peripherals.DCB.enable_trace(); - peripherals.DWT.enable_cycle_counter(); } // set up the test config let test_config = TestConfig { + platform: platform::CortexM, core_freq: board::COREFREQ, only_names: alloc::vec![], early_abort: false, diff --git a/libcrux-nrf52810/src/bin/mlkem.rs b/libcrux-nrf52810/src/bin/mlkem.rs index 57a36e4..5ce3b0a 100644 --- a/libcrux-nrf52810/src/bin/mlkem.rs +++ b/libcrux-nrf52810/src/bin/mlkem.rs @@ -21,14 +21,11 @@ fn main() -> ! { const HEAP_SIZE: usize = 1024; static mut HEAP_MEM: [MaybeUninit; HEAP_SIZE] = [MaybeUninit::uninit(); HEAP_SIZE]; unsafe { HEAP.init(addr_of_mut!(HEAP_MEM) as usize, HEAP_SIZE) } - - let mut peripherals = Peripherals::take().unwrap(); - peripherals.DCB.enable_trace(); - peripherals.DWT.enable_cycle_counter(); } // set up the test config let test_config = TestConfig { + platform: platform::CortexM, core_freq: board::COREFREQ, only_names: alloc::vec![], early_abort: false, diff --git a/libcrux-nrf52832/src/bin/mldsa.rs b/libcrux-nrf52832/src/bin/mldsa.rs index a2534f6..68f09c5 100644 --- a/libcrux-nrf52832/src/bin/mldsa.rs +++ b/libcrux-nrf52832/src/bin/mldsa.rs @@ -22,14 +22,11 @@ fn main() -> ! { const HEAP_SIZE: usize = 1024; static mut HEAP_MEM: [MaybeUninit; HEAP_SIZE] = [MaybeUninit::uninit(); HEAP_SIZE]; unsafe { HEAP.init(addr_of_mut!(HEAP_MEM) as usize, HEAP_SIZE) } - - let mut peripherals = Peripherals::take().unwrap(); - peripherals.DCB.enable_trace(); - peripherals.DWT.enable_cycle_counter(); } // set up the test config let test_config = TestConfig { + platform: platform::CortexM, core_freq: board::COREFREQ, only_names: alloc::vec![], early_abort: false, diff --git a/libcrux-nrf52832/src/bin/mlkem.rs b/libcrux-nrf52832/src/bin/mlkem.rs index 159bca6..5d40324 100644 --- a/libcrux-nrf52832/src/bin/mlkem.rs +++ b/libcrux-nrf52832/src/bin/mlkem.rs @@ -21,14 +21,11 @@ fn main() -> ! { const HEAP_SIZE: usize = 1024; static mut HEAP_MEM: [MaybeUninit; HEAP_SIZE] = [MaybeUninit::uninit(); HEAP_SIZE]; unsafe { HEAP.init(addr_of_mut!(HEAP_MEM) as usize, HEAP_SIZE) } - - let mut peripherals = Peripherals::take().unwrap(); - peripherals.DCB.enable_trace(); - peripherals.DWT.enable_cycle_counter(); } // set up the test config let test_config = TestConfig { + platform: platform::CortexM, core_freq: board::COREFREQ, only_names: alloc::vec![], early_abort: false, diff --git a/libcrux-nrf52840/src/bin/mldsa.rs b/libcrux-nrf52840/src/bin/mldsa.rs index b9d9633..3134114 100644 --- a/libcrux-nrf52840/src/bin/mldsa.rs +++ b/libcrux-nrf52840/src/bin/mldsa.rs @@ -22,14 +22,11 @@ fn main() -> ! { const HEAP_SIZE: usize = 1024; static mut HEAP_MEM: [MaybeUninit; HEAP_SIZE] = [MaybeUninit::uninit(); HEAP_SIZE]; unsafe { HEAP.init(addr_of_mut!(HEAP_MEM) as usize, HEAP_SIZE) } - - let mut peripherals = Peripherals::take().unwrap(); - peripherals.DCB.enable_trace(); - peripherals.DWT.enable_cycle_counter(); } // set up the test config let test_config = TestConfig { + platform: platform::CortexM, core_freq: board::COREFREQ, only_names: alloc::vec![], early_abort: false, diff --git a/libcrux-nrf52840/src/bin/mlkem.rs b/libcrux-nrf52840/src/bin/mlkem.rs index cefd045..e76f127 100644 --- a/libcrux-nrf52840/src/bin/mlkem.rs +++ b/libcrux-nrf52840/src/bin/mlkem.rs @@ -21,14 +21,11 @@ fn main() -> ! { const HEAP_SIZE: usize = 1024; static mut HEAP_MEM: [MaybeUninit; HEAP_SIZE] = [MaybeUninit::uninit(); HEAP_SIZE]; unsafe { HEAP.init(addr_of_mut!(HEAP_MEM) as usize, HEAP_SIZE) } - - let mut peripherals = Peripherals::take().unwrap(); - peripherals.DCB.enable_trace(); - peripherals.DWT.enable_cycle_counter(); } // set up the test config let test_config = TestConfig { + platform: platform::CortexM, core_freq: board::COREFREQ, only_names: alloc::vec![], early_abort: false, diff --git a/libcrux-nrf5340/src/bin/mldsa.rs b/libcrux-nrf5340/src/bin/mldsa.rs index a348af4..04f9a50 100644 --- a/libcrux-nrf5340/src/bin/mldsa.rs +++ b/libcrux-nrf5340/src/bin/mldsa.rs @@ -22,14 +22,11 @@ fn main() -> ! { const HEAP_SIZE: usize = 1024; static mut HEAP_MEM: [MaybeUninit; HEAP_SIZE] = [MaybeUninit::uninit(); HEAP_SIZE]; unsafe { HEAP.init(addr_of_mut!(HEAP_MEM) as usize, HEAP_SIZE) } - - let mut peripherals = Peripherals::take().unwrap(); - peripherals.DCB.enable_trace(); - peripherals.DWT.enable_cycle_counter(); } // set up the test config let test_config = TestConfig { + platform: platform::CortexM, core_freq: board::COREFREQ, only_names: alloc::vec![], early_abort: false, diff --git a/libcrux-nrf5340/src/bin/mlkem.rs b/libcrux-nrf5340/src/bin/mlkem.rs index 2b739c6..3d38c73 100644 --- a/libcrux-nrf5340/src/bin/mlkem.rs +++ b/libcrux-nrf5340/src/bin/mlkem.rs @@ -1,7 +1,7 @@ #![no_main] #![no_std] -use cortex_m::peripheral::Peripherals; + use libcrux_nrf5340 as board; // global logger + panicking-behavior + memory layout extern crate alloc; @@ -21,14 +21,11 @@ fn main() -> ! { const HEAP_SIZE: usize = 1024; static mut HEAP_MEM: [MaybeUninit; HEAP_SIZE] = [MaybeUninit::uninit(); HEAP_SIZE]; unsafe { HEAP.init(addr_of_mut!(HEAP_MEM) as usize, HEAP_SIZE) } - - let mut peripherals = Peripherals::take().unwrap(); - peripherals.DCB.enable_trace(); - peripherals.DWT.enable_cycle_counter(); } // set up the test config let test_config = TestConfig { + platform: platform::CortexM, core_freq: board::COREFREQ, only_names: alloc::vec![], early_abort: false, From 81f28ec70e947f2d4b3591d7c507e619aef0ad58 Mon Sep 17 00:00:00 2001 From: Jonas Schneider-Bensch Date: Thu, 31 Oct 2024 16:13:37 +0100 Subject: [PATCH 3/7] Update CI for new boards --- .github/workflows/build.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b9532a3..a68d73f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,14 +15,20 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - board_directory: [libcrux-nrf52840, libcrux-nucleo-l4r5zi] + board_directory: [ + libcrux-nucleo-l4r5zi, + libcrux-nrf52840, + libcrux-nrf52810, + libcrux-nrf52832, + libcrux-nrf5340, + ] steps: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@stable with: - targets: thumbv7em-none-eabihf,thumbv7em-none-eabi + targets: thumbv7em-none-eabihf,thumbv7em-none-eabi,thumbv8m.main-none-eabihf - name: Install flip-link run: cargo install flip-link From 2a42e19023a1a253e338ba1e506ff5914e06ebd2 Mon Sep 17 00:00:00 2001 From: Jonas Schneider-Bensch Date: Thu, 31 Oct 2024 16:16:59 +0100 Subject: [PATCH 4/7] Update l4r5zi crate --- libcrux-nucleo-l4r5zi/src/bin/mldsa.rs | 5 +---- libcrux-nucleo-l4r5zi/src/bin/mlkem.rs | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/libcrux-nucleo-l4r5zi/src/bin/mldsa.rs b/libcrux-nucleo-l4r5zi/src/bin/mldsa.rs index bb32d73..6b3a58b 100644 --- a/libcrux-nucleo-l4r5zi/src/bin/mldsa.rs +++ b/libcrux-nucleo-l4r5zi/src/bin/mldsa.rs @@ -21,13 +21,10 @@ fn main() -> ! { const HEAP_SIZE: usize = 1024; static mut HEAP_MEM: [MaybeUninit; HEAP_SIZE] = [MaybeUninit::uninit(); HEAP_SIZE]; unsafe { HEAP.init(addr_of_mut!(HEAP_MEM) as usize, HEAP_SIZE) } - - let mut peripherals = Peripherals::take().unwrap(); - peripherals.DCB.enable_trace(); - peripherals.DWT.enable_cycle_counter(); } // set up the test config let test_config = TestConfig { + platform: platform::CortexM, core_freq: board::COREFREQ, only_names: alloc::vec![], early_abort: false, diff --git a/libcrux-nucleo-l4r5zi/src/bin/mlkem.rs b/libcrux-nucleo-l4r5zi/src/bin/mlkem.rs index c9ffe93..f4b8af0 100644 --- a/libcrux-nucleo-l4r5zi/src/bin/mlkem.rs +++ b/libcrux-nucleo-l4r5zi/src/bin/mlkem.rs @@ -21,14 +21,11 @@ fn main() -> ! { const HEAP_SIZE: usize = 1024; static mut HEAP_MEM: [MaybeUninit; HEAP_SIZE] = [MaybeUninit::uninit(); HEAP_SIZE]; unsafe { HEAP.init(addr_of_mut!(HEAP_MEM) as usize, HEAP_SIZE) } - - let mut peripherals = Peripherals::take().unwrap(); - peripherals.DCB.enable_trace(); - peripherals.DWT.enable_cycle_counter(); } // set up the test config let test_config = TestConfig { + platform: platform::CortexM, core_freq: board::COREFREQ, only_names: alloc::vec![], early_abort: false, From 71656dd652ec3df6841cbce7d3ebcae1e3cbd895 Mon Sep 17 00:00:00 2001 From: Jonas Schneider-Bensch Date: Thu, 31 Oct 2024 16:29:53 +0100 Subject: [PATCH 5/7] Remove unused import --- libcrux-nrf52810/src/bin/mldsa.rs | 1 - libcrux-nrf52810/src/bin/mlkem.rs | 1 - libcrux-nrf52832/src/bin/mldsa.rs | 1 - libcrux-nrf52832/src/bin/mlkem.rs | 1 - libcrux-nrf5340/src/bin/mldsa.rs | 1 - 5 files changed, 5 deletions(-) diff --git a/libcrux-nrf52810/src/bin/mldsa.rs b/libcrux-nrf52810/src/bin/mldsa.rs index bd21853..045f699 100644 --- a/libcrux-nrf52810/src/bin/mldsa.rs +++ b/libcrux-nrf52810/src/bin/mldsa.rs @@ -1,7 +1,6 @@ #![no_main] #![no_std] -use cortex_m::peripheral::Peripherals; use libcrux_nrf52810 as board; // global logger + panicking-behavior + memory layout extern crate alloc; diff --git a/libcrux-nrf52810/src/bin/mlkem.rs b/libcrux-nrf52810/src/bin/mlkem.rs index 5ce3b0a..f230b4e 100644 --- a/libcrux-nrf52810/src/bin/mlkem.rs +++ b/libcrux-nrf52810/src/bin/mlkem.rs @@ -1,7 +1,6 @@ #![no_main] #![no_std] -use cortex_m::peripheral::Peripherals; use libcrux_nrf52810 as board; // global logger + panicking-behavior + memory layout extern crate alloc; diff --git a/libcrux-nrf52832/src/bin/mldsa.rs b/libcrux-nrf52832/src/bin/mldsa.rs index 68f09c5..4658afd 100644 --- a/libcrux-nrf52832/src/bin/mldsa.rs +++ b/libcrux-nrf52832/src/bin/mldsa.rs @@ -1,7 +1,6 @@ #![no_main] #![no_std] -use cortex_m::peripheral::Peripherals; use libcrux_nrf52832 as board; // global logger + panicking-behavior + memory layout extern crate alloc; diff --git a/libcrux-nrf52832/src/bin/mlkem.rs b/libcrux-nrf52832/src/bin/mlkem.rs index 5d40324..3eeab1d 100644 --- a/libcrux-nrf52832/src/bin/mlkem.rs +++ b/libcrux-nrf52832/src/bin/mlkem.rs @@ -1,7 +1,6 @@ #![no_main] #![no_std] -use cortex_m::peripheral::Peripherals; use libcrux_nrf52832 as board; // global logger + panicking-behavior + memory layout extern crate alloc; diff --git a/libcrux-nrf5340/src/bin/mldsa.rs b/libcrux-nrf5340/src/bin/mldsa.rs index 04f9a50..21be9d1 100644 --- a/libcrux-nrf5340/src/bin/mldsa.rs +++ b/libcrux-nrf5340/src/bin/mldsa.rs @@ -1,7 +1,6 @@ #![no_main] #![no_std] -use cortex_m::peripheral::Peripherals; use libcrux_nrf5340 as board; // global logger + panicking-behavior + memory layout extern crate alloc; From 66739123eda55fd4d8dd7f63994853d5ad6d86ee Mon Sep 17 00:00:00 2001 From: Jonas Schneider-Bensch Date: Thu, 31 Oct 2024 16:38:12 +0100 Subject: [PATCH 6/7] Remove unused import --- libcrux-nrf52840/src/bin/mldsa.rs | 5 ++--- libcrux-nrf52840/src/bin/mlkem.rs | 1 - 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/libcrux-nrf52840/src/bin/mldsa.rs b/libcrux-nrf52840/src/bin/mldsa.rs index 3134114..1fc310d 100644 --- a/libcrux-nrf52840/src/bin/mldsa.rs +++ b/libcrux-nrf52840/src/bin/mldsa.rs @@ -1,7 +1,6 @@ #![no_main] #![no_std] -use cortex_m::peripheral::Peripherals; use libcrux_nrf52840 as board; // global logger + panicking-behavior + memory layout extern crate alloc; @@ -15,7 +14,7 @@ static HEAP: Heap = Heap::empty(); #[cortex_m_rt::entry] fn main() -> ! { use libcrux_iot_testutil::*; - + // Initialize the allocator BEFORE you use it { use core::mem::MaybeUninit; @@ -23,7 +22,7 @@ fn main() -> ! { static mut HEAP_MEM: [MaybeUninit; HEAP_SIZE] = [MaybeUninit::uninit(); HEAP_SIZE]; unsafe { HEAP.init(addr_of_mut!(HEAP_MEM) as usize, HEAP_SIZE) } } - + // set up the test config let test_config = TestConfig { platform: platform::CortexM, diff --git a/libcrux-nrf52840/src/bin/mlkem.rs b/libcrux-nrf52840/src/bin/mlkem.rs index e76f127..4ae7228 100644 --- a/libcrux-nrf52840/src/bin/mlkem.rs +++ b/libcrux-nrf52840/src/bin/mlkem.rs @@ -1,7 +1,6 @@ #![no_main] #![no_std] -use cortex_m::peripheral::Peripherals; use libcrux_nrf52840 as board; // global logger + panicking-behavior + memory layout extern crate alloc; From a9ac34f00b4163b084e4a65134d5b18b6eef8285 Mon Sep 17 00:00:00 2001 From: Jonas Schneider-Bensch Date: Wed, 6 Nov 2024 11:21:44 +0100 Subject: [PATCH 7/7] Remove mldsa for nRF52810 --- libcrux-nrf52810/src/bin/mldsa.rs | 38 ------------------------------- 1 file changed, 38 deletions(-) delete mode 100644 libcrux-nrf52810/src/bin/mldsa.rs diff --git a/libcrux-nrf52810/src/bin/mldsa.rs b/libcrux-nrf52810/src/bin/mldsa.rs deleted file mode 100644 index 045f699..0000000 --- a/libcrux-nrf52810/src/bin/mldsa.rs +++ /dev/null @@ -1,38 +0,0 @@ -#![no_main] -#![no_std] - -use libcrux_nrf52810 as board; // global logger + panicking-behavior + memory layout - -extern crate alloc; - -use core::ptr::addr_of_mut; -use embedded_alloc::LlffHeap as Heap; - -#[global_allocator] -static HEAP: Heap = Heap::empty(); - -#[cortex_m_rt::entry] -fn main() -> ! { - use libcrux_iot_testutil::*; - - // Initialize the allocator BEFORE you use it - { - use core::mem::MaybeUninit; - const HEAP_SIZE: usize = 1024; - static mut HEAP_MEM: [MaybeUninit; HEAP_SIZE] = [MaybeUninit::uninit(); HEAP_SIZE]; - unsafe { HEAP.init(addr_of_mut!(HEAP_MEM) as usize, HEAP_SIZE) } - } - - // set up the test config - let test_config = TestConfig { - platform: platform::CortexM, - core_freq: board::COREFREQ, - only_names: alloc::vec![], - early_abort: false, - benchmark_runs: 5, - }; - - libcrux_testbench::mldsa::run_benchmarks(test_config); - - board::exit() -}