r00t
Posts: 2
Joined: Sat May 09, 2015 11:43 am

Debugging the Pi2 via JTAG

Wed May 20, 2015 10:41 am

Hello,
I would like to do some bare metal programming on the Pi2 in C (with the cirrus audio board).
Has somebody managed to map the ALT gpio functions of the expansion header correctly and setup a working toolchain/developement environment for productive use?
Thank you

dwelch67
Posts: 919
Joined: Sat May 26, 2012 5:32 pm

Re: Debugging the Pi2 via JTAG

Fri May 22, 2015 3:35 am

You possibly already know this but for the pi 1 https://github.com/dwelch67/raspberrypi in the armjtag directory. Other than changing the 0x20.... addresses to 0x3F... addresses one would assume based on what they are telling us this should just work.
this I assume is differen too...

Code: Select all

   set _CPU_TAPID 0x07b7617F
Perhaps I will try this tomorrow with a rpi2 and see what I see...

dwelch67
Posts: 919
Joined: Sat May 26, 2012 5:32 pm

Re: Debugging the Pi2 via JTAG

Fri May 22, 2015 1:37 pm

getting close, likely still missing something https://github.com/dwelch67/raspberrypi armjtag/rpi2 directory

from the readme

First cut at the raspberry pi 2, close but I dont think quite there yet

pinout is all the same, the raspberry pi 2 base address for things
is 0x3F000000 instead of 0x20000000 in theory all the rest is the
same other than the exact arm core.

bcmrpi2.cfg is taken from openocds bcm281xx.cfg and modified a little

it will connect

openocd -f amontec.cfg -f bcmrpi2.cfg
Open On-Chip Debugger 0.9.0-dev-hgb13d8a0d2adf-dirty (2014-12-10-15:33)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.sourceforge.net/doc/doxygen/bugs.html
Info : only one transport option; autoselect 'jtag'
adapter speed: 1000 kHz
Warn : Using DEPRECATED interface driver 'ft2232'
Info : Consider using the 'ftdi' interface driver, with configuration files in interface/ftdi/...
Info : clock speed 1000 kHz
Info : JTAG tap: bcmrpi2.dap tap/device found: 0x4ba00477 (mfg: 0x23b, part: 0xba00, ver: 0x4)
Info : bcmrpi2.cpu0: hardware has 6 breakpoints, 4 watchpoints
Info : bcmrpi2.cpu1: hardware has 6 breakpoints, 4 watchpoints
Info : bcmrpi2.cpu2: hardware has 6 breakpoints, 4 watchpoints
Info : bcmrpi2.cpu3: hardware has 6 breakpoints, 4 watchpoints



telnet localhost 4444
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Open On-Chip Debugger
> targets
TargetName Type Endian TapName State
-- ------------------ ---------- ------ ------------------ ------------
0 bcmrpi2.cpu0 cortex_a little bcmrpi2.dap running
1 bcmrpi2.cpu1 cortex_a little bcmrpi2.dap running
2 bcmrpi2.cpu2 cortex_a little bcmrpi2.dap running
3* bcmrpi2.cpu3 cortex_a little bcmrpi2.dap running
>

and then this is either stuff I dont know yet or not quite configured
right

>halt
Timeout waiting for read dcc
Timeout waiting for read dcc
in procedure 'halt'
> targets
TargetName Type Endian TapName State
-- ------------------ ---------- ------ ------------------ ------------
0 bcmrpi2.cpu0 cortex_a little bcmrpi2.dap running
1 bcmrpi2.cpu1 cortex_a little bcmrpi2.dap running
2 bcmrpi2.cpu2 cortex_a little bcmrpi2.dap running
3* bcmrpi2.cpu3 cortex_a little bcmrpi2.dap halted
>

so it did halt it but need to figure out the Timeout

r00t
Posts: 2
Joined: Sat May 09, 2015 11:43 am

Re: Debugging the Pi2 via JTAG

Fri May 22, 2015 2:14 pm

Great, thank you for the quick start!

henry10210
Posts: 13
Joined: Sun Oct 29, 2017 5:56 pm

Re: Debugging the Pi2 via JTAG

Mon Nov 20, 2017 5:02 am

Hello David, I've been struggling for more than month, to get openocd to connect to RPi2/3. Yesterday, I stumbled on a blog entry that mentioned an openocd branch that successfully connects to RPi3. The usage was shown in https://github.com/daniel-k/rpi3-aarch64-jtag. I still don't understand why ToT openocd cannot connect to RPi2 through my J-Link as you clearly can through with your amontec probe, but for whatever reason, this openocd "armv8" branch mentioned above can apparently connect to my RPi3 (but still not to RPi2). But I see the same problem you mention in this thread.
dwelch67 wrote:
Fri May 22, 2015 1:37 pm

and then this is either stuff I dont know yet or not quite configured
right

>halt
Timeout waiting for read dcc
Timeout waiting for read dcc
in procedure 'halt'
>
so it did halt it but need to figure out the Timeout
I am curious whether you ever got to the bottom of this "dcc" problem. Thanks for reading.

w/ regards,
Henry

jlbates
Posts: 2
Joined: Thu Dec 22, 2016 6:16 pm

Re: Debugging the Pi2 via JTAG

Thu Jan 11, 2018 7:40 pm

Just got a RPi 1 connected to SEGGER J-LINK debugger. Using jwelch;s "armjtag" project. After activating RTCK gpio23 the j-link connected like a charm, even though I did not have the pin wired. I guess the rpi needs this pin active along with the others. Added this to armjtag.c

ra&=~(7<<9); //gpio23
ra|=3<<9; //alt4 ARM_RTCK

I was able to connect and debug with both SEGGER's J-LINK GDB Server and J-LINK Commander. v6.22d. Then connected using OpenOCD and Eclipse. All this done on windows 7.

Hope this helps someone.

Return to “Bare metal”

Who is online

Users browsing this forum: No registered users and 9 guests