]> git.sur5r.net Git - openocd/log
openocd
14 years agoflash: add error handling to get_flash_by_addr/name
Øyvind Harboe [Fri, 11 Jun 2010 06:10:39 +0000 (08:10 +0200)]
flash: add error handling to get_flash_by_addr/name

autoprobing can fail and this error has to be
reported up the call stack.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
14 years agoarm mmu: error propagation added for address translation
Øyvind Harboe [Thu, 10 Jun 2010 14:18:14 +0000 (16:18 +0200)]
arm mmu: error propagation added for address translation

The return value for MMU translation was a mess, either
error or value.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
14 years agocfi: fix error propagation
Øyvind Harboe [Thu, 10 Jun 2010 13:27:35 +0000 (15:27 +0200)]
cfi: fix error propagation

any read/write operation to memory can fail.

block write algorithm error propagation was broken
in that it would continue after an error was reported
writing data to ram or the algorithm failing.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
14 years agojtag: added mising header
Thomas Koeller [Thu, 10 Jun 2010 14:54:25 +0000 (16:54 +0200)]
jtag: added mising header

Distributions created by 'make dist' were incomplete due to a
missing header file.

Signed-off-by: Thomas Koeller <thomas.koeller@baslerweb.com>
14 years agoflash: add error message if image is too big for flash
Øyvind Harboe [Wed, 9 Jun 2010 15:12:52 +0000 (17:12 +0200)]
flash: add error message if image is too big for flash

replaced assert() w/error message if the image is
too big.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
14 years agoflash: flash erase_address takes unsigned arguments
Øyvind Harboe [Wed, 9 Jun 2010 14:01:10 +0000 (16:01 +0200)]
flash: flash erase_address takes unsigned arguments

fixed bug where address was parsed as a signed, rather
than unsigned it.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
14 years agozy1000: fix optimisation gaffe
Øyvind Harboe [Mon, 7 Jun 2010 14:14:51 +0000 (16:14 +0200)]
zy1000: fix optimisation gaffe

DCC optimisation was broken on targets w/multiple TAP's.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
14 years agozy1000: added watchdog server
Øyvind Harboe [Thu, 6 May 2010 11:37:56 +0000 (13:37 +0200)]
zy1000: added watchdog server

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
14 years agocfi: fix GDB keep alive bug
Øyvind Harboe [Wed, 5 May 2010 14:18:50 +0000 (16:18 +0200)]
cfi: fix GDB keep alive bug

Long running CFI writes could cause GDB timeout.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
14 years agoverify: display up to 128 diff's
Øyvind Harboe [Wed, 5 May 2010 17:00:21 +0000 (19:00 +0200)]
verify: display up to 128 diff's

Showing up to 128 differences.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
14 years agogdb-server: fix error reporting bugs
Øyvind Harboe [Mon, 7 Jun 2010 13:14:04 +0000 (15:14 +0200)]
gdb-server: fix error reporting bugs

GDB and OpenOCD has two different error number
spaces and no mapping exists between them.

If a specific error number is to be reported
to GDB then this has to be done at the calling
site, rather than as a generic routine that
tries to map "retval" to GDB error number speak.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
14 years agojtag: rename JTAG_MOVESTATE to JTAG_TLR_RESET
Øyvind Harboe [Sat, 5 Jun 2010 09:30:49 +0000 (11:30 +0200)]
jtag: rename JTAG_MOVESTATE to JTAG_TLR_RESET

JTAG_MOVESTATE is misleading, this cmd is only used
for reset.

JTAG_PATHMOVE should be used otherwise.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
14 years agostm32 : change returned value of mass_erase function
gcembed [Tue, 1 Jun 2010 11:48:22 +0000 (13:48 +0200)]
stm32 : change returned value of mass_erase function

Hello,
"stm32x mass_erase" return ERROR_OK even if something goes wrong.
Here is a summary of changes :
* in stm32x_mass_erase : return ERROR_FLASH_OPERATION_FAILED when error
detected in FLASH_SR register;
* in COMMAND_HANDLER(stm32x_handle_mass_erase_command) : return the
returned value of stm32x_mass_erase().

I don't know if there is reason to always return ERROR_OK ?

Gaëtan

14 years agoNEWS: updates
Spencer Oliver [Thu, 3 Jun 2010 09:20:06 +0000 (10:20 +0100)]
NEWS: updates

Add new features since 0.4.0 release.

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
14 years agoetm: print something when trace buffer empty
Jon Povey [Mon, 31 May 2010 02:56:42 +0000 (11:56 +0900)]
etm: print something when trace buffer empty

ETM analyze produced no output when the trace buffer was empty.
This patch provides users with a clue.

Signed-off-by: Jon Povey <jon.povey@racelogic.co.uk>
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
14 years agonor: fix memory leaks during probe
Spencer Oliver [Sat, 29 May 2010 14:43:42 +0000 (15:43 +0100)]
nor: fix memory leaks during probe

Fix similar memory leaks as per commit:
ef72484b785ec7462a0415afea679d08b864c7fb

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
14 years agoflash: virtual driver update for get_flash_bank_by_name_noprobe
Spencer Oliver [Mon, 24 May 2010 11:32:58 +0000 (12:32 +0100)]
flash: virtual driver update for get_flash_bank_by_name_noprobe

Make sure we do not probe a flash when getting info.

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
14 years agonor: add get_flash_bank_by_name autoprobe
Spencer Oliver [Mon, 24 May 2010 11:30:29 +0000 (12:30 +0100)]
nor: add get_flash_bank_by_name autoprobe

When a flash cmd is called using the flash name the autoprobe
function is not called. autoprobe is called if flash_command_get_bank
falls through to get_flash_bank_by_num.

This makes both get_flash_bank_by_name and get_flash_bank_by_num
behave the same.

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
14 years agocfg: add pic32 virtual banks
Spencer Oliver [Mon, 24 May 2010 10:43:09 +0000 (11:43 +0100)]
cfg: add pic32 virtual banks

make use of the new virtual bank flash driver.

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
14 years agoflash: add virtual flash bank driver
Spencer Oliver [Mon, 24 May 2010 10:41:50 +0000 (11:41 +0100)]
flash: add virtual flash bank driver

This adds a virtual flash bank driver that allows virtual banks to
be defined that refer to an existing flash bank.

For example the real address for bank0 on the pic32 is 0x1fc00000
but the user program will either be in kseg0 (0xbfc00000) or
kseg1 (0x9fc00000).
This also means that gdb will be aware of all the read only flash
addresses.

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
14 years agoNOR/CFI: fix memory leak; check malloc return value
Antonio Borneo [Wed, 26 May 2010 02:04:03 +0000 (10:04 +0800)]
NOR/CFI: fix memory leak; check malloc return value

Every time command "flash probe #" is executed, memory
structures are re-allocated without preventive free()
of former areas, causing memory leak.
Also, memory allocation does not check return value,
determining segmentation fault in case of out of memory.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
14 years agoThere are no variants of arm7tdmi target
Freddie Chopin [Sat, 22 May 2010 07:51:07 +0000 (09:51 +0200)]
There are no variants of arm7tdmi target

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
14 years agoAll LPC2xxx chips are little endian and that cannot be changed - update config scripts
Freddie Chopin [Fri, 21 May 2010 16:02:58 +0000 (18:02 +0200)]
All LPC2xxx chips are little endian and that cannot be changed - update config scripts

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
14 years agoadd correct CPUTAPID value for LPC2129
Freddie Chopin [Fri, 21 May 2010 15:57:10 +0000 (17:57 +0200)]
add correct CPUTAPID value for LPC2129

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
14 years agoUpdate "flash bank" helper comments for LPC2xxx chips
Freddie Chopin [Fri, 21 May 2010 15:52:25 +0000 (17:52 +0200)]
Update "flash bank" helper comments for LPC2xxx chips

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
14 years agoLPC23xx and LPC24xx after reset run on internal 4MHz RC oscillator, so "flash bank...
Freddie Chopin [Fri, 21 May 2010 15:46:40 +0000 (17:46 +0200)]
LPC23xx and LPC24xx after reset run on internal 4MHz RC oscillator, so "flash bank" parameter should be 4000 (not 12000)

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
14 years agoat91sam9260: use RCLK
Øyvind Harboe [Fri, 21 May 2010 11:56:05 +0000 (13:56 +0200)]
at91sam9260: use RCLK

It might be possible to get this target going without
RCLK, but it would require more careful analysis and
usage of the reset events.

Enable fast memory accesses.

Tested on an at91sam9260 custom board w/external DRAM
and flash.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
14 years agocfg: update stm32 performance stick config
Spencer Oliver [Fri, 21 May 2010 10:45:40 +0000 (11:45 +0100)]
cfg: update stm32 performance stick config

 - As this is a complete unit, including jtag we might as welli nclude
the jtag cfg.
 - Add missing id for the str750 that is also in the jtag chain.
 - Reduce jtag startup speed to 500kHz.

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
14 years agoarm_adi_v5: correct ahbap_debugport_init mem-ap id (bug #23)
Spencer Oliver [Fri, 21 May 2010 10:43:17 +0000 (11:43 +0100)]
arm_adi_v5: correct ahbap_debugport_init mem-ap id (bug #23)

We request a id register read at the end of ahbap_debugport_init
but we never actually run the queue. In some cases this causes a
segfault.

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
14 years agoboard: dm355evm.cfg SDTIMR0/1 minor naming fix
Jon Povey [Fri, 21 May 2010 03:34:46 +0000 (12:34 +0900)]
board: dm355evm.cfg SDTIMR0/1 minor naming fix

Register name fix; ref. TI document sprueh7d

Signed-off-by: Jon Povey <jon.povey@racelogic.co.uk>
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
14 years agonand : Add Freescale iMX27 nand flash controller support
gcembed [Thu, 20 May 2010 06:25:09 +0000 (08:25 +0200)]
nand : Add Freescale iMX27 nand flash controller support

This patch add support of iMX27 nand flash controller. This is based on
driver for imx31 nand flash controller.
OOB functionality is not fully working. As in mx31 controller, mx2 NFC
has a bug that swap two bytes between SPARE and MAIN buffer.
I used this driver for several months and no problems appear.

14 years agoreset: fix reset halt bug
Gary Carlson [Wed, 19 May 2010 03:59:07 +0000 (20:59 -0700)]
reset: fix reset halt bug

I was finally able to figure out the cause of this problem.  There are two
parts to the patch.  The first patch modifies the configuration file I
originally generated for the Atmel AT91SAM9G20 board and achieves the
following:

+++ Splits the reset-init handler into a reset-start handler for some of the
initial configuration activities and keeps the remainder in the reset-init
handler as was the case before.  This was the real issue that was causing
the timing problems I identified before.  This solution was confirmed with
an o-scope on actual target hardware.

+++ Adds a new instruction in the reset-start handler to disable fast memory
accesses in the reset-start handler.  When the target jtag clock is started
out at 2 kHz during system clock initialization, memory writes (i.e.
register write to enable external reset pin -- basically to RSTC_MR) are
naturally slow and cause GDB keep-alive issues (refer to PATCH 2/2 for
additional fixes).

+++ Modifies the configuration file to use srst_only reset action. The
reset-start/reset-init handler split also now allows the correct behavior to
be used in the configuration file (previously had to use both SRST and TRST
even though only SRST is actually used and connected on the evaluation
board).

+++ Adds external NandFlash configuration support to take advantage of flash
driver added earlier.  Doesn't fix any bugs but adds functionality that was
marked as TBD before and thrown in when I did other work on the
configuration file.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
14 years agotarget: slow targets could cause GDB to time out
Gary Carlson [Wed, 19 May 2010 03:59:00 +0000 (20:59 -0700)]
target: slow targets could cause GDB to time out

This second half of the patch is proposed to clean up some GDB keep alive
issues on arm7_9 targets that start up with very slow clocks.  If an attempt
is made to write to key registers on the processor with a slow jtag speed,
GDB timeout warnings appear on the console (at least mine) when "reset halt"
or "reset init" commands are issued from the gdb client:

*** BEFORE PATCH ***

(gdb) monitor reset init
fast memory access is disabled
2 kHz
keep_alive() was not invoked in the 1000ms timelimit. GDB alive packet not
sent! (1026). Workaround: increase "set remotetimeout" in GDB
JTAG tap: at91sam9g20.cpu tap/device found: 0x0792603f (mfg: 0x01f, part:
0x7926, ver: 0x0)
target state: halted
target halted in ARM state due to breakpoint, current mode: Supervisor
cpsr: 0x000000d3 pc: 0x00000000
MMU: disabled, D-Cache: disabled, I-Cache: disabled
keep_alive() was not invoked in the 1000ms timelimit. GDB alive packet not
sent! (1027). Workaround: increase "set remotetimeout" in GDB
keep_alive() was not invoked in the 1000ms timelimit. GDB alive packet not
sent! (1006). Workaround: increase "set remotetimeout" in GDB
keep_alive() was not invoked in the 1000ms timelimit. GDB alive packet not
sent! (1006). Workaround: increase "set remotetimeout" in GDB
keep_alive() was not invoked in the 1000ms timelimit. GDB alive packet not
sent! (1006). Workaround: increase "set remotetimeout" in GDB
keep_alive() was not invoked in the 1000ms timelimit. GDB alive packet not
sent! (1004). Workaround: increase "set remotetimeout" in GDB
RCLK - adaptive
dcc downloads are enabled
fast memory access is enabled
NAND flash device 'NAND 256MiB 3,3V 8-bit' found
(gdb)

I added additional keep alive steps in areas that troubleshooting revealed
were causing problems.  I only did this however for non-fast write memory
accesses.  I don't think most people would be using fast memory accesses to
write to memory when the jtag and system clocks are slow anyway.

If you disagree with my feeling, think there is a more elegant way to handle
the problem, or think the patch will cause other unforeseen problems with
other targets, let me know.  As you can see below, the patch does eliminate
the problem on my development station and I suspect that it will benefit
others.

*** AFTER PATCH ***

(gdb) monitor reset init
fast memory access is disabled
2 kHz
JTAG tap: at91sam9g20.cpu tap/device found: 0x0792603f (mfg: 0x01f, part:
0x7926, ver: 0x0)
target state: halted
target halted in ARM state due to breakpoint, current mode: Supervisor
cpsr: 0x000000d3 pc: 0x00000000
MMU: disabled, D-Cache: disabled, I-Cache: disabled
RCLK - adaptive
dcc downloads are enabled
fast memory access is enabled
NAND flash device 'NAND 256MiB 3,3V 8-bit' found
(gdb)

Gary Carlson

Gary Carlson, MSEE
Principal Engineer
Carlson-Minot Inc.

14 years agojim: fix bug in tcl "puts"
Øyvind Harboe [Tue, 18 May 2010 10:34:12 +0000 (12:34 +0200)]
jim: fix bug in tcl "puts"

tcl "puts" didn't work because the logging code sensored strings
that did not include a '\n'. The correct thing is to sensor
empty strings, which are used to keep gdb connection alive.

The tcl "puts" code broke apart strings which do contain '\n' in
order to implement the -nonewline argument, which is how it
got hurt by the bug in log.c

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
14 years agozy1000: fix false positive warning about unitialized local variable
Øyvind Harboe [Tue, 18 May 2010 10:10:24 +0000 (12:10 +0200)]
zy1000: fix false positive warning about unitialized local variable

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
14 years agoat91rm9200 : reset_config should go to the board config file
Marc Pignat [Tue, 18 May 2010 09:38:01 +0000 (11:38 +0200)]
at91rm9200 : reset_config should go to the board config file

Let other boards do other things with srst and trst.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
14 years agoNAND/davinci: Fix segfault for hwecc4_infix reads
Jon Povey [Mon, 17 May 2010 07:16:22 +0000 (16:16 +0900)]
NAND/davinci: Fix segfault for hwecc4_infix reads

Page reads using hwecc4_infix layout segfaulted for check_bad_blocks because
the read assumed a valid data buffer, which check_bad_blocks does not use
(it only passes a 6 byte buffer for the start of OOB).

This version copes with undersized or missing data or oob buffers and uses
random read commands within the page to skip unwanted areas of data/OOB for
speed.

NOTE: Running check_bad_blocks with this layout will be reading infix
OOB locations, not manufacturer bad block markers. This means that if you
check blocks written in infix layout they will appear good, but manufacturer-
marked bad blocks may also appear good.
If you want to scan for manufactuer-marked bad blocks, you need to enable
raw_access before running check_bad_blocks, or use the non-infix layout.

Signed-off-by: Jon Povey <jon.povey@racelogic.co.uk>
CC: David Brownell <dbrownell@users.sourceforge.net>
14 years agoNAND: catch read errors when building BBT
Jon Povey [Mon, 17 May 2010 07:15:35 +0000 (16:15 +0900)]
NAND: catch read errors when building BBT

nand_build_bbt() was ignoring the return value from nand_read_page() and
blindly continuing.
It now passes the return value up to the caller if the read fails.

Signed-off-by: Jon Povey <jon.povey@racelogic.co.uk>
14 years agogdbserver: gdb cmds returning failure on success
Spencer Oliver [Mon, 17 May 2010 09:17:21 +0000 (10:17 +0100)]
gdbserver: gdb cmds returning failure on success

The gdb_memory_map cmd for example fell through and returned
ERROR_COMMAND_SYNTAX_ERROR on success - behaviour is now as expected.

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
14 years agoChange kb/s to KiB/s in messages about kibibytes
Jon Povey [Thu, 13 May 2010 03:20:20 +0000 (12:20 +0900)]
Change kb/s to KiB/s in messages about kibibytes

Change download rate messages about kibibytes from "kb/s" to "KiB/s" units.
See: http://en.wikipedia.org/wiki/Data_rate_units

Signed-off-by: Jon Povey <jon.povey@racelogic.co.uk>
14 years agoNOR/CFI: minor code cleanup
Antonio Borneo [Tue, 11 May 2010 03:48:09 +0000 (11:48 +0800)]
NOR/CFI: minor code cleanup

Remove few LOG_DEBUG() messages, together with code and
variables required to build such messages.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
14 years agoNOR/CFI: add cfi_read() implementation
Antonio Borneo [Tue, 11 May 2010 03:35:28 +0000 (11:35 +0800)]
NOR/CFI: add cfi_read() implementation

Final step to force bus_width size during CFI flash
read.

Added CFI specific implementation cfi_read() that uses
only accesses at bus_width size.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
14 years agoNOR: add read() callback to struct flash_driver
Antonio Borneo [Tue, 11 May 2010 03:16:33 +0000 (11:16 +0800)]
NOR: add read() callback to struct flash_driver

Final target is to force bus_width size during CFI flash
read.
In this first step I need to replace default flash read
with flash specific implementation.
This patch introduces:
- flash_driver_read() layer;
- default_flash_read(), backward compatible;
- read() callback in struct flash_driver;
- proper initialization in every flash_driver instance.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
14 years agoNOR/TCL: fix typo in error message
Antonio Borneo [Mon, 10 May 2010 09:07:28 +0000 (17:07 +0800)]
NOR/TCL: fix typo in error message

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
14 years agoNOR: fix comment for Doxygen
Antonio Borneo [Fri, 7 May 2010 09:04:32 +0000 (17:04 +0800)]
NOR: fix comment for Doxygen

Either bus_width and chip_width are in bytes.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
14 years agoNOR/CFI: remove use of cfi_add_byte()
Antonio Borneo [Fri, 7 May 2010 06:03:39 +0000 (14:03 +0800)]
NOR/CFI: remove use of cfi_add_byte()

Remove the function cfi_add_byte() and rewrite the only
instance of it.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
14 years agoNOR/CFI: use bus_width for memory access in cfi_write()
Antonio Borneo [Fri, 7 May 2010 05:50:42 +0000 (13:50 +0800)]
NOR/CFI: use bus_width for memory access in cfi_write()

During cfi_write(), head and tail of destination area
could be not aligned to bus_width.
Since write operation must be at bus_width size, source
buffer size is extended and buffer padded with current
values read from flash.

Force using bus_width to read current value from flash.
Do not use cfi_add_byte() anymore, to allow removing this
function later on.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
14 years agoNOR/CFI: use bus_width for memory access on flash ID.
Antonio Borneo [Fri, 23 Apr 2010 04:07:53 +0000 (12:07 +0800)]
NOR/CFI: use bus_width for memory access on flash ID.

NOR flash structure requires each access to be bus_width wide.
Fix read of flash ID accordingly to rule above.
Add case (chip_width == 4), allowed by CFI spec and coherent
with current value of CFI_MAX_CHIP_WIDTH but currently not
used by any target.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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

14 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.

14 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.

14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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

14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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

14 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>
14 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>
14 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>
14 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>
14 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>
14 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>
14 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.

14 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>
14 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>