David Brownell [Thu, 3 Dec 2009 06:57:08 +0000 (22:57 -0800)]
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!
David Brownell [Thu, 3 Dec 2009 06:57:08 +0000 (22:57 -0800)]
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.
David Brownell [Thu, 3 Dec 2009 06:57:07 +0000 (22:57 -0800)]
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.
David Brownell [Thu, 3 Dec 2009 06:57:07 +0000 (22:57 -0800)]
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.
David Brownell [Wed, 2 Dec 2009 23:24:14 +0000 (15:24 -0800)]
stubs: buildfix
The new stubs for httpd and ioutil gave errors like:
ioutil_stubs.c: In function ‘ioutil_init’:
ioutil_stubs.c:27: error: implicit declaration of function ‘LOG_DEBUG’
ioutil_stubs.c:28: error: ‘ERROR_OK’ undeclared (first use in this function)
ioutil_stubs.c:28: error: (Each undeclared identifier is reported only once
ioutil_stubs.c:28: error: for each function it appears in.)
Fix.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Zachary T Welch [Wed, 2 Dec 2009 03:58:32 +0000 (19:58 -0800)]
remove #if BUILD_HTTPD
Add httpd_stubs.c to provide no-op implementations of httpd_start()
and httpd_stop().
Allows these routines to be called unconditionally and ensures the
libocdserver ABI remains unchanged regardless of whether this feature
was built-in or not.
Prints a DEBUG message when the stub implementation is included.
David Brownell [Wed, 2 Dec 2009 19:31:32 +0000 (11:31 -0800)]
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>
David Brownell [Wed, 2 Dec 2009 05:47:45 +0000 (21:47 -0800)]
ARM: core DPM support for watchpoints
This is a NOP unless the underlying core exposes two new methods, and
neither of the two cores using this (ARM11xx, Cortex-A8) do so yet.
This patch only updates those cores so they pass a flag saying whether
or not to update breakpoint and watchpoint status before resuming; and
removing some now-needless anti-segfault code from ARM11. Cortex-A8
didn't have that code ... yes, it segfaulted when setting watchpoints.
NOTE: this uses a slightly different strategy for setting/clearing
breakpoints than the ARM7/ARM9/etc code uses. It leaves them alone
unless it's *got* to change something, to speed halt/resume cycles
(including single stepping).
ALSO NOTE: this under-delivers for Cortex-A8, where regions with size
up to 2 GBytes can be watched ... it handles watchpoints which ARM11 can
also handle (size 1/2/4 bytes). Should get fixed later.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
David Brownell [Tue, 1 Dec 2009 08:49:11 +0000 (00:49 -0800)]
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>
David Brownell [Tue, 1 Dec 2009 08:49:04 +0000 (00:49 -0800)]
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>
David Brownell [Tue, 1 Dec 2009 08:48:53 +0000 (00:48 -0800)]
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>
David Brownell [Tue, 1 Dec 2009 08:48:40 +0000 (00:48 -0800)]
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>
Øyvind Harboe [Mon, 30 Nov 2009 08:13:56 +0000 (09:13 +0100)]
main: invoke jtag_interface_quit() explicitly
There is no particular reason to invoke jtag_interface_quit()
on the atexit() handler, it just makes the code more obtuse
and stops other legitimate usage of atexit().
Zachary T Welch [Sun, 29 Nov 2009 00:29:41 +0000 (16:29 -0800)]
improve command prohibition error report
Ensures that the correct information gets displayed, depending on the
mode of the command being denied. Fixes misreporting all commands as
needing to run "before 'init'".
David Brownell [Tue, 1 Dec 2009 03:14:19 +0000 (19:14 -0800)]
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>
David Brownell [Tue, 1 Dec 2009 03:14:19 +0000 (19:14 -0800)]
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>
Zachary T Welch [Mon, 30 Nov 2009 02:39:13 +0000 (18:39 -0800)]
command output capture: do not use interp global
Adds a log_capture_state structure to pass to the log capture
callback used by the command module. Ensures that the capture occurs
in the proper context.
Zachary T Welch [Mon, 30 Nov 2009 00:32:06 +0000 (16:32 -0800)]
make syntax errors respond with 'usage'
The 'help' text will become more verbose, so its entire text will be
far more than desired when you only borked your syntax. The usage
still allows the commands to be looked up for more help.
Zachary T Welch [Sun, 29 Nov 2009 23:58:16 +0000 (15:58 -0800)]
improve command_done() API and docs
command_done() does not need to return an error, but it needed
Doxygen comment. Provide some for copy_command_context as well.
Note: this audit revealed some potential bugs with the command context
implementation. There was a reason that commands were added at the
end of the list. Shallow copying of command_context means that
the list is shared between them. And commands added at the top-level
before the pre-existing commands will not be available in the shared
context as they were before. Yikes!
Fortunately, this does not seem to occur in general use, as
'add_help_text' gets registered in startup.tcl and claims the first slot
in my own test cases. Thus, it seems that we have been masking the issue
for now, but it shows the need for further architectural improvement in
the core command module.
Zachary T Welch [Sun, 29 Nov 2009 22:29:24 +0000 (14:29 -0800)]
only display usable commands in help
With the ability to defer 'init', users can access the help system while
still in CONFIG mode. This patch omits commands from the help and usage
list when they cannot be run in the current command mode, making it much
easier to see what can be done at a given time.
Zachary T Welch [Sun, 29 Nov 2009 22:04:21 +0000 (14:04 -0800)]
allow deferal of init
Adds 'noinit' command to prevent OpenOCD from running 'init' at the end
up startup, allowing it to be given from telnet or TCL. This provides
the old behavior by default, and users can add this command to their
scripts to get the new behavior.