aboutsummaryrefslogtreecommitdiff
path: root/src/target/arm_adi_v5.c
AgeCommit message (Collapse)AuthorFilesLines
2014-03-07target: "dap info" command cosmetic output changesBrad Riensche1-18/+15
This makes the listing easier to read, imho. The tab indentation technique causes the base address to precess as the parser proceeds through the subtables, and can easily wrap. Change-Id: Iea5e678255e6314a9d532e4b222a2572b5394390 Signed-off-by: Brad Riensche <brad.riensche@gmail.com> Reviewed-on: http://openocd.zylin.com/1518 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2014-03-07targets: Print nested ROM tables with the 'dap info' command.Chris Johns1-344/+382
Move the ROM table printing into a separate function to allow recursive calls with nested tables. ROM tables can nest. The printing is limited to 16 levels. Update the types of tables printed. When an entry can't be read, print a warning and continue. Change-Id: Ib134edd9e987af2f5f606071521885b17af4d70f Signed-off-by: Chris Johns <chrisj@rtems.org> Reviewed-on: http://openocd.zylin.com/1427 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2014-01-11adi_v5: Remove unnecessary MEM-AP access functionsAndreas Fritiofson1-76/+12
It's far nicer to pass a size parameter than to split the calls to separate wrappers which are combined to a single function anyway. Change-Id: I716741ebf916f6f8e9358a31c8f4fe761107c82f Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/1847 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-12-22kinetis : Add timeouts to flash status checking in dap_syssec_kinetis_mdmap().Per Ekman1-4/+24
Change-Id: Ifc8fe7aa4c2a40a78fa0655435e82418f549bad3 Signed-off-by: Per Ekman <pekenator@gmail.com> Reviewed-on: http://openocd.zylin.com/1819 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-11-08kinetis : Fix broken check for mass erase.Per Ekman1-6/+8
If the flash is not ready (MDM_STAT_FREADY is 0) then dap_syssec_kinetis_mdmap() would act as if the MDM_STAT_SYSSEC bit was set and erase the flash. Wait until MDM_STAT_FREADY is set before checking the MDM_STAT_SYSSEC bit. Change-Id: I5c3352f625599016625ed9be8787033f49bfacea Signed-off-by: Per Ekman <pekenator@gmail.com> Reviewed-on: http://openocd.zylin.com/1762 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-10-31Clean up many C99 integer types format specifiersPaul Fertser1-7/+7
This eliminates most of the warnings reported when building for arm-none-eabi (newlib). Hsiangkai, there're many similar warnings left in your nds32 files, I didn't have the nerve to clean them all, probably you could pick it up. Change-Id: Id3bbe2ed2e3f1396290e55bea4c45068165a4810 Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/1674 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-10-02arm_adi_v5: Rewrite MEM-AP transfer implementationAndreas Fritiofson1-472/+224
Create a single pair of relatively simple functions to handle all variants of MEM-AP transfers. This replaces the many separate functions that handled different access sizes and packed or non-packed transfers, which were all implemented rather differently. With this single implementation, performance should be more consistent, regardless of transfer type. Change-Id: I89960e437fc6ba68a389c074fab8eac91abcf844 Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/1658 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-10-02arm_adi_v5: Fix packed transfers crossing TAR auto-increment blockAndreas Fritiofson1-6/+5
The word count returned from max_tar_block_size() was compared with the count of half-word/bytes in the u16 and u8 packed access functions, causing an infinite loop if the access actually crossed the boundary. Change max_tar_block_size() to return a byte count, and scale at the call site. Change-Id: I2fe9b5941eb485f3d8219cfdd29fb71e02006de4 Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/1649 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-10-02arm_adi_v5: Fix packed and unaligned memory writesAndreas Fritiofson1-68/+37
For packed and/or unaligned accesses, the write functions reordered the source buffer in place. Causing in the best case a segfault, in the worst case silent data corruption. Rewrite the data fetching to directly match the byte lane mapping according to IHI0031C, without destroying the buffer. Also slightly clean up variable usage and harmonize all the write functions. Change-Id: I9a01cfc5578653f9ec02043ff6b61a7a20f90d67 Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/1646 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-09-20adiv5: check packed transfers are supportedSpencer Oliver1-4/+27
Currently we try and use MEM-AP packed transfers as much as possible for 8/16bit transfers. However not all targets support packed transfers, so check before using. Change-Id: I66256007f25ccd0c583f23db5acf6d1aa8b5e57d Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/1602 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2013-06-05update files to correct FSF addressSpencer Oliver1-1/+1
Change-Id: I429f7fd51f77b0e7c86d7a7f110ca31afd76c173 Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/1426 Tested-by: jenkins Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2013-04-11arm_adi_v5: fix for csw nonsecure access.Michel JAOUEN1-1/+43
Add command to fix CSW_SPROT in register AP_CSW. This solves dap apmem access in non secure access. Change-Id: I7cfcb6434d75f5cfd4a2630a059901cdeea010ce Signed-off-by: Michel JAOUEN <michel.jaouen@stericsson.com> Reviewed-on: http://openocd.zylin.com/1276 Tested-by: jenkins Reviewed-by: mike brown Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-04-02arm_adi_v5: fix mem_ap_read_buf_u32() JTAG nastiness..mike brown1-39/+1
Moved JTAG code out of transport-neutral file (arm_adi_v5.c) into transport specific file (adi_v5_jtag.c). Added ap_block_read to dap_ops interface (arm_adi_v5.h) to support the move. Change-Id: I796d3984f138aad052b97c77ac9c12ffd1158f74 Signed-off-by: mike brown <mike@theshedworks.org.uk> Reviewed-on: http://openocd.zylin.com/1277 Tested-by: jenkins Reviewed-by: Michel JAOUEN <michel.jaouen@stericsson.com> Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-03-15adi_v5: search for Debug and Memory AP supportEvan Hunter1-0/+54
Adds dap_find_ap() function. Change-Id: I6643025624009b12d4936de67a605da52c07be49 Signed-off-by: Evan Hunter <ehunter@broadcom.com> Reviewed-on: http://openocd.zylin.com/909 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-03-15cortex_a : optimize apb read/write access.Evan Hunter1-9/+34
Rewrite: Adheres more closely to 'fast read/write' examples in TRM. up to 50x faster Change-Id: Ieb4da57d8367628f3e7306827a5b1f0ab550e641 Signed-off-by: Evan Hunter <ehunter@broadcom.com> Reviewed-on: http://openocd.zylin.com/903 Tested-by: jenkins Reviewed-by: Michel JAOUEN <michel.jaouen@stericsson.com> Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com> Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2012-11-30arm: Mis-aligned data issue fix.Jason Moehlman1-2/+3
Fixes issue with big endian hosts and mis-aligned data on some hosts. Fixes unaligned access exception on hosts that do not support unaligned access when debugging some arm targets. Signed-off-by: Jason Moehlman <jmoehlma@linux-software.com> Change-Id: I6bc6fb1b3c3565b256674b9ef43ed2afd14f5178 Reviewed-on: http://openocd.zylin.com/996 Tested-by: jenkins Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
2012-09-27Add extra Coresight component ROM identifiers for the Cortex-M4Evan Hunter1-0/+12
Signed-off-by: Evan Hunter <ehunter@broadcom.com> Change-Id: Iaf2d69cf10c341d3a516986677f69a4389b29b1a Reviewed-on: http://openocd.zylin.com/841 Tested-by: jenkins Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com> Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2012-08-24target: catch dap_lookup read errorSpencer Oliver1-0/+2
Issue found by clang-3.1 Change-Id: I2e922ec83117e75db5bec1e82edaa75a9e6e7464 Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/778 Tested-by: jenkins Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-05-14stlink: add armv7m stlink handlingSpencer Oliver1-8/+0
This enables us to better handle some of the low level functions that the stlink does not support. It also enables us to share a few more of the standard cortex_m3 functions if necessary. Change-Id: I7a2c57450122012ec189245d8879d8967913e00e Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/637 Tested-by: jenkins
2012-04-10topic: add reset functions for SWDSimon Qian1-4/+2
Add swd_init_reset and swd_add_reset. Add adapter_assert_reset and adapter_deassert_reset, and call them instead of JTAG reset functions. Change-Id: Ib2551c6fbb45513e0ae0dc331cfe3ee3f922298a Signed-off-by: Simon Qian <simonqian.openocd@gmail.com> Reviewed-on: http://openocd.zylin.com/526 Tested-by: jenkins Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com> Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2012-03-14stm32: determine all cpu types and use common examineMathias K1-0/+8
This patch determine all cpu types and not only the cortex M3 and the stm32 target use the common target examine function from the cortex_m sources. Change-Id: If689dd994b3855284b927fc4b206f420cf32b6c7 Signed-off-by: Mathias K <kesmtp@freenet.de> Reviewed-on: http://openocd.zylin.com/511 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2012-02-06build: cleanup src/target directorySpencer Oliver1-217/+119
Change-Id: Ia055b6d2b5f6449a38afd0539a8c66e7d7e0c059 Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/430 Tested-by: jenkins
2012-01-18cmd: add missing usage varsSpencer Oliver1-0/+1
we should have caught them all - hopefully. Change-Id: I35435317fccaf5ad0216244d69f76db6857bb582 Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/381 Tested-by: jenkins Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
2012-01-04retire ERROR_INVALID_ARGUMENTS and replace with ERROR_COMMAND_SYNTAX_ERRORØyvind Harboe1-5/+5
Change-Id: I6dee51e1fab1944085391f274a343cdb9014c7a4 Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com> Reviewed-on: http://openocd.zylin.com/300 Tested-by: jenkins Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com> Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2011-10-24warning: silence gcc by initializing local variablesØyvind Harboe1-1/+1
GCC doesn't understand that these are in fact initialized if they are used. Change-Id: I01988adb0547f785b48d869ddbe44cc17dca4739 Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com> Reviewed-on: http://openocd.zylin.com/116 Tested-by: jenkins Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
2011-09-23kinetis : fix deadlock on device having hasidcode false.Michel Jaouen1-3/+1
2011-09-16kinetis auto mass erase on secured devicesMathias K1-0/+182
This is a proof of concept to get access to the debug port of a secured kinetis cpu. On full flash erase the cpu is automatically secured and the debug port is not accessible. To get this to work the srst line is needed and the necessary configuration should be added to the configuration file.
2011-06-04Fix "unused variable" warnings (errors) detected with GCC 4.7.0 - trivial fixesFreddie Chopin1-4/+2
2011-04-01cortex_a: remove broken dbgbase patchup codeØyvind Harboe1-25/+0
the patchup code would get false positives when checking whether a dbgbase had to be corrected. The solution is to have autodetect default, with manual override in scripts. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2011-04-01types: write memory now uses constØyvind Harboe1-9/+9
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2011-03-22omap4430: tried to add in workaround for broken dbgbase queryØyvind Harboe1-0/+1
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2011-02-17arm_adi_v5: add/move apsel member in struct adiv5_dapLuca Ellero1-57/+50
This patch tries to make some order in "apsel" mess. "dap apsel" command was quite useless (and broken) by itself. With this patch we can use it to select between AHB or APB memory access (previous patch 05ab8bdb813acdcd74afa71d6656c2df816cb230 was somehow broken). - moves member apsel (in struct adiv5_dap) to ap_current - adds apsel member this strange choice is made trying to keep coherence in "dap apsel" command and to keep compatibility with other code (for example cortex_a8). Signed-off-by: Luca Ellero <lroluk@gmail.com>
2011-02-14arm_adi_v5: add wrapping transfer functions with selection of apLuca Ellero1-0/+74
Signed-off-by: Luca Ellero <lroluk@gmail.com>
2011-01-27add cortex-r4 etm id to dap infoMathias K1-2/+7
Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2011-01-26fix segfault from stack corruption in ahbap_debugport_initAndreas Fritiofson1-5/+4
ahbap_debugport_init was queueing reads to a local stack variable but didn't execute the queue before returning. Since the result of the reads are not used anyway, it's better to pass NULL as the destination instead of a dummy variable. I changed this throughout the function, even for the reads that were actually executed. Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2010-12-30CORTEX A8: Fix broken CPU identificationMarek Vasut1-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>
2010-12-24initial SWD transport (SWD infrastructure #2)David Brownell1-2/+6
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(-)
2010-11-05ADIv5: Implement function to lookup CoreSight componentMarek Vasut1-0/+41
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>
2010-11-05ADIv5: Introduce function to detect ROM Table locationMarek Vasut1-26/+53
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>
2010-09-20warnings: fix alignment warningsØyvind Harboe1-1/+1
These warnings are for architectures that do not support non-aligned word access. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-07-19arm_adi_v5: dap_run() error propagationØyvind Harboe1-15/+28
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-07-19arm_adi_v5: mem_ap_write error propagationØyvind Harboe1-5/+7
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-07-19arm_adi_v5: error propagation of mem_ap_read_atomic_u32 failureØyvind Harboe1-11/+33
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-07-19mem_ap_read_u32 error propagationØyvind Harboe1-5/+15
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-07-19arm_adi_v5: add error propagation for dap_setup_accessportØyvind Harboe1-11/+33
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-07-16ARM ADI-V5: cleanup CID/PID addressingDavid Brownell1-21/+23
Use addition for offsetting, not masking. Shorten some lines. Make "component_start" print-only (unused otherwise; don't save). Still doesn't resolve the issue where multiple components are wrongly displaying as NVICs on some Cortex-M3 parts because many PIDs appear to be zeroes ... maybe adapter related?? Signed-off-by: David Brownell <db@helium.(none)>
2010-07-13ARM ADI-V5: PIDs and CIDs are 8 bitsDavid Brownell1-21/+41
Mask the upper bits after 32-bit reads. Alsoo revert the ugly changes to use PRIx32; just cast to unsized integers when printing (two chars not eight). Signed-off-by: David Brownell <db@helium.(none)>
2010-06-22arm_adi_v5: error propagation fixesØyvind Harboe1-18/+22
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-06-15arm_adi: -Wshadow warning fixØyvind Harboe1-3/+3
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-05-21arm_adi_v5: correct ahbap_debugport_init mem-ap id (bug #23)Spencer Oliver1-0/+3
We request a id register read at the end of ahbap_debugport_init but we never actually run the queue. In some cases this causes a segfault. Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>