Commit Graph

1467 Commits

Author SHA1 Message Date
Nicolas Pitre
ed59dfc80a 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>
2009-12-03 18:42:01 -08:00
David Brownell
f62c035c52 doxygen: remove some warnings
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-03 18:31:38 -08:00
David Brownell
7e2dffbbff 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>
2009-12-03 16:18:24 -08:00
David Brownell
ea7a49cb9b 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>
2009-12-03 16:08:04 -08:00
David Brownell
6eee0729d7 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>
2009-12-03 16:08:04 -08:00
David Brownell
eb6c880ddc 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>
2009-12-03 16:08:04 -08:00
Zachary T Welch
822c06d9e3 remove tertiary include paths
With all #include directives converted, we only need to have the
top-level src/ directory in the search path.
2009-12-03 04:24:50 -08:00
Zachary T Welch
f7bd1e8f3a 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.
2009-12-03 04:24:50 -08:00
Zachary T Welch
7a4f4457e5 change #include "trace.h" to <target/trace.h>
Changes from the flat namespace to heirarchical one.  Instead of writing:

	#include "trace.h"

the following form should be used.

	#include <target/trace.h>

The exception is from .c files in the same directory.
2009-12-03 04:24:42 -08:00
Zachary T Welch
c6dd6a576d change #include "target.h" to <target/target.h>
Changes from the flat namespace to heirarchical one.  Instead of writing:

	#include "target.h"

the following form should be used.

	#include <target/target.h>

The exception is from .c files in the same directory.
2009-12-03 04:24:42 -08:00
Zachary T Welch
aaf948a6be change #include "mips_ejtag.h" to <target/mips_ejtag.h>
Changes from the flat namespace to heirarchical one.  Instead of writing:

	#include "mips_ejtag.h"

the following form should be used.

	#include <target/mips_ejtag.h>

The exception is from .c files in the same directory.
2009-12-03 04:24:41 -08:00
Zachary T Welch
36e53978b9 change #include "mips32_pracc.h" to <target/mips32_pracc.h>
Changes from the flat namespace to heirarchical one.  Instead of writing:

	#include "mips32_pracc.h"

the following form should be used.

	#include <target/mips32_pracc.h>

The exception is from .c files in the same directory.
2009-12-03 04:24:41 -08:00
Zachary T Welch
0241b1e105 change #include "etm.h" to <target/etm.h>
Changes from the flat namespace to heirarchical one.  Instead of writing:

	#include "etm.h"

the following form should be used.

	#include <target/etm.h>

The exception is from .c files in the same directory.
2009-12-03 04:24:41 -08:00
Zachary T Welch
1650ab3a22 change #include "embeddedice.h" to <target/embeddedice.h>
Changes from the flat namespace to heirarchical one.  Instead of writing:

	#include "embeddedice.h"

the following form should be used.

	#include <target/embeddedice.h>

The exception is from .c files in the same directory.
2009-12-03 04:24:41 -08:00
Zachary T Welch
f52a596860 change #include "armv7m.h" to <target/armv7m.h>
Changes from the flat namespace to heirarchical one.  Instead of writing:

	#include "armv7m.h"

the following form should be used.

	#include <target/armv7m.h>

The exception is from .c files in the same directory.
2009-12-03 04:24:41 -08:00
Zachary T Welch
a1c40f5120 change #include "armv7a.h" to <target/armv7a.h>
Changes from the flat namespace to heirarchical one.  Instead of writing:

	#include "armv7a.h"

the following form should be used.

	#include <target/armv7a.h>

The exception is from .c files in the same directory.
2009-12-03 04:24:41 -08:00
Zachary T Welch
377c5504b9 change #include "armv4_5_mmu.h" to <target/armv4_5_mmu.h>
Changes from the flat namespace to heirarchical one.  Instead of writing:

	#include "armv4_5_mmu.h"

the following form should be used.

	#include <target/armv4_5_mmu.h>

The exception is from .c files in the same directory.
2009-12-03 04:24:41 -08:00
Zachary T Welch
56adfadb5d change #include "armv4_5_cache.h" to <target/armv4_5_cache.h>
Changes from the flat namespace to heirarchical one.  Instead of writing:

	#include "armv4_5_cache.h"

the following form should be used.

	#include <target/armv4_5_cache.h>

The exception is from .c files in the same directory.
2009-12-03 04:24:41 -08:00
Zachary T Welch
ddea033043 change #include "armv4_5.h" to <target/armv4_5.h>
Changes from the flat namespace to heirarchical one.  Instead of writing:

	#include "armv4_5.h"

the following form should be used.

	#include <target/armv4_5.h>

The exception is from .c files in the same directory.
2009-12-03 04:24:41 -08:00
Zachary T Welch
15accefbe2 change #include "arm_jtag.h" to <target/arm_jtag.h>
Changes from the flat namespace to heirarchical one.  Instead of writing:

	#include "arm_jtag.h"

the following form should be used.

	#include <target/arm_jtag.h>

The exception is from .c files in the same directory.
2009-12-03 04:24:40 -08:00
Zachary T Welch
98eea5680b change #include "arm_dpm.h" to <target/arm_dpm.h>
Changes from the flat namespace to heirarchical one.  Instead of writing:

	#include "arm_dpm.h"

the following form should be used.

	#include <target/arm_dpm.h>

The exception is from .c files in the same directory.
2009-12-03 04:24:40 -08:00
Zachary T Welch
0c1bc6703c change #include "arm_adi_v5.h" to <target/arm_adi_v5.h>
Changes from the flat namespace to heirarchical one.  Instead of writing:

	#include "arm_adi_v5.h"

the following form should be used.

	#include <target/arm_adi_v5.h>

The exception is from .c files in the same directory.
2009-12-03 04:24:40 -08:00
Zachary T Welch
2c35b35e11 change #include "arm9tdmi.h" to <target/arm9tdmi.h>
Changes from the flat namespace to heirarchical one.  Instead of writing:

	#include "arm9tdmi.h"

the following form should be used.

	#include <target/arm9tdmi.h>

The exception is from .c files in the same directory.
2009-12-03 04:24:40 -08:00
Zachary T Welch
447f0896dd change #include "arm7tdmi.h" to <target/arm7tdmi.h>
Changes from the flat namespace to heirarchical one.  Instead of writing:

	#include "arm7tdmi.h"

the following form should be used.

	#include <target/arm7tdmi.h>

The exception is from .c files in the same directory.
2009-12-03 04:24:40 -08:00
Zachary T Welch
9e3136a5f8 change #include "arm7_9_common.h" to <target/arm7_9_common.h>
Changes from the flat namespace to heirarchical one.  Instead of writing:

	#include "arm7_9_common.h"

the following form should be used.

	#include <target/arm7_9_common.h>

The exception is from .c files in the same directory.
2009-12-03 04:24:40 -08:00
Zachary T Welch
28b1794505 change #include "arm11.h" to <target/arm11.h>
Changes from the flat namespace to heirarchical one.  Instead of writing:

	#include "arm11.h"

the following form should be used.

	#include <target/arm11.h>

The exception is from .c files in the same directory.
2009-12-03 04:24:40 -08:00
Zachary T Welch
cb4a475f6c change #include "jtag.h" to <jtag/jtag.h>
Changes from the flat namespace to heirarchical one.  Instead of writing:

	#include "jtag.h"

the following form should be used.

	#include <jtag/jtag.h>

The exception is from .c files in the same directory.
2009-12-03 04:24:33 -08:00
Zachary T Welch
df0e90ec8c change #include "types.h" to <helper/types.h>
Changes from the flat namespace to heirarchical one.  Instead of writing:

	#include "types.h"

the following form should be used.

	#include <helper/types.h>

The exception is from .c files in the same directory.
2009-12-03 04:22:52 -08:00
Zachary T Welch
6512e5e36b change #include "time_support.h" to <helper/time_support.h>
Changes from the flat namespace to heirarchical one.  Instead of writing:

	#include "time_support.h"

the following form should be used.

	#include <helper/time_support.h>

The exception is from .c files in the same directory.
2009-12-03 04:22:52 -08:00
Zachary T Welch
ba00ba47d2 change #include "replacements.h" to <helper/replacements.h>
Changes from the flat namespace to heirarchical one.  Instead of writing:

	#include "replacements.h"

the following form should be used.

	#include <helper/replacements.h>

The exception is from .c files in the same directory.
2009-12-03 04:22:52 -08:00
Zachary T Welch
c79cca04be change #include "log.h" to <helper/log.h>
Changes from the flat namespace to heirarchical one.  Instead of writing:

	#include "log.h"

the following form should be used.

	#include <helper/log.h>

The exception is from .c files in the same directory.
2009-12-03 04:22:52 -08:00
Zachary T Welch
35f1a40f6f change #include "jim.h" to <helper/jim.h>
Changes from the flat namespace to heirarchical one.  Instead of writing:

	#include "jim.h"

the following form should be used.

	#include <helper/jim.h>

The exception is from .c files in the same directory.
2009-12-03 04:22:52 -08:00
Zachary T Welch
14ed20967f change #include "fileio.h" to <helper/fileio.h>
Changes from the flat namespace to heirarchical one.  Instead of writing:

	#include "fileio.h"

the following form should be used.

	#include <helper/fileio.h>

The exception is from .c files in the same directory.
2009-12-03 04:22:51 -08:00
Zachary T Welch
264d24495d change #include "command.h" to <helper/command.h>
Changes from the flat namespace to heirarchical one.  Instead of writing:

	#include "command.h"

the following form should be used.

	#include <helper/command.h>

The exception is from .c files in the same directory.
2009-12-03 04:22:48 -08:00
Zachary T Welch
d1bc4375e9 change #include "binarybuffer.h" to <helper/binarybuffer.h>
Changes from the flat namespace to heirarchical one.  Instead of writing:

	#include "binarybuffer.h"

the following form should be used.

	#include <helper/binarybuffer.h>

The exception is from .c files in the same directory.
2009-12-03 04:22:17 -08:00
Zachary T Welch
896ac8d4ef allow #include directives to use module name
Includes the src directory in the search path, so header files may be
migrated from:

  #include "foo.h"

to
  #include <module/foo.h>

which is more conducive for installation.
2009-12-03 01:54:15 -08:00
Nicolas Pitre
a976ce2dd4 feroceon.c should be part of ARM7_9_SRC
The Feroceon and Dragonite cores are similar to the ARM926 and ARM966
cores respectively.

Signed-off-by: Nicolas Pitre <nico@marvell.com>
2009-12-03 09:57:17 +01:00
David Brownell
d5e4e23f9a ARM11: don't expose DSCR
Remove the remaining extra copy of DSCR, and the register cache
of which it was a part.  That cache wasn't a very safe, or even
necessary, idea; it was essentialy letting debugger-private state
be manipulated by Tcl code that couldn't know how to do it right.

This makes the "reg" output of an ARM11 resemble what most other
ARM cores produce ... forward motion in the "make ARM11 work like
the rest of the ARM cores" Jihad!
2009-12-02 23:08:43 -08:00
David Brownell
f0c3e7011f ARM11: store a clean copy of DSCR
Just store a clean copy of DSCR in the per-CPU struct, so we
trivially pass a pointer to a recent copy.  This replaces the
previous "last_dscr" and cleans up most of the related calling
conventions ... but it doesn't remove the other DSCR copy.
2009-12-02 23:08:43 -08:00
David Brownell
62dd15d78f ARM11: don't expose WDTR
Don't expose the WDTR register through the register cache any
more.  If anyone wants Tcl scripts to be able to use DCC based
communication with app code in the target, this wouldn't do it.

Bugfix:  don't trust the Tcl-accessible version of DSCR to
flag whether WDTR needs to be restored when resuming.
2009-12-02 23:08:42 -08:00
David Brownell
7e18d96d03 ARM11: don't expose RDTR
Don't expose the RDTR register through the register cache any
more.  If anyone wants Tcl scripts to be able to use DCC based
communication with app code in the target, this wouldn't do it.

Bugfix:  don't trust the Tcl-accessible version of DSCR to
flag whether RDTR needs to be restored when resuming.
2009-12-02 23:08:42 -08:00
David Brownell
6ec5b9c674 ARM11: streamline debug entry
Streamline arm11_on_enter_debug_state() entry:

 - It should handle the standard updates:
    * target->debug_reason
    * target->state

 - Don't waste time re-reading DSCR; just pass it in

Also rename the routine to "arm11_debug_entry()", matching the
convention used elsewhere in OpenOCD.
2009-12-02 23:08:42 -08:00
David Brownell
1d29440a9c ARM11: remove arm11->target
Don't need/want arm11->target; we have arm11->arm.target instead.
Also remove some unused watchpoint stuff.
2009-12-02 23:08:42 -08:00
David Brownell
c2af99d471 ARM DPM: tweak initialization
Move the initial breakpoint/watchpoint disable calls to
arm_dpm_initialize(), and start using that routine.  This
split helps with arm11 support.
2009-12-02 23:08:42 -08:00
Zachary T Welch
f4a1070dcf adding files required for distribution
Add headers missing from Makefile rules to pass 'make distcheck'.
These were included in the tree but were not added with those commits.
2009-12-02 18:29:05 -08:00
Zachary T Welch
4c43afce85 fix 'target init' command registration
The command handler registration was put at the top level, rather
than as a subcommand.  Move it to where it belongs.
2009-12-02 16:16:54 -08:00
Zachary T Welch
62fbb0f545 target: factor init to 'target init'
Adds 'target init' command handler, called as part of 'init'.
2009-12-02 13:26:23 -08:00
Zachary T Welch
e03f3c57a5 target: factor target_init() into pieces
Moves body of target initialization loop into a helper function,
cleaning up its visual flow in the process.
2009-12-02 13:26:23 -08:00
David Brownell
55eeea7fce ARMv7a/Cortex-A8: report watchpoint trigger insn
Save and display the address of the instruction which triggered the
watchpoint.  Because of pipelining, that's well behind the PC value
when debug entry completes.  (Example in a subroutine that had been
returned from...)

Remove unused A8 stuff, mostly watchpoint hooks from the header.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-02 11:31:32 -08:00
David Brownell
03c103d56a ARM: label SP and LR correctly
Except for USR/SYS mode, the labels for the shadowed SP and LR
registers were reversed.  LR is r14; SP is r13.  Fix.

This would not affect GDB users; GDB references are positional.
Only folk working directly with OpenOCD register values would
have noticed this bug.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-02 11:31:32 -08:00