Changes between Initial Version and Version 1 of Debugging/OpenOCD/Raspberry_Pi


Ignore:
Timestamp:
09/17/15 17:20:49 (9 years ago)
Author:
Pavel Pisa
Comment:

Raspberry Pi debugging with OpenOCD.

Legend:

Unmodified
Added
Removed
Modified
  • Debugging/OpenOCD/Raspberry_Pi

    v1 v1  
     1= Raspberry Pi Debugging with OpenOCD =
     2
     3[[TOC(Debugging/OpenOCD/Raspberry_Pi , depth=2)]]
     4
     5The scripts for OpenOCD debugging can be found in my
     6[https://github.com/ppisa/rpi-utils/tree/master/jtag-debug rpi-utils]
     7GitHUB repo for example. They are listed below as well.
     8
     9I have issues to load application image over JTAG (some data corruption,
     10may it be by overload of bus arbitration). But when application is load
     11over TFTP from U-boot it can be fully debugged.
     12
     13The JTAG interface has to be enabled first. For U-boot based
     14RTEMS image load it can be achieved by U-boot commands
     15{{{
     16mw.l 0x20200000 0x04a020
     17mw.l 0x20200008 0x65b6c0
     18}}}
     19
     20File "rpi-jt_usb5.cfg":
     21{{{
     22#daemon configuration
     23telnet_port 4444
     24gdb_port 3333
     25
     26# tell gdb our flash memory map
     27# and enable flash programming
     28#gdb_memory_map enable
     29#gdb_flash_program enable
     30
     31interface ftdi
     32#ftdi_device_desc "Dual RS232"
     33ftdi_vid_pid 0x0403 0x6010
     34
     35ftdi_layout_init 0x0cf8 0x0cfb
     36ftdi_layout_signal nTRST -data 0x0010 -noe 0x0800
     37ftdi_layout_signal nSRST -ndata 0x0040 -noe 0x0400
     38
     39ftdi_layout_signal nTRST -data 0x0010
     40ftdi_layout_signal nSRST -ndata 0x0040
     41ftdi_layout_signal LED -ndata 0x0800
     42
     43transport select jtag
     44
     45#ftdi_layout_signal SWD_EN -ndata 0x0400
     46#ftdi_layout_signal SWDIO_OE -alias TMS
     47
     48adapter_khz 500
     49
     50reset_config none
     51
     52#jtag_nsrst_delay 400
     53#jtag_ntrst_delay 400
     54
     55if { [info exists CHIPNAME] } {
     56   set  _CHIPNAME $CHIPNAME
     57} else {
     58   set  _CHIPNAME raspi
     59}
     60
     61reset_config none
     62
     63if { [info exists CPU_TAPID ] } {
     64   set _CPU_TAPID $CPU_TAPID
     65} else {
     66   set _CPU_TAPID 0x07b7617F
     67}
     68jtag newtap $_CHIPNAME arm -irlen 5 -expected-id $_CPU_TAPID
     69
     70set _TARGETNAME $_CHIPNAME.arm
     71target create $_TARGETNAME arm11 -chain-position $_TARGETNAME
     72
     73adapter_khz 500
     74
     75init
     76
     77#reset halt
     78
     79#wait_halt
     80
     81# check TDO connection
     82#echo 24 > /sys/class/gpio/export
     83#echo out > /sys/class/gpio/gpio24/direction
     84#echo 1 > /sys/class/gpio/gpio24/value
     85}}}
     86
     87File "gdb-openocd.init":
     88{{{
     89target remote localhost:3333
     90#load
     91}}}
     92
     93File "rpi-jt_usb5-ddd"
     94{{{
     95#!/bin/sh
     96
     97SCRIP_DIR="$(dirname "$(readlink -f "$0")")"
     98
     99nc -w 3 -z localhost 4444
     100if [ $? -ne 0 ]
     101then
     102  echo "Starting OpenOCD"
     103  openocd -f "$SCRIP_DIR/rpi-jt_usb5.cfg" &
     104  OPENOCD_PID=$!
     105  nc -w 10 -z localhost 4444
     106  if [ $? -ne 0 ]
     107  then
     108    echo "OpenOCD start failed"
     109  fi
     110fi
     111
     112ddd --debugger arm-elf-gdb -x "$SCRIP_DIR/gdb-openocd.init" "$1"
     113
     114kill $OPENOCD_PID
     115}}}