aboutsummaryrefslogtreecommitdiff
path: root/src/target/arm_adi_v5.c
AgeCommit message (Collapse)Author
2016-12-08cortex_m: allow setting debug ap during createMatthias Welwarsky
This patch adds a Cortex-M private configuration option that allows setting the acess point during target creation. This circumvents situations in hybrid systems when the correct access point can not be automatically detected. Change-Id: If313a5250e6e66509bb9080f3498feab7781dced Signed-off-by: Matthias Welwarsky <matthias.welwarsky@sysgo.com> Reviewed-on: http://openocd.zylin.com/3639 Tested-by: jenkins Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2016-12-08dap_dp_init: remove loopJiri Kastner
current loop sounds to me like 'we don't know what we do, let's do it ten times, maybe we will have luck'. should be enough to 'ping' debug port using reading CRTL_STAT. tested on cortex-a8, snapdragon, jetson k1, cortex-r5, cortex-r4 Change-Id: Ibc62ac1eca06c141f4fccd5de7b11350ca1f35fd Signed-off-by: Jiri Kastner <cz172638@gmail.com> Tested-by: Jiri Kastner <cz172638@gmail.com> Reviewed-on: http://openocd.zylin.com/3193 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-by: Liviu Dudau <liviu@dudau.co.uk> Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2016-07-17arm_adi_v5: add dap apreg command for AP register read/writeTomas Vanek
A developer tool: Direct access to AP registers can be useful for handling vendor specific AP like Freescale Kinetis MDM or Atmel SMAP. Change-Id: Ie2c7160fc6b2e398513eb23e1e52cbb52b88d9bd Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/2777 Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Tested-by: jenkins
2016-05-24Remove FSF address from GPL noticesMarc Schink
Also make GPL notices consistent according to: https://www.gnu.org/licenses/gpl-howto.html Change-Id: I84c9df40a774958a7ed91460c5d931cfab9f45ba Signed-off-by: Marc Schink <openocd-dev@marcschink.de> Reviewed-on: http://openocd.zylin.com/3488 Tested-by: jenkins Reviewed-by: Andreas Färber <afaerber@suse.de> Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com> Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2016-05-17arm_adi_v5: Add part number for TI MSP432P401RAndreas Färber
According to the MSP432P4xx Family TRM (SLAU356A) Figure 4-7, 0x9AF is the part number for MSP432P401xx devices. Verified on TI MSP-EXP432P401R LaunchPad. Change-Id: I22b57c42f2a0dc8263fab6b480cf8c169c7dc295 Signed-off-by: Andreas Färber <afaerber@suse.de> Reviewed-on: http://openocd.zylin.com/3486 Tested-by: jenkins Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2016-05-17arm_adi_v5: Add part numbers for Infineon XMC4000 familyAndreas Färber
This was found on multiple XMC4500: Valid ROM table present Component base address 0xe00ff000 Peripheral ID 0x00001c11db Designer is 0x0c1, Infineon (Siemens) Part is 0x1db, Unrecognized Component class is 0x1, ROM table MEMTYPE system memory present on bus On multiple XMC4700 and an XMC4800 this was found instead: Valid ROM table present Component base address 0xe00ff000 Peripheral ID 0x00001c11df Designer is 0x0c1, Infineon (Siemens) Part is 0x1df, Unrecognized Component class is 0x1, ROM table MEMTYPE system memory present on bus Name them "XMC4500 ROM" and "XMC4700/4800 ROM" respectively. Change-Id: If369a6d16524004ba439b878f090a313a9f3a760 Signed-off-by: Andreas Färber <afaerber@suse.de> Reviewed-on: http://openocd.zylin.com/3482 Tested-by: jenkins Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2016-05-17arm_adi_v5: Add part number for Infineon XMC1000 familyAndreas Färber
Not documented in the Reference Manuals but found on multiple XMC1100/1202: Valid ROM table present Component base address 0xf0000000 Peripheral ID 0x00001c11ed Designer is 0x0c1, Infineon (Siemens) Part is 0x1ed, Unrecognized Component class is 0x1, ROM table MEMTYPE system memory present on bus Name it "XMC1000 ROM", since it didn't differ between XMC1100 and XMC1200. Change-Id: I98a5a524c0d0836f395400fbac24fd496b2ec141 Signed-off-by: Andreas Färber <afaerber@suse.de> Reviewed-on: http://openocd.zylin.com/3481 Tested-by: jenkins Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2016-05-17arm_adi_v5: Adjust part number column alignmentAndreas Färber
Consistently increase the space-indentation of the .full values to nicely align with the new "Qualcomm QDSS Component v1" .type value. Change-Id: Icd28d8f3fc7c3afcccb9dcfe138ac57d64927d1a Suggested-by: Freddie Chopin <freddie.chopin@gmail.com> Signed-off-by: Andreas Färber <afaerber@suse.de> Reviewed-on: http://openocd.zylin.com/3480 Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com> Tested-by: jenkins
2016-05-14arm_adi_v5: Reorder Atmel part number entryAndreas Färber
Instead of placing Atmel last, after ANY_ID, place it after ARM (it's arm_adi_v5 despite 0x4BB) and sort it with the other vendors, i.e. before ADI and Qualcomm. Adapt column alignment. Drop the redundant "Atmel" comment to clarify that Analog is not Atmel. Change-Id: Ic06785db079cf58d49815a639236636c180e5e17 Signed-off-by: Andreas Färber <afaerber@suse.de> Reviewed-on: http://openocd.zylin.com/3479 Tested-by: jenkins Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2016-05-14arm_adi_v5: added partnumber for APQ8016Jiri Kastner
On APQ8016 was found a CoreSight component designed by Qualcomm, according to db410c HRM [1] it has a partnumber following this schema: [11:8] is 0x4 meaning Qualcomm designed Coresight component in QDSS. Reads as 0x4. [7:6] is Subsystem/core family ID (e.g. denote QDSS family or generation). [5:4] is Subsystem/core configuration options (e.g. denote cache options, etc.). [3:2] is Subsystem/core fuse options. [1:0] is Subsystem/core future use field Reads as 0x440. [1] - https://developer.qualcomm.com/download/sd410/hardware-register-description-qualcomm-snapdragon-410.pdf Change-Id: I9b4b41fd17c59d2f5ae35b53278d06d6087665f8 Signed-off-by: Jiri Kastner <cz172638@gmail.com> Signed-off-by: Andreas Färber <afaerber@suse.de> Reviewed-on: http://openocd.zylin.com/3408 Tested-by: jenkins Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2016-05-14arm_adi_v5: added partnumbersJiri Kastner
On hi6220 'dap info' returned some unknown components from ARM. Collected from ARM docs, mostly ROM table entries. Typo fix for Cortex-M3 FPB. Change-Id: I96bbf7349061937b3afc8bb8d6d1650f2609f82d Signed-off-by: Jiri Kastner <cz172638@gmail.com> Signed-off-by: Andreas Färber <afaerber@suse.de> Reviewed-on: http://openocd.zylin.com/3407 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2016-05-14arm_adi_v5: Add a few dap component ids, covers the atmel at91sam.James Mastros
Change-Id: I62473fdf3dbc30cb0e1443c3d3f37918f1d61b89 Signed-off-by: James Mastros <james@mastros.biz> Signed-off-by: Jiri Kastner <cz172638@gmail.com> Reviewed-on: http://openocd.zylin.com/3383 Tested-by: jenkins Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2016-02-25arm_adi_v5: Rewrite dap_rom_displayAndreas Fritiofson
Simplify by printing one component per call, instead of one complete ROM Table per call. Print common information the same way for all components, including ROM tables, because ROM tables (at least the top level) contain useful information in their identification registers, such as the manufacturer of the SoC. Print component designer name using the JEP106 helper when available. Change-Id: Ic51bccd98acfae6886243500153fbdd567be2fae Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/3182 Tested-by: jenkins Reviewed-by: Jiri Kastner <cz172638@gmail.com> Reviewed-by: James Mastros <james@mastros.biz>
2016-01-22arm_adi_v5: dap_partnums - correction of partnumbers, new addedJiri Kastner
according to... ARM DDI 0433B is: 0x9a5 Cortex-A5 PMU ARM DDI 0435C is: 0x955 Cortex-A5 ETM ARM DDI 0401C is: 0x950 Cortex-A9 PTM ARM DDI 0469B is: 0x931 Cortex-R5 ETM ARM DDI 0460D is: 0xc15 Cortex-R5 Debug ARM DDI 0458C is: 0x9b7 Cortex-R7 PMU 0xc17 Cortex-R7 Debug ARM DDI 0535C is: 0x95b Cortex-A17 PTM 0x9ae Cortex-A17 PMU 0xc0e Cortex-A17 Debug ARM DDI 0500F is: 0x9a8 Cortex-A53 CTI 0x95d Cortex-A53 ETM 0x9d3 Cortex-A53 PMU 0xd03 Cortex-A53 Debug ARM DDI 0488G is: 0x906 Cortex-A57/A72 CTI 0x95e Cortex-A57 ETM 0x9d7 Cortex-A57 PMU 0xd07 Cortex-A57 Debug ARM 100095_0002_03_en is: 0x95a Cortex-A72 ETM 0x9d8 Cortex-A72 PMU 0xd08 Cortex-A72 Debug Change-Id: Ieffefb30f2e75c45fe1a2f9c8204e3a9b1af3d7a Signed-off-by: Jiri Kastner <cz172638@gmail.com> Reviewed-on: http://openocd.zylin.com/3198 Tested-by: jenkins Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2016-01-22adi_v5_jtag: implement DAP WAIT supportMatthias Welwarsky
ADIv5 specifies that DP and AP accesses may generate a WAIT response when the hardware is not able to complete a request for various reasons in time before the next request is sent. Currently, the software treats a WAIT response as a fatal error and aborts operation on the DAP. This patch implements WAIT handling by keeping a journal of all outstanding and completed accesses, including their response status. At certain times (when dap_run() is called), the journal is inspected for WAIT responses and all discarded accesses are replayed to complete them. Special care is taken to not re-execute already successfully completed operations. Change-Id: I2790070388cf1ab2e8c9a042d74eb3ef776aa583 Signed-off-by: Matthias Welwarsky <matthias@welwarsky.de> Reviewed-on: http://openocd.zylin.com/3166 Tested-by: jenkins Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2016-01-03ARM ADIv5: CoreSight ROM decode part number and designer idPeter Lawrence
The existing arm_adi_v5.c code decodes CoreSight peripherals based on the part number field. However, these are specific to a particular manufacturer (often ARM). The same part number from two different manufacturers (distinct designer ids) should not decode as the same CoreSight peripheral. The Analog Devices ADSP-SC58x and ADSP-BF70x have peripherals that overlap with existing OpenOCD decoding. The part number is the same as existing OpenOCD decoding, but have a different JEP106 code. Most, if not all, of the existing part number entries in arm_adi_v5.c are probably specific to ARM. Change all entries suspected to be designed by ARM to match only ARM's designer ID. However, to preserve legacy behavior, existing non-ARM entries are encoded with a wildcard so that they will behave in the same way as the existing legacy code. It is desirable, however, to start encoding the data with designer codes to avoid such ambiguity. Revising the code to check both the part number and designer id seemed to a warrant a const array lookup table instead of a multi-tiered switch statement. Also try to sync part identification IDs with relevant ARM docs. Change-Id: Iac1374e4cfc6f04cebb479c0e3fa9bde527cc4a3 Signed-off-by: Peter Lawrence <majbthrd@gmail.com> [andreas.fritiofson@gmail.com: change JEP106 to designer ID, cleanup] Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/3128 Tested-by: jenkins
2015-12-29arm_adi_v5: Make the DAP API statelessAndreas Fritiofson
Remove entirely the concept of a "selected" AP that has to be maintained between calls. All the information the DAP ops need are now provided to each call through the AP/DAP pointer. Consolidate the cache of the SELECT fields into one single field caching the entire register. Change-Id: I2e1c93ac5ee8ac38a7d680ca2c660c30093a6b87 Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/3165 Tested-by: jenkins Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
2015-12-29arm_adi_v5: dap_queue_ap_* DAP->AP parameterAndreas Fritiofson
Move the mandatory dap_ap_select() call into the dap_queue_ap_read/write wrapper. This avoids the need for dap_ap_select() and the notion of a "current" AP within target code. Change-Id: I5cde8f3eef2c662f7458be6f3b3dd44ea693bd74 Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/3164 Tested-by: jenkins Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
2015-12-29arm_adi_v5: Fix dap apsel confusing behaviour.Andreas Fritiofson
Make dap apsel without arguments show current state instead of changing to AP 0. Change-Id: I75ea10e3e1b8a067f2dc417ec6691dc7ceec1af6 Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/3163 Tested-by: jenkins Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
2015-12-29arm_adi_v5: Remove all cases of "restoring" previous dap_ap_select()Andreas Fritiofson
All AP operations should select the AP to use before calling it so there's no point in restoring the previous value afterwards. The explicit call to dap_ap_select() before all AP operations should be moved into dap_queue_ap_read/write() which then would have to take the AP as an argument instead of the DAP. Change-Id: Icacb0c76ef2a5ac36b4d2f26b52ec01a8850286e Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/3156 Tested-by: jenkins Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
2015-12-29arm_adi_v5: Remove all mem_ap_sel_* functionsAndreas Fritiofson
All mem_ap_* functions now make sure the SELECT register is updated with the AP number that it's operating on. This shouldn't have to be handled explicitly. Change-Id: Ib193d8930fabb6a25715064355f98258c9580b5d Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/3153 Tested-by: jenkins Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
2015-12-29arm_adi_v5: Rename TAR and CSW setters and make them AP-specificAndreas Fritiofson
Change-Id: I0ab66b259e929e6ba826ada9cf8e35614df46410 Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/3152 Tested-by: jenkins Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
2015-12-29arm_adi_v5: Split ahbap_debugport_initAndreas Fritiofson
This function does two separate things, powering up the DP and setting up a MEM-AP. But the DP needs to be powered before even searching for a MEM-AP to initialize and targets may have multiple MEM-APs that need initializing. Split the function into dap_dp_init() and mem_ap_init() and change all call sites to use the appropriate one. Change-Id: I92f55e09754a93f3f01dd8e5aa1ffdf60c856126 Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/3151 Tested-by: jenkins Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
2015-12-29arm_adi_v5: Clean up dap info commandAndreas Fritiofson
Reduce use of magic numbers and add AXI type MEM-AP detection. Don't try to call dap_rom_display on a non-existent AP. AP identification is unique per designer, so make sure the JEDEC code matches ARM when interpreting the AP type. Change-Id: I8e86b7de61811382afe99bf15094ab71b43f5fdf Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/3150 Tested-by: jenkins Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
2015-12-29arm_adi_v5: Change mem_ap calls to take pointer to AP and not DAPAndreas Fritiofson
Change-Id: I8d3e42056aa5828cb917ca578a54b7d53846a150 Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/3149 Tested-by: jenkins Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
2015-12-29arm_adi_v5: Convert the AP references from numbers to pointersAndreas Fritiofson
Change the debug_ap and memory_ap fields of the cortex_a target and the debug_ap field of the cortex_m target to be pointers to the struct adiv5_ap instead of AP numbers in some known DAP. This reduces the dependency on the DAP struct in the targets and enables MEM-AP accesses to take the relevant AP as parameter. Change-Id: I39d7b134d78000564b7eec5bff464adf0ef89147 Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/3147 Tested-by: jenkins Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
2015-12-29cortex_m: Discover the AP to use, just like Cortex-AAndreas Fritiofson
This required fixing the AP ID parsing in dap_find_ap() to match IHI0031C. The AXI type was added too. Change-Id: I44577a7848df37586e650dce0fb57ac26f5f858c Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/3146 Tested-by: jenkins Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
2015-12-29arm_adi_v5: Add a back-pointer from an AP to its DAPAndreas Fritiofson
This will make it possible to reference directly the AP used for debug in the target instance and remove the DAP reference. This will in turn enable getting rid of the need to select an "active" AP in the DAP (using dap apsel). Change-Id: I265846a427c714204f4fd3df3cdb75843686c2d0 Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/3144 Tested-by: jenkins Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
2015-12-29arm_debug: Support multiple APs per DAP and remove DAP from armv7* structsPatrick Stewart
Separate out the values from adiv5_dap that are associated with a specific AP into a new struct, so we can properly support multiple APs. Remove the DAP struct from the armv7* structs, because we can have multiple CPUs per DAP, and we shouldn't have multiple DAP structs. Tidy up a few places where ap_current is used incorrectly. Change-Id: I0c6ef4b49cc86b140366347aaf9b76c07cbab0a8 Signed-off-by: Patrick Stewart <patstew@gmail.com> Reviewed-on: http://openocd.zylin.com/2984 Tested-by: jenkins Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de> Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2015-12-29cortex_m: Select an AP when accessing the DAPPatrick Stewart
Prepare to support multiple cortex-m cores on one DAP. Uses mem_ap_sel_* functions and removes mem_ap_* functions. Adds a new debug_ap parameter to the cortex_m (currently set to zero as in existing code). Change-Id: I6926029d1e7bf44a42d453d1aff349bda824ba72 Signed-off-by: Patrick Stewart <patstew@gmail.com> Reviewed-on: http://openocd.zylin.com/2983 Tested-by: jenkins Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de> Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2015-12-29adi_v5: Rename AP_REG_* to MEM_AP_REG_* and add LA supportAlamy Liu
This is a TODO in the src/target/arm_adi_v5.h for MEM-AP registers. Some new registers are introduced in ADIv5.2 specification. MEM_AP_REG_MGT (0x20) // Memory Barrier Transfer register MEM_AP_REG_TAR64 (0x08) // Bits[63:32] of Transfer Address MEM_AP_REG_BASE64 (0xF0) // Bits[63:32] of Debug Base Address Refer to 7.5 MEM-AP register summary in IHI0031C: ARM Debug Interface Architecture Specification ADIv5.0 to ADIv5.2 Change-Id: I3bc4296a04c35f5c64f851e5865d3099922613fa Signed-off-by: Alamy Liu <alamy.liu@gmail.com> Reviewed-on: http://openocd.zylin.com/2904 Tested-by: jenkins Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de> Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2015-11-27adi_v5: Fix wrong ap valueAlamy Liu
Problem dap->ap_current is register value, not field value. it restores invalid ap when it calls dap_ap_select(dap, ap_old) later. * assume the current ap is 1, dap->ap_current value would be (1 << 24). ap_old = dap->ap_current; <-- ap_old = 1<<24 = 0x1000000. ... dap_ap_select(dap, ap_old); <-- select 0x1000000, not 1. * All AP registers accessing fail afterwards. One of the reproducible case(s): CORE residents in AP >= 1 dap_lookup_cs_component() being used to find PE(*). In most cases, PE would be found in AP==0, hence the problem is hidden. When AP number is 1, dap->ap_current would have the value of 1<<24. Anyone get the AP value with dap->ap_current and resotre it later would select the wrong AP and all accessing later would fail. The ARM Versatile and/or FPGA would have better chance to provide this kind of environment that PE residents in AP>=1. As they have an 'umbrella' system at AP0, and main system at AP>=1. * PE: Processing Element. AKA Core. See ARM Glossary at http://infocenter.arm.com/help/topic/com.arm.doc.aeg0014g/ABCDEFGH.html Fix Use dap_ap_get_select() to get ap value. a. Retrieve current ap value by calling dap_ap_get_select(); src/flash/nor/kinetis.c src/target/arm_adi_v5.c b. The code is correct (dap->ap_current >> 24), but it's better to use dap_ap_get_select() so everything could be synchronized. src/flash/nor/sim3x.c Change-Id: I97b5a13a3fc5506cf287e299c6c35699374de74f Signed-off-by: Alamy Liu <alamy.liu@gmail.com> Reviewed-on: http://openocd.zylin.com/2935 Reviewed-by: Andreas Färber <afaerber@suse.de> Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
2015-04-16Fix several format specifiers errors exposed by arm-none-eabiPaul Fertser
Change-Id: I1fe5c5c0b22cc23deedcf13ad5183c957551a1b7 Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/2719 Tested-by: jenkins
2015-04-14target/arm_adi_v5, cortex_m: retry ahbap_debugport_init few times in case of ↵Paul Fertser
an error Some targets need arbitrary amount of time (usually not too long) after reset (both sysresetreq and srst) to do initialisation, and SWD/JTAG is not available during that. According to PSoC4 docs, the debugger should try connecting until it succeeds. Also ahbap_debugport_init might be necessary to perform after using hardware srst too, so add it there (except for the targets that support srst_nogate since they are very unlikely to need it). Change-Id: I3598d5ff7b8e0bf3a5566a57dec4b0b2b243d297 Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/2601 Tested-by: jenkins
2015-02-22 cortex_m: Add Cortex-M0 identification to ROM-table display.Uwe Bonnes
Change-Id: Id7715a83ba9793844475629aaffd10a81ce586b6 Signed-off-by: Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de> Reviewed-on: http://openocd.zylin.com/2549 Tested-by: jenkins Reviewed-by: Paul Fertser <fercerpav@gmail.com> Reviewed-by: Stian Skjelstad <stian@nixia.no>
2015-02-11cortex_a: Add Cortex-A5 identificationOlivier Schonken
Add Cortex-A5 identification to ROM-table display, and also to cortex_a_init_debug_access. This change is mostly cosmetic. Change-Id: I7b1dd8755d70d45eb5f315aa1918d44a813b3cdf Signed-off-by: Olivier Schonken <olivier.schonken@gmail.com> Reviewed-on: http://openocd.zylin.com/2483 Tested-by: jenkins Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2015-01-10cortex_a: Add support for A15 MPCoreKamal Dasu
Added Cortex-A15 support for DAP AHB-AP init code as per ADI V5 spec. Also added changes to make the APB MEM-AP to work with A15. Made the the cortex_a target code generic to work with A8, A9 and A15 single core or multicore implementation. Added armv7a code for os_border calculation to work for known A8, A9 and A15 platforms based on the ARM DDI 0344H, ARM DDI 0407F, ARM DDI 0406C ARMV7A architecture docs. Change-Id: Ib2803ab62588bf40f1ae4b9192b619af31525a1a Signed-off-by: Kamal Dasu <kdasu.kdev@gmail.com> Reviewed-on: http://openocd.zylin.com/1601 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2014-11-03arm_adi_v5: added two CoreSight peripheral IDsPeter Lawrence
added "Single Wire Output" and "Trace Memory Controller" peripheral IDs to dap_rom_display(), which is invoked by the "dap info" command Change-Id: Iea3201007bb98e6376fbb50be40a4a2e031b0a03 Signed-off-by: Peter Lawrence <majbthrd@gmail.com> Reviewed-on: http://openocd.zylin.com/2369 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2014-10-06target: constify structuresSpencer Oliver
Change-Id: I875cfab8dec4ade72ed9c9cd7d52baaca182a1ef Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/2295 Tested-by: jenkins
2014-10-06arm_adi_v5: make dap_lookup_cs_component() traverse subtables and handle ↵Paul Fertser
multicore When looking for a debug base address of a core, one should search through all the ROM tables, not just the top-level one. This code also assumes that the first found entry (in a depth-first search) will correspond to core 0, the second to core 1 etc. The patch is supposed to be an alternative implementation of http://openocd.zylin.com/#/c/1313/. Change-Id: Ifc88971a02fe3d9c00d9bf72a822ade5804d4e09 Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/1920 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2014-06-28adi_v5_swd: Read RDBUFF once after a sequence of AP readsAndreas Fritiofson
Increases performance by a factor of two for long reads. Change-Id: I81a7a83835058560c6a53a43c3cc991100f01766 Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/1954 Tested-by: jenkins Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2014-06-28adi_v5: Remove strange IDCODE check from dap info handlerAndreas Fritiofson
Otherwise it breaks SWD targets. The check seems really weird anyway since it loops through *all* TAPs after the ADIv5 target but doesn't do anything at all with the result, other than not setting the return values despite returning ERROR_OK. Remove a bogus initialization that was needed because of the odd behaviour of this routine when an IDCODE wasn't found. Change-Id: Ic086352f6af868b3406b00420291a0a671e3acac Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/1953 Tested-by: jenkins Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2014-06-28adi_v5_swd: Improve SWD supportFatih Aşıcı
Fix bug in parity calculation macro. Cache and update the selected DP bank when necessary. Add aborts when the Ack code signals a failure (we should really only clear the sticky bits, but this will do for now). Change-Id: I38a4da136ba1d9e989b33c1875a80c0b1b2be874 Signed-off-by: Fatih Aşıcı <fatih.asici@gmail.com> Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/1950 Tested-by: jenkins
2014-06-22target: arm_adi_v5: added types and subtypes based on latest coresight ↵Jiri Kastner
documentation while investigating coresight components, i've found some new partnumbers and devtypes. Change-Id: Ie68032b0b21d542c2084f80db38b06f5cd4c7591 Signed-off-by: Jiri Kastner <cz172638@gmail.com> Reviewed-on: http://openocd.zylin.com/2166 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2014-06-01arm_adi_v5: Do not ignore register polling timeoutAndrey Smirnov
Previous to this commit 'ahbap_debugport_init' would ignore if timeout happened or not when waiting for CDBGPWRUPACK and CSYSPWRUPACK and would continue initialization regardless. It also would not reset the timeout counter after finishing polling for CDBGPWRUPACK and starting for CSYSPWRUPACK which could potentially cause some problems. Also refactor code of both snippets into a more generic function to avoid duplication. Change-Id: I16e4f50e6819e08c4126e71ef8cec7db559d608e Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Reviewed-on: http://openocd.zylin.com/2086 Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Tested-by: jenkins
2014-05-10kinetis: Revise CPU un-securing codeAndrey Smirnov
Old version of the code had several problems, among them are: * Located in a generic ADI source file instead of some Kinetis specific location * Incorrect MCU detection code that would read generic ARM ID registers * Presence of SRST line was mandatory * There didn't seem to be any place where after SRST line assertion it would be de-asserted. * Reset was asserted after waiting for "Flash Controller Ready" bit to be set, which contradicts official programming guide AN4835 * Mass erase algorithm implemented by that code was very strange: ** After mass erase was initiated instead of just polling for the state of "Mass Erase Acknowledged" bit the code would repeatedly initiate mass erase AND poll the state of the "Mass Erase Acknowledged" ** Instead of just polling for the state of "Flash Mass Erase in Progress"(bit 0 in Control register) to wait for the end of the mass erase operation the code would: write 0 to Control register, read out Status register ignoring the result and then read Control register again and see if it is zero. * dap_syssec_kinetis_mdmap assumed that previously selected(before it was called) AP was 0. This commit moves all of the code to kinetis flash driver and introduces three new commands: o "kinetis mdm check_security" -- the intent of that function is to be used as 'examine-end' hook for any Kinetis target that has that kind of JTAG/SWD security mechanism. o "kinetis mdm mass_erase"" -- This function removes secure status from MCU be performing special version of flash mass erase. o "kinetis mdm test_securing" -- Function that allows to test securing fucntionality. All it does is erase the page with flash security settings thus making MCU 'secured'. New version of the code implements the algorithms specified in AN4835 "Production Flash Programming Best Practices for Kinetis K- and L-series MCUs", specifically sections 4.1.1 and 4.2.1. It also adds KL26 MCU to the list of devices for which this security check is performed. Implementing that algorithm also allowed to simplify mass command in kinetis driver, since we no longer need to write security bytes. The result that the old version of mass erase code can now be acheived using 'kinetis mdm mass_erase' Tested on accidentally locked FRDM-KL26Z with KL26 Kinetis MCU. Change-Id: Ic085195edfd963dda9d3d4d8acd1e40cc366b16b Signed-off-by: Andrey Smrinov <andrew.smirnov@gmail.com> Reviewed-on: http://openocd.zylin.com/2034 Tested-by: jenkins Reviewed-by: Paul Fertser <fercerpav@gmail.com> Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2014-05-05Fix some C99 format specifiersPaul Fertser
As exposed by arm-none-eabi build, fix the wrong modifiers. Change-Id: Ia6ce7c5c1d40e95059525c3e5d81b752df2fea7c Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/2122 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2014-04-14cortex_a: fix endiannes issues on TI TMS570Seth LaForge
The TI TMS470 and TMS570 series of processors are BE-32 processors, despite BE-32 not being supported by ARM in the Cortex-R4 core. TI hacked in BE-32 support, which requires odd swizzling in OpenOCD to make memory reads and writes function correctly. In particular, without this change, OpenOCD word reads and writes had the bytes reversed, and halfword and byte packed reads were reading garbage. In my testing, this change fixes these problems. Change-Id: I21dd30f4b9003f20fcc85f674ab833407bb61f74 Signed-off-by: Seth LaForge <sethml@google.com> Reviewed-on: http://openocd.zylin.com/2064 Tested-by: jenkins Reviewed-by: Paul Fertser <fercerpav@gmail.com> Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2014-03-29target: remove memory leaksSpencer Oliver
Found by clang. Change-Id: Ifb25dca52f8d9e8e46a35f0947a7239f26eb3757 Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/2067 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-by: Jörg Wunsch <openocd@uriah.heep.sax.de>
2014-03-07target: add CoreSight PMU and an unidentified component to "dap info"Paul Fertser
Change-Id: I705eae46b190dbd89ab01bc086c49eb04368d9b3 Reported-by: Brad Riensche <brad.riensche@gmail.com> Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/1928 Tested-by: jenkins Reviewed-by: Brad Riensche <brad.riensche@gmail.com> Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>