From b779b34fcfcf4a1a376479145aeb65478265bea6 Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Wed, 23 Mar 2022 05:33:01 +0100 Subject: [PATCH] improved mpsoc flash write command --- pus_tc/devs/ploc_mpsoc.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/pus_tc/devs/ploc_mpsoc.py b/pus_tc/devs/ploc_mpsoc.py index 8458de4..a7f3f47 100644 --- a/pus_tc/devs/ploc_mpsoc.py +++ b/pus_tc/devs/ploc_mpsoc.py @@ -17,16 +17,16 @@ from utility.input_helper import InputHelper LOGGER = get_console_logger() -MANUAL_INPUT = "3" +MANUAL_INPUT = "1" flash_write_file_dict = { - "1": ["/mnt/sd0/ploc/mpsoc/flash_write.bin", "/mnt/sd0/ploc/mpsoc/flash_write.bin"], - "2": ["/mnt/sd0/ploc/mpsoc/flash_write.bin", "/mnt/sd0/ploc/mpsoc/flash_write.bin"], MANUAL_INPUT: ["manual input", ""], + "2": ["/mnt/sd0/ploc/mpsoc/flash_write.bin", "/mnt/sd0/ploc/mpsoc/flash_write.bin"], } mpsoc_file_dict = { MANUAL_INPUT: ["manual input", ""], + "2": ["/tmp/flash_write", "/tmp/flash_write.bin"], } @@ -140,8 +140,10 @@ def prepare_mem_read_command(object_id: bytearray) -> bytearray: def prepare_flash_write_cmd(object_id: bytearray) -> bytearray: - file = get_flash_write_file() - command = object_id + struct.pack('!I', CommandIds.FLASH_WRITE) + bytearray(file, 'utf-8') + obcFile = get_flash_write_file() + mpsocFile = get_mpsoc_file() + command = object_id + struct.pack('!I', CommandIds.FLASH_WRITE) + bytearray(obcFile, 'utf-8') + \ + struct.pack('B', 0) + bytearray(mpsocFile, 'utf-8') return command @@ -185,7 +187,7 @@ def get_flash_write_file() -> str: def get_mpsoc_file() -> str: - LOGGER.info("Specify mpsoc file") + LOGGER.info("Specify flash file to write to") input_helper = InputHelper(mpsoc_file_dict) key = input_helper.get_key() if key == MANUAL_INPUT: