Skip to content

Commit

Permalink
[fi] Update OTBN Key Sideload handler
Browse files Browse the repository at this point in the history
This PR updates the OTBN Key Sideload hander to refect changes in the
repo.

Signed-off-by: Pascal Nasahl <[email protected]>
  • Loading branch information
nasahlpa committed Jun 6, 2024
1 parent 34a0227 commit a536cd6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
8 changes: 4 additions & 4 deletions fault_injection/fi_otbn.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,10 @@ def fi_parameter_sweep(cfg: dict, target: Target, fi_gear,
Returns:
device_id: The ID of the target device.
"""
# Setup key manager if needed by test.
ot_communication.init_keymgr(cfg["test"]["which_test"])
# Configure the OTBN FI code on the target.
device_id = ot_communication.init()
# Setup key manager if needed by test.
ot_communication.init_keymgr(cfg["test"]["which_test"])
# Store results in array for a quick access.
fi_results = []
# Start the parameter sweep.
Expand Down Expand Up @@ -132,10 +132,10 @@ def fi_parameter_sweep(cfg: dict, target: Target, fi_gear,
ot_communication = target.reset_target(com_reset = True)
# Re-establish UART connection.
ot_communication = OTFIOtbn(target)
# Setup key manager if needed by test.
ot_communication.init_keymgr(cfg["test"]["which_test"])
# Configure the OTBN FI code on the target.
ot_communication.init()
# Setup key manager if needed by test.
ot_communication.init_keymgr(cfg["test"]["which_test"])
# Reset FIGear if necessary.
fi_gear.reset()
else:
Expand Down
8 changes: 1 addition & 7 deletions target/communication/fi_otbn_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,7 @@ def init_keymgr(self, test: str) -> None:
# InitTrigger command.
time.sleep(0.01)
self.target.write(json.dumps("InitKeyMgr").encode("ascii"))
# As the init resets the chip, we need to call it again to complete
# the initialization of the key manager.
time.sleep(2)
self._ujson_otbn_fi_cmd()
time.sleep(0.01)
self.target.write(json.dumps("InitKeyMgr").encode("ascii"))
time.sleep(2)
time.sleep(0.5)

def init(self) -> None:
""" Initialize the OTBN FI code on the chip.
Expand Down

0 comments on commit a536cd6

Please sign in to comment.