The CoreBaseAddress and CTICoreBaseAddress need to be configured manually probably? Running JlinkExe and using the interactive CLI to connect will make it dump the addresses, they can be put in a jlink script like the rb3gen2 example.
Resetting the board doesn't work correctly, things have to be sequenced in a particular order to prevent hangs.
I found the most success by starting the JLinkGDBServer during or after sbl1.
I also had some issues touching imem, i guess this is because on rb3gen2 imem is actually DSP memory, and it is made inaccessible. Hence excluding it so the JTAG never tries to access these regions helps.
RB3 Gen 2:
./JLinkGDBServer -select USB=0 -device Cortex-A55 -endian little -if JTAG -speed 20000 -noir -LocalhostOnly -nologtofile -port 2331 -SWOPort 2332 -TelnetPort 2333 -JLinkScriptFile ./Script/RB5.JLinkScript
Your .gdbinit should have something like
target extended-remote :2331
add-symbol-file path/to/u-boot
define linux
print "Setting up Linux symbols"
add-symbol-file linux/.output/vmlinux
end
Unlike Linux, U-Boot doesn't (yet) have GDB scripts to handle loading symbols post-relocation. There are manual docs on doing this though.
For a fast dev loop, using cdba (or some other tooling to fully power cycle the board) in tandem with JTAG
The cdba lock file can be used to sequence gdb and the jlink gdbserver
while true; do inotifywait -e access /tmp/cdba-rb3gen2.lock; sleep 0.5; JLinkGDBServer ...; done
And similarly for gdb itself.