aboutsummaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
2021-12-03gdb_server: added and improved several debug printsJan Matyas1-3/+8
Added and improved several prints related to the GDB connection and various error states that may occur in relation to this connection. Change-Id: I233246190b613cc925b783561cfa3aa5267360fd Signed-off-by: Jan Matyas <matyas@codasip.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6288 Reviewed-by: Tim Newsome <tim@sifive.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins
2021-12-03target,flash: allow target_free_working_area on NULL area pointerTomas Vanek10-35/+35
Standard C library free() allows NULL pointer as a parameter. Change target_free_working_area() to conform this convention. Remove NULL pointer tests before target_free_working_area() calls. While on it add missing setting pointer to NULL after target_free_working_area(). Change-Id: I7c692ab04a9933398ba5bc614723ad0bdecb87b3 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/6712 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2021-12-03flash/nor/fespi: algorithm, large address, errorsTim Newsome1-327/+148
* Move more smarts into the target algorithm code, and rewrite that in C so it's easier to understand/maintain. * Support >24-bit addresses. * Check for errors. Change-Id: I3b1a143589fe6defafb8f95820aa682acc9646e7 Signed-off-by: Tim Newsome <tim@sifive.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6679 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2021-12-03flash/nor/at91samd: remove 'at91samd info' commandTomas Vanek1-13/+0
The command is a stub only, does nothing. Change-Id: Ib3b8c2122a9f6f2e179bee34ac56d0adf367bfcc Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/6730 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2021-12-03flash/nor/kinetis_ke: remove 'kinetis mdm test_securing' cmdTomas Vanek1-40/+0
The command might be a leftover from development of the driver. There is no documentation what it does. Change-Id: Iaa5aa1ac51638bd6acce172a5dd03846a165dc27 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/6728 Tested-by: jenkins Reviewed-by: Ivan-Artekit <ivan@artekit.eu>
2021-12-03flash/nor/kinetis_ke: add .help fields for tcl commandsTomas Vanek1-4/+4
Add help texts from similar driver kinetis.c While on it fix one existing help: the flash is obviously not NAND Change-Id: Ibd295105586b008aaabf2fb4e4a75bf551266e38 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/6727 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2021-11-29flash/nor/efm32: fixed BG1x identificationDoug Brunner1-3/+3
The EFM32 flash driver misidentifies the EFR32BG1B on my board as EFR32MG1B. Looks like this was caused by a copy-paste error, fixed. Signed-off-by: Doug Brunner <doug.a.brunner@gmail.com> Change-Id: I3067f7ba132c2562487da8c2371f63a4843230c1 Reviewed-on: https://review.openocd.org/c/openocd/+/6666 Tested-by: jenkins Reviewed-by: Fredrik Hederstierna <fredrik.hederstierna@gmail.com> Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2021-11-28drivers: call adapter_get_required_serial() in jtag_libusb_open()Antonio Borneo14-22/+17
Now that adapter serial is handled independently from the adapter drivers, move inside jtag_libusb_open() the call to adapter_get_required_serial(), so every adapter that uses libusb will automagically get USB serial support. Extend the documentation to list the adapters involved. Change-Id: I75b3482d38f8ed3418329f3106c5e8b689fd460b Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6663 Tested-by: jenkins
2021-11-28jtag/hla, jtag/stlink: switch to command 'adapter serial'Antonio Borneo6-67/+32
The driver hla defines the command 'hla_serial' to specify the serial string of the adapter. The driver st-link defines the command 'st-link serial' to specify the serial string of the adapter. Remove and deprecate the driver commands and use 'adapter serial'. Change-Id: I9505c398a77125b1ebf4ba71da7baf4d663b75be Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6657 Tested-by: jenkins
2021-11-28jtag/jlink: switch to command 'adapter serial'Antonio Borneo2-34/+23
The driver jlink defines the command 'jlink serial' to specify the serial string of the adapter. Remove and deprecate the driver command, and use 'adapter serial'. Note: in former code the commands 'jlink serial' and 'jlink usb' were mutually exclusive; running one of them would invalidate the effect of a previous execution of the other. The new code gives priority to 'adapter serial', even if executed before 'jlink usb'. Change-Id: I920b0c136716f459b6fd6f7da8a01a7fa1ed389f Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6656 Reviewed-by: zapb <dev@zapb.de> Tested-by: jenkins
2021-11-28jtag/xds110: switch to command 'adapter serial'Antonio Borneo2-47/+13
The driver xds110 defines the command 'xds110 serial' to specify the serial string of the adapter. Remove and deprecate the driver command, and use 'adapter serial'. Note: the original command 'xds110 serial' used a complex and undocumented conversion of the serial number through multibyte string, wide-character string and C cast. The XDS110 I can access and the lsusb dumps available through Google don't show any exotic USB serial that require such conversion. The original developer doesn't remember any constraint that mandates such conversion (see comments in https://review.openocd.org/4322/). The conversion is removed by this patch. Change-Id: I38909918079b2c1797ad85ebec2fea1b33743606 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6655 Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Tested-by: jenkins
2021-11-28jtag/vsllink: switch to command 'adapter serial'Antonio Borneo4-29/+10
The driver vsllink defines the command 'vsllink usb_serial' to specify the serial string of the adapter. Remove and deprecate the driver command, and use 'adapter serial'. Change-Id: Iadcc018b8aa8974ccd7156915b84e58270fad29d Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6654 Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Tested-by: jenkins
2021-11-28jtag/presto: switch to command 'adapter serial'Antonio Borneo2-42/+11
The driver presto defines the command 'presto serial' to specify the serial string of the adapter. Remove and deprecate the driver command, and use 'adapter serial'. Change-Id: I1a69acce7d4910082d2029d5941ae84f9424314c Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6653 Tested-by: jenkins
2021-11-28jtag/kitprog: switch to command 'adapter serial'Antonio Borneo2-26/+8
The driver kitprog defines the command 'kitprog_serial' to specify the serial string of the adapter. Remove and deprecate the driver command, and use 'adapter serial'. Change-Id: I844cb815af01137392b6d12e1b5972fc77ac092d Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6652 Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Tested-by: jenkins
2021-11-28jtag/ftdi: switch to command 'adapter serial'Antonio Borneo2-24/+9
The driver ftdi defines the command 'ftdi serial' to specify the serial string of the adapter. Remove and deprecate the driver command, and use 'adapter serial'. Change-Id: Ia5b1f325b9fab8f58b5ea70f8b807e50b148b939 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6651 Tested-by: jenkins
2021-11-28jtag/ft232r: switch to command 'adapter serial'Antonio Borneo2-20/+10
The driver ft232r defines the command 'ft232r serial_desc' to specify the serial string of the adapter. Remove and deprecate the driver command, and use 'adapter serial'. Change-Id: I0bd909923a668420604fed3c9f6a260716b044c7 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6650 Tested-by: jenkins
2021-11-28jtag/cmsis_dap: switch to command 'adapter serial'Antonio Borneo5-25/+11
The driver cmsis_dap defines the command 'cmsis_dap_serial' to specify the serial string of the adapter. Remove and deprecate the driver command, and use 'adapter serial'. Change-Id: I88e2d4de360a6c6f23529bb18494962a267250df Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6649 Tested-by: jenkins
2021-11-28jtag/aice: switch to command 'adapter serial'Antonio Borneo3-22/+8
The driver aice defines the command 'aice serial' to specify the serial string of the adapter, but actually does not use this value in the code. Remove and deprecate the driver command, and use 'adapter serial'. Change-Id: I892e0a4e1b41a7a87adf54a5736abf7419f32979 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6648 Tested-by: jenkins
2021-11-28jtag/adapter: add command 'adapter serial'Antonio Borneo2-0/+27
Several adapter define their own command to specify the USB serial number or serial string to be used during USB search. Define a general command 'adapter serial' to be proposed as replacement of the driver specific ones. No driver is changed so far to use it. Change-Id: I7631687a4163ccc63a9bdf3ad1fcb300fc483d3a Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6647 Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Tested-by: jenkins
2021-11-25target/hla_target: set cortex_m->common_magicTomas Vanek3-1/+16
hla_target uses the same struct cortex_m_common as the standard cortex_m target. Unlike the cortex_m target hla missed setting of common_magic. Set commont_magic to help pointer verification. Add convenience tests is_cortex_m_or_hla() and is_cortex_m_with_dap_access() Use proper test in cortex_m_verify_pointer() - this code relied on unset common_magic on hla target before the change. Change-Id: I4dae79f056c3d73adf524e26aa8ef2d3a57b471e Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/6741 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2021-11-23flash/psoc6: initialize usage fieldAntonio Borneo1-1/+1
The missing initialization triggers a run-time error message: Error: BUG: command 'psoc6 reset_halt' does not have the '.usage' field filled out Change-Id: I975e4ba99bd939aa924a9d62b1ab76b2ab5bf193 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6720 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2021-11-23flash/rp2040: don't initialize to NULL fields in structAntonio Borneo1-1/+0
When a struct is initialized, missing fields are already filled with zero or NULL. This change simplifies scripts to compare documentation and registered commands. Change-Id: I96fbdfa98bbb1f2b5e2a9532faf5a15cb5bc28dd Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6719 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2021-11-23openocd: declare struct command_registration in a single lineAntonio Borneo2-6/+3
To simplify scripts to compare documentation and registered commands. Change-Id: I3bed5ba80ea8be1fd615697e80d66b42d7b45fd1 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6718 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2021-11-23openocd: use unique name for struct command_registrationAntonio Borneo5-17/+17
Just to avoid name clash when comparing documentation with registered commands through scripts. Change-Id: I8832545d8d9236ea5dabe6e73732f51e5246caff Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6717 Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Tested-by: jenkins
2021-11-23openocd: use single line for register_commands*()Antonio Borneo7-16/+8
Do not split in multiple lines the calls to register_commands*(). No change in code behaviour, just make it easy to grep in the code and identify the commands that can be registered. This would help detecting undocumented commands. Change-Id: Id654e107cdabf7ee31fc3d227c1d2a59acc5669e Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6716 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2021-11-20target/arm_dap: check SWD DAP configurationTomas Vanek1-0/+52
Raise error if * more than one plain SWD DAPs are defined * plain and multidrop DAPs are mixed * two multidrop DAPs have the same TARGETSEL value Inspired by Graham Sanderson's http://review.openocd.org/4935 Change-Id: I7279744464f5cc6477e50695c596be9c5e5507bf Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/6142 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2021-11-20target/adi_v5_swd: add support for SWD multidropTomas Vanek2-35/+228
Based on Graham Sanderson's http://review.openocd.org/4935 Unlike Graham Sanderson's version this patch does not add any multidrop specific queuing. Multidrop SWD is handled mostly by the same code as single SWD, just a selection sequence is prepended to a SWD operation as needed. This is a minimal working implementation without checking for configuration errors (mixing multidrop and non multidrop DPs, multiple use of the same selection id etc...). Multidrop switching likely demands changes in the adapter code. Change-Id: I99a5742c209b49c0483e800f6105cb5e59a897d9 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/6141 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2021-11-20target/arm_adi_v5,arm_dap: introduce multidrop_targetsel and its configurationTomas Vanek2-1/+65
Add multidrop_targetsel to struct adiv5_dap. Add option -dp-id and -instance-id to dap create command. Add convenience function dap_is_multidrop() Change-Id: Ibb93abb5f50b3665c320a10c1497421035762134 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/6140 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2021-11-20target/arm_dap: clean up dap_configure codeTomas Vanek1-18/+22
dap_configure() contained first time init related tasks, as the call to dap_init_instance() and the check for configured tap. Move all first time init related stuff to dap_create() to make dap_configure() usable in eventual stand-alone 'dap configure' command. Change-Id: Ia86eadb4e960ce54e8581630d01af75720d2318d Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/6702 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
2021-11-20target/adi_v5_swd: introduce swd_queue_dp_read/write_inner()Tomas Vanek1-74/+92
This is a preparatory change for swd multidrop, mostly refactoring. Split swd_queue_dp_read/write() to inner and outer parts. Use the inner parts in swd_queue_dp_bankselect(), swd_connect() they do not need to check reconnect. Use the outer parts exclusively in swd_dap_ops. Rearrange the code to reduce forward declarations. Change-Id: I47b7f0cb037e0032a267463f06ba02123ba96fe7 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/6139 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins
2021-11-20drivers/bitbang: add support for SWD multidropTomas Vanek1-42/+33
Ignore ack received after DP_TARGETSEL write to prevent false error. This change also fixes a bug: Received ACK FAULT or JUNK value were incorrectly stored to queued_retval and later used as bitbang_swd_run_queue() error return. Use LOG_ERROR for parity mismatch. Change-Id: I5ff1f658f221af78d8bbec8416a7a0fc64ba2550 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/6700 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2021-11-20drivers/ftdi: add support for SWD multidropTomas Vanek1-3/+7
Ignore ack received after DP_TARGETSEL write to prevent false error. Inspired by Graham Sanderson's http://review.openocd.org/4935 Change-Id: I04fd77cde3244de250743d8c8bfb93ed26379385 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/6698 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2021-11-20drivers/swd: add support for SWD multidropTomas Vanek1-0/+41
According to ARM IHI0031C+ chapter 2.3.11 "TARGETSEL, Target Selection register" multidrop capable DPv2 must not drive SWDIO line during the response phase of a write to TARGETSEL register. Introduce helper functions swd_cmd_returns_ack() and swd_ack_to_error_code() to centralize these tests from all drivers to one place. Introduce distinct error codes for SWD protocol. Partly inspired by Graham Sanderson's http://review.openocd.org/4935 Change-Id: Ie5f9edb22e066a933a534bf2b29e7e1d3087dad1 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/6699 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins
2021-11-20target/arm_dap: fix memory leak in error path of dap_create()Tomas Vanek1-1/+4
Change-Id: I91fa5910670161b62a76fc834b6394c5a6c05395 Suggested-by: Antonio Borneo <borneo.antonio@gmail.com> Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/6685 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2021-11-20jtag/hla_layout: add #include <target/arm_tpiu_swo.h>Tarek BOCHKATI1-0/+1
hla_layout.h uses explicitly tpiu_pin_protocol enum defined in arm_tpiu_swo.h. To make this header file consistent, add the missing include. Change-Id: Ibecc279da8d6859ced2b8377e812554c747d81bb Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6687 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2021-11-20drivers/jtag_vpi: Added "jtag_vpi:" prefixes to log messagesJan Matyas1-5/+5
Added "jtag_vpi:" prefixes to log messages from the jtag_vpi driver. The intention is to make it clear what the messages relate to. Without the prefix, many of the log messages won't make much sense to the user. This change does not alter any functionality, just the printed text. Example: Before: Error: Can't connect to 127.0.0.1 : 5555 After: Error: jtag_vpi: Can't connect to 127.0.0.1 : 5555 Change-Id: I779c379f52722b094b200d08b25ab0f7280d2845 Signed-off-by: Jan Matyas <matyas@codasip.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6686 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2021-11-20target: Use target_addr_t for algorithm addresses.Tim Newsome2-6/+6
Otherwise 64-bit addresses can't work. Signed-off-by: Tim Newsome <tim@sifive.com> Change-Id: Id9f92ff8a1602153cc06810bcf515a9d0a89c81b Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/6662 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2021-11-20riscv: Clear type 6 triggers on connecting.Tim Newsome1-0/+4
I missed this when I first add mcontrol6 support. https://github.com/riscv/riscv-openocd/pull/648 Change-Id: I1a2706c7ea3a6757ed5083091cd2c764a8b0267c Signed-off-by: Tim Newsome <tim@sifive.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6684 Tested-by: jenkins Reviewed-by: Jan Matyas <matyas@codasip.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2021-11-20riscv: Regenerated debug_defines.h and encoding.hJan Matyas2-165/+1705
The main intention is to get access to some of the CSRs that were so far unknown to OpenOCD (tinfo, mcountinhibit, ...). https://github.com/riscv/riscv-openocd/pull/659 Signed-off-by: Tim Newsome <tim@sifive.com> Change-Id: I824fdb558d5c1f73432b0f56f3b0b4d865eceeba Reviewed-on: https://review.openocd.org/c/openocd/+/6682 Tested-by: jenkins Reviewed-by: Jan Matyas <matyas@codasip.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2021-11-20adi_v5_swd: add comment to describe debug flag 'do_sync'Antonio Borneo1-0/+1
Change-Id: I1f7f0eed7a6e3626f5fde841ec7fa1d29906db29 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6696 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2021-11-20ftdi: add support to switch to/from dormant stateAntonio Borneo1-0/+20
Partially extracted from https://review.openocd.org/4935 Change-Id: Ia3f197b257434a1a7979fdbc08936c7c541db1e2 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Signed-off-by: graham sanderson <graham.sanderson@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6693 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2021-11-20jlink: add support to switch to/from dormant stateAntonio Borneo1-0/+20
Change-Id: Ifeda21ab7a40926166045f211b9e772aedff715d Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6692 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2021-11-20drivers/bitbang: add support to switch to/from dormant stateAntonio Borneo1-2/+18
While there, replace the SWD_CMD_PARK macro to the magic number. Change-Id: Id9094dcb2b010b9e894a5ed9e4a99d2287e5969c Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6691 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2021-11-20cmsis_dap: add support for dormant-to-jtagAntonio Borneo1-0/+5
Change-Id: I4a51f3772cd94d7dda5a66a1d13acd24d0d0c63c Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6690 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2021-11-20arm_adi_v5: add missing enum DORMANT_TO_JTAGAntonio Borneo1-0/+1
Add the value DORMANT_TO_JTAG in the enum listing the SWJ-DP switching sequences. The corresponding bit-sequence is already available. Change-Id: I6f1ffd29a8f5729ec70ce0303248bc251409d37d Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6689 Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Tested-by: jenkins
2021-11-18cortex_m: Restore fast register reads if no polling is neededAndreas Fritiofson1-0/+10
If the target is in a state where S_REGRDY polling is necessary (slow clock, low power state...?), OpenOCD will continue to use the slow path even if the condition is temporary and the target at a later point would be capable of fast reads again. Revert to fast reads if a full register dump can be made without need for polling any of the registers; presumably it will succeed the next time too. Change-Id: I557f0d90b7ce6f9d81aa409b6400fc9c83d16008 Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6678 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2021-11-18target/cortex_m: faster reading of all CPU registersTomas Vanek4-11/+179
Without the change cortex_m_debug_entry() reads all registers calling cortex_m_load_core_reg_u32() for each register with a poor usage of JTAG/SWD queue. It is time consuming, especially on an USB FS based adapter. Moreover if target_request debugmsgs are enabled, DCB_DCRDR is saved and restored on each register read. This change introduces cortex_m_fast_read_all_regs() which queues all register reads and a single dap_run() transaction does all work. cortex_m_fast_read_all_regs() reads all registers unconditionally regardless register cache is valid or not. This is a difference from the original cortex_m_debug_entry() code. cortex_m_debug_entry times from -d3 log, Cortex-M4F and CMSIS-DAP (Kinetis K28F-FRDM kit) target_request | time [ms] debugmsgs | without the change | with the change ---------------+--------------------+----------------- disable | 186 | 27 enable | 232 | 29 Added checking of DHCSR.S_REGRDY flag. If "not ready" is seen, cortex_m->slow_register_read is set and fallback to the old register read method cortex_m_slow_read_all_regs() is used instead of cortex_m_fast_read_all_regs(). Change-Id: I0665d94b97ede217394640871dc451ec93410254 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/5321 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2021-11-18cortex_m: poll S_REGRDY on register r/wAntonio Borneo1-5/+48
Accordingly to arm documentation [1], chapter C1.6.4, the operation to read/write from/to core registers can require time, and the specific flag DHCSR.S_REGRDY has to be polled to verify that the operation has been completed. The lack of check on S_REGRDY causes OpenOCD to fail handling correctly the core registers on a Cortex-M4 emulated in a slow FPGA, and it could also fail on devices clocked at very low speed while using a fast adapter. Poll S_REGRDY as specified in [1] while either reading or writing the core registers. A timeout of 0.5s is added. This could still be too small in some extremely slow cases, but at least now we log the timeout event, which can help tracking down such odd issue. During register read include in the polling loop the read of DCRSR and to flush the JTAG queue only once. During register write, relax the write in DCRSR by removing the atomicity that is now useless since followed by the atomic read to S_REGRDY. During register read include the read of DCRSR inside the polling loop to relax the read of S_REGRDY since followed by the atomic read to DCRSR. This change has the drawback of adding other transfers to the adapter while reading/writing the registers, so it is expected to introduce some speed degradation during step-by-step. [1] DDI0403E - "ARMv7-M Architecture Reference Manual" Change-Id: I61f454248f11a3bec6dcf4c58a50c5c996d7ef81 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/5319 Tested-by: jenkins Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
2021-11-18target/cortex_m: cumulate DHCSR sticky bitsTomas Vanek2-16/+54
DCB DHCSR register contains S_RETIRE_ST and S_RESET_ST bits cleared on a read. The change introduces a helper function cortex_m_cumulate_dhcsr_sticky(). Call this function each time DHCSR is read to preserve S_RESET_ST state in the case of a reset event was detected. Introduce cortex_m_read_dhcsr_atomic_sticky() convenience helper to read DHCSR, store it to cortex_m->dcb_dhcsr and cumulate sticky bits. The cumulated state of S_RESET_ST is read and cleared in cortex_m_poll() Change-Id: Ib679599f850fd219fb9418c6ff32eed7cf5740da Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/6180 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
2021-11-18target/cortex_m: use cortex_m->dcb_dhcsr in cortex_m_soft_reset_halt()Tomas Vanek1-9/+6
cortex_m->dcb_dhcsr caches status of DHCSR register. Use it instead of local variable in cortex_m_soft_reset_halt() like in other code. Extracted from [1]. [1] Antonio Borneo: 6207: cortex_m: rework handling of dcb_dhcsr Link: https://review.openocd.org/c/openocd/+/6207 Change-Id: I9a0aeba0b6b0b4969f05f4a32fc2fc8d244f56ca Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/6677 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>