Update mik32_upload.py

This commit is contained in:
Sergey Shchelkanov 2023-04-13 14:11:56 +03:00
parent 6035ef1fb5
commit 9ee4fc9069

View File

@ -56,12 +56,12 @@ def upload_file(filename: str, boot_source: str = "eeprom") -> int:
cmd = shlex.split("%s -s %s -f interface/ftdi/m-link.cfg -f target/mcu32.cfg" % (DEFAULT_OPENOCD_EXEC_FILE_PATH, DEFAULT_OPENOCD_SCRIPTS_PATH), posix=False) cmd = shlex.split("%s -s %s -f interface/ftdi/m-link.cfg -f target/mcu32.cfg" % (DEFAULT_OPENOCD_EXEC_FILE_PATH, DEFAULT_OPENOCD_SCRIPTS_PATH), posix=False)
with subprocess.Popen(cmd, shell=True, stdout=subprocess.DEVNULL) as proc: with subprocess.Popen(cmd, shell=True, stdout=subprocess.DEVNULL) as proc:
if boot_source == "eeprom": if boot_source == "eeprom":
result = mik32_eeprom.write_words(bytes2words(get_content(filename))) result = write_words(bytes2words(get_content(filename)))
elif boot_source == "spifi": elif boot_source == "spifi":
mik32_spifi.spifi_write_file(get_content(filename)) spifi_write_file(get_content(filename))
result = 0 # TODO result = 0 # TODO
elif boot_source == "ram": elif boot_source == "ram":
mik32_ram.write_file(filename) write_file(filename)
result = 0 # TODO result = 0 # TODO
else: else:
raise Exception("Unsupported boot source, use eeprom or spifi") raise Exception("Unsupported boot source, use eeprom or spifi")