flash-arty: Add cable argument

To select the cable config. Defaults to arty

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
pull/331/head
Benjamin Herrenschmidt 3 years ago
parent 0a415410c9
commit 814d6914d0

@ -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

@ -7,7 +7,7 @@ import sys


BASE = os.path.dirname(os.path.abspath(__file__)) 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([ script = "; ".join([
"init", "init",
"jtagspi_init 0 {{{}}}".format(flash_proxy), "jtagspi_init 0 {{{}}}".format(flash_proxy),
@ -17,7 +17,7 @@ def flash(config, flash_proxy, address, data, filetype="", set_qe=False):
"exit" "exit"
]) ])
print(script) print(script)
subprocess.call(["openocd", "-f", config, "-c", script]) subprocess.call(["openocd", "-f", cable, "-f", config, "-c", script])


def get_version(): def get_version():
a = subprocess.run(["openocd", "-v"], capture_output=True) 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("-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("-f", "--fpga", help="a35, a100 or a200", default="a35")
parser.add_argument("-t", "--filetype", help="file type such as 'bin'", default="") 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() args = parser.parse_args()


version = get_version() version = get_version()
@ -49,5 +50,6 @@ else:


proxy = os.path.join(BASE, proxy) proxy = os.path.join(BASE, proxy)
config = os.path.join(BASE, "xilinx-xc7{}.cfg".format(version)) 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())

@ -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] source [find cpld/xilinx-xc7.cfg]



@ -1,13 +1,6 @@
# This file is the same sa xilinx-xc7.cfg, except we use # This file is the same sa xilinx-xc7.cfg, except we use
# verify_image instead of verify_bank # 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] source [find cpld/xilinx-xc7.cfg]


# From jtagspi.cfg with modification to support # From jtagspi.cfg with modification to support

Loading…
Cancel
Save