Skip to content

Commit

Permalink
Remove clearing SRAM by default.
Browse files Browse the repository at this point in the history
This puts clearing SRAM at startup behind the feature `clear-sram`.
  • Loading branch information
zhalvorsen committed Oct 21, 2024
1 parent a9ad8a6 commit 3a4cf9e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions rom/dev/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ itrng = ["caliptra-hw-model/itrng"]
verilator = ["caliptra-hw-model/verilator"]
no-fmc = []
fake-rom = []
clear-sram = []
no-cfi = ["caliptra-image-verify/no-cfi", "caliptra-drivers/no-cfi"]
slow_tests = []
"hw-1.0" = ["caliptra-builder/hw-1.0", "caliptra-drivers/hw-1.0", "caliptra-registers/hw-1.0", "caliptra-hw-model/hw-1.0"]
Expand Down
4 changes: 4 additions & 0 deletions rom/dev/src/start.S
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ _start:
andi t1, t1, 0x3
bne t1, x0, post_ecc_init

#ifdef CARGO_FEATURE_CLEAR_SRAM
//
// Cold Boot
//
Expand All @@ -117,6 +118,7 @@ _start:
la a0, DCCM_ORG // dest
la a1, DCCM_SIZE // len
call _zero_mem256
#endif // CARGO_FEATURE_CLEAR_SRAM

post_ecc_init:

Expand Down Expand Up @@ -354,9 +356,11 @@ exit_rom:

// Save the FMC address
addi a3, a0, 0
#ifdef CARGO_FEATURE_CLEAR_SRAM
la a0, STACK_ORG // dest
la a1, STACK_SIZE // len
call _zero_mem256
#endif // CARGO_FEATURE_CLEAR_SRAM

// Clear all registers
li x1, 0; li x2, 0; li x3, 0; li x4, 0;
Expand Down

0 comments on commit 3a4cf9e

Please sign in to comment.