Commit Graph

1415 Commits

Author SHA1 Message Date
David Brownell
1c7d3d200c ARMv7a: move constants out of Cortex-A8 header
These are architecturally defined, not core-specific.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-01 20:39:58 -08:00
David Brownell
63dc352876 ARM11: remove previous mcr()/mrc() methods
We don't need this code, now that the DPM code handles it.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-01 00:49:16 -08:00
David Brownell
5949a3b3a5 Cortex-A8: remove previous mcr()/mrc() methods
We don't need this code, now that the DPM code handles it.
Neither do we need the ARMv7-A CP15 operations; remove their
remnants too.  And disable a mostly-needless diagnostic.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-01 00:49:11 -08:00
David Brownell
563d937c3c ARM: implement mrc()/mcr() as DPM ops
Instead of having separate ARM11 and Cortex-A8 implementations of
this code, have one shared implementation which just builds on the
existing "run instruction via R0" support.

This enables followup patches to remove that now-unused code from
those two drivers.  (Patches to move the "mrc" and "mcr" code into
"struct arm" are due too ... MIPS and other cores do not support
those ARM-specific concepts.)

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-01 00:49:04 -08:00
David Brownell
177bbd8891 target: "mcr" and "mrc" are ARM-specific
Switch "mrc" and "mcr" commands to be toplevel ARM operations,
as they should initially have been.

Correct the usage message for both commands:  it matches ARM
documentation (as one wants!) instead of reordering them to
match the funky mrc() and mcr() method usage (sigh).

For Cortex-A8: restore a line that got accidentally dropped,
so the secure monitor mode shadow registers will show again.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-01 00:48:53 -08:00
David Brownell
209a0197f0 ARMv7-A: stop using CP15 ops
The ARMv7-A code uses read_cp15() to access fault registers.
Instead, use DPM operations directly, passing in the relevant
MRC instructions.

This eliminates per-operation overhead (though it'll be hard
to observe, this is uncommon) and helps eliminate read_cp15().

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-01 00:48:40 -08:00
David Brownell
fb984a477d Cortex-A8: stop using CP15 ops
There were two chunks of Cortex-A8 code which called the
ARMv7-A CP15 operations; get rid of them, helping prepare
to remove those methods completely:

 - post_debug_entry() can use the mrc() method to read
   its two registers.

 - write_memory() can use dpm->instr_write_data_r0() to
   flush the ICache and DCache ... doing it this way is
   actually faster since it reduces per-write overhead.

Note that the mrc() method parameters are re-ordered with
respect to the ARM instruction documentation, so that part
can be confusing.

Cleaned up the layout and comments in those areas a bit.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-12-01 00:48:40 -08:00
David Brownell
892604bc7e XScale: restore_context() cleanup
Clean up two aspects to this routine:  bad naming, since it
doesn't restore the context, just the banked registers; and
excess indentation for the bulk of the code.

Also make some of its call sites stash the function's return
code; someday they should use it for error checking.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-30 19:14:19 -08:00
David Brownell
da7c202b57 XScale: context restore, cleanup/bugfix
This "loop over all registers" routine shared the same mess as
full_context() in terms of dozens of needless number_to_mode()
calls.  Fix that, and comments, with related cleanup.

The misnamed xscale_restore_context() had a related bug.  It
was restoring the *WRONG REGISTERS* ... always from whatever
the current mode was, instead of using the copy from whichever
register bank it was trying to restore.  (But it marked the
intended register as having been restored...)  Fixed that.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-30 19:14:19 -08:00
Zachary T Welch
7b2906de24 do not extern 'interp' from command.c
Adds 'interp' field to command_context, chasing the few remaining
references to the global variable outside of the command module.
2009-11-30 16:29:34 -08:00
Zachary T Welch
8e8a359af2 target: avoid using interp global variable
Adds 'interp' to target_event_action structure to avoid using the
global variable of the same name.
2009-11-30 16:29:34 -08:00
David Brownell
5219b35be6 XScale: clean up full_context() (#2)
Streamline the loop by continuing as soon as we know there's no
work to be done; this lets us un-indent almost everything.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-29 13:06:12 -08:00
David Brownell
8c8e53baf6 XScale: clean up full_context() (#1)
When fetching all the registers, XScale was doing various stupid
things like calling number_to_mode() a few dozen times instead of
just once, and mapping access to each register three times (again,
instead of just once).  Stop that.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-29 13:04:56 -08:00
David Brownell
e456da073a XScale: debug entry uses new register mapping
Use the new mapping interfaces in the debug entry path.
SPSR and the banked registers now have smaller and faster
accessors ... use them.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-29 12:58:30 -08:00
Marek Vasut
17b7600a59 XScale: initial PXA3xx support
[dbrownell@users.sourceforge.net: user's guide; variant param is optional]

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-29 12:57:05 -08:00
David Brownell
73ec6d9b89 ARM11: fix warning on cygwin
Previous version of JTAG_DEBUG() macro hid this bug.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-29 09:14:52 -08:00
David Brownell
a398c85de7 Cortex-M3: don't chain "struct arm" commands
Those commands presume support for the "classic" set of CPU
modes (FIQ, supervisor, IRQ, etc) ... which aren't supported
by the ARMv7-M or ARMv6-M architectures.  They also presume
a "struct arm" base type, which this code doesn't use.

We haven't cleaned up the register handling enough to be able
to share any of those "base" methods.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-28 14:19:45 -08:00
Zachary T Welch
cdfdcb2854 add more stub handlers to testee target
Prevent everything from crashing when exercising various commands.
2009-11-28 13:00:39 -08:00
Zachary T Welch
070259cadb explode tcl_target_func into many handlers
Eliminate the monolithic tcl_target_func by registering each of its
commands using the new chained command registration mechanism.

Also chains the target's commands under the CPU command, though these
may not work properly without some further modification.
2009-11-28 13:00:39 -08:00
Zachary T Welch
cb8d567b75 split jim_target into multiple handlers
The 'target' command group was implemented using its own command
dispatching, which can be eliminated by using the new chained command
registration mechanism.  This patch splits the jim_target() function
into individual handlers, which makes them to be visible to the help and
usage commands.  These one-trick handlers are much easier to understand.
2009-11-28 13:00:39 -08:00
David Brownell
5f0223423d ARM11: fix warning on amd64
Previous version of JTAG_DEBUG() macro hid this bug.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-28 11:55:00 -08:00
David Brownell
30f6142fc8 ARM11: fix dbgtap JTAG_DEBUG
There is no DEBUG() macro; don't call one!  Always at
least *parse* debug code, to help prevent such errors.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-28 11:28:17 -08:00
David Brownell
acbe054a38 target: uplevel add_{break,watch}point() error checks
In target_type.h it's documented that the target must be
halted for add_breakpoint() ... and with slight ambiguity,
also for its add_watchpoint() sibling.  So rather than
verifying that constraint in the CPU drivers, do it in the
target_add_{break,watch}point() routines.

Add minor paranoia on the remove_*point() paths too:  save
the return value, and print it out in in the LOG_DEBUG message
in case it's nonzero.

Note that with some current cores, like all ARMv7 ones I've
looked at, there's no technical issue preventing watchpoint or
breakpoint add/remove operations on active cores.  This model
seems deeply wired into OpenOCD though.

ALSO:  the ARM targets were fairly "good" about enforcing that
constraint themselves.  The MIPS ones were relied on other code
to catch such stuff, but it's not clear such code existed ...
keep an eye out for new issues on MIPS.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-28 10:40:26 -08:00
David Brownell
68889ea02f target: remove unused TARGET_EVENT_OLD_* symbols
Just two *_OLD_* symbols left...

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-28 10:36:32 -08:00
David Brownell
e0cb27df6b Cortex-A8: support "reset-assert" event
Use the new "reset-assert" event; else SRST; else fail.
Tested on an OMAP3, using the event.

NOTE:  still doesn't handle "reset halt".  For some reason
neither VCR nor PRCR seemed effective; they held the value
that was written, but VCR didn't trigger debug entry when
the reset vector fired (maybe the vector needs configuring?)
and PRCR refused to hold the chip in reset until deassert()
could force the core into debug state.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-27 18:50:26 -08:00
David Brownell
4e56a2303b target: groundwork for "reset-assert" event
This defines a "reset-assert" event and a supporting utility
routine, and documents both how targets should implement it
and how config scripts should use it.  Core-specific updates
are needed to make this work.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-27 18:50:20 -08:00
David Brownell
4d2750e571 ARM11: write_memory() avoids increment check
When writing to a chip's "reset yourself" register, the ARM11 code
was reporting a spurious failure.  Just don't bother checking for
correctly incremented pointers given single-unit writes ... it's
a bit faster that way too.  (Reads should likely do the same thing.
For that matter, such checks are usually just a waste...)

Shrink an overlong parameter name, and associated lines'o'code.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-27 18:40:37 -08:00
David Brownell
fd5f53f035 XScale: add stub {read,write}_phys routines
Just make these fail, instead of letting them write over
potentially random memory.  Users should be able to work
around the lack of real implementations by disbling the
MMU by hand ... until someone provides a Real Fix.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-26 12:00:56 -08:00
David Brownell
2653b80307 target: create and use target_name()
Several of the sites now using target_type_name() really
ought to be using an instance-specific name.  Create a
function called target_name(), accessing the instance's
own (command) name.

Use it in several places that really should be displaying
instance-specific names.  Also in several places which
were already doing so, but which had no wrapper to call.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-25 16:38:08 -08:00
David Brownell
b715a81f5b target: target_get_name() --> target_type_name()
There are two names that may matter on a per-target basis.
One is a per-instance name (for example, "at91sam7s.cpu").
The other is the name of its type (for example, "arm7tdmi"),
which is shared among multiple targets.

Currently target_get_name() returns the type name, which is
misleading and is rarely appropriate for target diagnostics.
Rename that as target_type_name().

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-25 16:38:08 -08:00
David Brownell
cc53ad81d3 ARM: minor armv4/armv5 cleanup
Lines of 300+ characters are still bad; debug tweaks.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-25 16:18:22 -08:00
David Brownell
21378f58b6 ARM: comment tweaks in ADIv5
"OptimoDE DESS" is ARM's semicustom DSPish stuff.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-25 16:14:45 -08:00
David Brownell
5d244b85e2 ARM7/9: shrink run_algorithm_inner() lines
300+ characters is unreasonable.  So is half that.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-25 16:11:26 -08:00
Zachary T Welch
4946925bea use ARRAY_SIZE macro
Search and destroy lingering cases where the ARRAY_SIZE macro should
be used to convey more intrinsic meaning in the OpenOCD code.
2009-11-25 10:32:00 -08:00
Zachary T Welch
9d4c89f37f add 'testee' target type
Alliteration aside, this should provide the final piece of the puzzle
for developers that want to get started writing a new target type.
In this way, it also seeks to complement the 'dummy' interface driver
and 'faux' NOR flash driver.
2009-11-25 10:29:06 -08:00
Zachary T Welch
17a9dea53a add jim_handler to command_registration
Adding jim_handler field to command_registration allows removing the
register_jim helper.  All command registrations now go through the
register_command{,s}() functions.
2009-11-24 21:37:37 -08:00
Zachary T Welch
f74e2e033a remove register_commands from etm_capture_driver
Converts callback to an array of command_registration records.
Moves oocd_trace driver definition to end of file to eliminate
useless forward declaration.
2009-11-24 21:37:36 -08:00
Zachary T Welch
66ee303456 remove target_type register_command callback
Uses chaining of command_registration structures to eliminate all
target_type register_callback routines.  Exports the command_handler
registration arrays for those target types that are used by others.
2009-11-24 21:37:36 -08:00
Zachary T Welch
144e3678bd xscale: use register_commands() 2009-11-24 21:37:36 -08:00
Zachary T Welch
8a41656391 trace: use register_commands() 2009-11-24 21:37:36 -08:00
Zachary T Welch
5f6962b34f target_request: use register_commands() 2009-11-24 21:37:36 -08:00
Zachary T Welch
4e67912fb0 target: use register_commands() 2009-11-24 21:37:36 -08:00
Zachary T Welch
c3800b5e67 oocd_trace: use register_commands() 2009-11-24 21:37:36 -08:00
Zachary T Welch
a17caa387c etm_dummy: use register_commands() 2009-11-24 21:37:36 -08:00
Zachary T Welch
dd063d9914 etm: use register_commands() 2009-11-24 21:37:36 -08:00
Zachary T Welch
8161fd3163 etb: use register_commands() 2009-11-24 21:37:36 -08:00
Zachary T Welch
97fbd793b3 cortex_m3: use register_commands() 2009-11-24 21:37:36 -08:00
Zachary T Welch
28300bbf6f cortex_a8: use register_commands() 2009-11-24 21:37:36 -08:00
Zachary T Welch
df95fe25a4 armv7m: use register_commands() 2009-11-24 21:37:36 -08:00
Zachary T Welch
d79176e1bc armv7a: use register_commands() 2009-11-24 21:37:35 -08:00