flash write command

This commit is contained in:
Jakob Meier
2022-03-26 20:48:39 +01:00
parent 4b918b3da0
commit e52582613e
6 changed files with 744 additions and 714 deletions

View File

@ -25,6 +25,11 @@ flash_write_file_dict = {
}
mpsoc_file_dict = {
MANUAL_INPUT: ["manual input", ""],
"2": ["0:/flash", "0:/flash"],
}
sequence_file_dict = {
MANUAL_INPUT: ["manual input", ""],
"2": ["0:/EM16/231", "0:/EM16/231"],
}
@ -163,7 +168,7 @@ def prepare_mem_read_command(object_id: bytearray) -> bytearray:
def prepare_flash_write_cmd(object_id: bytearray) -> bytearray:
obcFile = get_flash_write_file()
obcFile = get_obc_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')
@ -193,14 +198,14 @@ def prepare_downlink_pwr_on_cmd(object_id: bytearray) -> bytearray:
def prepare_replay_write_sequence_cmd(object_id: bytearray) -> bytearray:
null_terminator = 0
use_decoding = int(input("Use decoding (set to 1): "))
file = get_mpsoc_file()
file = get_sequence_file()
command = object_id + struct.pack('!I', CommandIds.TC_REPLAY_WRITE_SEQUENCE) + struct.pack('!B', use_decoding) + \
bytearray(file, 'utf-8') + struct.pack('!B', null_terminator)
bytearray(file, 'utf-8')
return command
def get_flash_write_file() -> str:
LOGGER.info("Specify flash file")
def get_obc_file() -> str:
LOGGER.info("Specify OBC file ")
input_helper = InputHelper(flash_write_file_dict)
key = input_helper.get_key()
if key == MANUAL_INPUT:
@ -211,7 +216,7 @@ def get_flash_write_file() -> str:
def get_mpsoc_file() -> str:
LOGGER.info("Specify flash file to write to")
LOGGER.info("Specify MPSoC file")
input_helper = InputHelper(mpsoc_file_dict)
key = input_helper.get_key()
if key == MANUAL_INPUT:
@ -219,3 +224,14 @@ def get_mpsoc_file() -> str:
else:
file = mpsoc_file_dict[key][1]
return file
def get_sequence_file() -> str:
LOGGER.info("Specify sequence file")
input_helper = InputHelper(sequence_file_dict)
key = input_helper.get_key()
if key == MANUAL_INPUT:
file = input("Ploc MPSoC: Specify absolute name file: ")
else:
file = mpsoc_file_dict[key][1]
return file