aboutsummaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
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>
2021-11-18cortex_m: use cortex_m_write_debug_halt_mask() in cortex_m_single_step_core()Tomas Vanek1-5/+2
cortex_m_single_step_core() used mem_ap_write_atomic_u32() to manipulate dhcsr bits unlike the rest of code, where a specialized function cortex_m_write_debug_halt_mask() takes place. Unify setting of dhcsr bits and use cortex_m_write_debug_halt_mask() here as well. Extracted from [1]. [1] Antonio Borneo: 6207: cortex_m: rework handling of dcb_dhcsr Link: https://review.openocd.org/c/openocd/+/6207 Change-Id: I9ef05ce88a9dce42e1d3d5404a4fe87ec86b5fe8 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/6676 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
2021-11-18flash/nor/at91samd: Add SAMR35J18B supportJanco Kock1-0/+1
Add support for the mcu SAMR35J18B Signed-off-by: Janco <janco@factorylab.nl> Change-Id: I45d801485ad1c16d1b3086516a2b6d71d13f3fc7 Reviewed-on: https://review.openocd.org/c/openocd/+/6664 Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Tested-by: jenkins
2021-11-15flash/nor/stm32f1x: Add support for GD32E23xasier702-2/+20
GD32E23x from GigaDevice is cortex-M23 microcontroller and it can work with the stm32f1x driver. Modifications are similar to this done for GD32F1x0 in #6164 (https://review.openocd.org/c/openocd/+/6164). Configuration file is added because its cortex-M23 CPU ID is different. I think that GigaDevice microcontrollers should be handled in an independent unit to separate them from STM32, but nowadays quick solution is welcome. Signed-off-by: asier70Andrzej Sierżęga <asier70@gmail.com> Change-Id: I91f31f5f66808bc50a8f607ac2c107e6b7c5e2b8 Reviewed-on: https://review.openocd.org/c/openocd/+/6527 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2021-11-13jtagspi: fix build on MacOSAntonio Borneo1-2/+2
Commit be57b0ab847e ("Update jtagspi driver for 1-, 2- and 4-byte addresses") introduces two incorrect format string for uint32_t data types. This cause build failure on MacOS: src/flash/nor/jtagspi.c:474:35: error: format specifies type 'unsigned char' but the argument has type 'uint32_t' (aka 'unsigned int') [-Werror,-Wformat] LOG_DEBUG("status=0x%02" PRIx8, *status); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~ src/flash/nor/jtagspi.c:513:65: error: format specifies type 'unsigned char' but the argument has type 'uint32_t' (aka 'unsigned int') [-Werror,-Wformat] LOG_ERROR("Cannot enable write to flash. Status=0x%02" PRIx8, status); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~ Fix the format string. Change-Id: I209053317c8b26c35c6f11be0553ccccc698c551 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Fixes: be57b0ab847e ("Update jtagspi driver for 1-, 2- and 4-byte addresses") Reviewed-on: https://review.openocd.org/c/openocd/+/6701 Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Tested-by: jenkins
2021-11-13flash/stm32h7x: don't read flash size using the H74/H75x CPU2Tarek BOCHKATI1-6/+11
CPU2 (Cortex-M4) cannot read flash size register. assume the maximum flash size without triggering an error message Change-Id: I5c3328b7cc42e3aa57165075021227d7936f3d26 Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6670 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2021-11-13flash/stm32h7x: avoid using magic numbers for device idsTarek BOCHKATI1-20/+25
Change-Id: I4d682ee828404974abd9a42f98b840d77835cfe0 Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6669 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins
2021-11-13stlink (tcp): manage scattered stlink-server responsesTarek BOCHKATI1-9/+28
detected in ubuntu 20.04 sometimes, the stlink-server response could be segmented on multiple packets. this causes stlink_tcp_send_cmd to fail with the following msg: Error: failed to receive USB CMD response because the received_size < expected size to fix the issue, do recv in a loop till all data is received or timeout is reached. Change-Id: I46cc60c231b4cc52f150ead268f843bc60c41149 Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6671 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins
2021-11-13helper/log: Add macros for target-related errors/warnings/...Jan Matyas1-0/+17
This commit introduces macros for target related log entries (error, warning, ...) which is a very common operation in OpenOCD: * LOG_TARGET_ERROR * LOG_TARGET_WARNING * LOG_TARGET_INFO * LOG_TARGET_DEBUG * LOG_TARGET_DEBUG_IO The goal is to have one macro for this common operation and to make such log entries look the same way - to make it more readable for humans as well easier for parsing via scripts. Change-Id: I6166565fc9040b03d3fca5c3aa44a1ccbcf96ad2 Signed-off-by: Jan Matyas <matyas@codasip.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6667 Tested-by: jenkins Reviewed-by: Tim Newsome <tim@sifive.com> Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2021-11-13jtag/adapter: fix memory leak on usb locationAntonio Borneo1-0/+2
At exit, free the memory allocated to hold the USB location. Change-Id: I050701f4dc8be14fd40e8add9d0b047461fa0d1c Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6646 Tested-by: jenkins Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
2021-11-13jtag: remove file driver.hAntonio Borneo5-30/+6
The only purpose of include file driver.h was to expose the API to register the adapter's commands. Move the prototype in adapter.h, already used by openocd.c. Change-Id: Ie1090c60ef9e5bac5ea187c87bed6e7b08d9671c Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6645 Tested-by: jenkins Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
2021-11-13jtag: align adapter speed code to new structureAntonio Borneo11-59/+59
Rename the jtag_XXX functions as adapter_XXX. Rename internal variables. Adapt log messages and comments text. Change-Id: I67f209c67074899cd58bad495055def03f0d1bcf Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6644 Tested-by: jenkins Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>