Skip to content

Commit 4312e42

Browse files
authored
Workaround in test_generate_csr_envelop_stress for issue with DOT on subsystem FPGA (#3880)
1 parent b106b0d commit 4312e42

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

rom/dev/tests/rom_integration_tests/test_idevid_derivation.rs

100644100755
Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,16 @@ fn fuses_with_random_uds() -> Fuses {
100100
const UDS_LEN: usize = core::mem::size_of::<u32>() * 16;
101101
let mut uds_bytes = [0; UDS_LEN];
102102
rand_bytes(&mut uds_bytes).unwrap();
103-
let mut uds_seed = [0u32; 16];
104103

104+
// WORKAROUND: On FPGA subsystem (core_test mode), UDS words 8-15 are written to OTP at
105+
// 0xac8 (DOT_FUSE_ARRAY). MCU ROM treats an odd total popcount as DOT-locked,
106+
// and if the DOT blob is absent, it errors out. This ensures an even number of bits are set.
107+
let dot_fuse_bits: u32 = uds_bytes[32..64].iter().map(|b| b.count_ones()).sum();
108+
if dot_fuse_bits & 1 == 1 {
109+
uds_bytes[32] ^= 1;
110+
}
111+
112+
let mut uds_seed = [0u32; 16];
105113
for (word, bytes) in uds_seed.iter_mut().zip(uds_bytes.chunks_exact(4)) {
106114
*word = u32::from_be_bytes(bytes.try_into().unwrap());
107115
}

0 commit comments

Comments
 (0)