Regarding 'halt' command failing, this is most likely due to nSRST not being setup properly, I've also struggled with this problem for a bit and realized I needed to properly setup the pins on my adapter for things to work.
Why are you entering all this stuff manually on the OpenOCD shell? I've just put it all into a .cfg fine loaded on start, then just issue
mt7622_reset
mt7622_ddrinit
mt7622_uboot
and you should find yourself in RAM-loaded U-Boot which allows you to write fixed bootloader to flash.
My reason for typing each command is due to crashing when I try to run:
./src/openocd -f tumpa-lite.cfg -f openocd.cfg
Open On-Chip Debugger 0.12.0+dev-00044-g4cb1fdb14 (2023-01-23-20:12)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
adapter speed: 200 kHz
Info : linux os creation
Segmentation fault (core dumped)
What do you enable when you run make on openocd? This command fails and I think it's due to something I'm not running.
jtag_tdo_sample_edge falling
Also, I've been connecting to the JTAG pins on the Tumpa-Lite. Will this work or should I use GPIO?
Oh, I never saw that happening. Maybe try with the latest release of OpenOCD (still with the patch from mtk-openwrt on top) rather than the development version...
I don't know this specific adapter, but in theory yes, this looks good and should work.
Make sure the relevant signals and GND are connected, and you should be good to go.
I suppose this adapter board will have appropriate pull-up and pull-down resistors in place when using the connector with JTAG label... (?)
I removed line feed from all commands to allow me to cut/paste and see the output of each. It still crashed with seg fault.
openocd -f tumpa-lite.cfg -f openocd.cfg
Open On-Chip Debugger 0.12.0
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : linux os creation
Segmentation fault (core dumped)
> adapter speed 10000
adapter speed: 10000 kHz
> transport select jtag
Transport "jtag" was already selected
jtag
************changed from jtag_tdo_sample_edge falling****************
> ftdi
ftdi samples TDO on falling edge of TCK
>
> adapter srst delay 750
adapter srst delay: 750
> jtag_ntrst_assert_width 100
jtag_ntrst_assert_width: 100
> jtag_ntrst_delay 50
jtag_ntrst_delay: 50
>
> reset_config trst_and_srst separate srst_gates_jtag srst_open_drain
trst_and_srst separate srst_gates_jtag trst_push_pull srst_open_drain connect_deassert_srst
>
> if { [info exists CHIPNAME] } { set _CHIPNAME $CHIPNAME } else { set _CHIPNAME mt7622 }
mt7622
>
> if { [info exists DAP_TAPID] } { set _DAP_TAPID $DAP_TAPID } else { set _DAP_TAPID 0x4ba00477 }
0x4ba00477
>
> jtag newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0x0f -expected-id $_DAP_TAPID
The 'jtag newtap' command must be used before 'init'.
More info:
Since OpenOCD version 0.11.0, the Debug Access Port (DAP) is no longer implicitly created together with the target. It must be explicitly declared using the dap create command. For all ARMv6-M, ARMv7 and ARMv8 targets, the option "-dap dap_name" has to be used instead of "-chain-position dotted.name" when the target is created.
> dap create -dap mt7622.dap mt7622.cpu
Unknown param: mt7622.dap, try one of: -chain-position, -ignore-syspwrupack, -dp-id, -instance-id, -adiv6, or -adiv5
> dap create -dap mt7622.dap
wrong # args: should be "-dap ?name? ..options..."
I can tell you that I was using OpenOCD commit 427552c078 (ie. before v0.11.0) with patch from mtk-openwrt on top, and that worked nicely with the configuration I have posted before (on my x86_64 host running ArchLinux)