summaryrefslogtreecommitdiff
path: root/src/server
Commit message (Collapse)AuthorAgeFilesLines
* telnet: fix strage blank spaces at beginning of telnet linesØyvind Harboe2010-01-311-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | Sometimes we saw two strange blank spaces at the beginning of the telnet lines. progress ogress > This patch fixes this problem: progress progress > The code changes are *reasonably* clean, but perhaps it could be made a bit more elegant, but I didn't want to change things after I finished diagnosis/testing & submitting the patch. The problem was that logging can send the text and the newline separately in two different requests and the telnet code would incorrectly remove the prompt from the end of a line. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* gdb_server: handle stepi/continue packet while target is running with more graceØyvind Harboe2010-01-211-9/+14
| | | | | | | | | | Rather than issuing a halt and then stepi/resume, just wait for target to halt. Issue a sterner warning via gdb console that any gdb register changes will be ignored in this case. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* gdb_server: correctly report flash sector sizesDavid Brownell2010-01-201-31/+46
| | | | | | | | | | | | | | | Report each region of same-size sectors separately, instead of incorrectly reporting that every sector has the same size. This is a longstanding bug on NOR flash chips with non-uniform sector sizes. It was largely hidden by other bugs in flash handling. When some of those were recently fixed, this one was exposed as a regression on str710. [oyvind.harboe@zylin.com: update the loop to behave on str7 ] Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com> Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* gdb_server -- subroutinize memory map logicDavid Brownell2010-01-191-107/+116
| | | | | | | | Put the memory map logic into its own subroutine. This will make it a bit easier to package bugfixes, and simplifies the query packet handling. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* gdb_server -- symbol cleanupDavid Brownell2010-01-192-62/+105
| | | | | | | | Make most methods static; net minor object code shrink. Likewise various data symbols; no net change. Shrink some overlong lines. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* GDB: change gdb_breakpoint_override to COMMAND_ANYSpencer Oliver2010-01-141-1/+1
| | | | | | - enable gdb_breakpoint_override to be used within config script. Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
* NOR: add optional "flash erase_address" sector paddingDavid Brownell2010-01-131-3/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a NOR flash mechanism where erase_address ranges can be padded out to sector boundaries, triggering a diagnostic: > flash erase_address 0x0001f980 16 address range 0x0001f980 .. 0x0001f98f is not sector-aligned Command handler execution failed in procedure 'flash' called at file "command.c", line 647 called at file "command.c", line 361 > > flash erase_address pad 0x0001f980 16 Adding extra erase range, 0x0001f800 to 0x0001f97f Adding extra erase range, 0x0001f990 to 0x0001fbff erased address 0x0001f980 (length 16) in 0.095975s (0.163 kb/s) > This addresses what would otherwise be something of a functional regression. An earlier version of the interface had a dangerous problem: it would silently erase data outside the range it was told to erase. Fixing that bug turned up some folk who relied on that unsafe behavior. (The classic problem with interface bugs!) Now they can get that behavior again. If they really need it, just specify "pad". Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* gdbserver: fix typo that broke read/write watchpointØyvind Harboe2010-01-131-2/+8
| | | | | | | | | | | | | It looks like a bugfix from normal breakpoints was not copied over. Do not use clever mathematics and assumptions to convert from GDB enum for break/watchpoints to OpenOCD enum. Drop connection upon unknown breakpoint type, this code path was not really considered by the previous code I think. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* Doxygen file commentsDavid Brownell2010-01-111-1/+10
| | | | | | | Add file comments to a few files. Make the GDB server use more conventional (pointer-free) hex digit conversion. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* shutdown: more graceful shutdownØyvind Harboe2010-01-111-1/+3
| | | | | | | Shutdown is not an error condition, do not return error from main. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* src/server: usage/help/doc updatesDavid Brownell2010-01-094-52/+53
| | | | | | | | | | | | | | | Make "usage" messages use the same EBNF as the User's Guide; no angle brackets. Improve and correct various helptexts. Specifically for the port commands, clarify that the number is optional, and omitting it causes the current number to be displayed. Don't use "&function"; a function's name is its address. Remove a couple instances of pointless whitespace; shrink a few overlong lines. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* gdb: fix regression in gdb_port commandØyvind Harboe2010-01-051-2/+3
| | | | | | | | | | | | | | | | | | | The gdb_port command can be invoked during normal execution to report the port used for gdb, whereas it was listed as CONFIG stage only, which caused an error when excuting it to return the reported error. Also in line with the grander goal of making more commands available during all "modes" (perhaps retiring config mode), there is no particular reason to limit gdb_port to the config stage. Regression was introduced in: b3bf1d12b2fdfba1c1cbee3e1afbfbb27cbd1a26 aka v0.4.0-rc1-32-gb3bf1d1 Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* streamline and document helptext mode displaysDavid Brownell2010-01-021-1/+2
| | | | | | | | | | | | | | | | | | | Most commands are usable only at runtime; so don't bother saying that, it's noise. Moreover, tokens like EXEC are cryptic. Be more clear: highlight only the commands which may (also) be used during the config stage, thus matching the docs more closely. There are - Configuration commands (per documentation) - And also some commands that valid at *any* time. Update the docs to note that "help" now shows this mode info. This also highlighted a few mistakes in command configuration, mostly commands listed as "valid at any time" which shouldn't have been. This just fixes ones I noted when sanity testing. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* whitespace cleanup, mostly for docsAntonio Borneo2009-12-304-351/+351
| | | | | | | | Remove useless space/tab at end of lines. Remove spaces in indentation and replace with tab. Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* cygwin 1.7 build fixesDavid Brownell2009-12-263-9/+9
| | | | | | | | | | | It's less accepting of signed char ... insisting that e.g. tolower() not receive one as a parameter. It's probably good to phase out such usage, given the number of bugs that lurk in the vicinity (assumptions that char is unsigned), so fix these even though such usage is actually legal. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* server: server loop will exhaust data inputs before sleepingØyvind Harboe2009-12-161-17/+31
| | | | | | | | | | By exhausting data on input, the performance will be more consistent + the code more clearly distinguishes between polling and processing. A test showed gdb packet load performance go from ~1550kByte/s to 1650kBytes/s + being more stable. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* server: add server_preinit which is called before config file is parsed.Spencer Oliver2009-12-112-1/+11
| | | | | | | 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>
* gdb_server: use more local variables in inner loop of fetching packetstiny ↵Øyvind Harboe2009-12-111-31/+73
| | | | | | | | | | | | | | | | | | 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>
* gdb_server: make struct gdb_connection privateØyvind Harboe2009-12-112-19/+21
| | | | | | it is only used inside gdb_server.c Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* build: add build/src to include pathØyvind Harboe2009-12-081-0/+1
| | | | | | This allows including generated include files. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* remove flash.h from treeZachary T Welch2009-12-041-1/+1
| | | | | Remove the now vestigial <flash/flash.h> header from the tree, replacing a few references with <flash/nor/core.h>
* remove target.h from flash.hZachary T Welch2009-12-041-0/+1
| | | | | 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.
* fix regressions with GDB port numbersZachary T Welch2009-12-031-3/+11
| | | | | | 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.
* remove tertiary include pathsZachary T Welch2009-12-031-4/+0
| | | | | With all #include directives converted, we only need to have the top-level src/ directory in the search path.
* change #include "server.h" to <server/server.h>Zachary T Welch2009-12-032-2/+2
| | | | | | | | | | | | 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.
* change #include "flash.h" to <flash/flash.h>Zachary T Welch2009-12-031-1/+1
| | | | | | | | | | | | Changes from the flat namespace to heirarchical one. Instead of writing: #include "flash.h" the following form should be used. #include <flash/flash.h> The exception is from .c files in the same directory.
* change #include "target_request.h" to <target/target_request.h>Zachary T Welch2009-12-032-2/+2
| | | | | | | | | | | | Changes from the flat namespace to heirarchical one. Instead of writing: #include "target_request.h" the following form should be used. #include <target/target_request.h> The exception is from .c files in the same directory.
* change #include "target.h" to <target/target.h>Zachary T Welch2009-12-032-2/+2
| | | | | | | | | | | | 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.
* change #include "register.h" to <target/register.h>Zachary T Welch2009-12-031-1/+1
| | | | | | | | | | | | Changes from the flat namespace to heirarchical one. Instead of writing: #include "register.h" the following form should be used. #include <target/register.h> The exception is from .c files in the same directory.
* change #include "image.h" to <target/image.h>Zachary T Welch2009-12-031-1/+1
| | | | | | | | | | | | Changes from the flat namespace to heirarchical one. Instead of writing: #include "image.h" the following form should be used. #include <target/image.h> The exception is from .c files in the same directory.
* change #include "breakpoints.h" to <target/breakpoints.h>Zachary T Welch2009-12-031-1/+1
| | | | | | | | | | | | Changes from the flat namespace to heirarchical one. Instead of writing: #include "breakpoints.h" the following form should be used. #include <target/breakpoints.h> The exception is from .c files in the same directory.
* change #include "jtag.h" to <jtag/jtag.h>Zachary T Welch2009-12-031-1/+1
| | | | | | | | | | | | 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.
* change #include "log.h" to <helper/log.h>Zachary T Welch2009-12-032-2/+2
| | | | | | | | | | | | 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.
* stubs: buildfixDavid Brownell2009-12-021-0/+1
| | | | | | | | | | | | | | 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-022-0/+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 #if logic for openocd_sleep_*ludeZachary T Welch2009-12-023-0/+45
| | | | | Adds server_stubs.c to hold these routines, using automake logic to ensure it gets included under the right conditions.
* remove interp global variable!Zachary T Welch2009-11-301-1/+1
| | | | | | | 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!
* do not extern 'interp' from command.cZachary T Welch2009-11-305-13/+20
| | | | | Adds 'interp' field to command_context, chasing the few remaining references to the global variable outside of the command module.
* move server_init() to openocd_main()Zachary T Welch2009-11-301-1/+15
| | | | | | | | | 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-302-34/+48
| | | | | | | | | | | | 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).
* fix typos in source filesUwe Hermann2009-11-263-8/+8
| | | | | | Correct some spelling errors in source comments and printed output. Signed-off-by: Zachary T Welch <zw@superlucidity.net>
* target: create and use target_name()David Brownell2009-11-251-5/+5
| | | | | | | | | | | | | 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>
* target: target_get_name() --> target_type_name()David Brownell2009-11-251-2/+2
| | | | | | | | | | | | | 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>
* httpd: use register_commands()Zachary T Welch2009-11-243-15/+49
| | | | | | | Updates httpd_start() to use register_commands() for 'readform' and 'writeform' commands. Adds server/httpd.h to export the new signatures for this function (and httpd_stop), which allows removing the obsoleted declarations inside openocd.c.
* server: use register_commandsZachary T Welch2009-11-244-45/+95
| | | | Converts server directory to use new command registration paradigm.
* use COMMAND_REGISTER macroZachary T Welch2009-11-244-10/+10
| | | | | Replaces direct calls to register_command() with a macro, to allow its parameters to be changed and callers updated in phases.
* improve startup tcl scriptsZachary T Welch2009-11-241-0/+2
| | | | | Fix a couple of layering violations missed in the last round. Add missing comment headers.
* use COMMAND_PARSE_ENABLE macro where appropriateZachary T Welch2009-11-181-42/+3
| | | | | | | | Updates all command parsing of simple "enable" and "disable" arguments. A few case in the tree use a tri-state or extended arguments, which cannot use this simple macro. Simlifies the xscale icache/dcache command handler logic.
* split startup.tcl file across modulesZachary T Welch2009-11-182-0/+9
| | | | | | | Moves definitions for each layer into their own file, eliminating layering violations in the built-in TCL code. Updates src/Makefile.am rules to include all files in the final startup.tcl input file, and others Makefile.am rules to distribute the new files in our packages.
* command_handler: change 'cmd_ctx' to CMD_CTXZachary T Welch2009-11-172-2/+2
| | | | Convert all command handler 'cmd_ctx' parameter usage with CMD_CTX.