From cbcf6df26f03fb048089d73f802f423ea5334809 Mon Sep 17 00:00:00 2001 From: Josuah Demangeon Date: Mon, 31 Jul 2023 13:53:24 +0200 Subject: [PATCH 1/2] lattice_ecp5_evn: add_jtagbone flag This follows https://github.com/enjoy-digital/litex/pull/1087 which allows using the built-in JTAG for both the FPGA programming and the internal core of the FPGA. --- litex_boards/targets/lattice_ecp5_evn.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/litex_boards/targets/lattice_ecp5_evn.py b/litex_boards/targets/lattice_ecp5_evn.py index 304e137d..36ac5713 100755 --- a/litex_boards/targets/lattice_ecp5_evn.py +++ b/litex_boards/targets/lattice_ecp5_evn.py @@ -46,6 +46,7 @@ class _CRG(LiteXModule): class BaseSoC(SoCCore): def __init__(self, sys_clk_freq=50e6, toolchain="trellis", x5_clk_freq=None, with_led_chaser = True, + with_jtagbone = True, **kwargs): platform = lattice_ecp5_evn.Platform(toolchain=toolchain) @@ -55,6 +56,10 @@ class BaseSoC(SoCCore): # SoCCore ---------------------------------------------------------------------------------- SoCCore.__init__(self, platform, sys_clk_freq, ident="LiteX SoC on ECP5 Evaluation Board", **kwargs) + # JtagBone --------------------------------------------------------------------------------- + if with_jtagbone: + self.add_jtagbone() + # Leds ------------------------------------------------------------------------------------- if with_led_chaser: self.leds = LedChaser( @@ -68,12 +73,14 @@ def main(): parser = LiteXArgumentParser(platform=lattice_ecp5_evn.Platform, description="LiteX SoC on ECP5 Evaluation Board.") parser.add_target_argument("--sys-clk-freq", default=60e6, type=float, help="System clock frequency.") parser.add_target_argument("--x5-clk-freq", type=int, help="Use X5 oscillator as system clock at the specified frequency.") + parser.add_target_argument("--with-jtagbone", action="store_true", help="Add JTAGBone.") args = parser.parse_args() soc = BaseSoC( toolchain = args.toolchain, sys_clk_freq = args.sys_clk_freq, x5_clk_freq = args.x5_clk_freq, + with_jtagbone = args.with_jtagbone, **parser.soc_argdict) builder = Builder(soc, **parser.builder_argdict) if args.build: From 538399cb3bf94ed0ec9575cda9964947ee3da837 Mon Sep 17 00:00:00 2001 From: Josuah Demangeon Date: Mon, 31 Jul 2023 14:05:34 +0200 Subject: [PATCH 2/2] lattice_ecp5_evn: update OpenOCD syntax When running `litex_server`, this error appeared: can't read "_CHIPNAME": no such variable This is a fix for the specific lattice_ecp5_evn board. It also refreshes the OpenOCD syntax. --- litex_boards/prog/openocd_evn_ecp5.cfg | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/litex_boards/prog/openocd_evn_ecp5.cfg b/litex_boards/prog/openocd_evn_ecp5.cfg index 21e9bb40..12783574 100644 --- a/litex_boards/prog/openocd_evn_ecp5.cfg +++ b/litex_boards/prog/openocd_evn_ecp5.cfg @@ -1,9 +1,10 @@ -interface ftdi -ftdi_vid_pid 0x0403 0x6010 -ftdi_channel 0 -ftdi_layout_init 0xfff8 0xfffb +adapter driver ftdi +adapter speed 25000 +transport select jtag +ftdi vid_pid 0x0403 0x6010 +ftdi channel 0 +ftdi layout_init 0x00e8 0x60eb reset_config none -adapter_khz 5000 - -jtag newtap ecp5 tap -irlen 8 -expected-id 0x81113043 +set _CHIPNAME ecp5 +jtag newtap $_CHIPNAME tap -irlen 8 -expected-id 0x81113043