mirror of
https://github.com/MikronMIK32/mik32-uploader.git
synced 2026-01-01 13:37:03 +03:00
wip
This commit is contained in:
parent
b8458bb382
commit
01e24277f8
@ -25,6 +25,8 @@ openocd_scripts_path = os.path.join("openocd", "share", "openocd", "scripts")
|
|||||||
openocd_interface_path = os.path.join("interface", "ftdi", "m-link.cfg")
|
openocd_interface_path = os.path.join("interface", "ftdi", "m-link.cfg")
|
||||||
openocd_target_path = os.path.join("target", "mik32.cfg")
|
openocd_target_path = os.path.join("target", "mik32.cfg")
|
||||||
|
|
||||||
|
openocd_default_speed = 500
|
||||||
|
|
||||||
supported_formats = [".hex"]
|
supported_formats = [".hex"]
|
||||||
|
|
||||||
|
|
||||||
@ -161,6 +163,7 @@ def upload_file(
|
|||||||
openocd_scripts=openocd_scripts_path,
|
openocd_scripts=openocd_scripts_path,
|
||||||
openocd_interface=openocd_interface_path,
|
openocd_interface=openocd_interface_path,
|
||||||
openocd_target=openocd_target_path,
|
openocd_target=openocd_target_path,
|
||||||
|
openocd_speed=openocd_default_speed,
|
||||||
) -> int:
|
) -> int:
|
||||||
"""
|
"""
|
||||||
Write ihex or binary file into MIK32 EEPROM or external flash memory
|
Write ihex or binary file into MIK32 EEPROM or external flash memory
|
||||||
@ -202,8 +205,10 @@ def upload_file(
|
|||||||
f"{openocd_exec} -s {openocd_scripts} "
|
f"{openocd_exec} -s {openocd_scripts} "
|
||||||
f"-f {openocd_interface} -f {openocd_target}", posix=False
|
f"-f {openocd_interface} -f {openocd_target}", posix=False
|
||||||
)
|
)
|
||||||
|
# proc = subprocess.Popen(
|
||||||
|
# cmd, creationflags=subprocess.CREATE_NEW_CONSOLE | subprocess.SW_HIDE)
|
||||||
proc = subprocess.Popen(
|
proc = subprocess.Popen(
|
||||||
cmd, creationflags=subprocess.CREATE_NEW_CONSOLE | subprocess.SW_HIDE)
|
cmd, creationflags= subprocess.SW_HIDE)
|
||||||
|
|
||||||
with OpenOcdTclRpc(host, port) as openocd:
|
with OpenOcdTclRpc(host, port) as openocd:
|
||||||
pages_eeprom = segments_to_pages(list(filter(
|
pages_eeprom = segments_to_pages(list(filter(
|
||||||
@ -241,6 +246,8 @@ def createParser():
|
|||||||
'--openocd-host', dest='openocd_host', default='127.0.0.1')
|
'--openocd-host', dest='openocd_host', default='127.0.0.1')
|
||||||
parser.add_argument('--openocd-port', dest='openocd_port',
|
parser.add_argument('--openocd-port', dest='openocd_port',
|
||||||
default=OpenOcdTclRpc.DEFAULT_PORT)
|
default=OpenOcdTclRpc.DEFAULT_PORT)
|
||||||
|
parser.add_argument('--openocd-speed', dest='openocd_speed',
|
||||||
|
default=openocd_default_speed)
|
||||||
parser.add_argument('--keep-halt', dest='keep_halt',
|
parser.add_argument('--keep-halt', dest='keep_halt',
|
||||||
action='store_true', default=False)
|
action='store_true', default=False)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
@ -272,6 +279,7 @@ if __name__ == '__main__':
|
|||||||
openocd_scripts=namespace.openocd_scripts,
|
openocd_scripts=namespace.openocd_scripts,
|
||||||
openocd_interface=namespace.openocd_interface,
|
openocd_interface=namespace.openocd_interface,
|
||||||
openocd_target=namespace.openocd_target,
|
openocd_target=namespace.openocd_target,
|
||||||
|
openocd_speed=namespace.openocd_speed,
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
print("Nothing to upload")
|
print("Nothing to upload")
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user