added some commands for preparing flash
EIVE/-/pipeline/pr-main This commit looks good Details

This commit is contained in:
Robin Müller 2024-04-25 17:26:57 +02:00
parent 36d9323b57
commit dfa45dbdba
Signed by: muellerr
GPG Key ID: A649FB78196E3849
1 changed files with 18 additions and 6 deletions

View File

@ -27,6 +27,8 @@ _LOGGER = logging.getLogger(__name__)
MANUAL_INPUT = "1"
CRIT_CMD_APID_DICT = {"1": ("flash_mkfs", 0x12A)}
OBC_WRITE_FILE_DICT = {
MANUAL_INPUT: ("manual input", ""),
"2": ("/mnt/sd0/ploc/mpsoc/flash_write.bin", "/mnt/sd0/ploc/mpsoc/flash_write.bin"),
@ -90,7 +92,7 @@ class ActionId(enum.IntEnum):
TC_FLASH_READ_FULL_FILE = 30
TC_SIMPLEX_STORE_FILE = 31
TC_VERIFY_BOOT = 32
TC_ENABLE_FLASH_TC_EXECUTION = 33
TC_ENABLE_TC_EXECUTION = 33
TC_FLASH_MKFS = 34
@ -130,7 +132,7 @@ class OpCode:
MODE_IDLE = "mode_idle"
MODE_REPLAY = "mode_replay"
MODE_SNAPSHOT = "mode_snapshot"
ENABLE_FLASH_TC_EXECUTION = "enable_flash_tc_exec"
ENABLE_TC_EXECUTION = "enable_tc_exec"
FLASH_MKFS = "flash_mkfs"
@ -162,7 +164,7 @@ class Info:
DISABLE_PLOC_SUPV_COMMANDING_TO_ON = (
"Disable PLOC SUPV commanding when switching ON"
)
ENABLE_FLASH_TC_EXECUTION = "Enable execution of Flash MKFS command"
ENABLE_TC_EXECUTION = "Enable execution of critical commands"
FLASH_MKFS = "Flash MKFS command"
@ -277,10 +279,20 @@ def pack_ploc_mpsoc_commands(
+ bytearray(cam_cmd, "utf-8")
)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
if cmd_str == OpCode.ENABLE_FLASH_TC_EXECUTION:
q.add_log_cmd(Info.ENABLE_FLASH_TC_EXECUTION)
if cmd_str == OpCode.ENABLE_TC_EXECUTION:
q.add_log_cmd(Info.ENABLE_TC_EXECUTION)
while True:
for key, val in CRIT_CMD_APID_DICT.items():
print(f"{key}: {val[0]} with APID {val[1]}")
key = input("Please specify the command to enable by key: ")
if key not in CRIT_CMD_APID_DICT:
print("invalid key")
continue
apid = CRIT_CMD_APID_DICT[key][1]
break
app_data = struct.pack("!H", apid)
q.add_pus_tc(
create_action_cmd(PLOC_MPSOC_ID, ActionId.TC_ENABLE_FLASH_TC_EXECUTION)
create_action_cmd(PLOC_MPSOC_ID, ActionId.TC_ENABLE_TC_EXECUTION, app_data)
)
if cmd_str == OpCode.FLASH_MKFS:
q.add_log_cmd(Info.FLASH_MKFS)