<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.sharpfin.org/index.php?action=history&amp;feed=atom&amp;title=OpenOCD</id>
	<title>OpenOCD - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://www.sharpfin.org/index.php?action=history&amp;feed=atom&amp;title=OpenOCD"/>
	<link rel="alternate" type="text/html" href="https://www.sharpfin.org/index.php?title=OpenOCD&amp;action=history"/>
	<updated>2026-04-23T13:10:45Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.4</generator>
	<entry>
		<id>https://www.sharpfin.org/index.php?title=OpenOCD&amp;diff=225&amp;oldid=prev</id>
		<title>Philipp: Created page with &quot;== &lt;big&gt;Barracuda module debug over JTAG using OpenOCD&lt;/big&gt; ==   It was tested on  Ubuntu 10.04 LTS and  reciva-kernel-v24080215+00.tar.bz2 kernel pack.  ===OpenOCD installation and testing ===  To install openocd in Ubuntu enter command   sudo apt-get install openocd   Create openocd config file &#039;&#039;JTAGdebug.cfg&#039;&#039; with this contents:   #  # Parallel port wiggler (many clones available) on port 0xc8b8  #  telnet_port 4444  gdb_port 3333  interface parport  parport_port 0...&quot;</title>
		<link rel="alternate" type="text/html" href="https://www.sharpfin.org/index.php?title=OpenOCD&amp;diff=225&amp;oldid=prev"/>
		<updated>2025-06-08T13:31:46Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;== &amp;lt;big&amp;gt;Barracuda module debug over JTAG using OpenOCD&amp;lt;/big&amp;gt; ==   It was tested on  Ubuntu 10.04 LTS and  reciva-kernel-v24080215+00.tar.bz2 kernel pack.  ===OpenOCD installation and testing ===  To install openocd in Ubuntu enter command   sudo apt-get install openocd   Create openocd config file &amp;#039;&amp;#039;JTAGdebug.cfg&amp;#039;&amp;#039; with this contents:   #  # Parallel port wiggler (many clones available) on port 0xc8b8  #  telnet_port 4444  gdb_port 3333  interface parport  parport_port 0...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== &amp;lt;big&amp;gt;Barracuda module debug over JTAG using OpenOCD&amp;lt;/big&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It was tested on  Ubuntu 10.04 LTS and  reciva-kernel-v24080215+00.tar.bz2 kernel pack.&lt;br /&gt;
&lt;br /&gt;
===OpenOCD installation and testing ===&lt;br /&gt;
&lt;br /&gt;
To install openocd in Ubuntu enter command&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install openocd &lt;br /&gt;
&lt;br /&gt;
Create openocd config file &amp;#039;&amp;#039;JTAGdebug.cfg&amp;#039;&amp;#039; with this contents:&lt;br /&gt;
&lt;br /&gt;
 #&lt;br /&gt;
 # Parallel port wiggler (many clones available) on port 0xc8b8&lt;br /&gt;
 #&lt;br /&gt;
 telnet_port 4444&lt;br /&gt;
 gdb_port 3333&lt;br /&gt;
 interface parport&lt;br /&gt;
 parport_port 0&lt;br /&gt;
 parport_cable wiggler&lt;br /&gt;
 # Found on the &amp;#039;TinCanTools&amp;#039; Hammer board.&lt;br /&gt;
 if { [info exists CHIPNAME] } {&lt;br /&gt;
   set  _CHIPNAME $CHIPNAME&lt;br /&gt;
   } else {&lt;br /&gt;
   set  _CHIPNAME s3c2410&lt;br /&gt;
  }&lt;br /&gt;
  if { [info exists ENDIAN] } {&lt;br /&gt;
   set  _ENDIAN $ENDIAN&lt;br /&gt;
  } else {&lt;br /&gt;
  # This config file was defaulting to big endian..&lt;br /&gt;
   set  _ENDIAN little&lt;br /&gt;
 }&lt;br /&gt;
 if { [info exists CPUTAPID] } {&lt;br /&gt;
   set  _CPUTAPID $CPUTAPID&lt;br /&gt;
 } else {&lt;br /&gt;
   set  _CPUTAPID 0xffffffff&lt;br /&gt;
 }&lt;br /&gt;
 #use combined on interfaces or targets that cannot set TRST/SRST separately&lt;br /&gt;
 reset_config trst_and_srst&lt;br /&gt;
 #jtag scan chain&lt;br /&gt;
 jtag newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_CPUTAPID&lt;br /&gt;
 set _TARGETNAME $_CHIPNAME.cpu&lt;br /&gt;
 target create $_TARGETNAME arm920t -endian $_ENDIAN -chain-position $_TARGETNAME -variant arm920t&lt;br /&gt;
 $_TARGETNAME configure -work-area-virt 0 -work-area-phys 0x30800000 -work-area-size  0x20000 -work-area-backup 0&lt;br /&gt;
 # speed up memory downloads&lt;br /&gt;
 arm7_9 fast_memory_access enable&lt;br /&gt;
 arm7_9 dcc_downloads enable&lt;br /&gt;
 nand device s3c2410 s3c2410.cpu&lt;br /&gt;
 &lt;br /&gt;
Now it&amp;#039;s possible to  test OpenOCD.&lt;br /&gt;
Connect JTAG cable to pc, power on radio and execute command in a shell &lt;br /&gt;
&lt;br /&gt;
 sudo openocd -f JTAGdebug.cfg &lt;br /&gt;
&lt;br /&gt;
You should see the output&lt;br /&gt;
&lt;br /&gt;
 Open On-Chip Debugger 0.3.1 (2010-01-18-14:21)&lt;br /&gt;
 $URL$&lt;br /&gt;
 For bug reports, read&lt;br /&gt;
 	http://openocd.berlios.de/doc/doxygen/bugs.html&lt;br /&gt;
 parport port = 0&lt;br /&gt;
 trst_and_srst separate srst_gates_jtag trst_push_pull srst_open_drain&lt;br /&gt;
 fast memory access is enabled&lt;br /&gt;
 dcc downloads are enabled&lt;br /&gt;
 Error: Translation from jtag_speed to khz not implemented&lt;br /&gt;
 Info : interface specific clock speed value 0&lt;br /&gt;
 Info : JTAG tap: s3c2410.cpu tap/device found: 0x0032409d (mfg: 0x04e, part: 0x0324, ver: 0x0)&lt;br /&gt;
 Warn : JTAG tap: s3c2410.cpu       UNEXPECTED: 0x0032409d (mfg: 0x04e, part: 0x0324, ver: 0x0)&lt;br /&gt;
 Error: JTAG tap: s3c2410.cpu  expected 1 of 1: 0xffffffff (mfg: 0x7ff, part: 0xffff, ver: 0xf)&lt;br /&gt;
 Error: Trying to use configured scan chain anyway...&lt;br /&gt;
 Warn : Bypassing JTAG setup events due to errors&lt;br /&gt;
 Info : Embedded ICE version 2&lt;br /&gt;
 &lt;br /&gt;
Now you can halt radio connecting to OpenOCD with telnet in a new shell window&lt;br /&gt;
&lt;br /&gt;
 telnet localhost 4444 &lt;br /&gt;
&lt;br /&gt;
Telnet output : &lt;br /&gt;
&lt;br /&gt;
 Code: [Select]&lt;br /&gt;
 Trying ::1...&lt;br /&gt;
 Trying 127.0.0.1...&lt;br /&gt;
 Connected to localhost.&lt;br /&gt;
 Escape character is &amp;#039;^]&amp;#039;.&lt;br /&gt;
 Open On-Chip Debugger&lt;br /&gt;
 &amp;gt; &lt;br /&gt;
&lt;br /&gt;
In telnet terminal enter command &amp;#039;&amp;#039;halt&amp;#039;&amp;#039; and terminal writes&lt;br /&gt;
&lt;br /&gt;
 &amp;gt; halt&lt;br /&gt;
 target state: halted&lt;br /&gt;
 target halted in ARM state due to debug-request, current mode: Supervisor&lt;br /&gt;
 cpsr: 0x20000093 pc: 0xc0015c74&lt;br /&gt;
 MMU: enabled, D-Cache: enabled, I-Cache: enabled&lt;br /&gt;
 &amp;gt;  &lt;br /&gt;
&lt;br /&gt;
Now we can power off radio and go to second part.&lt;br /&gt;
&lt;br /&gt;
=== Kernel with debug options compiling ===&lt;br /&gt;
&lt;br /&gt;
To see debugging symbols in gdb shell you need compiled kernel with debug option enabled.&lt;br /&gt;
In reciva kernel Makefile you need to add -g option after -Wall in these 2 lines:&lt;br /&gt;
&lt;br /&gt;
 HOSTCFLAGS	= -Wall &amp;#039;&amp;#039;&amp;#039;-g&amp;#039;&amp;#039;&amp;#039; -Wstrict-prototypes -O2 -fomit-frame-pointer&lt;br /&gt;
 CFLAGS := $(CPPFLAGS) -Wall &amp;#039;&amp;#039;&amp;#039;-g&amp;#039;&amp;#039;&amp;#039; -Wstrict-prototypes -Wno-trigraphs -O2 \&lt;br /&gt;
 &lt;br /&gt;
Now you can rebuild kernel.&lt;br /&gt;
After build you need a file vmlinux from reciva kernel root dir it&amp;#039;s about 32M size.&lt;br /&gt;
&lt;br /&gt;
If your radio kernel version is the same like kernel source you can skip information below how to flash new kernel to radio.&lt;br /&gt;
&lt;br /&gt;
=== New  kernel flashing ===&lt;br /&gt;
&lt;br /&gt;
The kernel file zImage could be found in folder &lt;br /&gt;
/arch/arm/boot&lt;br /&gt;
&lt;br /&gt;
To be suitable for sharpflash you need to use getpart utility&lt;br /&gt;
&lt;br /&gt;
 getpart zImage 0 fc000 kernel.new&lt;br /&gt;
&lt;br /&gt;
After this kernel.new size must be the same like kernel-mtd.bin from backups.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#FF0000&amp;quot;&amp;gt; &amp;lt;big&amp;gt;Before doing this be sure you have backup of your radio working kernel partition.&amp;lt;/big&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Now turn on radio and sharpflash the new kernel.&lt;br /&gt;
&lt;br /&gt;
 sharpflash -w kernel.new 4000 fc000 &lt;br /&gt;
When flashing is finished restart radio.&lt;br /&gt;
If you have changed  in kernel source something, for debugging must use apropriate vmlinux file. &lt;br /&gt;
&lt;br /&gt;
=== Debugging with gdb ===&lt;br /&gt;
Turn on radio.&lt;br /&gt;
Run OpenOCD and  telnet. Enter &amp;#039;&amp;#039;halt&amp;#039;&amp;#039; command in telnet window when radio display lights up.&lt;br /&gt;
Now we need to run gdb in a new shell window. &lt;br /&gt;
&lt;br /&gt;
 root@reciva-dev:/home/shared# gdb&lt;br /&gt;
&lt;br /&gt;
Gdb output screen&lt;br /&gt;
&lt;br /&gt;
  GNU gdb (GDB) 7.1-ubuntu&lt;br /&gt;
 Copyright (C) 2010 Free Software Foundation, Inc.&lt;br /&gt;
 License GPLv3+: GNU GPL version 3 or later &amp;lt;http://gnu.org/licenses/gpl.html&amp;gt;&lt;br /&gt;
 This is free software: you are free to change and redistribute it.&lt;br /&gt;
 There is NO WARRANTY, to the extent permitted by law.  Type &amp;quot;show copying&amp;quot;&lt;br /&gt;
 and &amp;quot;show warranty&amp;quot; for details.&lt;br /&gt;
 This GDB was configured as &amp;quot;i486-linux-gnu&amp;quot;.&lt;br /&gt;
 For bug reporting instructions, please see:&lt;br /&gt;
 &amp;lt;http://www.gnu.org/software/gdb/bugs/&amp;gt;.&lt;br /&gt;
 (gdb)  &lt;br /&gt;
&lt;br /&gt;
to load debug symbols in gdb environment execute &amp;#039;&amp;#039;file vmlinux&amp;#039;&amp;#039;.(I have copied vmlinux file to the place where  execute gdb in my case /home/shared) &lt;br /&gt;
&lt;br /&gt;
 (gdb)file vmlinux &lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
&lt;br /&gt;
 Reading symbols from /home/shared/gdb/vmlinux...done.&lt;br /&gt;
 (gdb) &lt;br /&gt;
&lt;br /&gt;
Now connect to OpenOCD enter in gdb this command&lt;br /&gt;
&lt;br /&gt;
 target remote localhost:3333 &lt;br /&gt;
&lt;br /&gt;
Output :&lt;br /&gt;
&lt;br /&gt;
 Remote debugging using localhost:3333&lt;br /&gt;
 0xc01b8d28 in cr_alignment ()&lt;br /&gt;
 (gdb) &lt;br /&gt;
&lt;br /&gt;
Now i&amp;#039;ts possible to get kernel variable values.&lt;br /&gt;
&lt;br /&gt;
Below it&amp;#039;s shown method how to get dmesg printout using log_buf variable.&lt;br /&gt;
&lt;br /&gt;
===Gdb script for dmesg===&lt;br /&gt;
&lt;br /&gt;
You can simply copy paste this script to gdb environment&lt;br /&gt;
&lt;br /&gt;
 define dmesg&lt;br /&gt;
 set $i=0&lt;br /&gt;
 set $end_idx=(log_end -1)&lt;br /&gt;
  while($i&amp;lt; logged_chars)&lt;br /&gt;
  printf&amp;quot;%c&amp;quot;,log_buf[$i]&lt;br /&gt;
  set $i=$i+1&lt;br /&gt;
  end&lt;br /&gt;
 end &lt;br /&gt;
&lt;br /&gt;
At the end you need to press enter.&lt;br /&gt;
Output :&lt;br /&gt;
&lt;br /&gt;
 (gdb) define dmesg&lt;br /&gt;
 Type commands for definition of &amp;quot;dmesg&amp;quot;.&lt;br /&gt;
 End with a line saying just &amp;quot;end&amp;quot;.&lt;br /&gt;
 &amp;gt;set $i=0&lt;br /&gt;
 &amp;gt;set $end_idx=(log_end -1)&lt;br /&gt;
  &amp;gt;while($i&amp;lt; logged_chars)&lt;br /&gt;
  &amp;gt;printf&amp;quot;%c&amp;quot;,log_buf[$i]&lt;br /&gt;
  &amp;gt;set $i=$i+1&lt;br /&gt;
  &amp;gt;end&lt;br /&gt;
 &amp;gt;end&lt;br /&gt;
 (gdb) &lt;br /&gt;
&lt;br /&gt;
Now execute &amp;#039;&amp;#039;dmesg&amp;#039;&amp;#039; command in gdb shell&lt;br /&gt;
&lt;br /&gt;
 (gdb) dmesg&lt;br /&gt;
 &amp;lt;4&amp;gt;Linux version 2.4.26-vrs1-bast2 (pb@bob.internal.reciva.com) (gcc version 3.3.4) v24080215+00 #1 Fri Feb 15 17:33:14 GMT 2008&lt;br /&gt;
 &amp;lt;4&amp;gt;CPU: Arm920Tid(wb) revision 0&lt;br /&gt;
 &amp;lt;4&amp;gt;Machine: Reciva-IR2&lt;br /&gt;
 &amp;lt;4&amp;gt;HWCONFIG values are: 15 1f (1013)&lt;br /&gt;
 &amp;lt;4&amp;gt;S3C2410: 202.800000 MHz, memory 101.400000 MHz, pclk 50.700000 MHz&lt;br /&gt;
 &amp;lt;4&amp;gt;On node 0 totalpages: 8192&lt;br /&gt;
 &amp;lt;4&amp;gt;zone(0): 8192 pages.&lt;br /&gt;
 &amp;lt;4&amp;gt;zone(1): 0 pages.&lt;br /&gt;
 &amp;lt;4&amp;gt;zone(2): 0 pages.&lt;br /&gt;
 &amp;lt;4&amp;gt;Kernel command line: root=/dev/mtdblock2 ro init=/linuxrc&lt;br /&gt;
 &amp;lt;7&amp;gt;Relocating machine vectors to 0xffff0000&lt;br /&gt;
 &amp;lt;4&amp;gt;irq: clearing subpending status 00000402&lt;br /&gt;
 &amp;lt;4&amp;gt;bast_init_irq:&lt;br /&gt;
 &amp;lt;4&amp;gt;setup_timer: TCNTB4 at d890003c&lt;br /&gt;
 &amp;lt;4&amp;gt;setup_timer: tcon=00000000, tcnt should be f799&lt;br /&gt;
 &amp;lt;4&amp;gt;setup_timer: about to configure timer4&lt;br /&gt;
 &amp;lt;4&amp;gt;setup_timer: stopping timer&lt;br /&gt;
 &amp;lt;4&amp;gt;setup_timer: adding interrupt&lt;br /&gt;
 &amp;lt;4&amp;gt;setup_timer: starting timer&lt;br /&gt;
 &amp;lt;4&amp;gt;Calibrating delay loop (skipped)... 101.17 BogoMIPS&lt;br /&gt;
 &amp;lt;6&amp;gt;Memory: 32MB = 32MB total&lt;br /&gt;
 ---Type &amp;lt;return&amp;gt; to continue, or q &amp;lt;return&amp;gt; to quit---&lt;br /&gt;
&lt;br /&gt;
Pressing enter you can read all dmesg.&lt;/div&gt;</summary>
		<author><name>Philipp</name></author>
	</entry>
</feed>