{#
#
# Copyright (C) 2020-2024 PyFPGA Project
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
#}

set -e

DOCKER="docker run --user $(id -u):$(id -g) --rm -v $HOME:$HOME -w $PWD"

{% if family == 'ecp5' %}
$DOCKER --device /dev/bus/usb hdlc/prog openocd -f /usr/share/trellis/misc/openocd/ecp5-evn.cfg -c "transport select jtag; init; svf {{ bitstream }}; exit"
{% else %}
$DOCKER --device /dev/bus/usb hdlc/prog iceprog {{ bitstream }}
{% endif %}
