Skip to content

Commit

Permalink
tools/psoc6/mpy-psoc6.py: Added kitprog3 update option in device-setup.
Browse files Browse the repository at this point in the history
Signed-off-by: enriquezgarc <enriquezgarcia.external@infineon.com>
  • Loading branch information
jaenrig-ifx committed Nov 22, 2023
1 parent 9e3c10f commit 1c43712
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions tools/psoc6/mpy-psoc6.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def fwloader_update_kitprog():

def fwloader_remove():
file_extension = ".zip"
fwloader_compressed = "fwlaoder" + file_extension
fwloader_compressed = "fwloader" + file_extension
os.remove(fwloader_compressed)
shutil.rmtree("fw-loader")
shutil.rmtree("kp-firmware")
Expand Down Expand Up @@ -303,7 +303,7 @@ def wait_user_termination():
input("Press ENTER to continue...\n")


def device_setup(board, version, quiet=False):
def device_setup(board, version, update_dbg_fw=False, quiet=False):
if board is None:
board = select_board()
else:
Expand All @@ -316,9 +316,10 @@ def device_setup(board, version, quiet=False):

print("MicroPython PSoC6 Version :: ", version)

fwloader_download_install()
fwloader_update_kitprog()
fwloader_remove()
if update_dbg_fw:
fwloader_download_install()
fwloader_update_kitprog()
fwloader_remove()

openocd_download_install()
openocd_board_conf_download(board)
Expand Down Expand Up @@ -457,7 +458,7 @@ def parser_quick_start(args):
quick_start(args.board, args.version)

def parser_device_setup(args):
device_setup(args.board, args.version, args.q)
device_setup(args.board, args.version, args.u, args.q)

def parser_firmware_deploy(args):
openocd_program(args.board, args.hexfile)
Expand Down Expand Up @@ -502,6 +503,9 @@ def parser_device_erase(args):
parser_ds.add_argument(
"-q", action="store_true", help="Quiet. Do not prompt any user confirmation request"
)
parser_ds.add_argument(
"-u", action="store_true", help="Update board Kitprog3 debugger firmware"
)
parser_ds.set_defaults(func=parser_device_setup)

# firmware deploy
Expand Down Expand Up @@ -542,6 +546,4 @@ def parser_device_erase(args):

if __name__ == "__main__":
set_environment()
# parser()
fwloader_download_install()
fwloader_update_kitprog()
parser()

0 comments on commit 1c43712

Please sign in to comment.