Noob: How to add OpenOCD support to new ARM7TDMI target

Hello all,

I’m just starting out with JTAG. I’ve bought a Bus Blaster, and I’d like to be able to use OpenOCD to flash and debug an [Analog Devices ADuC7061 chip. I have an [ADuC7061MKZ development board. The ADuC706x family is based on an Arm7TDMI core.

What is required to add support for a chip like this? I was hoping it would be fairly standard given the core, but looking at the OpenOCD source I wonder if I need for instance to add a flash driver with assembly code for writing to flash.

Thanks for any hints,

Erland](EVAL-ADUC7061 Evaluation Board | Analog Devices)](http://www.analog.com/en/processors-dsp/analog-microcontrollers/aduc7061/products/product.html)

According to the src OpenOCD already has a aduc702x driver (src/flash/nor/aduc702x.c). This would be a good starting point.

Cheers

Spen

Thanks for the pointer.

I’ve made a new flash driver by copying the aduc702x driver and modifying the addresses and memory map of the aduc706x.

I can connect to the target:

$ openocd -f interface/busblaster.cfg -f board/ADuC7061MKZ.cfg
Open On-Chip Debugger 0.6.1 (2013-01-29-23:23)
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_nsrst_delay: 200
jtag_ntrst_delay: 200
adapter speed: 400 kHz
Info : device: 6 "2232H"
Info : deviceID: 67330064
Info : SerialNumber: FTWBN4A9A
Info : Description: Dual RS232-HS A
Info : max TCK change to: 30000 kHz
Info : clock speed 400 kHz
Info : JTAG tap: aduc706x.cpu tap/device found: 0x3f0f0f0f (mfg: 0x787, part: 0xf0f0, ver: 0x3)
Info : Embedded ICE version 1
Info : aduc706x.cpu: hardware has 2 breakpoint/watchpoint units

but I am having problems with halting/reset and reading memory:

$ ~/src/yagarto-4.7.2/bin/arm-none-eabi-gdb main.elf 
GNU gdb (GDB) 7.5.1
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=x86_64-apple-darwin10.8.0 --target=arm-none-eabi".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /Users/erl/src/elab/shift/main.elf...done.
(gdb) target remote localhost:3333
Remote debugging using localhost:3333
0x00081ff4 in gpio_setValue (port=0, bit=0, value=0) at gpio.c:71
71	    (*dataRegister) = (*dataRegister) & ~(1 << (bit + 16));
(gdb)

However, the processor is not halted (I see by flashing LEDs that the code is still running). The OpenOCD server prints:

Warn : acknowledgment received, but no packet pending
Error: timeout waiting for SYSCOMP & DBGACK, last DBG_STATUS: 4
Warn : target not halted

I could stop it by:

(gdb) monitor halt
Jazelle debug entry -- BROKEN!
Jazelle state handling is BROKEN!
target state: halted
target halted in Jazelle state due to debug-request, current mode: User
cpsr: 0x21000010 pc: 0x000816d2
(gdb)

When I try to disassemble, I think gdb just sees zeros:

(gdb) disassemble
Dump of assembler code for function gpio_setValue:
   0x00081f70 <+0>:	andeq	r0, r0, r0
   0x00081f74 <+4>:	andeq	r0, r0, r0
   0x00081f78 <+8>:	andeq	r0, r0, r0
   0x00081f7c <+12>:	andeq	r0, r0, r0
   0x00081f80 <+16>:	andeq	r0, r0, r0
   0x00081f84 <+20>:	andeq	r0, r0, r0
   0x00081f88 <+24>:	andeq	r0, r0, r0
   0x00081f8c <+28>:	andeq	r0, r0, r0
   0x00081f90 <+32>:	andeq	r0, r0, r0
   0x00081f94 <+36>:	andeq	r0, r0, r0

But I do get some stuff, like partially correct stack traces:

(gdb) bt
#0  0x00081ff4 in gpio_setValue (port=0, bit=0, value=0) at gpio.c:71
#1  0x00000000 in ?? ()
(gdb)

reading/writing from SRAM does not seem to work, even behaves very strangely:

(gdb) monitor mdw 0x40000
0x00040000: 00000000 
(gdb) monitor mww 0x40000 0x12345678
(gdb) monitor mdw 0x40000
0x00040000: e1a08008 
(gdb) monitor mdw 0x40000
0x00040000: 00000000 
(gdb)

Any pointers on where to go from here would be highly appreciated.

Thanks,

Erland