Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom memory layout for STM32-L4R5ZI #19

Merged
merged 4 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions libcrux-nucleo-l4r5zi/.cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ rustflags = [
# target improves performance)
# target = "thumbv6m-none-eabi" # Cortex-M0 and Cortex-M0+
# target = "thumbv7m-none-eabi" # Cortex-M3
target = "thumbv7em-none-eabi" # Cortex-M4 and Cortex-M7 (no FPU)
# target = "thumbv7em-none-eabihf" # Cortex-M4F and Cortex-M7F (with FPU)
# target = "thumbv7em-none-eabi" # Cortex-M4 and Cortex-M7 (no FPU)
target = "thumbv7em-none-eabihf" # Cortex-M4F and Cortex-M7F (with FPU)

[alias]
rb = "run --bin"
Expand Down
2 changes: 1 addition & 1 deletion libcrux-nucleo-l4r5zi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ panic-probe = { version = "0.3", features = ["print-defmt"] }
cortex-m-semihosting = "0.5.0"
libcrux-ml-kem = { path = "../libcrux/libcrux-ml-kem", default-features = false, features = ["pre-verification", "mlkem512", "mlkem768", "mlkem1024"] }
libcrux-ml-dsa = { path = "../libcrux/libcrux-ml-dsa" }
embassy-stm32 = { version = "0.1.0", features = ["stm32l4r5zi", "defmt", "time", "time-driver-any", "memory-x"] }
embassy-time = "0.3.2"
embassy-stm32 = { version = "0.1.0", features = ["stm32l4r5zi", "defmt", "time", "time-driver-any"] }

[dev-dependencies]
defmt-test = "0.3"
Expand Down
14 changes: 14 additions & 0 deletions libcrux-nucleo-l4r5zi/memory.x
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
MEMORY
{
FLASH : ORIGIN = 0x08000000, LENGTH = 2048K /* BANK_1 */
RAM : ORIGIN = 0x20000000, LENGTH = 640K /* SRAM */
}


/* This is where the call stack will be allocated. */
/* The stack is of the full descending type. */
/* We use this variable to locate the call stack and static variables
in different memory regions. For the L4R5ZI, we want to locate it
at the top of SRAM3, the largest RAM region. For more details, see
https://md.cryspen.com/68n4HBCpR1qRe17_CRxiaQ */
_stack_start = 0x200a0000;
6 changes: 3 additions & 3 deletions libcrux-nucleo-l4r5zi/src/bin/mldsa_65.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ use embassy_time::{self, Instant};
use libcrux_ml_dsa::ml_dsa_65;
use libcrux_nucleo_l4r5zi as _; // global logger + panicking-behavior + memory layout

const KEYGEN_ITERATIONS: usize = 100;
const SIGN_ITERATIONS: usize = 100;
const VERIFY_ITERATIONS: usize = 100;
const KEYGEN_ITERATIONS: usize = 5;
const SIGN_ITERATIONS: usize = 5;
const VERIFY_ITERATIONS: usize = 5;

fn time_operation<SetupF, OpF, Input>(
description: &str,
Expand Down