From a0d586d753a49f7c29c04d8930b8ebcc1f1b0c51 Mon Sep 17 00:00:00 2001 From: "Jakob.Meier" <–meierj@irs.uni-stuttgart.de> Date: Fri, 20 Aug 2021 08:40:18 +0200 Subject: [PATCH] supervisor update commanding --- config/hook_implementations.py | 12 ++++-- pus_tc/ploc_supervisor.py | 6 +-- pus_tc/ploc_upater.py | 77 ++++++++++++++++++++++++---------- 3 files changed, 66 insertions(+), 29 deletions(-) diff --git a/config/hook_implementations.py b/config/hook_implementations.py index 261b39d..5983199 100644 --- a/config/hook_implementations.py +++ b/config/hook_implementations.py @@ -153,10 +153,14 @@ class EiveHookObject(TmTcHookBase): service_ploc_supv_tuple = ("PLOC Supervisor", op_code_dict_srv_ploc_supv) op_code_dict_srv_ploc_updater = { - "0": ("Ploc Updater: Update partion A on NVM0", {OpCodeDictKeys.TIMEOUT: 2.0}), - "1": ("Ploc Updater: Update partion B on NVM0", {OpCodeDictKeys.TIMEOUT: 2.0}), - "2": ("Ploc Updater: Update partion A on NVM1", {OpCodeDictKeys.TIMEOUT: 2.0}), - "3": ("Ploc Updater: Update partion B on NVM1", {OpCodeDictKeys.TIMEOUT: 2.0}), + "0": ("Ploc Updater: Update uboot on partition A", {OpCodeDictKeys.TIMEOUT: 2.0}), + "1": ("Ploc Updater: Update bitstream on partition A", {OpCodeDictKeys.TIMEOUT: 2.0}), + "2": ("Ploc Updater: Update linux on partition A", {OpCodeDictKeys.TIMEOUT: 2.0}), + "3": ("Ploc Updater: Update application on partition A", {OpCodeDictKeys.TIMEOUT: 2.0}), + "4": ("Ploc Updater: Update uboot on partition B", {OpCodeDictKeys.TIMEOUT: 2.0}), + "5": ("Ploc Updater: Update bitstream on partition B", {OpCodeDictKeys.TIMEOUT: 2.0}), + "6": ("Ploc Updater: Update linux on partition B", {OpCodeDictKeys.TIMEOUT: 2.0}), + "7": ("Ploc Updater: Update application on partition B", {OpCodeDictKeys.TIMEOUT: 2.0}), } service_ploc_updater_tuple = ("Ploc Updater", op_code_dict_srv_ploc_updater) diff --git a/pus_tc/ploc_supervisor.py b/pus_tc/ploc_supervisor.py index eb8a9b0..6bbd1ad 100644 --- a/pus_tc/ploc_supervisor.py +++ b/pus_tc/ploc_supervisor.py @@ -408,7 +408,7 @@ def pack_set_alert_limit_cmd(object_id: bytearray) -> bytearray: latchup_id = get_latchup_id() dutycycle = int(input("Specify dutycycle:")) command = bytearray() - command = object_id + struct.pack('!I', SupvActionIds.AUTO_CALIBRATE_ALERT) + command = object_id + struct.pack('!I', SupvActionIds.SET_ALERT_LIMIT) command = command + struct.pack('!B', latchup_id) command = command + struct.pack('!I', dutycycle) return command @@ -420,8 +420,8 @@ def pack_set_alert_irq_filter_cmd(object_id: bytearray) -> bytearray: @param object_id The object id of the PLOC supervisor handler. """ latchup_id = get_latchup_id() - tp = int(input("Specify TP:")) - div = int(input("Specify DIV:")) + tp = int(input("Specify filter type (TP):")) + div = int(input("Specify clock divider (DIV):")) command = bytearray() command = object_id + struct.pack('!I', SupvActionIds.SET_ALERT_IRQ_FILTER) command = command + struct.pack('!B', latchup_id) diff --git a/pus_tc/ploc_upater.py b/pus_tc/ploc_upater.py index 2d92cfe..471d8c9 100644 --- a/pus_tc/ploc_upater.py +++ b/pus_tc/ploc_upater.py @@ -1,7 +1,8 @@ # -*- coding: utf-8 -*- """ -@file ploc_supervisor.py -@brief Tests for commanding the supervisor of the PLOC. +@file ploc_udpater.py +@brief Commands to initiate update transfer to ploc supervisor. This only updates the software of the MPSoC, it is not + possible to update the software of the supervisor. The supervisor is programmed by Thales. @author J. Meier @date 10.07.2021 @@ -28,17 +29,25 @@ latchup_id_dict = { class UpdaterActionIds: - UPDATE_NVM0_A = 0 - UPDATE_NVM0_B = 1 - UPDATE_NVM1_A = 2 - UPDATE_NVM1_B = 3 + UPDATE_A_UBOOT = 0 + UPDATE_A_BITSTREAM = 1 + UPDATE_A_LINUX = 2 + UPDATE_A_APP_SW = 3 + UPDATE_B_UBOOT = 4 + UPDATE_B_BITSTREAM = 5 + UPDATE_B_LINUX = 6 + UPDATE_B_LINUX = 7 class ImagePathDefs: - imageNvm0A = "/mnt/sd0/ploc/updateNvm0A.bin" - imageNvm0B = "/mnt/sd0/ploc/updateNvm0B.bin" - imageNvm1A = "/mnt/sd0/ploc/updateNvm1A.bin" - imageNvm1B = "/mnt/sd0/ploc/updateNvm1B.bin" + imageAuboot = "/mnt/sd0/ploc/updateAuboot.bin" + imageAbitsream = "/mnt/sd0/ploc/updateAbitstream.bin" + imageAlinux = "/mnt/sd0/ploc/updateAlinux.bin" + imageAappsw = "/mnt/sd0/ploc/updateAappsw.bin" + imageBuboot = "/mnt/sd0/ploc/updateBuboot.bin" + imageBbitsream = "/mnt/sd0/ploc/updateBbitstream.bin" + imageBlinux = "/mnt/sd0/ploc/updateBlinux.bin" + imageBappsw = "/mnt/sd0/ploc/updateBappsw.bin" def pack_ploc_updater_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: str) -> TcQueueT: @@ -48,26 +57,50 @@ def pack_ploc_updater_test_into(object_id: bytearray, tc_queue: TcQueueT, op_cod ) if op_code == "0": - tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Update partition A on NVM0")) - command = object_id + struct.pack('!I', UpdaterActionIds.UPDATE_NVM0_A) + \ - bytearray(ImagePathDefs.imageNvm0A, 'utf-8') + tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Update uboot on partition A")) + command = object_id + struct.pack('!I', UpdaterActionIds.UPDATE_A_UBOOT) + \ + bytearray(ImagePathDefs.imageAuboot, 'utf-8') command = PusTelecommand(service=8, subservice=128, ssc=30, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) if op_code == "1": - tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Update partition B on NVM0")) - command = object_id + struct.pack('!I', UpdaterActionIds.UPDATE_NVM0_B) + \ - bytearray(ImagePathDefs.imageNvm0B, 'utf-8') + tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Update bitstream on parition A")) + command = object_id + struct.pack('!I', UpdaterActionIds.UPDATE_A_BITSTREAM) + \ + bytearray(ImagePathDefs.imageAbitsream, 'utf-8') command = PusTelecommand(service=8, subservice=128, ssc=31, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) if op_code == "2": - tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Update partition A on NVM1")) - command = object_id + struct.pack('!I', UpdaterActionIds.UPDATE_NVM1_A) + \ - bytearray(ImagePathDefs.imageNvm1A, 'utf-8') + tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Update linux on partition A")) + command = object_id + struct.pack('!I', UpdaterActionIds.UPDATE_A_LINUX) + \ + bytearray(ImagePathDefs.imageAlinux, 'utf-8') command = PusTelecommand(service=8, subservice=128, ssc=32, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) if op_code == "3": - tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Update partition B on NVM1")) - command = object_id + struct.pack('!I', UpdaterActionIds.UPDATE_NVM1_B) + \ - bytearray(ImagePathDefs.imageNvm1B, 'utf-8') + tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Update application on partition A")) + command = object_id + struct.pack('!I', UpdaterActionIds.UPDATE_A_APP_SW) + \ + bytearray(ImagePathDefs.imageAappsw, 'utf-8') + command = PusTelecommand(service=8, subservice=128, ssc=33, app_data=command) + tc_queue.appendleft(command.pack_command_tuple()) + if op_code == "4": + tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Update uboot on partition B")) + command = object_id + struct.pack('!I', UpdaterActionIds.UPDATE_B_UBOOT) + \ + bytearray(ImagePathDefs.imageBuboot, 'utf-8') + command = PusTelecommand(service=8, subservice=128, ssc=30, app_data=command) + tc_queue.appendleft(command.pack_command_tuple()) + if op_code == "5": + tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Update bitstream on parition B")) + command = object_id + struct.pack('!I', UpdaterActionIds.UPDATE_B_BITSTREAM) + \ + bytearray(ImagePathDefs.imageBbitsream, 'utf-8') + command = PusTelecommand(service=8, subservice=128, ssc=31, app_data=command) + tc_queue.appendleft(command.pack_command_tuple()) + if op_code == "6": + tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Update linux on partition B")) + command = object_id + struct.pack('!I', UpdaterActionIds.UPDATE_B_LINUX) + \ + bytearray(ImagePathDefs.imageBlinux, 'utf-8') + command = PusTelecommand(service=8, subservice=128, ssc=32, app_data=command) + tc_queue.appendleft(command.pack_command_tuple()) + if op_code == "7": + tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Update application on partition B")) + command = object_id + struct.pack('!I', UpdaterActionIds.UPDATE_B_APP_SW) + \ + bytearray(ImagePathDefs.imageBappsw, 'utf-8') command = PusTelecommand(service=8, subservice=128, ssc=33, app_data=command) tc_queue.appendleft(command.pack_command_tuple())