update ploc supv update cmd

This commit is contained in:
Robin Müller 2022-08-21 00:22:41 +02:00
parent 00e99292cc
commit 9ed2593a54
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
1 changed files with 14 additions and 2 deletions

View File

@ -125,6 +125,8 @@ class OpCodes:
REQUEST_HK = ["4", "req-hk"]
START_MPSOC = ["5", "mpsoc-start"]
STOP_MPSOC = ["6", "mpsoc-stop"]
START_UPDATE = ["42", "start-update"]
PERFORM_UPDATE = ["update"]
class Info(str, enum.Enum):
@ -170,7 +172,7 @@ def add_ploc_supv_cmds(defs: TmtcDefinitionWrapper):
oce.add("38", "PLOC Supervisor: Factory reset clear all")
oce.add("39", "PLOC Supervisor: Factory reset clear mirror entries")
oce.add("40", "PLOC Supervisor: Factory reset clear circular entries")
oce.add("42", "PLOC Supervisor: Perform update")
oce.add(OpCodes.PERFORM_UPDATE, "PLOC Supervisor: Perform update")
oce.add("43", "PLOC Supervisor: Terminate supervisor process")
oce.add("44", "PLOC Supervisor: Start MPSoC quiet")
oce.add("45", "PLOC Supervisor: Set shutdown timeout")
@ -345,7 +347,7 @@ def pack_ploc_supv_commands(p: ServiceProviderParams):
"!I", SupvActionIds.FACTORY_RESET_CLEAR_CIRCULAR
)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
if op_code == "42":
if op_code in OpCodes.PERFORM_UPDATE:
q.add_log_cmd("PLOC Supervisor: Perform update")
command = pack_update_command(object_id.as_bytes)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
@ -607,6 +609,14 @@ def pack_update_command(object_id: bytes) -> bytearray:
memory_id = int(input("Specify memory ID: "))
start_address = int(input("Specify start address: 0x"), 16)
update_file = get_update_file()
init_bytes_written = input("Specify bytes to start from [0 default]: ")
if init_bytes_written == "":
init_bytes_written = 0
init_bytes_written = int(init_bytes_written)
init_seq_count = input("Specify initial sequence count [1 default]: ")
if init_seq_count == "":
init_seq_count = 0
init_seq_count = int(init_seq_count)
command += object_id
command += struct.pack("!I", SupvActionIds.PERFORM_UPDATE)
command += bytearray(update_file, "utf-8")
@ -614,6 +624,8 @@ def pack_update_command(object_id: bytes) -> bytearray:
command += struct.pack("!B", 0)
command += struct.pack("!B", memory_id)
command += struct.pack("!I", start_address)
command.extend(struct.pack("!I", init_bytes_written))
command.extend(struct.pack("!H", init_seq_count))
return bytearray(command)