Skip to content

Commit

Permalink
tools/psoc6/mpy-psoc6.py: Refined openocd fw-loader error handling.
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 8f68019 commit d6b246c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tools/psoc6/mpy-psoc6.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import argparse, os, sys, shlex, shutil, subprocess, requests, tarfile, zipfile
import argparse, os, sys, shlex, shutil, subprocess, time, requests, tarfile, zipfile

boards = [
{"name": "CY8CPROTO-062-4343W", "ocd_cfg_file": "psoc6_2m.cfg"},
Expand Down Expand Up @@ -147,7 +147,7 @@ def parse_output_for_error(fwloader_stdout):

fwl_proc = subprocess.Popen(fwloader_args, stderr=subprocess.PIPE, stdout=subprocess.PIPE)
try:
out, err = fwl_proc.communicate(timeout=15)
out, err = fwl_proc.communicate(timeout=90)
except:
fwl_proc.kill()
raise Exception(colour_str_error("fwloader error"))
Expand Down Expand Up @@ -275,7 +275,7 @@ def openocd_program(board, hex_file, serial_adapter_sn=None):

ocd_proc = subprocess.Popen(openocd_args, stderr=subprocess.PIPE, stdout=subprocess.PIPE)
try:
out, err = ocd_proc.communicate(timeout=15)
out, err = ocd_proc.communicate(timeout=20)
except:
ocd_proc.kill()
raise Exception(colour_str_error("openocd error"))
Expand Down Expand Up @@ -366,6 +366,7 @@ def device_setup(board, version, update_dbg_fw=False, quiet=False):
fwloader_update_kitprog()
finally:
fwloader_remove()
time.sleep(10) # Wait for the device to restart

openocd_download_install()
openocd_board_conf_download(board)
Expand Down

0 comments on commit d6b246c

Please sign in to comment.