openocd.git
14 years agoserver: add server_preinit which is called before config file is parsed.
Spencer Oliver [Thu, 10 Dec 2009 14:31:28 +0000 (14:31 +0000)]
server: add server_preinit which is called before config file is parsed.

This fixes the issue under native win32 of the socket interface not being
enabled (via WSAStartup) before init is called from a script.

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
14 years agobuild: fix cygwin build warnings
Spencer Oliver [Thu, 10 Dec 2009 11:28:38 +0000 (11:28 +0000)]
build: fix cygwin build warnings

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
14 years agogdb_server: use more local variables in inner loop of fetching packetstiny refactorin...
Øyvind Harboe [Thu, 10 Dec 2009 18:14:45 +0000 (19:14 +0100)]
gdb_server: use more local variables in inner loop of fetching packetstiny refactoring to allow optimisation of inner loops

Some profiling information for arm7 16MHz GDB load operation shows
gdb_get_packet_inner() near the very top.

Each sample counts as 0.01 seconds.
  %   cumulative   self              self     total
 time   seconds   seconds    calls  Ts/call  Ts/call  name
 52.91      2.27     2.27                             embeddedice_write_dcc
 11.89      2.78     0.51                             gdb_get_packet_inner
  8.86      3.16     0.38                             memcpy
  3.26      3.30     0.14                             idle_thread_main(unsigned int)
  3.03      3.43     0.13                             cyg_in_cksum

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
14 years agogdb_server: make struct gdb_connection private
Øyvind Harboe [Thu, 10 Dec 2009 18:11:03 +0000 (19:11 +0100)]
gdb_server: make struct gdb_connection private

it is only used inside gdb_server.c

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
14 years agooptimisation: tiny optimisation for embedded ice
Øyvind Harboe [Thu, 10 Dec 2009 14:09:20 +0000 (15:09 +0100)]
optimisation: tiny optimisation for embedded ice

use two shift operations instead of three to set embedded
ice register.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
14 years agoembedded hosts: optimize common code path for core arm operations
Øyvind Harboe [Thu, 10 Dec 2009 14:00:19 +0000 (15:00 +0100)]
embedded hosts: optimize common code path for core arm operations

avoid fn call for the if check on whether anything needs
to be done.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
14 years agoanotyer cygwin compile fix
David Brownell [Fri, 11 Dec 2009 01:42:20 +0000 (17:42 -0800)]
anotyer cygwin compile fix

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agozy1000: revc FPGA now works
Øyvind Harboe [Mon, 7 Dec 2009 11:38:56 +0000 (12:38 +0100)]
zy1000: revc FPGA now works

remove kludge code.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
14 years agoARM: update arm_opcodes.h copyright
David Brownell [Thu, 10 Dec 2009 05:43:23 +0000 (21:43 -0800)]
ARM: update arm_opcodes.h copyright

I neglected to copy Magnus' copyright when I moved several
declarations from the ARMv7-M header.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agostellaris: flash protection updates, minor fixes
David Brownell [Thu, 10 Dec 2009 05:16:09 +0000 (21:16 -0800)]
stellaris: flash protection updates, minor fixes

Bugfix the read side of flash protection:
 - read the right register(s)!
 - handle more than 64K
 - record the results in the right places
 - don't display garbage.

Partially bugfix the write side:
 - use 2KB lock regions instead of 1KB pages (!)
 - validate input range
 - don't try to _remove_ protection (it's write-once)
 - #define values we'll need to commit writes.
 - ... still doesn't handle pages over 64KB mark, or commit writes

And minor cleanup and fixes:
 - get rid of some forward decls
 - properly locate a doxygen comment
 - fix some bad indentation
 - remove superfluous #include
 - add a new part ID (many are still missing)
 - make the downloaded algorithm code be read-only

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoComment and doxygen fixes
David Brownell [Wed, 9 Dec 2009 18:25:08 +0000 (10:25 -0800)]
Comment and doxygen fixes

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoETM: only include oocd_trace.h when tracing enabled.
Spencer Oliver [Wed, 9 Dec 2009 10:35:30 +0000 (10:35 +0000)]
ETM: only include oocd_trace.h when tracing enabled.
Fixes build issue on systems that do not have <termios.h>, eg native win32.

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
14 years agoFix compilation error with gcc 4.4.1
Rafael Campos Las Heras [Tue, 8 Dec 2009 19:25:50 +0000 (20:25 +0100)]
Fix compilation error with gcc 4.4.1

Signed-off-by: Rafael Campos Las Heras <methril@gmail.com>
14 years agotarget: remove more exit() calls
David Brownell [Tue, 8 Dec 2009 21:09:38 +0000 (13:09 -0800)]
target: remove more exit() calls

These were all basically "can't happen" cases ... like having
state be corrupted by an alpha particle after the previous check
for whether a value was in-range.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agotarget: remove needless "extern"s
David Brownell [Tue, 8 Dec 2009 21:06:41 +0000 (13:06 -0800)]
target: remove needless "extern"s

Most of these happened to be in the target.h file.

Some of those are associated with symbols that could be
removed at some point ... e.g. NVP_ASSERT/true and its
sibling NVP_DEASSERT/false.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agotarget: move 'extern' decls to *.h files
David Brownell [Tue, 8 Dec 2009 21:06:41 +0000 (13:06 -0800)]
target: move 'extern' decls to *.h files

The exception being declarations for drivers.  Those should
be split out in some clean way -- like driver add/remove calls
made by initialization code -- but that's for another day.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoARM: cygwin complile fixes
David Brownell [Tue, 8 Dec 2009 10:00:35 +0000 (02:00 -0800)]
ARM: cygwin complile fixes

It's as if despite integers being 32-bits, GCC refuses to
convert a "uint32_t" to one of them.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agozy1000: some background info on the zy1000 file.
Øyvind Harboe [Tue, 8 Dec 2009 09:40:47 +0000 (10:40 +0100)]
zy1000: some background info on the zy1000 file.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
14 years agominidriver: fix inline capability of minidriver
Øyvind Harboe [Fri, 4 Dec 2009 15:00:43 +0000 (16:00 +0100)]
minidriver: fix inline capability of minidriver

Low latency low CPU processing power systems(embedded)
will benefit greatly from being able to inline certain
jtag_add_xxx() fn's. The trick is that this has to be
done in such a way as to allow implementing an OpenOCD
API with a shared library(eventually) on a PC hosted
OpenOCD.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
14 years agozy1000: remove unecessary include
Øyvind Harboe [Sat, 5 Dec 2009 10:07:06 +0000 (11:07 +0100)]
zy1000: remove unecessary include

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
14 years agobuild: add build/src to include path
Øyvind Harboe [Sat, 5 Dec 2009 09:50:59 +0000 (10:50 +0100)]
build: add build/src to include path

This allows including generated include files.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
14 years agoARM: cope with stupidheaded compiler
David Brownell [Tue, 8 Dec 2009 02:14:46 +0000 (18:14 -0800)]
ARM: cope with stupidheaded compiler

Some versions of GCC don't understand that if you mask with 0x3
then have cases 0-3, it's not possible for a variable assigned in
all those branches to have no value at end-of-case.  Feh.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoARM: list number of HW breakpoints/watchpoints
David Brownell [Mon, 7 Dec 2009 22:55:08 +0000 (14:55 -0800)]
ARM: list number of HW breakpoints/watchpoints

When starting up, say how many hardware breakpoints and watchpoints
are available on various targets.

This makes it easier to tell GDB how many of those resources exist.
Its remote protocol currently has no way to ask OpenOCD for that
information, so it must configured by hand (or not at all).

Update the docs to mention this; remove obsolete "don't do this" info.
Presentation of GDB setup information is still a mess, but at least
it calls out the three components that need setup.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agotarget: add debug_reason_name()
David Brownell [Mon, 7 Dec 2009 22:55:08 +0000 (14:55 -0800)]
target: add debug_reason_name()

Provide and use debug_reason_name() instead of expecting targets
to call Jim_Nvp_value2name_simple().  Less dependency on Jim, and
the code becomes more clear too.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoARM: don't clone arm_arch_state() code
David Brownell [Mon, 7 Dec 2009 22:55:08 +0000 (14:55 -0800)]
ARM: don't clone arm_arch_state() code

Have various ARM cores delegate to arm_arch_state() to display
basic information, instead of duplicating that logic.

This shrinks the code, makes them all report when semihosting
is active, and highlights which data are specific to this core.
(Like ARM720 not having separate instruction and data caches.)

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoUser's Guide: add quickie setup notes
David Brownell [Mon, 7 Dec 2009 22:55:07 +0000 (14:55 -0800)]
User's Guide: add quickie setup notes

Add a brief "setup with no customization" note showing the
how easily things can work if standard OpenOCD config scripts
already exist.  We've had some new users comment that this
information is needlessly hard to find, so that starting to
use OpenOCD is more difficult than it should be.

Plus describe a few other issues that come up when setting
up an OpenOCD server.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoARM: use <target/arm.h> not armv4_5.h
David Brownell [Mon, 7 Dec 2009 22:54:13 +0000 (14:54 -0800)]
ARM: use <target/arm.h> not armv4_5.h

Move most declarations in <target/armv4_5.h> to <target/arm.h>
and update users.

What's left in the older file is stuff that I think should be
removed ... the old register cache access stuff, which makes it
awkward to support microcontroller profile (Cortex-M) cores.

The armv4_5_run_algorithm() declaration was moved too, even
though it's not yet as generic as it probably ought to be.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoARM: rename some generic routines
David Brownell [Mon, 7 Dec 2009 22:54:13 +0000 (14:54 -0800)]
ARM: rename some generic routines

Rename some (mostly) generic ARM functions:

    armv4_5_arch_state()       --> arm_arch_state()
    armv4_5_get_gdb_reg_list() --> arm_get_gdb_reg_list()
    armv4_5_init_arch_info()   --> arm_init_arch_info()

Cores using the microcontroller profile may want a different
arch_state() routine though.

(Also fix strange indentation in arm_arch_state: use tabs only!
And update a call to it, removing assignment-in-conditional.)

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoARM: move opcode macros to <target/arm_opcodes.h>
David Brownell [Mon, 7 Dec 2009 22:54:12 +0000 (14:54 -0800)]
ARM: move opcode macros to <target/arm_opcodes.h>

Move the ARM opcode macros from <target/armv4_5.h>, and a few
Thumb2 ones from <target/armv7m.h>, to more appropriate homes
in a new <target/arm_opcodes.h> file.

Removed duplicate opcodes from that v7m/Thumb2 set.  Protected
a few macro argument references by adding missing parentheses.

Tightening up some of the line lengths turned up a curious artifact:
the macros for the Thumb opcodes are all 32 bits wide, not 16 bits.
There's currently no explanation for why it's done that way...

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoARM: remove mrc_opcode(), use MRC() or MCR()
David Brownell [Mon, 7 Dec 2009 22:54:12 +0000 (14:54 -0800)]
ARM: remove mrc_opcode(), use MRC() or MCR()

Get rid of mrc_opcode() in favor of ARMV4_5_MRC() or, where
arm*20t should have used it, ARMV4_5_MCR() instead.

Basically, *writing* coprocessor registers shouldn't have
used the *read* opcode ... and both should stick to standard
opcode constructors, not rearranging parameter sequence any
more than already needed.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoARM: disassemble two more v6+ instructions
David Brownell [Mon, 7 Dec 2009 22:46:29 +0000 (14:46 -0800)]
ARM: disassemble two more v6+ instructions

The SRS and RFE instructions speed exception entry/exit by
making it easy to save and restore PC and SPSR.  This handles
both ARM and Thumb2 encodings.

Fix minor PLD goofage; that "should never reach this point"
can't happen, so remove it.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoARM DPM: don't write low bits of watchpoint value
David Brownell [Mon, 7 Dec 2009 20:05:59 +0000 (12:05 -0800)]
ARM DPM: don't write low bits of watchpoint value

The low two bits are defined as should-be-zero-or-presereved.
We'll take the zero option, it's easier to enforce.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoOMAP2420: define reset-assert event
David Brownell [Mon, 7 Dec 2009 19:57:46 +0000 (11:57 -0800)]
OMAP2420: define reset-assert event

Behave like OMAP3530:  force global software reset.  Given the
patch to teach ARM11 how to use these events, and use VCR to
catch the reset vector, this works better than either the
current reset logic or than using SRST.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoUser's Guide: mention ETM on ARM11 comes up too
David Brownell [Mon, 7 Dec 2009 19:54:06 +0000 (11:54 -0800)]
User's Guide: mention ETM on ARM11 comes up too

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoadd 'flash list', rewrite 'flash banks'
Zachary T Welch [Mon, 7 Dec 2009 05:30:21 +0000 (21:30 -0800)]
add 'flash list', rewrite 'flash banks'

Rename the existing 'flash banks' implementation as 'flash list', and
replace the broken 'flash_banks' TCL wrapper with a new command handler.

Adds documentation for the new 'flash list' command in the user guide.

14 years agoallow 'flash_banks' command to give GDB output
Zachary T Welch [Mon, 7 Dec 2009 04:19:18 +0000 (20:19 -0800)]
allow 'flash_banks' command to give GDB output

The 'flash banks' command produces a list that needs to be formatted
properly for GDB's 'mem info' to work properly.  The flash_banks TCL
wrapper provided this formatting, but wrappers no longer work for
second-level commands as they did in the past.  With this patch,
the 'flash_banks' command can be used with the new command syntax
and display the required information.

14 years agofix NOR flash regression
Zachary T Welch [Mon, 7 Dec 2009 04:15:08 +0000 (20:15 -0800)]
fix NOR flash regression

When factoring the bank setup command into flash_bank_add(), I forgot
to include a call to the new helper.

14 years agomisc code review updates
David Brownell [Sat, 5 Dec 2009 22:40:06 +0000 (14:40 -0800)]
misc code review updates

More updates from the code review by Steve Grubb <sgrubb@redhat.com>.
The Jim float-comparision bug just gets a comment not a fix, though.

Cc: Steve Grubb <sgrubb@redhat.com>.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoNOR: add 29LV400BC flash device
Mathias Kuester [Sat, 5 Dec 2009 13:55:24 +0000 (14:55 +0100)]
NOR: add 29LV400BC flash device

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoARM semihosting: use breakpoint on ARM7
Nicolas Pitre [Sat, 5 Dec 2009 06:01:55 +0000 (01:01 -0500)]
ARM semihosting: use breakpoint on ARM7

Fall back to software breakpoint when vector catch isn't available.

Possible enhancements:

 - add extra optional command parameter to select high vectors
 - add extra optional command parameter to select hardware breakpoint

Signed-off-by: Nicolas Pitre <nico@marvell.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoARM semihosting: work with both low and high vectors
Nicolas Pitre [Sat, 5 Dec 2009 06:01:54 +0000 (01:01 -0500)]
ARM semihosting: work with both low and high vectors

Signed-off-by: Nicolas Pitre <nico@marvell.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agorename nand.h to flash//nand/core.h
Zachary T Welch [Sat, 5 Dec 2009 06:04:37 +0000 (22:04 -0800)]
rename nand.h to flash//nand/core.h

Rename nand.h as flash/nand/core.h, chase consumers.  The public APIs
need to be sorted out with imp.h, but this allows other changes to
begin improving the separation between policy and mechanism.

Moves #include <target/target.h> and #include "driver.h" into the
internal headers or source files, removing it from <flash/nand/core.h>.

14 years agomove remaining nand helper files
Zachary T Welch [Sat, 5 Dec 2009 05:38:13 +0000 (21:38 -0800)]
move remaining nand helper files

Move remaining NAND implementation files into src/flash/nand/.

14 years agosplit nand.c into nand/{core,fileio,tcl}.c
Zachary T Welch [Sat, 5 Dec 2009 03:28:18 +0000 (19:28 -0800)]
split nand.c into nand/{core,fileio,tcl}.c

Moves commands into nand/tcl.c and core implementation to 'nand/core.c'
and 'nand/fileio.c'.  Eliminates 'flash/nand.c'.

Adds 'nand/imp.h' to share routines between TCL commands and core.

14 years agosplit NAND driver handling into nand/driver.[ch]
Zachary T Welch [Sat, 5 Dec 2009 02:24:14 +0000 (18:24 -0800)]
split NAND driver handling into nand/driver.[ch]

This work parallels the NOR directory, encapsulating the NAND drivers
into a separate file.  This takes an extra step by encapsulating the
type of data structure used to manage the drivers, allowing it to be
changed from an array to a dynamic list in the future.

14 years agoARM: doc updates for main header
David Brownell [Sat, 5 Dec 2009 04:44:29 +0000 (20:44 -0800)]
ARM: doc updates for main header

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoARM: rename armv4_5_build_reg_cache() as arm_*()
David Brownell [Sat, 5 Dec 2009 04:33:02 +0000 (20:33 -0800)]
ARM: rename armv4_5_build_reg_cache() as arm_*()

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoARM: rename armv4_5_algorithm as arm_algorithm
David Brownell [Sat, 5 Dec 2009 04:19:49 +0000 (20:19 -0800)]
ARM: rename armv4_5_algorithm as arm_algorithm

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoARM: misc generic cleanup
David Brownell [Sat, 5 Dec 2009 04:14:46 +0000 (20:14 -0800)]
ARM: misc generic cleanup

Remove an undesirable use of the CPSR symbol ... it needs to vanish.
Flag mode-to-number stuff as obsolete; say why ... should also vanish.

Get rid of no-longer-used mode and state typedefs.

Comment a few of the implicit ties to "classic ARM".

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoARM: ARMV4_5_COMMON_MAGIC --> ARM_COMMON_MAGIC
David Brownell [Sat, 5 Dec 2009 03:46:44 +0000 (19:46 -0800)]
ARM: ARMV4_5_COMMON_MAGIC --> ARM_COMMON_MAGIC

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoARM: switch target_to_armv4_5() to target_to_arm()
David Brownell [Sat, 5 Dec 2009 03:43:03 +0000 (19:43 -0800)]
ARM: switch target_to_armv4_5() to target_to_arm()

And remove that old symbol.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoARM: rename armv4_5_state_* as arm_state_*
David Brownell [Sat, 5 Dec 2009 03:39:25 +0000 (19:39 -0800)]
ARM: rename armv4_5_state_* as arm_state_*

And make arm_state_strings[] be const.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoARM: rename armv4_5_mode_* AS arm_mode_*
David Brownell [Sat, 5 Dec 2009 03:33:33 +0000 (19:33 -0800)]
ARM: rename armv4_5_mode_* AS arm_mode_*

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoARM: rename ARMV4_5_MODE_* as ARM_MODE_*
David Brownell [Sat, 5 Dec 2009 03:21:14 +0000 (19:21 -0800)]
ARM: rename ARMV4_5_MODE_* as ARM_MODE_*

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoARM: rename ARMV4_5_STATE_* as ARM_STATE_*
David Brownell [Sat, 5 Dec 2009 03:14:48 +0000 (19:14 -0800)]
ARM: rename ARMV4_5_STATE_* as ARM_STATE_*

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoARM11: report watchpoint trigger insn
David Brownell [Sat, 5 Dec 2009 02:57:31 +0000 (18:57 -0800)]
ARM11: report watchpoint trigger insn

As with Cortex-A8, the WFAR register holds useful information
that should be recorded and, where relevant, displayed.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoARM11: basic watchpoint support
David Brownell [Sat, 5 Dec 2009 02:57:31 +0000 (18:57 -0800)]
ARM11: basic watchpoint support

Use the DPM watchpoint support; remove old incomplete stubs.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoARM11: tweak TAP ops and debugging
David Brownell [Sat, 5 Dec 2009 02:57:30 +0000 (18:57 -0800)]
ARM11: tweak TAP ops and debugging

Tweak scanchain 7 debug messaging:

 - show register addresses in decimal, matching ARM docs;
 - remove some pointless noise

Avoid some needless roundtrips:

 - skip SCAN_N when SCREG already holds that number (speeds up
   polling and other common operations)
 - avoid zeroing vcr twice on resume

Show the IR opcode as a label ("RESTART") too; and in decimal,
matching ARM docs.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoreorder build order of src directory
Zachary T Welch [Fri, 4 Dec 2009 12:42:38 +0000 (04:42 -0800)]
reorder build order of src directory

Descend into the library modules in order, from bottom-to-top.

14 years agoremove flash.h from tree
Zachary T Welch [Sat, 5 Dec 2009 00:40:19 +0000 (16:40 -0800)]
remove flash.h from tree

Remove the now vestigial <flash/flash.h> header from the tree,
replacing a few references with <flash/nor/core.h>

14 years agosplit flash.h into into flash/nor/*.h
Zachary T Welch [Sat, 5 Dec 2009 00:07:47 +0000 (16:07 -0800)]
split flash.h into into flash/nor/*.h

Move the bulk of the flash.h file into flash/nor/core.h, leaving an
empty husk that will be removed in the next patch.

The NOR driver structure is an implementation detail, so move it into
its own private header file <flash/nor/driver.h> along with helper
declaration for finding them by name.

14 years agoremove target.h from flash.h
Zachary T Welch [Fri, 4 Dec 2009 22:06:20 +0000 (14:06 -0800)]
remove target.h from flash.h

The flash.h header does not require the target.h header file, but
its implementation source files do.  Move it to flash/nor/imp.h.

14 years agosplit NOR and NAND flash headers
Zachary T Welch [Fri, 4 Dec 2009 21:42:09 +0000 (13:42 -0800)]
split NOR and NAND flash headers

Moves common flash errors to <flash/common.h> to decouple these two
mostly unrelated trees of code.

14 years agoeliminate src/flash/flash.c
Zachary T Welch [Fri, 4 Dec 2009 12:37:27 +0000 (04:37 -0800)]
eliminate src/flash/flash.c

Move remaining NOR flash implemenation into flash/nor/core.c
Removes flash.c from the build, leaving only its header to split.

14 years agoadd flash/nor/drivers.c
Zachary T Welch [Fri, 4 Dec 2009 12:10:42 +0000 (04:10 -0800)]
add flash/nor/drivers.c

Encapsulates access to the flash_drivers array, providing a base
of operations for future dynamic driver module loading features.

14 years agomove more nor flash implementation details
Zachary T Welch [Fri, 4 Dec 2009 12:01:45 +0000 (04:01 -0800)]
move more nor flash implementation details

Splits the exec mode commands out of flash.c into the flash/nor/ files.
The routines used by these high-level commands are moved into nor/core.c,
with their internal declarations placed in nor/imp.h.

Fixes distribution of <flash/nor/core.h> header.

14 years agoARM: semihosting entry cleanup
David Brownell [Sat, 5 Dec 2009 00:51:48 +0000 (16:51 -0800)]
ARM: semihosting entry cleanup

Clean up arm_semihosting() entry a bit, comment some issues and just
which SVC opcodes are getting intercepted.  Microcontroller profile
cores will need a new entry, since they use BKPT instead (and don't
have either SVC mode or an SPSR register).

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoARM: remove semihosting globals
David Brownell [Sat, 5 Dec 2009 00:51:48 +0000 (16:51 -0800)]
ARM: remove semihosting globals

Store a flag and errno in in "struct arm".
Have "poll" output report when semihosting is active.
Shrink some of the affected lines.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoUser's Guide: more semihosting info
David Brownell [Fri, 4 Dec 2009 18:11:31 +0000 (10:11 -0800)]
User's Guide: more semihosting info

List it in the concept index, in the section about target software
changes a project might want to consider, and in the section about
debug messaging.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agobootstrap: stop execution upon error
Øyvind Harboe [Fri, 4 Dec 2009 08:50:55 +0000 (09:50 +0100)]
bootstrap: stop execution upon error

When tools are not installed, exit immediately. This makes
the error messages clearer.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
14 years agoadd flash/nor/core.[ch]
Zachary T Welch [Fri, 4 Dec 2009 01:14:07 +0000 (17:14 -0800)]
add flash/nor/core.[ch]

The newly moved flash TCL routines access the internals of the module
too much.  Fix the layering issues by adding new core NOR flash APIs:

<flash/nor/core.h>:
  - flash_driver_find_by_name() - self-descriptive

<flash/nor/imp.h>:
  - flash_bank_add()            - encapsulates adding banks to bank list
  - flash_bank_list()           - encapsulates retreiving bank list

This allows the externs in flash/nor/imp.h to be removed, and
these mechanisms may now be re-used by other flash module code.

14 years agoadd flash/nor/{tcl.c,imp.h} from flash/flash.c
Zachary T Welch [Fri, 4 Dec 2009 00:47:49 +0000 (16:47 -0800)]
add flash/nor/{tcl.c,imp.h} from flash/flash.c

Moves the top-level 'flash' command handlers into flash/nor/tcl.c,
with flash/nor/imp.h providing an internal implementation header
to share non-public API components.

14 years agoseparate Jim from jtag/core.c
Zachary T Welch [Fri, 4 Dec 2009 00:25:51 +0000 (16:25 -0800)]
separate Jim from jtag/core.c

After previous efforts, only one Jim routine remained in jtag/core.c,
and moving it to jtag/tcl.c painlessly finishes separating these layers.
The headers need separating, but the implementation is clean.

14 years agoswitch 'rm' command away from using Jim
Zachary T Welch [Fri, 4 Dec 2009 00:22:46 +0000 (16:22 -0800)]
switch 'rm' command away from using Jim

Commands that do not need to use Jim should be registered as
high-level command handlers.

14 years agocheck top-level command registrations
Zachary T Welch [Fri, 4 Dec 2009 01:38:24 +0000 (17:38 -0800)]
check top-level command registrations

When calling module_register_commands, the return value needs to be
checked for failures.  Instead of duplicating code, use an array of
function pointers to the identical registration functions to iterate
over during startup.

14 years agoallow 'jtag init' to be run in any mode
Zachary T Welch [Fri, 4 Dec 2009 01:41:39 +0000 (17:41 -0800)]
allow 'jtag init' to be run in any mode

Help alleviate further potential problems with interactive startup.

14 years agotarget: cygwin build fixes
David Brownell [Fri, 4 Dec 2009 08:42:36 +0000 (00:42 -0800)]
target: cygwin build fixes

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agozy1000: FPGA revC wip
Øyvind Harboe [Fri, 4 Dec 2009 07:20:38 +0000 (08:20 +0100)]
zy1000: FPGA revC wip

The bug in revC register memory access is pretty much
cornered now.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
14 years agobasic ARM semihosting support
Nicolas Pitre [Thu, 3 Dec 2009 22:27:13 +0000 (17:27 -0500)]
basic ARM semihosting support

Semihosting enables code running on an ARM target to use the
I/O facilities on the host computer. The target application must
be linked against a library that forwards operation requests by
using the SVC instruction that is trapped at the Supervisor Call
vector by the debugger.  The "hosted" library version provided
with CodeSourcery's Sourcery G++ Lite for ARM EABI is one example.

This is currently available for ARM9 processors, but any ARM
variant should be able to support this with little additional work.

Tested using binaries compiled with Sourcery G++ Lite 2009q1-161
and ARM RVCT 3.0.

[dbrownell@users.sourceforge.net: doc tweaks, NEWS]

Signed-off-by: Nicolas Pitre <nico@marvell.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agodoxygen: remove some warnings
David Brownell [Fri, 4 Dec 2009 02:31:38 +0000 (18:31 -0800)]
doxygen: remove some warnings

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoMake ARM NAND I/O operations aware of last op
Dean Glazeski [Mon, 16 Nov 2009 19:40:46 +0000 (13:40 -0600)]
Make ARM NAND I/O operations aware of last op

Updates the ARM NAND I/O code to look at and update the op
field of arm_nand_data to reflect the last operation performed.
It uses this field to copy the correct code to the target in the
case where the struct is used for reads and writes.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoARM NAND I/O interface update
Dean Glazeski [Mon, 16 Nov 2009 19:34:24 +0000 (13:34 -0600)]
ARM NAND I/O interface update

Modify the arm_nand_data struct to better support both read and
write operations while using the same struct.  An additional
field was added, and initialized, to record the last operation
so that the correct code can be loaded to the working area.

[dbrownell@users.sourceforge.net: merge init patch, tweak GPL note]

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoNAND page command refactoring.
Dean Glazeski [Fri, 20 Nov 2009 06:19:39 +0000 (00:19 -0600)]
NAND page command refactoring.

Created a new function that handles sending a command and the address
information for pages to a NAND device.

[dbrownell@users.sourceforge.net: tweaked line lengths, name 'oob_only']

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoARMv7-A: tweak arch_state()
David Brownell [Fri, 4 Dec 2009 00:18:24 +0000 (16:18 -0800)]
ARMv7-A: tweak arch_state()

Punt to the armv4_5_arch_state() for all the common stuff, to
shrink code and so we will get any improvements it provides.

Don't hide watchpoint status if we happen to be in "abort" mode.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoARM DPM: share debug reason logic
David Brownell [Fri, 4 Dec 2009 00:08:04 +0000 (16:08 -0800)]
ARM DPM: share debug reason logic

No point in both ARM11 and Cortex-A8 having private copies
of the logic sorting out e.g. DBG_REASON_WATCHPOINT.

Add and use a shared routine for this ... there's actually
a bunch more debug entry logic that could be shared, this
is just a start on that.  Note that this routine fixes a
bug observed in the ARM11 code, where some abort mode quirks
were displayed as being an unknown debug reason; and also
silences needless ARM11 chatter.

Likewise with private copies of DSCR ... add one to the DPM
struct.  Save it as part of setting DBG_REASON_* so later
patches can switch over to using that copy.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoARM11: use shared DSCR bit names
David Brownell [Fri, 4 Dec 2009 00:08:04 +0000 (16:08 -0800)]
ARM11: use shared DSCR bit names

For the bits now defined in "arm_dpm.h", switch to the
shared DSCR_* symbol and remove the ARM11_DSCR_* version.

Define DSCR_INT_DIS and use it instead of the ARM11_DSCR_*
sibling symbol.  (Note:  for both ARM11 and Cortex-A8, this
should arguably be enabled by default when single stepping.)

Remove some other unused declarations in "arm11.h".

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoARM DPM: make DSCR bit defs sharable
David Brownell [Fri, 4 Dec 2009 00:08:04 +0000 (16:08 -0800)]
ARM DPM: make DSCR bit defs sharable

Move the symbols for these bits from "armv7a.h" to "arm_dpm.h",
where they can be seen and used not just by Cortex-A but also
by the ARM11 (armv6) code.

Change them from bit numbers to bit masks ... this matches the
usage in ARM11 code, and also makes it easier to read.

Rename DSCR_EXT_INT_EN as DSCR_ITR_EN to match the docs; it's
enabling ITR functionality, not external interrupts, so this
changes the name to be less misleading.  (There *IS* a bit
affecting interrupts, and this isn't it.)

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agofix another init regression
David Brownell [Thu, 3 Dec 2009 22:44:03 +0000 (14:44 -0800)]
fix another init regression

This makes Beagle work again, instead of losing horribly because
the JTAG event handlers are no longer able to e.g. "runtest".  I
get the previous quirky behavior ... comes up OK but "reset halt"
somewhat mysteriously makes it all better.  (Instead of nothing
being able to work at all...)  However, I'm still seeing:

 The 'init' command must be used before 'init'.

That seems to come from invoking "jtag init", sometime after it
gets mapped to "ocd_jtag init", according to debug message traces.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agofix double 'init' regression
Zachary T Welch [Thu, 3 Dec 2009 13:23:16 +0000 (05:23 -0800)]
fix double 'init' regression

To prevent regression in the behavior of 'init', we allow it to run in
any mode.  If provided with -c init and with -c noinit, then the second
init at startup caused a spurious mode failure.  Let 'init' handle it.

14 years agofix regressions with GDB port numbers
Zachary T Welch [Thu, 3 Dec 2009 13:13:45 +0000 (05:13 -0800)]
fix regressions with GDB port numbers

Use a separate variable for iterating GDB service port numbers than
the one set by the user.  Restores the behavior of returning the
original port number and only incrementing the port used on success.

14 years agozy1000: include files have moved about
Øyvind Harboe [Thu, 3 Dec 2009 12:47:25 +0000 (13:47 +0100)]
zy1000: include files have moved about

now compiles again after include files were moved about
to reduce -I usage and stop using quotes but rather
angle brackets for include files.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
14 years agoremove tertiary include paths
Zachary T Welch [Sun, 29 Nov 2009 00:27:10 +0000 (16:27 -0800)]
remove tertiary include paths

With all #include directives converted, we only need to have the
top-level src/ directory in the search path.

14 years agochange #include "../hello.h" to "hello.h"
Zachary T Welch [Thu, 3 Dec 2009 11:46:15 +0000 (03:46 -0800)]
change #include "../hello.h" to "hello.h"

Before we can -I the top-level src/ directory alone, references to
"hello.h" must be updated.  This is an internal header, so it does
not need angle brackets.

14 years agochange #include "xsvf.h" to <xsvf/xsvf.h>
Zachary T Welch [Thu, 3 Dec 2009 12:15:05 +0000 (04:15 -0800)]
change #include "xsvf.h" to <xsvf/xsvf.h>

Changes from the flat namespace to heirarchical one.  Instead of writing:

#include "xsvf.h"

the following form should be used.

#include <xsvf/xsvf.h>

The exception is from .c files in the same directory.

14 years agochange #include "svf.h" to <svf/svf.h>
Zachary T Welch [Thu, 3 Dec 2009 12:15:05 +0000 (04:15 -0800)]
change #include "svf.h" to <svf/svf.h>

Changes from the flat namespace to heirarchical one.  Instead of writing:

#include "svf.h"

the following form should be used.

#include <svf/svf.h>

The exception is from .c files in the same directory.

14 years agochange #include "pld.h" to <pld/pld.h>
Zachary T Welch [Thu, 3 Dec 2009 12:15:04 +0000 (04:15 -0800)]
change #include "pld.h" to <pld/pld.h>

Changes from the flat namespace to heirarchical one.  Instead of writing:

#include "pld.h"

the following form should be used.

#include <pld/pld.h>

The exception is from .c files in the same directory.

14 years agochange #include "telnet_server.h" to <server/telnet_server.h>
Zachary T Welch [Thu, 3 Dec 2009 12:15:03 +0000 (04:15 -0800)]
change #include "telnet_server.h" to <server/telnet_server.h>

Changes from the flat namespace to heirarchical one.  Instead of writing:

#include "telnet_server.h"

the following form should be used.

#include <server/telnet_server.h>

The exception is from .c files in the same directory.

14 years agochange #include "server.h" to <server/server.h>
Zachary T Welch [Thu, 3 Dec 2009 12:15:03 +0000 (04:15 -0800)]
change #include "server.h" to <server/server.h>

Changes from the flat namespace to heirarchical one.  Instead of writing:

#include "server.h"

the following form should be used.

#include <server/server.h>

The exception is from .c files in the same directory.

14 years agochange #include "httpd.h" to <server/httpd.h>
Zachary T Welch [Thu, 3 Dec 2009 12:15:03 +0000 (04:15 -0800)]
change #include "httpd.h" to <server/httpd.h>

Changes from the flat namespace to heirarchical one.  Instead of writing:

#include "httpd.h"

the following form should be used.

#include <server/httpd.h>

The exception is from .c files in the same directory.

14 years agochange #include "gdb_server.h" to <server/gdb_server.h>
Zachary T Welch [Thu, 3 Dec 2009 12:15:02 +0000 (04:15 -0800)]
change #include "gdb_server.h" to <server/gdb_server.h>

Changes from the flat namespace to heirarchical one.  Instead of writing:

#include "gdb_server.h"

the following form should be used.

#include <server/gdb_server.h>

The exception is from .c files in the same directory.

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)