Skip to content

Commit

Permalink
Add feature to skip clearing SRAM in ROM.
Browse files Browse the repository at this point in the history
This allows ROM builds to skip clearing SRAM with the feature `skip-clear-sram`. This can be useful for simulation builds where clearing SRAM takes a significant amount of time.
  • Loading branch information
zhalvorsen committed Oct 21, 2024
1 parent a9ad8a6 commit fbf1f40
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 = []
skip-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

#ifndef CARGO_FEATURE_SKIP_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_SKIP_CLEAR_SRAM

post_ecc_init:

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

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

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

0 comments on commit fbf1f40

Please sign in to comment.