openocd.git
13 years agoNOR/CFI: identify memory accesses not using "bus_width".
Antonio Borneo [Tue, 20 Apr 2010 04:15:49 +0000 (12:15 +0800)]
NOR/CFI: identify memory accesses not using "bus_width".

Since NOR flash devices does not handle "byte enable lanes",
each read/write access involves the whole "chip_width".
When multiple devices are in parallel, usually all chips are
enabled during each access.
All such cases are compatible with flash accesses at
"bus_width" size.

Access at "bus_width" size is mandatory for write access to
avoid transferring of garbage values to flash.
During read access the flash controller should take care,
and discard unneeded bytes. Anyway, it is good practice to
use "bus_width" size also for read.

Every memory access that does not respect "bus_width" size
is marked with a "FIXME" comment.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
13 years agoNOR/CFI: simplify bufferwsize computation
Antonio Borneo [Mon, 19 Apr 2010 08:40:08 +0000 (16:40 +0800)]
NOR/CFI: simplify bufferwsize computation

Review and simplify computation of bufferwsize.
Add comments about variables' meaning.

The same code is present 3 times in the file.
Current patch updates all the 3 instances.

Step 1)
  Replace "switch(bank->chip_width) {...}".
  Illegal values of bank->chip_width are already dropped.
  For legal values, the code is equivalent to:
        bufferwsize = buffersize / bank->chip_width;

Step 2)
  The above code replacement plus the following line:
        bufferwsize /= (bank->bus_width / bank->chip_width);
  is merged in a single formula:
        bufferwsize = (buffersize / bank->chip_width) /
                (bank->bus_width / bank->chip_width);
  and simplified as:
        bufferwsize = buffersize / bank->bus_width;

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
13 years agoNOR/CFI: check "flash bank" command arguments
Antonio Borneo [Thu, 15 Apr 2010 17:17:01 +0000 (01:17 +0800)]
NOR/CFI: check "flash bank" command arguments

Arguments chip_width and bus_width of command "flash bank" are
not fully checked.
While bus_width is later on redundantly checked in several other
parts (e.g. in cfi_command_val()) and generates run-time error,
chip_width is never checked, nor related to actual bus_width
value.
Added check to avoid:
- (chip_width == 0), that would mean no memory chip at all,
  avoiding also division by zero e.g. in cfi_get_u8();
- (bus_width == 0), that would mean no bus at all;
- unsupported cases of chip_width or bus_width value not power
  of 2;
- unsupported case of chip width wider than bus.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
13 years agocomments on doc/manual/primer/jtag.txt
Jun Ma [Fri, 14 May 2010 13:43:11 +0000 (21:43 +0800)]
comments on doc/manual/primer/jtag.txt

1. fix some errors in jtag.txt(in my personal opinion, please review).
2. remove a broken link

Signed-off-by: Jun Ma <sync.jma@gmail.com>
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
13 years agomissing pointer's declaration when enable macro -D_DEBUG_GDB_IO_.
Jun Ma [Fri, 14 May 2010 13:04:14 +0000 (21:04 +0800)]
missing pointer's declaration when enable macro -D_DEBUG_GDB_IO_.

reproducable when "./configure --enable-maintainer-mode CFLAGS=-D_DEBUG_GDB_IO_"

Signed-off-by: Jun Ma <sync.jma@gmail.com>
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
13 years agoNAND: fix first and last handling in nand_build_bbt
Jon Povey [Thu, 13 May 2010 09:31:42 +0000 (18:31 +0900)]
NAND: fix first and last handling in nand_build_bbt

Last block was being skipped, fix by changing the loop test from "<" to "<="

First block argument was ignored, always started from block 0 (and counted
the wrong blocks as bad if first was nonzero). Now we use it.

Signed-off-by: Jon Povey <jon.povey@racelogic.co.uk>
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
13 years agoNAND: fix off-by-one error in erase command argument range
Jon Povey [Thu, 13 May 2010 09:31:41 +0000 (18:31 +0900)]
NAND: fix off-by-one error in erase command argument range

The last_block argument to nand_erase() is checked against nand->num_blocks,
but the highest valid block number is (total - 1), the test for invalid should
be ">=" rather than ">".

Signed-off-by: Jon Povey <jon.povey@racelogic.co.uk>
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
13 years agoscripts: update flash bank names
Spencer Oliver [Wed, 12 May 2010 22:04:57 +0000 (23:04 +0100)]
scripts: update flash bank names

As the flash bank name is now unique update the scripts to suit.

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
13 years agoflash: require unique flash bank name
Spencer Oliver [Wed, 12 May 2010 21:42:26 +0000 (22:42 +0100)]
flash: require unique flash bank name

Make sure the flash bank name is unique

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
13 years agoflash: add flash bank name support
Spencer Oliver [Wed, 12 May 2010 21:40:19 +0000 (22:40 +0100)]
flash: add flash bank name support

flash cmds can now be passed either the bank name or the bank number.
For example.
flash info stm32.flash
flash info 0

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
13 years agozy1000.cfg: gdb connect will fail first time without gdb-attach
Øyvind Harboe [Wed, 12 May 2010 11:45:04 +0000 (13:45 +0200)]
zy1000.cfg: gdb connect will fail first time without gdb-attach

gdb-attach does a reset init to make sure that the CFI probe
will succeed upon first gdb connect.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
13 years agofix instruction refilling bug when using software breakpoints on a big-endian arm926e...
Jun Ma [Mon, 10 May 2010 14:54:25 +0000 (22:54 +0800)]
fix instruction refilling bug when using software breakpoints on a big-endian arm926ej-s system

Signed-off-by: Jun Ma <sync.jma@gmail.com>
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
13 years agoFujitsu MBM29SL800TE flash support
Karl Kurbjun [Tue, 11 May 2010 04:18:24 +0000 (22:18 -0600)]
Fujitsu MBM29SL800TE flash support

Hi,

This is my first post to the list.  First, I would like to thank
everyone for their work on OpenOCD, it is a great tool to work with.  I
have been using it to debug code on hardware for the Rockbox project
(www.rockbox.org).

The target that I primarily work with has a Spansion/Fujitsu NOR flash
(MBM29SL800TE).  I attached a patch that adds support for this flash.  I
hope it can be included in the main repository.  If there is something
that needs to be changed with the patch before inclusion please let me
know.

-Karl Kurbjun

13 years agoDocumentation: consistency in GDB command name
Marc Pignat [Tue, 11 May 2010 05:59:22 +0000 (07:59 +0200)]
Documentation: consistency in GDB command name

Always use the complete name of the GDB command, not an abbreviation.

13 years agoDocumentation : arm920t implements armv4
Marc Pignat [Tue, 11 May 2010 05:58:57 +0000 (07:58 +0200)]
Documentation : arm920t implements armv4

There is a small typo in the cpu list, arm920t is armv4.

13 years agomips32: 20 second timeout/megabyte for CRC check
Spencer Oliver [Mon, 10 May 2010 13:15:12 +0000 (14:15 +0100)]
mips32: 20 second timeout/megabyte for CRC check

There was a fixed 20 second timeout which is too little
for large, slow timeout checks.

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
13 years agoarmv7m: 20 second timeout/megabyte for CRC check
Spencer Oliver [Mon, 10 May 2010 13:14:57 +0000 (14:14 +0100)]
armv7m: 20 second timeout/megabyte for CRC check

There was a fixed 20 second timeout which is too little
for large, slow timeout checks.

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
13 years agocfi: add Numonyx M29W128G reset workaround
Spencer Oliver [Mon, 10 May 2010 11:23:41 +0000 (12:23 +0100)]
cfi: add Numonyx M29W128G reset workaround

The ST/Numonix M29W128G has an issue when a 0xff cmd is sent,
it cause an internal undefined state. The workaround according
to the Numonyx is to send another 0xf0 reset cmd

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
13 years agocfg: add stm32eval board configs
Spencer Oliver [Fri, 7 May 2010 13:24:13 +0000 (14:24 +0100)]
cfg: add stm32eval board configs

Increase working area for stm3210e_eval.cfg.
Add new configs for the following boards:
STM321000B-EVAL, STM32100C-EVAL, STM32100B-EVAL

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
13 years agoserver: incorrectly display socket port number
Spencer Oliver [Thu, 6 May 2010 21:51:20 +0000 (22:51 +0100)]
server: incorrectly display socket port number

c->sin.sin_port does not contain a valid port number so just use
service->port as this is always correct.

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
13 years agoflash: stop caching protection state
Øyvind Harboe [Wed, 5 May 2010 13:08:34 +0000 (15:08 +0200)]
flash: stop caching protection state

There are a million reasons why cached protection state might
be stale: power cycling of target, reset, code executing on
the target, etc.

The "flash protect_check" command is now gone. This is *always*
executed when running a "flash info".

As a bonus for more a more robust approach, lots of code could
be deleted.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
13 years agoflash: erase_address now has an unlock option
Øyvind Harboe [Wed, 5 May 2010 07:32:43 +0000 (09:32 +0200)]
flash: erase_address now has an unlock option

Quite useful to be able to unlock the flash, just like in
the flash write_image cmd.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
13 years agocfi: fix error handling for protect fn
Øyvind Harboe [Wed, 5 May 2010 07:32:03 +0000 (09:32 +0200)]
cfi: fix error handling for protect fn

No error was propagated.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
13 years agozy1000: fix tcl command to read power dropout status
Øyvind Harboe [Wed, 5 May 2010 06:19:40 +0000 (08:19 +0200)]
zy1000: fix tcl command to read power dropout status

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
13 years agogdb: connect will now fail if flash autoprobe fails
Øyvind Harboe [Tue, 4 May 2010 11:26:52 +0000 (13:26 +0200)]
gdb: connect will now fail if flash autoprobe fails

This stops GDB from launching with an empty memory map,
making gdb load w/flashing fail for no obvious reason.

The error message points in the direction of the gdb-attach
event that can be set up to issue a halt or "reset init"
which will put GDB in a well defined stated upon attach
and thus have a robust flash autoprobe.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
13 years agozy1000: fix keep_alive() bug
Øyvind Harboe [Tue, 4 May 2010 10:28:05 +0000 (12:28 +0200)]
zy1000: fix keep_alive() bug

introduced in latest commit. Should have held off merging
that commit. Sigh....

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
13 years agoFixed bug in tcl-server
Matthias Bode [Mon, 3 May 2010 20:35:38 +0000 (22:35 +0200)]
Fixed bug in tcl-server

No segmentationfault when sending commands to tcl-server.

modified:   src/server/server.c
modified:   src/server/tcl_server.c
modified:   src/server/tcl_server.h

13 years agocommand context: fix errors when running certain commands on startup
Øyvind Harboe [Mon, 3 May 2010 15:01:53 +0000 (17:01 +0200)]
command context: fix errors when running certain commands on startup

Various commands, e.g. "arm mcr xxxx" would fail if invoked upon startup
since it there was no command context defined for the jim interpreter
in that case.

A Jim interpreter is now associated with a command context(telnet,
gdb server's) or the default global command context.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
13 years agoflash: more flash write_image bugfixes
Øyvind Harboe [Tue, 4 May 2010 05:29:40 +0000 (07:29 +0200)]
flash: more flash write_image bugfixes

Remove/fix lots of bugs in handling of non-contigious sections
and out of order sections.

Fix a gaffe introduced in previous commit to src/flash/nor/core.c

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
13 years agostr7x: improve error handling
Øyvind Harboe [Mon, 3 May 2010 13:25:35 +0000 (15:25 +0200)]
str7x: improve error handling

clean up error handling a bit. No change in behavior.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
13 years agodocumentation typo
Marc Pignat [Wed, 5 May 2010 08:39:20 +0000 (10:39 +0200)]
documentation typo

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
13 years agodocs: now builds again
Øyvind Harboe [Wed, 5 May 2010 07:21:58 +0000 (09:21 +0200)]
docs: now builds again

Fix gaffe committed last time.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
13 years agostr71x: fix previous commit
Spencer Oliver [Tue, 4 May 2010 14:51:43 +0000 (15:51 +0100)]
str71x: fix previous commit

fix build issue with 70226c221f5879bb6126ff3f2ec9ae64c68d80d6 commit

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
13 years agoflash: less bogus errors
Øyvind Harboe [Mon, 3 May 2010 16:11:34 +0000 (18:11 +0200)]
flash: less bogus errors

Removed bogus errors when trying to allocate a large
a target memory buffer as possible.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
13 years agostr7x: fix bogus error messages
Øyvind Harboe [Mon, 3 May 2010 13:50:39 +0000 (15:50 +0200)]
str7x: fix bogus error messages

Remove bogus error messages when trying to allocate a
large chunk of target memory and then falling back to
a smaller one.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
13 years agotarget: clean up target memory allocation error messages
Øyvind Harboe [Mon, 3 May 2010 13:49:23 +0000 (15:49 +0200)]
target: clean up target memory allocation error messages

target memory allocation can be implemented not to show
bogus error messages.

E.g. when trying a big allocation first and then a
smaller one if that fails.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
13 years agozy1000: wait for srst to deassert
Øyvind Harboe [Tue, 4 May 2010 05:36:05 +0000 (07:36 +0200)]
zy1000: wait for srst to deassert

make wait for srst deassert more long latency friendly
(JTAG over TCP/IP), print actual time if it was more than
1ms.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
13 years agocfi: made som info output debug output
Øyvind Harboe [Tue, 4 May 2010 05:25:30 +0000 (07:25 +0200)]
cfi: made som info output debug output

E.g. how much target memory that is used during flashing
is debug info.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
13 years agoSTM32 flash erase timeout fix
Tobias Ringström [Fri, 30 Apr 2010 12:04:14 +0000 (14:04 +0200)]
STM32 flash erase timeout fix

The current timeout for STM32 flash block erase and flash mass erase is
10 (ms), which is too tight, and fails around 50% of the time for me.
The data sheet for STM32F107VC specifies a maximum erase time of 40 ms
(for both operations).

I'd also consider it a bug that the code does not detect a timeout, but
just assumes that the operation has completed.  The attached patch does
not address this bug.

The attached patch increases the timeouts from 10 to 100 ms.  Please apply.

/Tobias

13 years agozy1000: it has a CFI chip, no need for the ecosflash driver
Øyvind Harboe [Fri, 30 Apr 2010 00:51:05 +0000 (02:51 +0200)]
zy1000: it has a CFI chip, no need for the ecosflash driver

The ecosflash driver is no longer used by any of the config
scripts. It is more useful to get more testing of CFI.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
13 years agoflash: write_image would fail for certain images
Øyvind Harboe [Thu, 29 Apr 2010 15:42:47 +0000 (17:42 +0200)]
flash: write_image would fail for certain images

Fix a bug where write_image would fail if the sections
in the image were not in ascending order. This has previously
been fixed in gdb load.

Solved by sorting the image sections before running flash
write_image erase unlock foo.elf.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
13 years agoflash: write_image will now pad erase to nearest sector
Øyvind Harboe [Thu, 29 Apr 2010 01:49:32 +0000 (03:49 +0200)]
flash: write_image will now pad erase to nearest sector

this is done for unlocking and it is a simple omission that
it wasn't done for sectors.

The unnerving thing is that nobody has complained about this
until now....

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
13 years agonor: remove bogus output about padding sections
Øyvind Harboe [Wed, 28 Apr 2010 06:01:28 +0000 (08:01 +0200)]
nor: remove bogus output about padding sections

padding of 0 bytes is actually no padding, do not output
warning about padding in that case.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
13 years agoAdd Voipac PXA270 module support
Marek Vasut [Mon, 26 Apr 2010 01:34:03 +0000 (03:34 +0200)]
Add Voipac PXA270 module support

This patch adds support for the Voipac PXA270 module. Including NOR flash.

Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
13 years agoAdd VPACLink interface definition
Marek Vasut [Mon, 26 Apr 2010 01:08:00 +0000 (03:08 +0200)]
Add VPACLink interface definition

This patch adds definition file for the Voipac VPACLink JTAG adaptor. The
adaptor is combined JTAG/UART device.

Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
13 years agoxscale: add support for length arg to wp command
Mike Dunn [Wed, 21 Apr 2010 17:40:51 +0000 (13:40 -0400)]
xscale: add support for length arg to wp command

This patch adds support for the length argument to the xscale implementation of
the wp command.  Per discussion with David, the length argument specifies the
range of addresses over which a memory access should generate a debug exception.
This patch utilizes the "mask" feature of the xscale debug hardware to implement
the correct functionality of the length argument.  Some limitations imposed by
the hardware are:

   - The length must be a power of two, with a minumum of 4.
   - Two data breakpoint registers are available, allowing for two watchpoints.
     However, if the length of a watchpoint is greater than four, both registers
     are used (the second for a mask value), limiting the number of watchpoints
     to one.

This patch also removes a useless call to xscale_get_reg(dbcon) in
xscale_set_watchpoint() (value had already been read from the register cache,
and the same previously read value is then modified and written back).

I have been using and testing this patch for a couple days.

Questions, corrections, criticisms of course gratefully received.

13 years agotelo: update configuration scripts to matched master branch
michal smulski [Sat, 24 Apr 2010 14:51:34 +0000 (16:51 +0200)]
telo: update configuration scripts to matched master branch

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
13 years agoadapter: allow adjusting srst assert with
michal smulski [Sat, 24 Apr 2010 14:50:27 +0000 (16:50 +0200)]
adapter: allow adjusting srst assert with

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
14 years agodocs: improve load_image docs
michal smulski [Tue, 20 Apr 2010 20:18:04 +0000 (22:18 +0200)]
docs: improve load_image docs

add docs for missing args.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
14 years agodoc: gdb-attach can fix gdb connect issues
Øyvind Harboe [Tue, 20 Apr 2010 07:05:07 +0000 (09:05 +0200)]
doc: gdb-attach can fix gdb connect issues

Flash probing must succeed for e.g. gdb load and automatic
hardware/software breakpoints to work.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
14 years agostm32x: allow flash probe on a running target
Andreas Fritiofson [Fri, 16 Apr 2010 23:03:39 +0000 (01:03 +0200)]
stm32x: allow flash probe on a running target

If the flash has not yet been probed and GDB connects while the target is
running, the flash probe triggered by GDB's memory map read will fail. In
that case the returned memory map will be empty, causing a subsequent load
from within GDB to fail. There's not much you can do from GDB to recover,
other than a restart; a 'mon reset init' and manual 'mon flash probe' won't
help since GDB has already made up its mind about the memory map.

It seems there's no reason to require the target to be halted when probing
the flash. Remove the check to let a valid memory map be provided to GDB
even when connecting to a running target.

Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
14 years agoNOR/core bugfix: restore invariants
David Brownell [Fri, 16 Apr 2010 02:48:55 +0000 (19:48 -0700)]
NOR/core bugfix: restore invariants

The The patch labeled "CFI CORE: bug-fix protect single sector" was merged
rged without some requested bugfixes.  Most significantly it broke invariants
in the code, invalidating descriptions and changing the calling convention
for underlying drivers.  (It (Also wasn't CFI-specific...)

Fix that, and Include an update from Antonio Borneo for the degenerate
"nothing to do" case, (although that's still in the  wrong location.  which
is presumably why that is it was working in some cases but not all.)

 src/flash/nor/core.c |   21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoNOR/CFI: remove redundant code
Antonio Borneo [Wed, 14 Apr 2010 08:51:16 +0000 (16:51 +0800)]
NOR/CFI: remove redundant code

Arguments for "flash bank" command are already
parsed and put in "bank" struct.
Removed code to parse them again.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
14 years agoNOR/CFI: fix order of arguments check
Antonio Borneo [Wed, 14 Apr 2010 08:32:30 +0000 (16:32 +0800)]
NOR/CFI: fix order of arguments check

Syntax of "flash bank" command requires:
- chip_width as CMD_ARGV[3]
- bus_width  as CMD_ARGV[4]
Actual code swaps the arguments.
Bug has no run time impact since wrong variables
are only used to check value and both are checked
against same constraint.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
14 years agoxscale: fix analyze_trace for trace data collected in wrap mode
Mike Dunn [Tue, 13 Apr 2010 17:34:52 +0000 (13:34 -0400)]
xscale: fix analyze_trace for trace data collected in wrap mode

This patch fixes the xscale_analyze_trace() function.  This function was
defective for a trace collected in 'fill' mode (hiccups with repeated
instructions) and completely broken when buffer overflowed in 'wrap' mode.  The
reason for the latter case is that the checkpoint registers were interpreted
incorrectly when two checkpoints are present in the trace (which will be true in
'wrap' mode once the buffer fills).  In this case, checkpoint1 register will
contain the older entry, and checkpoint0 the newer.  The original code assumed
the opposite.  I eventually gave up trying to understand all the logic of the
function, and rewrote it.  I think it's much cleaner and understandable now.  I
have been using and testing this for a few weeks now.  I'm confident it hasn't
regressed in any way.

Also added capability to handle (as best as possible) the case where an
instruction can not be read from the loaded trace image; e.g., partial image.
This was a 'TODO' comment in the original xscale_analyze_trace().

Outside of xcsale_analyze_trace(), these (related) changes were made:

- Remove pc_ok and current_pc elements from struct xscale_trace.  These elements
  and associated logic are useless clutter because the very first entry placed
  in the trace buffer is always an indirect jump to the address at which
  execution resumed.  This type of trace entry includes the literal address in
  the trace buffer, so the initial address of the trace is immediately
  determined from the trace buffer contents and does not need to be recorded
  when trace is enabled.

- Added num_checkpoints to struct xscale_trace_data, which is necessary in order
  to correctly interpret the checkpoint register contents.

- In xscale_read_trace()
  - Fix potential array out-of-bounds condition.
  - Eliminate partial address entries when parsing trace (can occur in wrap mode).
  - Count and record number of checkpoints in trace.

- Added small, inlined utility function xscale_display_instruction() to help
  make the code more concise and clear.

TODO:
 - Save processor state (arm or thumb) in struct xscale_trace when trace is
   enabled so that trace can be analyzed correctly (currently assumes arm mode).
 - Add element to struct xscale_trace that records (when trace is enabled)
   whether vector table is relocated high (to 0xffff0000) or not, so that a
   branch to an exception vector is traced correctly (curently assumes vectors
   at 0x0).

14 years agoTCL SCRIPTS: fix command name
Antonio Borneo [Thu, 15 Apr 2010 09:11:01 +0000 (17:11 +0800)]
TCL SCRIPTS: fix command name

Some tcl script has underline between the words "flash bank"
resulting in 'invalid command name "flash_bank"'.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
14 years agocortex-a8: more MMU support
Anton Fedotov [Wed, 14 Apr 2010 05:36:08 +0000 (07:36 +0200)]
cortex-a8: more MMU support

+ virt2phys() can now convert virtual address to real
+ read_memory() and write_memory() are renamed to read_phys_memory()
and write_phys_memory()
+ new read_memory() and write_memory() try to resolve real address if
mmu is enambled than perform real address reading/writing
   + if address is bellow 0xc000000 than TTB0 is used for page table
dereference, if above - than TTB1. Linux style of user/kernel address
separation
   + if above fails (i.e address is unspecified) than mode is checked
whether it is Supervisor (than TTB1) or User (than TTB0)
- Software breakpoints doesn't work. You should invoke
"gdb_breakpoint_override hard" before you start debugging
+ cortex_a8_mmu(), cortex_a8_enable_mmu_caches(),
cortex_a8_disable_mmu_caches() are implemented

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
14 years agoTARGET/ARM7_9_COMMON: review scope of symbols
Antonio Borneo [Sat, 10 Apr 2010 17:31:42 +0000 (01:31 +0800)]
TARGET/ARM7_9_COMMON: review scope of symbols

Add "static" qualifier to private functions.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
14 years agoNOR/TMS470: review scope of symbols
Antonio Borneo [Sat, 10 Apr 2010 17:19:41 +0000 (01:19 +0800)]
NOR/TMS470: review scope of symbols

Add "static" qualifier to private functions and data.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
14 years agoTARGET/MIPS32: review scope of functions
Antonio Borneo [Sat, 10 Apr 2010 17:16:14 +0000 (01:16 +0800)]
TARGET/MIPS32: review scope of functions

Add "static" qualifier to private functions.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
14 years agoTARGET/MIPS32_PRACC: review scope of functions
Antonio Borneo [Sat, 10 Apr 2010 17:11:11 +0000 (01:11 +0800)]
TARGET/MIPS32_PRACC: review scope of functions

Add "static" qualifier to private functions.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
14 years agoTARGET/MIPS32_DMAACC: review scope of functions
Antonio Borneo [Sat, 10 Apr 2010 17:03:53 +0000 (01:03 +0800)]
TARGET/MIPS32_DMAACC: review scope of functions

Add "static" qualifier to private functions.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
14 years agoHELPER/LOG: review unused symbols
Antonio Borneo [Sat, 10 Apr 2010 14:25:22 +0000 (22:25 +0800)]
HELPER/LOG: review unused symbols

Remove unused functions:
- log_catch
- log_rethrow
- log_try

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
14 years agoTARGET/MIPS_EJTAG: review scope of functions
Antonio Borneo [Sat, 10 Apr 2010 14:20:41 +0000 (22:20 +0800)]
TARGET/MIPS_EJTAG: review scope of functions

Add "static" qualifier to private functions.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
14 years agoNOR/CFI: review scope of functions
Antonio Borneo [Sat, 10 Apr 2010 14:14:34 +0000 (22:14 +0800)]
NOR/CFI: review scope of functions

Add "static" qualifier to private functions.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
14 years agoTARGET/DSP563XX_ONCE: review scope of functions
Antonio Borneo [Sat, 10 Apr 2010 14:12:20 +0000 (22:12 +0800)]
TARGET/DSP563XX_ONCE: review scope of functions

Add "static" qualifier to private functions.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
14 years agoOPENOCD: review scope of functions
Antonio Borneo [Sat, 10 Apr 2010 14:04:03 +0000 (22:04 +0800)]
OPENOCD: review scope of functions

Add "static" qualifier to private functions.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
14 years agoJTAG/COMMANDS: review scope of functions
Antonio Borneo [Sat, 10 Apr 2010 14:01:16 +0000 (22:01 +0800)]
JTAG/COMMANDS: review scope of functions

Add "static" qualifier to private functions.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
14 years agoBINARYBUFFER: review scope of data and functions
Antonio Borneo [Sat, 10 Apr 2010 13:54:37 +0000 (21:54 +0800)]
BINARYBUFFER: review scope of data and functions

Add "static" qualifier to private data and functions.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
14 years agoNOR/STR7X: review scope of data
Antonio Borneo [Sat, 10 Apr 2010 13:52:33 +0000 (21:52 +0800)]
NOR/STR7X: review scope of data

Add "static" qualifier to private data.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
14 years agoNAND/TCL: review scope of functions
Antonio Borneo [Sat, 10 Apr 2010 13:50:15 +0000 (21:50 +0800)]
NAND/TCL: review scope of functions

Add "static" qualifier to private functions.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
14 years agoMFLASH: review scope of functions
Antonio Borneo [Sat, 10 Apr 2010 12:11:40 +0000 (20:11 +0800)]
MFLASH: review scope of functions

Add "static" qualifier to private functions.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
14 years agoNAND/ARM_IO: review scope of functions
Antonio Borneo [Sat, 10 Apr 2010 12:09:59 +0000 (20:09 +0800)]
NAND/ARM_IO: review scope of functions

Add "static" qualifier to private functions.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
14 years agoNAND/CORE: review scope of functions
Antonio Borneo [Sat, 10 Apr 2010 12:08:41 +0000 (20:08 +0800)]
NAND/CORE: review scope of functions

Add "static" qualifier to private functions.
Move function's comment from core.h to core.c.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
14 years agoNAND/MX3: review scope of data
Antonio Borneo [Sat, 10 Apr 2010 12:03:19 +0000 (20:03 +0800)]
NAND/MX3: review scope of data

Add "static" qualifier to private data.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
14 years agoNOR/ADUC702X: review scope of data
Antonio Borneo [Sat, 10 Apr 2010 11:58:15 +0000 (19:58 +0800)]
NOR/ADUC702X: review scope of data

Add "static" qualifier to private data.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
14 years agoNOR/AVRF: review scope of data
Antonio Borneo [Sat, 10 Apr 2010 11:56:24 +0000 (19:56 +0800)]
NOR/AVRF: review scope of data

Add "static" qualifier to private data.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
14 years agoNOR/CORE: review scope of data
Antonio Borneo [Sat, 10 Apr 2010 11:54:22 +0000 (19:54 +0800)]
NOR/CORE: review scope of data

Add "static" qualifier to private data.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
14 years agoNOR/DRIVERS: review scope of functions
Antonio Borneo [Sat, 10 Apr 2010 11:38:15 +0000 (19:38 +0800)]
NOR/DRIVERS: review scope of functions

Add "static" qualifier to private functions.
Remove unused "extern" in src/ecosboard.c

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
14 years agoSTR9XPEC: review scope of functions
Antonio Borneo [Sat, 10 Apr 2010 11:29:51 +0000 (19:29 +0800)]
STR9XPEC: review scope of functions

Add "static" qualifier to private functions.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
14 years agoTCL: review scope of functions
Antonio Borneo [Sat, 10 Apr 2010 11:28:13 +0000 (19:28 +0800)]
TCL: review scope of functions

Add "static" qualifier to private functions.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
14 years agoTIME_SUPPORT: review unused symbols
Antonio Borneo [Sat, 10 Apr 2010 11:25:32 +0000 (19:25 +0800)]
TIME_SUPPORT: review unused symbols

Remove unused functions:
- timeval_add

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
14 years agoHELLO: review unused symbols
Antonio Borneo [Sat, 10 Apr 2010 09:23:06 +0000 (17:23 +0800)]
HELLO: review unused symbols

Remove unused functions:
- hello_register_commands

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
14 years agoPLD: review scope of functions
Antonio Borneo [Sat, 10 Apr 2010 09:06:16 +0000 (17:06 +0800)]
PLD: review scope of functions

Add "static" qualifier to private functions.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
14 years agoADI_V5_JTAG: review scope of data
Antonio Borneo [Sat, 10 Apr 2010 09:03:02 +0000 (17:03 +0800)]
ADI_V5_JTAG: review scope of data

Add "static" qualifier to private data.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
14 years agoARM920T: review scope of functions
Antonio Borneo [Sat, 10 Apr 2010 09:01:06 +0000 (17:01 +0800)]
ARM920T: review scope of functions

Add "static" qualifier to private functions.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
14 years agoARM_JTAG: review scope of functions
Antonio Borneo [Sat, 10 Apr 2010 08:59:50 +0000 (16:59 +0800)]
ARM_JTAG: review scope of functions

Add "static" qualifier to private functions.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
14 years agoARM_SIMULATOR: review scope of functions
Antonio Borneo [Sat, 10 Apr 2010 08:57:49 +0000 (16:57 +0800)]
ARM_SIMULATOR: review scope of functions

Add "static" qualifier to private functions.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
14 years agoARMV4_5_MMU: review unused symbols
Antonio Borneo [Sat, 10 Apr 2010 08:46:59 +0000 (16:46 +0800)]
ARMV4_5_MMU: review unused symbols

Remove unused data:
- armv4_5_mmu_page_type_names
Remove prototype of not existing function:
- armv4mmu_translate_va

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
14 years agoARMV4_5: review scope of data
Antonio Borneo [Sat, 10 Apr 2010 08:46:01 +0000 (16:46 +0800)]
ARMV4_5: review scope of data

Add "static" qualifier to private data.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
14 years agoEMBEDDEDICE: review scope of functions
Antonio Borneo [Sat, 10 Apr 2010 08:44:54 +0000 (16:44 +0800)]
EMBEDDEDICE: review scope of functions

Add "static" qualifier to private functions.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
14 years agoTARGET: review unused symbols
Antonio Borneo [Fri, 9 Apr 2010 16:25:35 +0000 (00:25 +0800)]
TARGET: review unused symbols

Remove unused functions:
- target_all_handle_event

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
14 years agoTARGET: review scope of functions
Antonio Borneo [Fri, 9 Apr 2010 16:22:46 +0000 (00:22 +0800)]
TARGET: review scope of functions

Add "static" qualifier to private functions.
Remove unused "extern" in src/ecosboard.c

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
14 years agoARMv7M: review scope of functions
Antonio Borneo [Fri, 9 Apr 2010 16:07:40 +0000 (00:07 +0800)]
ARMv7M: review scope of functions

Add "static" qualifier to private functions.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
14 years agoRestore deleted '!' character
David Brownell [Sun, 4 Apr 2010 08:28:50 +0000 (01:28 -0700)]
Restore deleted '!' character

I'm not sure what caused this significant character to get deleted.
it may be related to intermittent Editor or terminal flakes  I've
been seeing lately (sigh).  This fix is trivial.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agotarget: are we running algorithm code?
David Brownell [Sun, 4 Apr 2010 07:42:05 +0000 (00:42 -0700)]
target: are we running algorithm code?

Fixing one bug can easily uncover another  .... in this case,
making sure that we properly invalidate some cached NOR state when
resuming arbitrary target code turned up an issue when the code
wasn't quite arbitrary (and we couldn't know that, but some parts
of OpenOCD assumed the cache would not be invalidated.

Specifically:  some flash drivers (like CFI) update that state in loops
with downloaded algorithms, thus invalidating the state as it's probed.

 + Add a new target state flag, to record whether the target is
  running downloaded algorithm code.

 + Use that flag to add a special case:  "trust" downloaded algorithms
   not to corrupt that cached state, bypassing cache invalidation.

Also update some of the documentation to stipulate that this flavor of
trustworthiness is now *required* ... not just a fortuitous acident.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agosimplify and unconfuse target_run_algorithm()
David Brownell [Sun, 4 Apr 2010 07:38:39 +0000 (00:38 -0700)]
simplify and unconfuse target_run_algorithm()

For some reason there are *two* schemes for interposing logic into
the run_algorithm() code path...  One is a standard procedural wapper
around the target method invocation.

the other (superfluous) one hacked the method table by splicing
a second procedural wrapper into the method table.  Remove it:

* Rename its  slightly-more-featureful wrapper so it becomes
  the standard procedural wrapper, leaving its added logic
  (where it should have been in the first place.

          Also add a paranoia check, to report targets that don't
  support algorithms without traversing a NULL pointer, and
  tweak its code structure a bit so it's easier to modify.

* Get rid of the superfluous/conusing method table hacks.

This is a net simplification, making it simpler to analyse what's
going on, and then interpose logic . ... by ensuring there's only one
natural place for it to live.

------------

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agobuildfix
David Brownell [Sun, 4 Apr 2010 01:36:07 +0000 (18:36 -0700)]
buildfix

Without this, a system using gcc (GCC) 4.2.4 (Ubuntu 4.2.4-1ubuntu4)
aborts builds after reporting:

tcl.c: In function ‘handle_irscan_command’:
tcl.c:1168: warning: passing argument 1 of ‘buf_set_u32’ discards qualifiers from pointer target type

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoxscale: fix trace buffer functionality when resuming from a breakpoint
Mike Dunn [Sun, 28 Mar 2010 19:48:32 +0000 (15:48 -0400)]
xscale: fix trace buffer functionality when resuming from a breakpoint

Problem: halt at a breakpoint, enable trace buffer ('xscale trace_buffer enable
fill'), then resume.  Wait for debug exception when trace buffer fills (if not
sooner due to another breakpoint, vector catch, etc).  Instead, never halts.
When halted explicitly from OpenOCD and trace buffer dumped, it contains only
one entry; a branch to the address of the original breakpoint.  If the above
steps are repeated, except that the breakpoint is removed before resuming, the
trace buffer fills and the debug exception is generated, as expected.

Cause: related to how a breakpoint is stepped over on resume.  The breakpoint is
temporarily removed, and a hardware breakpoint is set on the next instruction
that will execute.  xscale_debug_entry() is called when that breakpoint hits.
This function checks if the trace buffer is enabled, and if so reads the trace
buffer from the target and then disables the trace (unless multiple trace
buffers are specified by the user when trace is enabled).  Thus you only trace
one instruction before it is disabled.

Solution: kind of a hack on top of a hack, but it's simple.  Anything better
would involve some refactoring.  This has been tested and trace now works as
intended, except that the very first instruction is not part of the trace when
resuming from a breakpoint.

TODO: still many issues with trace: doesn't work during single-stepping (trace
buffer is flushed each step), 'xscale analyze_trace' works only marginally for
a trace captured in 'fill' mode, and not at all for a trace captured in 'wrap'
mode.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
14 years agojtag/tcl.c cleanup -- split out "adapter.c"
David Brownell [Sat, 27 Mar 2010 17:07:13 +0000 (10:07 -0700)]
jtag/tcl.c cleanup -- split out "adapter.c"

Clean up the jtag/tcl.c file, which was one of the biggest and
messiest ones in that directory.  Do it by splitting out all the
generic adapter commands to a separate "adapter.c" file (leaving
the "tcl.c" file holding only JTAG utilities).

Also rename the little-used "jtag interface" to "adapter_name", which
should have been at least re-categorized earlier (it's not jtag-only).

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)