summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
...
* fix 'target init' command registrationZachary T Welch2009-12-021-6/+6
| | | | | The command handler registration was put at the top level, rather than as a subcommand. Move it to where it belongs.
* stubs: buildfixDavid Brownell2009-12-022-0/+2
| | | | | | | | | | | | | | 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>
* remove #if BUILD_HTTPDZachary T Welch2009-12-023-4/+33
| | | | | | | | | | | 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.
* remove BUILD_IOUTIL symbolZachary T Welch2009-12-025-13/+61
| | | | | | | | | | Add ioutil_stubs.c to provide an empty ioutil_init() routine. Add ioutil.h to prevent applications from needing to declare it. Allows unconditionally calling that function during startup, and the resulting libocdhelper library API is now more stable. Prints a DEBUG message when the stub implementation is included.
* remove #if logic for openocd_sleep_*ludeZachary T Welch2009-12-025-19/+45
| | | | | Adds server_stubs.c to hold these routines, using automake logic to ensure it gets included under the right conditions.
* target: factor init to 'target init'Zachary T Welch2009-12-022-5/+25
| | | | Adds 'target init' command handler, called as part of 'init'.
* target: factor target_init() into piecesZachary T Welch2009-12-021-69/+84
| | | | | Moves body of target initialization loop into a helper function, cleaning up its visual flow in the process.
* jtag: factor init into 'jtag init'Zachary T Welch2009-12-022-7/+32
| | | | | Adds 'jtag init' command handler, which can be called as part of a fine-grained 'init' process.
* flash: factor init to 'flash init'Zachary T Welch2009-12-022-3/+25
| | | | Split flash initialiation into 'flash init', called from 'init'.
* mflash: factor init to 'mflash init'Zachary T Welch2009-12-022-3/+25
| | | | Splits mflash initialiation to 'mflash init', called from 'init'.
* nand: factor init to 'nand init'Zachary T Welch2009-12-022-3/+28
| | | | | Split NAND initialization into 'nand init', which gets called from the main 'init' command.
* pld: factor init to 'pld init'Zachary T Welch2009-12-022-2/+26
| | | | Split PLD initialization into 'pld init', which gets called from 'init'.
* ARMv7a/Cortex-A8: report watchpoint trigger insnDavid Brownell2009-12-025-44/+33
| | | | | | | | | | | 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>
* ARM: label SP and LR correctlyDavid Brownell2009-12-021-12/+12
| | | | | | | | | | | 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>
* zy1000: keep up with startup refactoring work.Øyvind Harboe2009-12-021-0/+5
| | | | | | keep up with server_init() introduction. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* Cortex-A8: basic watchpoint supportDavid Brownell2009-12-011-0/+66
| | | | | | | Actually this should handle both breakpoints and watchpoints ... but the DPM framework only handles watchpoints for now. Works on Beagle. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* ARM: core DPM support for watchpointsDavid Brownell2009-12-014-41/+302
| | | | | | | | | | | | | | | | | | | | | 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>
* ARMv7a: move constants out of Cortex-A8 headerDavid Brownell2009-12-012-35/+48
| | | | | | These are architecturally defined, not core-specific. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* zy1000: keep up with latest changes to command handlingØyvind Harboe2009-12-012-7/+5
| | | | | | Keep up with Jim Tcl interpreter creation cleanup. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* command: the Jim interpreter can now be provided rather than createdØyvind Harboe2009-12-013-12/+18
| | | | | | | In embedded hosts, the Jim interpreter can come from the existing context rather than be created by OpenOCD. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* ARM11: remove previous mcr()/mrc() methodsDavid Brownell2009-12-011-75/+0
| | | | | | We don't need this code, now that the DPM code handles it. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* Cortex-A8: remove previous mcr()/mrc() methodsDavid Brownell2009-12-012-104/+1
| | | | | | | | 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>
* ARM: implement mrc()/mcr() as DPM opsDavid Brownell2009-12-011-0/+59
| | | | | | | | | | | | | 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>
* target: "mcr" and "mrc" are ARM-specificDavid Brownell2009-12-019-218/+228
| | | | | | | | | | | | | | 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>
* ARMv7-A: stop using CP15 opsDavid Brownell2009-12-011-5/+36
| | | | | | | | | | | 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>
* Cortex-A8: stop using CP15 opsDavid Brownell2009-12-011-16/+53
| | | | | | | | | | | | | | | | | | | | | 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>
* main: invoke jtag_interface_quit() explicitlyØyvind Harboe2009-12-011-6/+2
| | | | | | | | 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(). Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* improve command prohibition error reportZachary T Welch2009-11-301-2/+10
| | | | | | 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'".
* XScale: restore_context() cleanupDavid Brownell2009-11-301-38/+30
| | | | | | | | | | | 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>
* XScale: context restore, cleanup/bugfixDavid Brownell2009-11-301-15/+29
| | | | | | | | | | | | | | 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>
* remove interp global variable!Zachary T Welch2009-11-303-20/+22
| | | | | | | Finish removing references to the 'interp' global variable from the command module, encapsulating all reference via command_context. Eliminates use of the global entirely, so it can be removed. Hurrah!
* command output capture: do not use interp globalZachary T Welch2009-11-301-15/+34
| | | | | | 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.
* do not extern 'interp' from command.cZachary T Welch2009-11-3011-23/+31
| | | | | Adds 'interp' field to command_context, chasing the few remaining references to the global variable outside of the command module.
* target: avoid using interp global variableZachary T Welch2009-11-302-9/+11
| | | | | Adds 'interp' to target_event_action structure to avoid using the global variable of the same name.
* jtag: avoid using interp global variableZachary T Welch2009-11-302-6/+13
| | | | | Adds 'interp' field to jtag_tap_event_action structure to avoid using the global variable of same name.
* fix foo command group help messagesZachary T Welch2009-11-301-3/+6
| | | | Splits the old help strings to provide proper usage as well.
* make syntax errors respond with 'usage'Zachary T Welch2009-11-302-4/+4
| | | | | | 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.
* move improperly located documentationZachary T Welch2009-11-301-15/+17
| | | | | Somehow, the comment block for command handlers ended up associated with the output_handler. Move it to the command_handler_t declaration.
* improve command_done() API and docsZachary T Welch2009-11-302-6/+19
| | | | | | | | | | | | | | | | | | 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.
* only display usable commands in helpZachary T Welch2009-11-301-0/+3
| | | | | | | 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.
* allow deferal of initZachary T Welch2009-11-301-4/+23
| | | | | | | 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.
* move server_init() to openocd_main()Zachary T Welch2009-11-302-19/+28
| | | | | | | | | Moves the telnet and TCL server startup to server_init(), moving their respective command registration in to server_register_commands(). Adds proper error checking for these particular startup processes. Moves the core server startup to openocd_main(), improving related error checking and preparing to defer 'init'.
* improve gdb_init() sequenceZachary T Welch2009-11-303-35/+49
| | | | | | | | | | | | Rework gdb_init to create flexible APIs (gdb_target_add_{one,all}) and static helper (gdb_target_start) for starting GDB services. Eliminates duplicated code and provides general mechanisms for adding GDB services. The 'init' command is updated to call the new API, and later patches can decouple its policy of adding all targets therein. Provides the new capability to use both piped and TCP servers when multiple targets are defined. The first target fills the pipe, and others will be started on TCP ports (unless disabled, i.e. gdb_port=0).
* zy1000: keep up with changes to command structureØyvind Harboe2009-11-301-0/+1
| | | | | | | | | | | | | Add missing COMMAND_REGISTRATION_DONE. For now the command syntax for zy1000 needs to be compatible across 0.3/0.4, the world outside OpenOCD interfaces to zy1000 using the old syntax. Post 0.4 release(0.4.1 even) I'll switch to subcommand scheme. Switch to subcommands post 0.3 lifecycle. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* XScale: clean up full_context() (#2)David Brownell2009-11-291-39/+30
| | | | | | | 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>
* XScale: clean up full_context() (#1)David Brownell2009-11-291-17/+32
| | | | | | | | | 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>
* XScale: debug entry uses new register mappingDavid Brownell2009-11-291-9/+10
| | | | | | | | 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>
* XScale: initial PXA3xx supportMarek Vasut2009-11-292-11/+39
| | | | | | [dbrownell@users.sourceforge.net: user's guide; variant param is optional] Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* ARM11: fix warning on cygwinDavid Brownell2009-11-291-9/+22
| | | | | | Previous version of JTAG_DEBUG() macro hid this bug. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* bugfix: 'init' changes state, not main()David Brownell2009-11-281-1/+2
| | | | | | | | Code other than main() may invoke "init". When it does so, customized handlers may need to run ... so make sure the command context state is updated before they do so. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>