Ethernut Home Hardware Firmware Tools Download Community
 
 
Search | Legals | Deutsch

OpenOCD for AT91SAM7SE - Part 3

This is part 3 of our OpenOCD for AT91SAM7SE tutorial.

Configuring the CPU

Declaring a TAP

In the last part OpenOCD suggested to add a jtag newtap command to the configuration. Its general form is

jtag newtap <chipname> <tapname> <options>

We just need to fill out the parameters given in angle brackets. They have the following meanings.

Parameter Description
chipname A board may contain several chips with JTAG interfaces. You must specify unique chip names to identify each of them.
tapname A chip may contain several test access points (TAPs). You must specify a unique TAP names to identify each of them.
options At least, we must specify the length of the JTAG instruction register of the TAP, using the option -irlen. It is also a good idea to let OpenOCD know the expected JTAG ID-Code using the option -expected-id.

Remember the output we got at the end of the last part:

Warn : There are no enabled taps.  AUTO PROBING MIGHT NOT WORK!!
Warn : AUTO auto0.tap - use "jtag newtap auto0 tap -expected-id 0x3f0f0f0f ..."
Warn : AUTO auto0.tap - use "... -irlen 4"

In most cases the autoprobe feature works quite well and OpenOCD suggests to use

jtag newtap auto tap -irlen 4 -expected-id 0x3f0f0f0f

For the AT91SAM7SE512 let's replace the chip name auto with sam7se512 and the TAP name tap with cpu. This gives the following line, which you should add to your existing openocd.cfg. Btw. you can stop the running OpenOCD executable with Ctrl-C.

jtag newtap sam7se512 cpu -irlen 4 -expected-id 0x3f0f0f0f

We may later refer to this specific TAP by its dotted name sam7se512.cpu.

Starting OpenOCD with this modified configuration should produce the following output

Open On-Chip Debugger 0.6.0-rc1 (2012-08-08-20:04)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.sourceforge.net/doc/doxygen/bugs.html
Info : only one transport option; autoselect 'jtag'
8 kHz
Info : device: 4 "2232C"
Info : deviceID: 67354056
Info : SerialNumber: TLVE8EUJA
Info : Description: Turtelizer JTAG/RS232 Adapter A
Info : clock speed 8 kHz
Info : JTAG tap: sam7se512.cpu tap/device found: 0x3f0f0f0f (mfg: 0x787, part: 0xf0f0, ver: 0x3)
Warn : gdb services need one or more targets defined

We still have one warning, which will be handled next.

Declaring a Debug Target

Some of you may simply want to use OpenOCD to flash a target board, but in the first place it has been created for debugging. So far we have configured the JTAG interface only, nothing is known about CPU internals.

While OpenOCD is mainly used with ARM CPUs, it supports a few other targets, more or less well. Controlling different targets via JTAG is complicated. For example, targets may be switched to different modes or states, may or may not have an MMU and even a simple reset may result in a number of side effects, which are not always trivial to handle. Even if it would have been limited to ARM cores, there are quite many variants with totally different features.

As a result, most of OpenOCD's knowledge about target CPUs has been hard coded and you select the right routines by simply telling OpenOCD, which kind of chip it is connected to at a given TAP, using the configuration command target create. Its general form is

target create <targetname> <type> <options>

The meaning of the parameters is given in the following table.

Parameter Description
targetname The name that will be used to access this target. By convention the same dotted name as for the TAP is used here.
type This is the important option, which let's OpenOCD know the type of chip to control. For the AT91SAM7SE we specify arm7tdmi.
options Several options are available to further specify the chip variant and to provide additional information about the target. At least one option is mandantory, the -chain-position, which tells OpenOCD the name of the TAP this target is attached at.

For the AT91SAM7SE512 we should use

target create sam7se512.cpu arm7tdmi -chain-position sam7se512.cpu

After adding this line to the openocd.cfg (don't forget to save it), OpenOCD should start running without any more errors or warnings.

Open On-Chip Debugger 0.6.0-rc1 (2012-08-08-20:04)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.sourceforge.net/doc/doxygen/bugs.html
Info : only one transport option; autoselect 'jtag'
8 kHz
sam7se512.cpu
Info : device: 4 "2232C"
Info : deviceID: 67354056
Info : SerialNumber: TLVE8EUJA
Info : Description: Turtelizer JTAG/RS232 Adapter A
Info : clock speed 8 kHz
Info : JTAG tap: sam7se512.cpu tap/device found: 0x3f0f0f0f (mfg: 0x787, part: 0xf0f0, ver: 0x3)
Info : Embedded ICE version 1
Info : sam7se512.cpu: hardware has 2 breakpoint/watchpoint units

At this point, the complete contents of your openocd.cfg should be

interface ft2232
ft2232_layout turtelizer2
ft2232_device_desc "Turtelizer JTAG/RS232 Adapter"
adapter_khz 8
jtag newtap sam7se512 cpu -irlen 4 -expected-id 0x3f0f0f0f
target create sam7se512.cpu arm7tdmi -chain-position sam7se512.cpu

Again, replacing the first line with interface turtle when using the Turtelizer support package.

Are you bored? Don't worry, hard times are ahead. In the next part you will learn how to configure the PLL of the EIR board. Dig out the AT91SAM7SE data sheet now.