From 814d6914d0cd6e733a8a19629f410068e75c131e Mon Sep 17 00:00:00 2001 From: Benjamin Herrenschmidt Date: Fri, 24 Sep 2021 14:23:06 +1000 Subject: [PATCH] flash-arty: Add cable argument To select the cable config. Defaults to arty Signed-off-by: Benjamin Herrenschmidt --- openocd/arty.cfg | 6 ++++++ openocd/flash-arty | 8 +++++--- openocd/xilinx-xc7.cfg | 6 ------ openocd/xilinx-xc7_openocd_v0.11.cfg | 7 ------- 4 files changed, 11 insertions(+), 16 deletions(-) create mode 100644 openocd/arty.cfg diff --git a/openocd/arty.cfg b/openocd/arty.cfg new file mode 100644 index 0000000..6cd9939 --- /dev/null +++ b/openocd/arty.cfg @@ -0,0 +1,6 @@ +interface ftdi +ftdi_vid_pid 0x0403 0x6010 +ftdi_channel 0 +ftdi_layout_init 0x00e8 0x60eb +reset_config none +adapter_khz 25000 diff --git a/openocd/flash-arty b/openocd/flash-arty index 815dea9..6d4d13d 100755 --- a/openocd/flash-arty +++ b/openocd/flash-arty @@ -7,7 +7,7 @@ import sys BASE = os.path.dirname(os.path.abspath(__file__)) -def flash(config, flash_proxy, address, data, filetype="", set_qe=False): +def flash(cable, config, flash_proxy, address, data, filetype="", set_qe=False): script = "; ".join([ "init", "jtagspi_init 0 {{{}}}".format(flash_proxy), @@ -17,7 +17,7 @@ def flash(config, flash_proxy, address, data, filetype="", set_qe=False): "exit" ]) print(script) - subprocess.call(["openocd", "-f", config, "-c", script]) + subprocess.call(["openocd", "-f", cable, "-f", config, "-c", script]) def get_version(): a = subprocess.run(["openocd", "-v"], capture_output=True) @@ -33,6 +33,7 @@ parser.add_argument("file", help="file to write to flash") parser.add_argument("-a", "--address", help="offset in flash", type=lambda x: int(x,0), default=0) parser.add_argument("-f", "--fpga", help="a35, a100 or a200", default="a35") parser.add_argument("-t", "--filetype", help="file type such as 'bin'", default="") +parser.add_argument("-c", "--cable", help="cable type such as 'arty'", default="arty") args = parser.parse_args() version = get_version() @@ -49,5 +50,6 @@ else: proxy = os.path.join(BASE, proxy) config = os.path.join(BASE, "xilinx-xc7{}.cfg".format(version)) +cable = os.path.join(BASE, "{}.cfg".format(args.cable)) -flash(config, proxy, args.address, args.file, args.filetype.lower()) +flash(cable, config, proxy, args.address, args.file, args.filetype.lower()) diff --git a/openocd/xilinx-xc7.cfg b/openocd/xilinx-xc7.cfg index 5359d4f..5017632 100644 --- a/openocd/xilinx-xc7.cfg +++ b/openocd/xilinx-xc7.cfg @@ -1,9 +1,3 @@ -interface ftdi -ftdi_vid_pid 0x0403 0x6010 -ftdi_channel 0 -ftdi_layout_init 0x00e8 0x60eb -reset_config none -adapter_khz 25000 source [find cpld/xilinx-xc7.cfg] diff --git a/openocd/xilinx-xc7_openocd_v0.11.cfg b/openocd/xilinx-xc7_openocd_v0.11.cfg index 8f7df34..2cece58 100644 --- a/openocd/xilinx-xc7_openocd_v0.11.cfg +++ b/openocd/xilinx-xc7_openocd_v0.11.cfg @@ -1,13 +1,6 @@ # This file is the same sa xilinx-xc7.cfg, except we use # verify_image instead of verify_bank -interface ftdi -ftdi_vid_pid 0x0403 0x6010 -ftdi_channel 0 -ftdi_layout_init 0x00e8 0x60eb -reset_config none -adapter_khz 25000 - source [find cpld/xilinx-xc7.cfg] # From jtagspi.cfg with modification to support