From 324cc51eb5ede7126cdc5911748f5b6bc8dde2bb Mon Sep 17 00:00:00 2001 From: Jonas Schneider-Bensch Date: Thu, 31 Oct 2024 14:38:40 +0100 Subject: [PATCH] Fix l4r5zi build --- libcrux-nucleo-l4r5zi/src/bin/mldsa.rs | 17 +++++++++++++---- libcrux-nucleo-l4r5zi/src/bin/mlkem.rs | 16 +++++++++++++--- libcrux-nucleo-l4r5zi/src/lib.rs | 2 ++ 3 files changed, 28 insertions(+), 7 deletions(-) diff --git a/libcrux-nucleo-l4r5zi/src/bin/mldsa.rs b/libcrux-nucleo-l4r5zi/src/bin/mldsa.rs index d8ac40e..675a929 100644 --- a/libcrux-nucleo-l4r5zi/src/bin/mldsa.rs +++ b/libcrux-nucleo-l4r5zi/src/bin/mldsa.rs @@ -2,7 +2,9 @@ #![no_std] use cortex_m::peripheral::Peripherals; -use libcrux_nucleo_l4r5zi as _; // global logger + panicking-behavior + memory layout +use libcrux_nucleo_l4r5zi as board; // global logger + panicking-behavior + memory layout + +extern crate alloc; use core::ptr::addr_of_mut; use embedded_alloc::LlffHeap as Heap; @@ -23,8 +25,15 @@ fn main() -> ! { peripherals.DCB.enable_trace(); peripherals.DWT.enable_cycle_counter(); } + // set up the test config + let test_config = TestConfig { + core_freq: board::COREFREQ, + only_names: alloc::vec![], + early_abort: false, + benchmark_runs: 5, + }; + + libcrux_testbench::mldsa::run_benchmarks(test_config); - libcrux_testbench::mldsa::run_benchmarks(); - - libcrux_nucleo_l4r5zi::exit() + board::exit() } diff --git a/libcrux-nucleo-l4r5zi/src/bin/mlkem.rs b/libcrux-nucleo-l4r5zi/src/bin/mlkem.rs index a560623..530b72a 100644 --- a/libcrux-nucleo-l4r5zi/src/bin/mlkem.rs +++ b/libcrux-nucleo-l4r5zi/src/bin/mlkem.rs @@ -2,7 +2,9 @@ #![no_std] use cortex_m::peripheral::Peripherals; -use libcrux_nucleo_l4r5zi as _; // global logger + panicking-behavior + memory layout +use libcrux_nucleo_l4r5zi as board; // global logger + panicking-behavior + memory layout + +extern crate alloc; use core::ptr::addr_of_mut; use embedded_alloc::LlffHeap as Heap; @@ -24,7 +26,15 @@ fn main() -> ! { peripherals.DWT.enable_cycle_counter(); } - libcrux_testbench::mlkem::run_benchmarks(); + // set up the test config + let test_config = TestConfig { + core_freq: board::COREFREQ, + only_names: alloc::vec![], + early_abort: false, + benchmark_runs: 5, + }; + + libcrux_testbench::mlkem::run_benchmarks(test_config); - libcrux_nucleo_l4r5zi::exit() + board::exit() } diff --git a/libcrux-nucleo-l4r5zi/src/lib.rs b/libcrux-nucleo-l4r5zi/src/lib.rs index 4d97cee..17629b4 100644 --- a/libcrux-nucleo-l4r5zi/src/lib.rs +++ b/libcrux-nucleo-l4r5zi/src/lib.rs @@ -9,6 +9,8 @@ use embassy_stm32 as _; // memory layout use panic_probe as _; +pub const COREFREQ: u32 = 4_000_000; + // same panicking *behavior* as `panic-probe` but doesn't print a panic message // this prevents the panic message being printed *twice* when `defmt::panic` is invoked #[defmt::panic_handler]