summaryrefslogtreecommitdiff
path: root/src/target
Commit message (Collapse)AuthorAgeFilesLines
* error handling: the error number is not part of the user interfaceØyvind Harboe2011-01-034-7/+8
| | | | | | | | Do not propagate error number to user. This is for internal programming purposes only. Error messages to the user is reported as text via LOG_ERROR(). Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* CORTEX A8: Fix broken CPU identificationMarek Vasut2010-12-301-3/+17
| | | | | | | This patch fixes the issue where the OMAP CPU (and possibly others) was mistaken for iMX51 and therefore had misadjusted debug base. Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
* Compilation Warnings on OS X 10.5Andrew MacIsaac2010-12-294-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I received a number of "-Wshadow" related warnings (treated as errors) while trying to build on OS X Leopard. In addition, there were two miscellaneous other warnings in the flash drivers. Attached are two patches which correct these issues and the commit messages to accompany them. My system has the following configuration (taken from uname -a): Darwin 9.8.0 Darwin Kernel Version 9.8.0: Wed Jul 15 16:55:01 PDT 2009; root:xnu-1228.15.4~1/RELEASE_I386 i386 === Werror_patch.txt Commit Message === compilation: fixes for -Wshadow warnings on OS X These changes fix -Wshadow compilation warnings on OS X 10.5.8 Compiled with the following configure command: ../configure --prefix=/usr/local --enable-maintainer-mode --enable-jlink --enable-ft2232_libftdi === flash_patch.txt Commit Message === compilation: fixes for flash driver warnings on OS X These changes fix two compilation warnings on OS X 10.5.8: ../../../../src/flash/nor/at91sam3.c:2767: warning: redundant redeclaration of 'at91sam3_flash' ../../../../src/flash/nor/at91sam3.c:101: warning: previous declaration of 'at91sam3_flash' was here and ../../../../src/flash/nor/stmsmi.c:205: warning: format not a string literal and no format arguments Compiled with the following configure command: ../configure --prefix=/usr/local --enable-maintainer-mode --enable-jlink --enable-ft2232_libftdi === Andrew
* warnings: use more 'const' for char *Øyvind Harboe2010-12-299-10/+10
| | | | Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* target: do not expose error numbers to usersØyvind Harboe2010-12-291-6/+0
| | | | | | | error numbers are only reported at DEBUG log levels and used internally, they are not part of the user interface. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* initial SWD transport (SWD infrastructure #2)David Brownell2010-12-243-8/+284
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This piggy backs on JTAG so it's not yet pretty, but that seems unavoidable so far given today's OpenOCD internals. SWD init and data transfer are unfinished and untested, but that should cause no regressions, and will be addressed by the time drivers start using this infrastructure. Checking in whould get the code working better sooner, and turn up any structural/architectural issues while they're easier to fix. The debug adapter drivers will provide simple SWD driver structs with methods that kick in as needed (instead of JTAG). So far just one adapter driver has been updated (not yet ready to use or circulate). The biggest issues are probably - fault handling, where the ARM Debug Interface V5 pipelining needs work in both JTAG and SWD modes and - missing rewrite of block I/O code to work on both of our Cortex-ready transports (Current code is hard-wired to JTAG); relates also to the pipelining issue. - omitted support to activate/deactivate SWO/SWV trace (this is technically trivial, but configuring what to trace is NOT. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> ---- doc/openocd.texi | 17 ++ src/jtag/core.c | 3 src/jtag/interface.h | 4 src/jtag/jtag.h | 2 src/jtag/swd.h | 114 +++++++++++++++++++ src/jtag/tcl.c | 2 src/target/adi_v5_swd.c | 281 ++++++++++++++++++++++++++++++++++++++++++++++-- src/target/arm_adi_v5.c | 8 + src/target/arm_adi_v5.h | 3 9 files changed, 425 insertions(+), 9 deletions(-)
* config: add init_targets proc that is executed just before initØyvind Harboe2010-12-221-0/+8
| | | | | | | | | | | this allows configuration scripts to export a init_targets proc rather than setting up the target directly. This allows for new conventions in how to set up target vs. board script and how to transfer default settings between board and target scripts. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* xscale: trace buffer remains enabled until explicitly disabledMike Dunn2010-12-042-54/+97
| | | | | | | | | | | | | | | | | | | | | Hi everyone, Since a call went out for patches... been sitting on this for months. For some reason, the xscale trace buffer is automatically disabled as soon as a break occurs and the trace data is collected. This patch was a result of the frustration of always re-enabling it, or else hitting a breakpoint and checking the trace data, only to discover that I forgot to re-enable it before resuming. Don't see why it should work this way. There is no run-time penalty, AFAIK. Along the way, I also cleaned up a little by removing the ugly practice of recording wrap mode by setting the fill count variable to "-1", replacing it with an enum that records the trace mode. I've been using this for months. Comments, criticisms gratefully received. Mike Signed-off-by: Mike Dunn <mikedunn@newsguy.com>
* cortex_m3: change cortec_m3 reset_config behaviourSpencer Oliver2010-12-032-19/+2
| | | | | | | | | Currently the cmd 'cortex_m3 reset_config' will overide the default target's 'reset_config'. Chnage the behaviour to use the target 'reset_config' if configured and fallback if not. Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
* profile: use 100Hz as a default sampling frequencyØyvind Harboe2010-12-011-2/+2
| | | | | | | | it's a lie that is somewhere in the vicinity of the truth. Certainly 64MHz confuses gprof and produces zero output and no error messages. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* fastload: fix error handling upon running out of memoryØyvind Harboe2010-11-221-6/+16
| | | | Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* build: add common.mkSpencer Oliver2010-11-181-4/+1
| | | | | | | Rather than specifying common makefile variables move them all to a common.mk. Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
* cortex_m3: report detected error condition in pollØyvind Harboe2010-11-091-6/+13
| | | | | | | | | | | | If the CPU crashed at some point, poll will discover this. Previously the poll fn would clear the error and print a warning, rather than propagating the error. The new behavior is to report the error back up, but still clear the error. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* target: document that target_poll() will report and clear sticky errorsØyvind Harboe2010-11-091-0/+12
| | | | Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* CortexA8: Implement debug base autodetectionMarek Vasut2010-11-051-7/+12
| | | | | | | Implement autodetection of debug base. Also, implement a function solving various hardware quirks (like iMX51 ROM Table location bug). Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
* ADIv5: Implement function to lookup CoreSight componentMarek Vasut2010-11-052-0/+45
| | | | | | | This patch implements "dap_lookup_cs_component()", which allows to lookup CS component by it's identification. Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
* ADIv5: Introduce function to detect ROM Table locationMarek Vasut2010-11-052-27/+56
| | | | | | | | | | | This patch adds function called "dap_detect_debug_base()", which should be called to get location of the ROM Table. By walking ROM Table, it's possible to discover the location of DAP. Sadly, some CPUs misreport this value, therefore I had to introduce an fixup table, which will be used in case such CPU is detected. Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
* arm964e: Add support for ARM946E target.ddraskovic2010-11-044-0/+769
| | | | | | | | | | | | | | | | | So far most of the people have been using existing ARM966E in the place of ARM946E, because they have practically the same scan chains. However, ARM946E has caches, which further complicates JATG handling via scan-chain. this was preventing single-stepping for ARM946E when SW breakpoints are used. This patch thus introduces : 1) Correct cache handling on memory write 2) Possibility to flush whole cache and turn it off during debug, or just to flush affected lines (faster and better) 3) Correct SW breakpoint handling and correct single-stepping 4) Corrects the bug on CP15 read and write, so CP15 values are now correctly R/W
* jim tests: use installedØyvind Harboe2010-10-294-31/+46
| | | | Delete obsolete jim that comes with OpenOCD.
* src: add loader src descriptionSpencer Oliver2010-10-283-0/+6
| | | | | | - add comment where to find the various loaders src files. Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
* Make systesetreq typos read sysresetreq insteadPeter Stuge2010-10-251-1/+1
| | | | Signed-off-by: Peter Stuge <peter@stuge.se>
* TARGET: review handle_load_image_command()Antonio Borneo2010-10-121-16/+8
| | | | | | | | Collect variable definitions. Report syntax error to command dispatcher. Propagate error when unable to open file. Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
* TARGET: fix segfault in handle_dump_image_command()Antonio Borneo2010-10-121-3/+3
| | | | | | | The struct fileio is used after fileio_close(). Move fileio_close() after last usage. Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
* fileio: fileio_size() can now failØyvind Harboe2010-09-293-6/+37
| | | | | | Part of making the fileio API more robust. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* fileio: refactor struct fileio to be an opaque structureØyvind Harboe2010-09-293-6/+6
| | | | Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* image: fix spelling mistakeØyvind Harboe2010-09-272-13/+13
| | | | | | struct imageection => struct imagesection Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* jtagdp: remove #if 0'd kludges and explain why the code is correctØyvind Harboe2010-09-211-16/+24
| | | | | | | | | short story: if the JTAG clock is too high, then the behavior will be flaky and kludging the code may seem to make things beter, but really it's just a red herring. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* embeddedice: fix error handlingØyvind Harboe2010-09-211-0/+4
| | | | | | error is now reported at failure site. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* warnings: fix alignment warningsØyvind Harboe2010-09-208-15/+15
| | | | | | | These warnings are for architectures that do not support non-aligned word access. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* xscale: check that wp length does not exceed addressMike Dunn2010-09-201-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Hi everyone, A while back I sent in a patch that adds support for watchpoint lengths greater than four on xscale. It's been working well, until the other day, when it caused an unexpected debug exception. Looking into this I realized there is a case where it breaks: when the length arg is greater than the base address. This is a consequence of the way the hardware works. Don't see a work-around, so I added code to xscale_add_watchpoint() to check for and disallow this combination. Some more detail... xscale watchpoint hardware does not support a length directly. Instead, a mask value can be specified (not to be confused with the optional mask arg to the wp command, which xscale does not support). Any bits set in the mask are ignored when the watchpoint hardware compares the access address to the watchpoint address. So as long as the length is a power of two, setting the mask to length-1 effectively specifies the length. Or so I thought, until I realized that if the length exceeds the base address, *all* bits of the base address are ignored by the comaparator, and the watchpoint range effectively becomes 0 .. length. Questions, comments, criticisms gratefully received. Thanks, Mike Signed-off-by: Mike Dunn <mikedunn@newsguy.com>
* xscale: bp/wp: additional LOG_ERROR on failureMike Dunn2010-09-201-6/+10
| | | | | | | | | | | | | | | | | | | | | Hi everyone, Added more LOG_ERROR messsages to watchpoint and breakpoint code, given that the infrastructure no longer interprets returned error codes. Also changed existing LOG_INFO and LOG_WARNING to LOG_ERROR for cases where an error is returned. Note that the check of the target state is superflous, since the infrastruture code currently checks this before calling target code. Is this being reconsidered as well? Also, should we stop returning anything other than ERROR_OK and ERROR_FAIL? Comments gratefully received. Thanks, Mike Signed-off-by: Mike Dunn <mikedunn@newsguy.com>
* breakpoints: fix error handlingØyvind Harboe2010-09-141-29/+7
| | | | | | | | do not try to interpret "retval" into a string, just amend a bit about the context of the already reported error. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* xscale: fix sw breakpoints for thumb; set bp immediatelyMike Dunn2010-09-131-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Hi everyone, Version 2 of this patch. Code added to breakpoints.c was removed from previous patch, and item 3 added, per discussion with Øyvind regarding error reporting. Item 4 added, which I just noticed. I tried to use a software breakpoint in thumb code on the xscale for the first time recently, and was surprised to find that it didn't work. The result was this patch, which does four things: 1): fix trivial cut-n-paste error that caused thumb breakpoints to not work 2): call xscale_set_breakpoint() from xscale_add_breakpoint() 3): log error on data abort in xscale_write_memory() 4): fixed incorrect error code returned by xscale_set_breakpoint() when no breakpoint register is available; added comment Item 2 not only makes the xscale breakpoint code consistent with other targets, but also alerts the user immediately if an error occurs when writing the breakpoint instruction to target memory (previously, xscale_set_breakpoint() was not called until execution resumed). Also, calling xscale_breakpoint_set() as part of the call chain starting with handle_bp_command() and propagating the return status back up the chain avoids the situation where OpenOCD "thinks" the breakpoint is set when in reality an error ocurred. Item 3 provides a helpful message for a common reason for failure to set sw breakpoint. This was thoroughly tested, mindful of the fact that breakpoint management is somewhat dicey during single-stepping. Comments and criticisms of course gratefully received. Mike Signed-off-by: Mike Dunn <mikedunn@newsguy.com> Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* propagate return status of set_breakpoint() up call chainMike Dunn2010-09-133-9/+5
| | | | | | | | | | | | | | | | | | | | | | | | | Hi everyone, I figured since I was poking around in the breakpoint code on other arches, I'd add this change to those arches that don't do it already. This patch propagates the return code of <arch>_set_breakpoint() up the call stack. This ensures that the higher layer breakpoint infrastructure is aware that an error ocurred, in which case the breakpoint is not recorded. Normally I wouldn't touch code that I can't test, but the code is very uniform across architectures, and the change is rather benign, so I figured after careful inspection that it is safe. If the maintainers or others think this is imprudent, the patch can be dropped. Also changed the error code to something more appropriate in two cases where hardware resources are unavailable. Comments and criticisms of course gratefully received. Mike Signed-off-by: Mike Dunn <mikedunn@newsguy.com> Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* xscale: mark xscale registers invalid on debug entryMike Dunn2010-09-091-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | Hi everyone, This simple patch fixes a problem I noticed on the xscale where incorrect values are sometimes reported by the reg command. The problem can occur when requesting the value of registers in the xscale-specific register cache. With a couple of exceptions, none of the registers in the xscale register cache are automatically retrieved on debug entry. This is probably fine, as they are unlikely to be needed on a regular basis during a typical debug session, and they can be retrieved when explicitly requested by name using the reg command. The problem is that once this is done, the register remains marked as valid for the remainder of the OpenOCD session, and the reg command will henceforth always report the same value because it is obtained from the cache and is never again retrieved from the debug handler on the target. The fix is to mark all registers in the xscale register cache as invalid on debug entry (before the two exceptions are retrieved), thus forcing retrieval (when requested) from the target across resumptions in execution, and avoiding the reporting of stale values. Small addition change by Øyvind: change 'i' to unsigned to fix compiler warning for xscale_debug_entry() fn. Signed-off-by: Mike Dunn <mikedunn@newsguy.com> Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* cortex m3: add cortex_m3 reset_config cmdSpencer Oliver2010-08-312-51/+84
| | | | | | | | | | | | This new cmd adds the ability to choose the Cortex-M3 reset method used. It defaults to using SRST for reset if available otherwise it falls back to using NVIC VECTRESET. This is known to work on all cores. Move any luminary specific reset handling to the stellaris cfg file. Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
* avr32: work-in-progressOleksandr Tymoshenko2010-08-1510-0/+1769
| | | | | | | | | | | | | committed so as to ease cooperation and to let it be improved over time. So far it supports: - halt/resume - registers inspection - memory inspection/modification I'm still getting up to speed with OpenOCD internals and AVR32 so code is a little bit messy and I'd appreciate any feedback.
* tcl: remove silly ocd_ prefix to array2mem and mem2arrayØyvind Harboe2010-08-111-2/+2
| | | | | | | | ocd_ prefix is used internally in OpenOCD as a kludge more or less to deal with the two kinds of commands that OpenOCD has. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* debug: use assert's when approperiateØyvind Harboe2010-08-112-4/+2
| | | | | | error was returned instead of using assert. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* arm: add missing error reportingØyvind Harboe2010-08-113-1/+28
| | | | | | | when an unknown core mode is read from the target, report error. Can be communication failure. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* arm7/9: fix "reset run + halt"Øyvind Harboe2010-08-092-11/+27
| | | | | | | | | | | | | | | | if polling is off, then "reset run + halt" would fail since halt incorrectly assumed the target was in the reset state as it is the internal poll implementation that moves the sw tracking of the target state out of the reset state. To reproduce: > reset run; halt JTAG tap: zy1000.cpu tap/device found: 0x1f0f0f0f (mfg: 0x787, part: 0xf0f0, ver: 0x1) BUG: arm7/9 does not support halt during reset. This is handled in arm7_9_assert_reset() Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* target: if polling fails, back offØyvind Harboe2010-08-091-8/+29
| | | | | | | | | | | | back-off algorithm for polling. Double polling interval up to 5000ms when it fails. when polling succeeds, reset backoff. This avoids flooding logs(as much) when working with conditions where the target polling will fail. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* verify_image: print out a statement that there are no further errorsØyvind Harboe2010-08-021-1/+10
| | | | | | | | | It is useful to know that the printed errors are *all* the errors there were. Added missing error handling(found by inspection). Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* mips32: exit_point optional for mips32_run_algorithmSpencer Oliver2010-07-201-1/+1
| | | | | | | | | As the mips32 uses instruction breakpoints for algorithms we do not really need to check the pc on exit. This now matches the behaviour of the arm codebase. Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
* armv7m: exit_point optional for armv7m_run_algorithmSpencer Oliver2010-07-201-1/+1
| | | | | | | | | As the armv7m uses instruction breakpoints for algorithms we do not really need to check the pc on exit. This now matches the behaviour of the arm4_5 codebase. Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
* armv4_5: add algorithms instruction breakpoint supportSpencer Oliver2010-07-201-6/+16
| | | | | | | Update the arm_checksum_memory and arm_blank_check_memory algorithms to use a breakpoint instruction on v5 arch. Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
* arm11 error propagation fixesØyvind Harboe2010-07-203-29/+32
| | | | Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* arm_jtag_scann error propagation fixesØyvind Harboe2010-07-205-12/+34
| | | | Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* arm_dpm: error propagation fixesØyvind Harboe2010-07-191-2/+26
| | | | | | found by inspection Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* adi_jtag_ error propagationØyvind Harboe2010-07-191-4/+12
| | | | Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>