improved mpsoc flash write command

This commit is contained in:
Jakob Meier 2022-03-23 05:33:01 +01:00
parent 71c16f78ae
commit b779b34fcf

View File

@ -17,16 +17,16 @@ from utility.input_helper import InputHelper
LOGGER = get_console_logger() LOGGER = get_console_logger()
MANUAL_INPUT = "3" MANUAL_INPUT = "1"
flash_write_file_dict = { 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", ""], MANUAL_INPUT: ["manual input", ""],
"2": ["/mnt/sd0/ploc/mpsoc/flash_write.bin", "/mnt/sd0/ploc/mpsoc/flash_write.bin"],
} }
mpsoc_file_dict = { mpsoc_file_dict = {
MANUAL_INPUT: ["manual input", ""], 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: def prepare_flash_write_cmd(object_id: bytearray) -> bytearray:
file = get_flash_write_file() obcFile = get_flash_write_file()
command = object_id + struct.pack('!I', CommandIds.FLASH_WRITE) + bytearray(file, 'utf-8') 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 return command
@ -185,7 +187,7 @@ def get_flash_write_file() -> str:
def get_mpsoc_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) input_helper = InputHelper(mpsoc_file_dict)
key = input_helper.get_key() key = input_helper.get_key()
if key == MANUAL_INPUT: if key == MANUAL_INPUT: