openocd.git
3 years agotelnet: support end and home keys 94/6094/5
Tarek BOCHKATI [Wed, 10 Mar 2021 23:36:17 +0000 (00:36 +0100)]
telnet: support end and home keys

this will help navigate to the line start and end easily

Change-Id: I3f42eb5267df64c59a85ece67de5fce39a8843ec
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: http://openocd.zylin.com/6094
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
3 years agoImplement CRC32 algorithm for RISC-V. 76/6076/4
Tim Newsome [Wed, 3 Mar 2021 20:41:03 +0000 (12:41 -0800)]
Implement CRC32 algorithm for RISC-V.

Signed-off-by: Tim Newsome <tim@sifive.com>
Change-Id: Id437f78e74e3d837ff203f84c4eeb996bfad9a01
Reviewed-on: http://openocd.zylin.com/6076
Reviewed-by: Jan Matyas <matyas@codasip.com>
Reviewed-by: Marc Schink <dev@zapb.de>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
3 years agoaarch64: add support for "reset halt" 47/5947/4
Christian Hoff [Mon, 23 Nov 2020 13:34:56 +0000 (14:34 +0100)]
aarch64: add support for "reset halt"

Support halting the CPU directly after a reset. If halt is
requested, the CPU stops directly at the reset vector, before
any code is executed.

This functionality was implemented using the Reset Catch
debug event.

Change-Id: If90d54c088442340376f0b588ba10267ea8e7327
Signed-off-by: Christian Hoff <christian.hoff@advantest.com>
Reviewed-on: http://openocd.zylin.com/5947
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
3 years agojtag: remove minidriver code and minidriver-dummy 91/6091/4
Antonio Borneo [Tue, 3 Nov 2020 15:50:49 +0000 (16:50 +0100)]
jtag: remove minidriver code and minidriver-dummy

With zy1000 removed, there is no other implementation that uses
the minidriver, apart from the test/example minidriver-dummy.
While the idea of the minidriver is probably still valid (that is
to intercept jtag primitives before serialization), there is no
current use case, no guarantee it is really working, and the way
it was implemented (by macros and #if conditionals) is really hard
to maintain and test.

Let's let it rip in git history, from where it could eventually be
taken back in a more modern implementation.
The entry points of minidriver API are still in the code with the
original names.

Change-Id: I882e32cb26cf5842f9cba14e3badaf8948e3760d
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6091
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
3 years agozy1000: drop the code, deprecated in v0.10.0 90/6090/4
Antonio Borneo [Sun, 1 Nov 2020 11:30:27 +0000 (12:30 +0100)]
zy1000: drop the code, deprecated in v0.10.0

The code for zy1000 has been marked as deprecated in release
v0.10.0, 4 years ago.

Time to drop it!

Change-Id: I08fca2a2bf8f616f031e15fd37dac3197a40ba50
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6090
Tested-by: jenkins
3 years agoioutil: drop the code, deprecated in v0.10.0 89/6089/4
Antonio Borneo [Sun, 1 Nov 2020 09:51:36 +0000 (10:51 +0100)]
ioutil: drop the code, deprecated in v0.10.0

The code for ioutil has been marked as deprecated in release
v0.10.0, 4 years ago.

Time to drop it!

Change-Id: I36dce1669ebe9acada5f9e752835c53e5214e3be
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6089
Tested-by: jenkins
3 years agooocd_trace: drop the code, deprecated in v0.10.0 88/6088/4
Antonio Borneo [Sun, 1 Nov 2020 09:41:47 +0000 (10:41 +0100)]
oocd_trace: drop the code, deprecated in v0.10.0

The code for oocd_trace has been marked as deprecated in release
v0.10.0, 4 years ago.

Time to drop it!

Change-Id: I989f8345dee4ff2369bcf5e2e2ace86bbd5aa6a5
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6088
Tested-by: jenkins
3 years agotarget: remove handling of target's deprecated_name 87/6087/3
Antonio Borneo [Sat, 31 Oct 2020 23:14:52 +0000 (00:14 +0100)]
target: remove handling of target's deprecated_name

We do not have anymore any deprecated target name.
Drop the code to handle deprecated target names and the placehold
in struct target_type.

This patch is separated from the patch that drops the remaining
deprecated target names to be ready to revert this if there is any
need in the future.

Change-Id: I96fca7ffa39d8292f81e79f115ea45c4a30035d7
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6087
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
3 years agotarget: remove target names already deprecated in v0.8.0 86/6086/3
Antonio Borneo [Sat, 31 Oct 2020 23:10:55 +0000 (00:10 +0100)]
target: remove target names already deprecated in v0.8.0

Some target name were marked as deprecated in release v0.7.0 and
v0.8.0, almost 7 years ago, and replaced with more 'actual' names.
We can reasonably expect that in these 7 years any user of OpenOCD
has already migrated to v0.8.0 or to some newer release, thus has
already updated any local/personal script to get rid of the
deprecated message.

Drop the target names already deprecated in v0.8.0.

Change-Id: I7c7491496db1b302b4eb1e9fc6090b58d4acf05a
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6086
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
3 years agostartup.tcl: remove commands already deprecated in v0.7.0 85/6085/3
Antonio Borneo [Sat, 31 Oct 2020 22:58:33 +0000 (23:58 +0100)]
startup.tcl: remove commands already deprecated in v0.7.0

Some command were already marked as deprecated in release v0.7.0,
more then 7 years ago, and for some of them the depredation date
is even earlier.
We can reasonably expect that in these 7 years any user of OpenOCD
has already migrated to v0.7.0 or to some following intermediate
build, thus has already updated any local/personal script to get
rid of the deprecated message.

Drop the commands already deprecated in v0.7.0.

Change-Id: I81cdc415ab855ebf30980ef5199f9780c5d7f932
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6085
Tested-by: jenkins
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
3 years agoopenocd: remove command line flag -p/--pipe deprecated in v0.5.0 84/6084/3
Antonio Borneo [Sat, 31 Oct 2020 23:22:49 +0000 (00:22 +0100)]
openocd: remove command line flag -p/--pipe deprecated in v0.5.0

The OpenOCD command line flag -p/--pipe was marked as deprecated
in release v0.5.0, more than 9 years ago.
We can reasonably expect that in these 9 years any user of OpenOCD
has already migrated to v0.5.0 or to some newer release, thus has
already updated any local/personal script to get rid of the
deprecated message.

Drop the command line flag already deprecated in v0.5.0.

Change-Id: I2faeb592ed2c2f67c2d3227f118093e39fcf4a8c
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6084
Tested-by: jenkins
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
3 years agotarget/arm920t: remove command 'arm920t cp15i' deprecated in v0.4.0 83/6083/3
Antonio Borneo [Sat, 31 Oct 2020 23:45:05 +0000 (00:45 +0100)]
target/arm920t: remove command 'arm920t cp15i' deprecated in v0.4.0

The command 'arm920t cp15i' was marked as deprecated in release
v0.4.0, almost 11 years ago.
We can reasonably expect that in these years any user of OpenOCD
has already migrated to v0.4.0 or to some newer release, thus has
already updated any local/personal script.
There is no run-time warning about the deprecation, but it is
reported in the help and in the documentation.

Drop the command already deprecated in v0.4.0.

Change-Id: I755c4283e13e125558fcd73b15fe20498eae95ca
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6083
Tested-by: jenkins
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
3 years agotarget/arm720t: remove command 'arm720t cp15' deprecated in v0.4.0 82/6082/3
Antonio Borneo [Sat, 31 Oct 2020 23:38:13 +0000 (00:38 +0100)]
target/arm720t: remove command 'arm720t cp15' deprecated in v0.4.0

The command 'arm720t cp15' was marked as deprecated in release
v0.4.0, almost 11 years ago.
We can reasonably expect that in these years any user of OpenOCD
has already migrated to v0.4.0 or to some newer release, thus has
already updated any local/personal script.
There is no run-time warning about the deprecation, but it is
reported in the help and in the documentation.

Drop the command already deprecated in v0.4.0.

Change-Id: I2b325d0312d96ca5e5f0f1bad13bb162b3b75c52
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6082
Tested-by: jenkins
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
3 years agoflash/stm32l4x: zero init stm32l4_flash_bank struct on flash bank initialization 03/6103/2
Raúl Sanchez Siles [Sat, 13 Mar 2021 00:09:01 +0000 (01:09 +0100)]
flash/stm32l4x: zero init stm32l4_flash_bank struct on flash bank initialization

This is specially needed when, in the probe routine, device is not
found among the stm32l4_parts. In this case, the stm32l4_flash_bank->part_info
is undefined and inadvertentanly used afterwards:
part_info = stm32l4_info->part_info;

If the stm32l4_flash_bank is zero init, the probe routine checks for
the validity of the part_info field in the previous struct and correctly
detects the unsupported (or not found) condition, raising an error
rather than a SIGSEGV

Change-Id: I7d9d669fb3fa7f8f0903acd60046966b4acb0031
Signed-off-by: Raúl Sánchez Siles <rasasi78@gmail.com>
Reviewed-on: http://openocd.zylin.com/6103
Tested-by: jenkins
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
3 years agoconfigure.ac: switch to autoconf 2.69 08/6008/4
Antonio Borneo [Fri, 8 Jan 2021 12:15:14 +0000 (13:15 +0100)]
configure.ac: switch to autoconf 2.69

OpenOCD file configure.ac requires autoconf equal or newer then
2.64, which is quite old.
These are the release dates so far:
- autoconf-2.64 2009-07-26
- autoconf-2.65 2009-11-21
- autoconf-2.66 2010-07-02
- autoconf-2.67 2010-08-02
- autoconf-2.68 2010-09-22
- autoconf-2.69 2012-04-24
- autoconf-2.70 2020-12-08

Switch to autoconf 2.69, which is old enough to be the standard in
current systems.
This should reduce the effort on configure.ac compatibility.

Change-Id: Ia7c78d2fa34c50ed5ccf4fb66ad3484369cf3b4a
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6008
Tested-by: jenkins
3 years agojimtcl: update to version 0.80 (2020-10-29) 49/5949/3
Antonio Borneo [Sun, 29 Nov 2020 21:25:37 +0000 (22:25 +0100)]
jimtcl: update to version 0.80 (2020-10-29)

Update jimtcl to version 0.80.
Add a workaround in Makefile.am to allow 'make distcheck' with the
new jimtcl. A fix is already merged upstream but will be part of
the future release 0.81 of jimtcl.

Change-Id: I1cebfb9c17179114960dc771e0b31836b4b9b058
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5949
Tested-by: jenkins
3 years agotcl/target: add BCM2711 configuration file 66/6066/5
Tarek BOCHKATI [Wed, 17 Feb 2021 23:35:48 +0000 (00:35 +0100)]
tcl/target: add BCM2711 configuration file

The Broadcom BCM2711 used in Raspberry Pi 4
No documentation was found on Broadcom website
Partial information is available in raspberry pi website:
https://www.raspberrypi.org/documentation/hardware/raspberrypi/bcm2711/

Change-Id: I3db6c9af520af8ab4c21ad35ff0f2db28efc0325
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: http://openocd.zylin.com/6066
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 years agotcl/target: add BCM2837 configuration file 69/6069/3
Tarek BOCHKATI [Sat, 20 Feb 2021 22:40:56 +0000 (23:40 +0100)]
tcl/target: add BCM2837 configuration file

This is the Broadcom chip used in the Raspberry Pi 3,
and in later models of the Raspberry Pi 2.

Partial information is available in raspberry pi website:
https://www.raspberrypi.org/documentation/hardware/raspberrypi/bcm2837
https://www.raspberrypi.org/documentation/hardware/raspberrypi/bcm2837b0

Change-Id: I1188a7866304c59f670a543809aca3927174786e
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: http://openocd.zylin.com/6069
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 years agotcl/target: add BCM2836 configuration file 68/6068/3
Tarek BOCHKATI [Sat, 20 Feb 2021 22:21:53 +0000 (23:21 +0100)]
tcl/target: add BCM2836 configuration file

The Broadcom chip used in the Raspberry Pi 2 Model B

Partial information is available in raspberry pi website:
https://www.raspberrypi.org/documentation/hardware/raspberrypi/bcm2836

Change-Id: I50b040db213c5b72f63d5f5534c552426c7376f9
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: http://openocd.zylin.com/6068
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 years agotcl/target: add BCM2835 configuration file 67/6067/5
Tarek BOCHKATI [Fri, 19 Feb 2021 14:23:34 +0000 (15:23 +0100)]
tcl/target: add BCM2835 configuration file

This is the Broadcom chip used in the Raspberry Pi Model A, B, B+,
the Compute Module, and the Raspberry Pi Zero.

Partial information is available in raspberry pi website:
https://www.raspberrypi.org/documentation/hardware/raspberrypi/bcm2835

Change-Id: Ifeb012952473d624327e8c010ac5c886d9473aa0
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: http://openocd.zylin.com/6067
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 years agoflash/nor/stmqspi: Replace macros with static inline functions 46/6046/6
Marc Schink [Mon, 1 Feb 2021 20:23:35 +0000 (21:23 +0100)]
flash/nor/stmqspi: Replace macros with static inline functions

There is no good reason to use macros instead of static inline functions. The
current code is hard maintain. For example, it changes variables outside of the
macro scope. Also, it is conflicting with the C coding style.

Change-Id: I5ac9d2ae076ef73c176d4e32b2e7e0a99fa875ab
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: http://openocd.zylin.com/6046
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 years agostlink: swo: use completely the available buffer 61/6061/2
Antonio Borneo [Sat, 13 Feb 2021 22:28:16 +0000 (23:28 +0100)]
stlink: swo: use completely the available buffer

The buffer passed to stlink_usb_trace_read() is allocated of size
*size and does not need to be zero-terminated. There is no reason
to not fill its last byte.

When checking the bytes available on swo, limit the retrieved byte
length to *size.

Change-Id: Iade0f8963118695931f13a8a3f1ab204911236b6
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reported-by: Adrian Negreanu <adrian.negreanu@nxp.com>
Reviewed-on: http://openocd.zylin.com/6061
Tested-by: jenkins
Reviewed-by: Adrian M Negreanu <adrian.negreanu@nxp.com>
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
3 years agojtag/nulink: add a space after PRIx32 60/6060/2
Antonio Borneo [Sat, 13 Feb 2021 13:40:18 +0000 (14:40 +0100)]
jtag/nulink: add a space after PRIx32

Missing the space cause the hex value to be printed together with
the following field.

Add a space after PRIx32.

Change-Id: I95824a9a8b8c0ad911d6c31f732d926cb3e0c068
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6060
Tested-by: jenkins
Reviewed-by: Jonathan McDowell <noodles-openocd@earth.li>
3 years agocortex_m: avoid reading and writing non-existent registers 59/6059/5
Tarek BOCHKATI [Fri, 12 Feb 2021 20:12:43 +0000 (21:12 +0100)]
cortex_m: avoid reading and writing non-existent registers

Change-Id: Iedc24352c8d3444372da06d00fcec9603540f950
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: http://openocd.zylin.com/6059
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 years agoAdd configuration file for Olimex H405 49/6049/5
Felipe Balbi [Thu, 4 Feb 2021 12:50:15 +0000 (14:50 +0200)]
Add configuration file for Olimex H405

Change-Id: I34a030f65ebe041408655ea9792346b146bd1092
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Reviewed-on: http://openocd.zylin.com/6049
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 years agoserver: revert commit 7e6556b3cad8 31/6031/2
Antonio Borneo [Fri, 13 Nov 2020 22:39:26 +0000 (23:39 +0100)]
server: revert commit 7e6556b3cad8

With the removal of old tpiu code, commit 7e6556b3cad8 ("server:
permit the add_service function to return the created service")
http://openocd.zylin.com/5717/ can be reverted.

Fix also the new calls to add_service().

Change-Id: Ib7f2dfc6a9e829239e20313e0f121911085fdc00
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6031
Tested-by: jenkins
Reviewed-by: Adrian M Negreanu <adrian.negreanu@nxp.com>
3 years agoarmv7m_trace: get rid of the old tpiu code 30/6030/2
Antonio Borneo [Fri, 13 Nov 2020 22:36:24 +0000 (23:36 +0100)]
armv7m_trace: get rid of the old tpiu code

Remove all the old tpiu code and replace it with a wrapper that
uses the new commands, prints-out the new commands and informs
about the deprecation.

All the code that handles the deprecated tpiu commands is enclosed
between the comments
/* START_DEPRECATED_TPIU */
and
/* END_DEPRECATED_TPIU */
so will be easy to remove it in the future.

Change-Id: I70b0486770128203b923346382d9a90b8ec08439
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6030
Tested-by: jenkins
Reviewed-by: Adrian M Negreanu <adrian.negreanu@nxp.com>
3 years agotcl/target: start using the new TPIU/SWO support 59/5859/8
Antonio Borneo [Sun, 11 Oct 2020 22:12:05 +0000 (00:12 +0200)]
tcl/target: start using the new TPIU/SWO support

Create the TPIU and SWO device in target config file.
Replace the target event 'trace-config' with the TPIU/SWO event
'post-enable'.
Extend the existing code in the event handler to properly set the
gpio mode and speed to permit synchronous trace.

This patch is not exhaustive of all the targets that have SWO, but
has to be considered as an initial example.

Change-Id: If4bbf364c0d2aef3ae49951e76507a3b1cfd58e7
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5859
Tested-by: jenkins
Reviewed-by: Adrian M Negreanu <adrian.negreanu@nxp.com>
3 years agoarm_tpiu_swo: add support for independent TPIU and SWO 58/5858/10
Antonio Borneo [Sun, 11 Oct 2020 22:11:46 +0000 (00:11 +0200)]
arm_tpiu_swo: add support for independent TPIU and SWO

This is supposed to replace big part of armv7m_trace.[ch], since
TPIU is not only the one implemented in Cortex-M3 and M4.

Change-Id: I7588d16cbefe9cdb371c52fb0aa5cdfb48518804
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5858
Tested-by: jenkins
3 years agoitm: rework itm commands before 'init' 29/6029/3
Antonio Borneo [Fri, 13 Nov 2020 18:41:41 +0000 (19:41 +0100)]
itm: rework itm commands before 'init'

If the command 'itm port[s]' is issued before 'init', the ITM can
not be programmed because OpenOCD cannot access the target yet.
The configuration is recorded and applied after target examine.
The current test to trigger the ITM delayed-programming is based
on the TPIU configuration. This is allowed because the only use of
ITM it so send data through TPIU.
In case of system TPIU, not belonging anymore to the target, there
is no more association between target ITM and system TPIU.

Add a flag to record the pending ITM configuration requested
before 'init' and test the flag to trigger the delayed-programming
of the ITM.

Change-Id: I101eb97a116d7925cd2ff068f3e8813fc008b08e
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6029
Tested-by: jenkins
3 years agostlink: fix execution order in stlink_config_trace() 34/5934/3
Antonio Borneo [Thu, 12 Nov 2020 14:27:01 +0000 (15:27 +0100)]
stlink: fix execution order in stlink_config_trace()

The change [1] guarantees that the value pointed by 'prescaler'
gets always set, even when the adapter does not support the
specific mode requested (e.g. sync), or during trace disabling.
This works fine with the code in armv7m_trace_tpiu_config(), but
requires all the parameters to be valid also to disable the trace
(with 'enable==false'), otherwise returns error on incorrect
parameters or even causes segmentation fault if pointers
'trace_freq' or 'prescaler' are NULL.

Another problem in stlink_config_trace(), not linked with [1], is
caused by a tentative to change the settings on an already enabled
trace; the trace is disabled before the new parameters are fully
validated and in case of invalid parameters the trace is not
re-enabled.
It would be more logical to first check all the parameters, then
disable the trace, change the settings and re-enable the trace.

Practically revert [1] by checking 'enable==false' at function
entry, then disable trace and exit without any further check on
the other parameters.
For the case 'enable==true', validate all the function parameters
then disable the trace, update the trace settings and re-enable
the trace.
Modify the caller armv7m_trace_tpiu_config() to initialize the
variable 'prescaler' to a safe value to avoid the issue targeted
by [1].

[1] commit 38277fa75280 ("jtag/drivers/stlink_usb: fix SWO prescaler")

Change-Id: Ia6530682162ca2c9f5ac64301f2456f70cc07ed2
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5934
Tested-by: jenkins
Reviewed-by: Adrian M Negreanu <adrian.negreanu@nxp.com>
3 years agodrivers/rlink: switch to libusb1 91/5991/5
Antonio Borneo [Tue, 29 Dec 2020 00:26:15 +0000 (01:26 +0100)]
drivers/rlink: switch to libusb1

Convert the driver from libusb0 to libusb1.

Change-Id: I17d14522db18b4050d462d23151ec97d3a315a7f
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5991
Tested-by: jenkins
Reviewed-by: Marc Schink <dev@zapb.de>
3 years agoarmv7m_trace_itm_config: wait for ITMBusy to be cleared 43/6043/4
Adrian Negreanu [Fri, 20 Nov 2020 16:53:51 +0000 (18:53 +0200)]
armv7m_trace_itm_config: wait for ITMBusy to be cleared

pg315 of CoreSight Components:

It is recommended that the ITMEn bit is cleared and waits for the
ITMBusy bit to be cleared, before changing any fields in the
Control Register, otherwise the behavior can be unpredictable.

Change-Id: Ie9a2b842825c98ee5edc9a35776320c668047769
Signed-off-by: Adrian Negreanu <adrian.negreanu@nxp.com>
Reviewed-on: http://openocd.zylin.com/6043
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 years agocmsis_dap: remove DAP_MAX_CLOCK 64/5964/3
Adrian Negreanu [Mon, 7 Dec 2020 12:54:05 +0000 (14:54 +0200)]
cmsis_dap: remove DAP_MAX_CLOCK

Discussed here:

    https://sourceforge.net/p/openocd/mailman/message/35466010/

Change-Id: Ic4d38a872f4b13b794ad0a8a2abdbe5bb21eced3
Signed-off-by: Adrian Negreanu <adrian.negreanu@nxp.com>
Reviewed-on: http://openocd.zylin.com/5964
Tested-by: jenkins
Reviewed-by: Bohdan Tymkiv <bhdt@cypress.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 years agotarget: Remove redundant initialization of endianness 39/6039/2
Yasushi SHOJI [Thu, 28 Jan 2021 14:25:26 +0000 (23:25 +0900)]
target: Remove redundant initialization of endianness

target->endianness is initialized to TARGET_ENDIAN_UNKNOWN at 34 lines
below, before calling target_configure.  This initialization is
redundant and not needed.

Change-Id: Iea2d5e17a13c1a8b0b209ba7c20043736b520ef6
Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
Reviewed-on: http://openocd.zylin.com/6039
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 years agotarget/mips: Remove typedef'd struct 33/6033/2
Marc Schink [Tue, 26 Jan 2021 08:15:47 +0000 (09:15 +0100)]
target/mips: Remove typedef'd struct

The C style guide forbids typedef'd structs, see 'Naming Rules'.

Change-Id: I449590251056c478c05105cdc18014ab4eb77ed8
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: http://openocd.zylin.com/6033
Tested-by: jenkins
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 years agoflash/nand/lpc32xx: Remove typedef'd struct 32/6032/2
Marc Schink [Tue, 26 Jan 2021 08:04:57 +0000 (09:04 +0100)]
flash/nand/lpc32xx: Remove typedef'd struct

The C style guide forbids typedef'd structs, see 'Naming Rules'.

Change-Id: I983dd52307136d1b5adb58d8c44c0c14422d31e2
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: http://openocd.zylin.com/6032
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 years agortos: Remove typedef'd struct 28/6028/2
Marc Schink [Mon, 25 Jan 2021 10:28:59 +0000 (11:28 +0100)]
rtos: Remove typedef'd struct

The C style guide forbids typedef'd structs, see 'Naming Rules'.

Change-Id: Ia7c8218fb61ff0c74b6dd0d10fb51a77cf059c14
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: http://openocd.zylin.com/6028
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 years agotcl/target: add Rockchip RK3399 target 94/5994/4
Jiri Kastner [Fri, 1 Jan 2021 22:27:11 +0000 (23:27 +0100)]
tcl/target: add Rockchip RK3399 target

Change-Id: I28f404b1e53fc9dbb04b3f939294ae248bbde183
Signed-off-by: Jiri Kastner <cz172638@gmail.com>
Reviewed-on: http://openocd.zylin.com/5994
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 years agostlink: support of ST-LINK TCP server using stlink-dap and hla 33/5633/23
Tarek BOCHKATI [Tue, 12 Jan 2021 22:58:53 +0000 (23:58 +0100)]
stlink: support of ST-LINK TCP server using stlink-dap and hla

Quote: The ST-LINK TCP server is an application to share the debug
interface of a single ST-LINK board among several host applications,
typically a debugging tool and a monitoring tool.

Note: ST-Link TCP server does not support the SWIM transport.

ST-LINK TCP server allows several applications to connect to the same
ST-Link through sockets (TCP).

To use ST-LINK TCP server:
 - using stlink-dap : use 'st-link backend tcp [port]'
 - using hla : use 'hla_stlink_backend tcp [port]'

the default port value is 7184

Change-Id: I9b79f65267f04b1e978709934892160e65bd2d6d
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: http://openocd.zylin.com/5633
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 years agostlink: separate stlink core from USB functions 32/5632/14
Tarek BOCHKATI [Sun, 24 May 2020 16:55:44 +0000 (17:55 +0100)]
stlink: separate stlink core from USB functions

the introduced stlink_backend_s struct provides an API to separate USB
internals from stlink core.

this separation aims to ease:
 - stlink-server integration [1]
 - stlink driver split into modules:
   - stlink_core
   - stlink_usb
   - stlink_tcp [1]

[1] refer to http://openocd.zylin.com/#/c/5633/

Change-Id: Iff6790942612ce1769ec4c75990914534e5e9e24
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: http://openocd.zylin.com/5632
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 years agoeMAG: Add Ampere eMAG config files 69/5569/5
Anthony Ferranti [Wed, 1 Apr 2020 19:46:30 +0000 (15:46 -0400)]
eMAG: Add Ampere eMAG config files

Add board and target configuration files for
Ampere eMAG8180 board and Ampere eMAG processor.

Tested on an Ampere eMAG8180 development platform.

Change-Id: I222653f0fc12d25202a7e469db3594076cbc38ed
Signed-off-by: Anthony Ferranti <ferranti@os.amperecomputing.com>
Signed-off-by: Daniel Goehring <dgoehrin@os.amperecomputing.com>
Reviewed-on: http://openocd.zylin.com/5569
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 years agotcl/board: Add AM642 EVM basic support 52/5952/13
Nishanth Menon [Mon, 30 Nov 2020 14:18:32 +0000 (08:18 -0600)]
tcl/board: Add AM642 EVM basic support

Add basic connection details with AM642 EVM

Change-Id: I95dcf6afadb61bfd8456b79274eae863b834167d
Signed-off-by: Nishanth Menon <nm@ti.com>
Reviewed-on: http://openocd.zylin.com/5952
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Vignesh Raghavendra
Tested-by: jenkins
3 years agotcl/board: Add J7200 EVM basic support 51/5951/13
Nishanth Menon [Mon, 30 Nov 2020 03:01:24 +0000 (21:01 -0600)]
tcl/board: Add J7200 EVM basic support

Add basic connection details with J7200 EVM

Change-Id: Ia8fa5033a693ac09849d33693c81b8cb206f17c1
Signed-off-by: Nishanth Menon <nm@ti.com>
Reviewed-on: http://openocd.zylin.com/5951
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
3 years agotcl/board: Add J721E EVM basic support 85/5185/17
Nishanth Menon [Sat, 11 May 2019 08:15:39 +0000 (03:15 -0500)]
tcl/board: Add J721E EVM basic support

Add basic connection details with J721E EVM

Change-Id: I0c2d25252432914d8e371e81761a59c05924bd8e
Signed-off-by: Nishanth Menon <nm@ti.com>
Reviewed-on: http://openocd.zylin.com/5185
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
3 years agotcl/board: Add AM654 EVM basic support 83/5183/17
Nishanth Menon [Fri, 8 Jun 2018 21:48:27 +0000 (16:48 -0500)]
tcl/board: Add AM654 EVM basic support

Add basic connection details with AM654 evm

Change-Id: Iea2240860e50ae42cf6f1617a10e24f63c6dd988
Signed-off-by: Nishanth Menon <nm@ti.com>
Reviewed-on: http://openocd.zylin.com/5183
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
3 years agotcl/target: Add K3 basic support 82/5182/15
Nishanth Menon [Fri, 8 Jun 2018 21:48:27 +0000 (16:48 -0500)]
tcl/target: Add K3 basic support

Add basic connection details for AM654 and J721E SoCs from TI.

See AM65x Technical Reference Manual (SPRUID7, April 2018)
for further details: https://www.ti.com/lit/pdf/spruid7

See J721E Technical Reference Manual (SPRUIL1, May 2019)
for further details: https://www.ti.com/lit/pdf/spruil1

See J7200 Technical Reference Manual (SPRUIU1, June 2020)
for further details: https://www.ti.com/lit/pdf/spruiu1

See AM64X Technical Reference Manual (SPRUIM2, Nov 2020)
for further details: https://www.ti.com/lit/pdf/spruim2

Change-Id: Ie5108c6ad6f1304a6bf5b9f81aa9ebd33b8a559d
Signed-off-by: Nishanth Menon <nm@ti.com>
Reviewed-on: http://openocd.zylin.com/5182
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
3 years agoRestore normal development cycle
Paul Fertser [Sun, 7 Mar 2021 12:44:45 +0000 (15:44 +0300)]
Restore normal development cycle

Signed-off-by: Paul Fertser <fercerpav@gmail.com>
3 years agoThe openocd-0.11.0 release v0.11.0
Paul Fertser [Sun, 7 Mar 2021 10:36:49 +0000 (13:36 +0300)]
The openocd-0.11.0 release

Signed-off-by: Paul Fertser <fercerpav@gmail.com>
3 years agotcl/target/eos_s3: fix variable's expansion typo 79/6079/3
Antonio Borneo [Wed, 3 Mar 2021 20:57:33 +0000 (21:57 +0100)]
tcl/target/eos_s3: fix variable's expansion typo

TCL expands the variables only if preceded by a dollar sign.

Add the missing dollar before the variable's name '_CPUTAPID'.

Change-Id: Icc5d0dddf24f75d12ee63fee69e1b265e842ca43
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reported-by: Wes Cilldhaire <wes@sol1.com.au>
Fixes: c3166b43e415 ("tcl/target: Add QuickLogic EOS S3 MCU configuration")
Reviewed-on: http://openocd.zylin.com/6079
Tested-by: jenkins
Reviewed-by: TM <tommy_murphy@hotmail.com>
3 years agotarget: avoid polling during 'resumed' event handler 74/6074/4
Antonio Borneo [Fri, 26 Feb 2021 21:35:39 +0000 (22:35 +0100)]
target: avoid polling during 'resumed' event handler

OpenOCD is based on a single main loop that schedules all the
activities.
At the execution of a TCL command, the timestamp is checked to
eventually trigger the polling of the targets. This means that by
executing a TCL command the polling can be triggered and detect a
change of target's state.

When openocd 'resumes' a target, the target can halt again by
hitting a breakpoint.
The 'resumed' event handler is started just after the target has
been resumed, but it triggers a polling before the execution of
its very first instruction.
If the polling finds the target halted, it will run the 'halted'
event handler, that will then be executed 'before' the pending
'resumed' handler.

In case of gdb, a 'continue' command will restart the target but,
polling (and halt detection) executed before the end of the resume
process will hide the halt. As a consequence, the gdb will not be
informed of the halt and will remains waiting as if the target is
still running without showing the prompt.

This can be verified by running on the target a firmware with a
loop, run openocd with a dummy 'resumed' event, and let gdb to set
a breakpoint in the loop. A 'continue' command will cause the
target to halt again by hitting the breakpoint at the next loop
iteration, but gdb will loose it and will not return the prompt.

openocd -f board/st_nucleo_f4.cfg -c \
'stm32f4x.cpu configure -event resumed {echo hello}'
arm-none-eabi-gdb -ex 'target remote :3333' -ex 'b *$pc' -ex c

Disable the polling while executing target's resume().
Document it and provide hints to developers to cope with future
implementation.

Change-Id: I3be830a8e7c2ef6278617cb4547a4d676b0ddeb5
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reported-by: Габитов Александр Фаритович <gabitov@planarchel.ru>
Reviewed-on: http://openocd.zylin.com/6074
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
3 years agoautotools: generate list of NEWS-xx file during configure 54/6054/2
Antonio Borneo [Thu, 11 Feb 2021 18:47:46 +0000 (19:47 +0100)]
autotools: generate list of NEWS-xx file during configure

Commit 4fc0f3530c51 ("Makefile.am: fix non-POSIX warning from
automake") uses the BSD make extension '!=' to generate the list
of files NEWS-xx, but it's not POSIX (yet), it's not backward
compatible with GNU make 3.82 (used in CentOS 7, EOL scheduled for
2024) and depending on automake evolution it could trigger again
the warning 'apparently' just fixed.

Move in configure the generation of the file list.
The only drawback is that when a developer adds a new NEWS-xx
file, he/she has to run configure again before 'make distcheck',
otherwise will get failure.

Change-Id: Ia97e7f4e612655a97702f95e8451040539659b85
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reported-by: Jan Matyáš <jmatyas@codasip.com>
Reviewed-on: http://openocd.zylin.com/6054
Tested-by: jenkins
Reviewed-by: Jan Matyas <matyas@codasip.com>
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
3 years agotarget: use proper macro for parsing watchpoint address 58/6058/2
Peter Mamonov [Mon, 12 Oct 2020 12:02:44 +0000 (15:02 +0300)]
target: use proper macro for parsing watchpoint address

Currently wp/rwp commands fail on 64-bit targets:

> wp 0xffffffff80001400 4
addr option value ('0xffffffff80001400') is not valid

Change-Id: I94d4af906b02b7bd463c8d79a6235a3646dfc434
Signed-off-by: Peter Mamonov <pmamonov@gmail.com>
Reviewed-on: http://openocd.zylin.com/6058
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 years agoFix jtag_usb_location_equal for path members > 9 48/6048/2
Krzysztof Hockuba [Wed, 3 Feb 2021 22:01:29 +0000 (23:01 +0100)]
Fix jtag_usb_location_equal for path members > 9

In case an USB location path contains path members
larger than 9. The string_length variable is regardless
decremented by 2 with assumption that the member is
one digit length. For exmaple 1-12.2 will fail.
This patch uses strlen to calculate
digits in a path member.

Change-Id: I9c26a04d0c6af13fec65157f222599497294e2b2
Signed-off-by: Krzysztof Hockuba <krzysztof@hockuba.eu>
Reviewed-on: http://openocd.zylin.com/6048
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 years agodoc/manual: Fix function name typo 42/6042/3
Yasushi SHOJI [Thu, 28 Jan 2021 14:40:52 +0000 (23:40 +0900)]
doc/manual: Fix function name typo

We have both the singular form, register_command(), and the plural form
register_commands().

Change-Id: I905ea83988b8ac70dd809b02d53b646aa4d66697
Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
Reviewed-on: http://openocd.zylin.com/6042
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
3 years agodoc/manual: Fix @subpage handling 41/6041/3
Yasushi SHOJI [Thu, 28 Jan 2021 14:31:41 +0000 (23:31 +0900)]
doc/manual: Fix @subpage handling

The subpage "thelist" used to have a title "Pending and Open Tasks"
but the commit c41db358a0100ab changed it to "The List". With
@subpage, it now renders:

    "The List of The List enumerates opportunities for"

instead of

    "The List of Pending and Open Tasks enumerates opportunities for"

This commit fix it to

    "The List enumerates opportunities for"

Change-Id: Ifee0dcd9b3c9f7e651a8748a7afda99eedea3c5c
Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
Reviewed-on: http://openocd.zylin.com/6041
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 years agodoc: Fix type in Hooking up the JTAG Adapter 40/6040/2
Yasushi SHOJI [Thu, 28 Jan 2021 14:27:37 +0000 (23:27 +0900)]
doc: Fix type in Hooking up the JTAG Adapter

We are talking about adapter connectivity in this chapter. It should
be "dongles" instead of "cables".

Change-Id: I7bd4307765517375caa2af86dfc929d0ef66c3e6
Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
Reviewed-on: http://openocd.zylin.com/6040
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
3 years agogithub: fix github wokflow while pushing a tag 47/6047/3
Tarek BOCHKATI [Sun, 31 Jan 2021 23:18:14 +0000 (00:18 +0100)]
github: fix github wokflow while pushing a tag

this fix permits to add correctly the generated artifact (windows binaries)
into the release section.

Change-Id: Ia982370d3a1e08c623ebcabb5ac97e9fb49d00e0
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: http://openocd.zylin.com/6047
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 years agosteppenprobe: fix file permission 38/6038/2
Antonio Borneo [Wed, 27 Jan 2021 22:53:12 +0000 (23:53 +0100)]
steppenprobe: fix file permission

Commit 895d4a599585 ("tcl/interface/ftdi: Add Steppenprobe open
hardware interface") erroneously set the execution permission to
the configuration file.

Strip the execution permission.

Change-Id: I556451d5e6fee4aee385451e8c90216a25b6ef46
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Fixes: http://openocd.zylin.com/5653
Reviewed-on: http://openocd.zylin.com/6038
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
Tested-by: Paul Fertser <fercerpav@gmail.com>
3 years agoRestore +dev suffix
Paul Fertser [Sun, 24 Jan 2021 22:43:17 +0000 (01:43 +0300)]
Restore +dev suffix

Signed-off-by: Paul Fertser <fercerpav@gmail.com>
3 years agoThe openocd-0.11.0-rc2 release candidate v0.11.0-rc2
Paul Fertser [Sun, 24 Jan 2021 21:23:21 +0000 (00:23 +0300)]
The openocd-0.11.0-rc2 release candidate

Signed-off-by: Paul Fertser <fercerpav@gmail.com>
3 years agoREADME: add missing items for 0.11 27/6027/8
Tarek BOCHKATI [Sat, 23 Jan 2021 17:57:46 +0000 (18:57 +0100)]
README: add missing items for 0.11

JTAG adapters
  Cadence DPI, Cypress Kitpro, FTDI FT232R, Linux GPIOD, Mellanox rshim,
  Nuvoton Nu-Link, Nu-Link2, NXP IMX GPIO, Remote Bitbang, TI XDS110,
  Xilinx XVC/PCIe

Debug targets
  AArch64, Cortex-M (ARMv8-M), ARCv2, MIPS64, RISC-V, ST-STM8

Flash Drivers
  ATmega128RFA1, Atmel SAM, eSi-RISC, EZR32HG, MAX32, MXC, nRF52, PSoC6,
  Renesas RPC HF and SH QSPI, SiFive Freedom E, ST BlueNRG,
  STM32 QUAD/OCTO-SPI for Flash/FRAM/EEPROM, SWM050, TI CC13xx, TI CC26xx,
  TI CC32xx, TI MSP432, Winner Micro w600, Xilinx XCF

Change-Id: I341618ac5d7189e4f98268cecd66c99447b72af8
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@st.com>
Reviewed-on: http://openocd.zylin.com/6027
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
3 years agojlink: fix device discovery when network is off 25/6025/3
Bohdan Tymkiv [Fri, 22 Jan 2021 15:13:34 +0000 (17:13 +0200)]
jlink: fix device discovery when network is off

If user specifies a serial number for the jlink device, openocd
extends the search to network jlink devices too, without checking
if the host has a valid and functional network connection. If the
network is not functional, libjaylink returns error. This error
invalidates the discovery on USB, even if it was successful.

Factor-out parts of the jlink_init into separate jlink_open_device
function, use that function to firstly discover and match USB
devices and, if matching device was not found on the USB bus and
serial number was specified, repeat discovery and matching via TCP.

Fixes: https://sourceforge.net/p/openocd/tickets/294/
Change-Id: Iea0de1640d4e5b21ecc7e9c1dd6d36f214d647c2
Signed-off-by: Bohdan Tymkiv <bohdan200@gmail.com>
Reviewed-on: http://openocd.zylin.com/6025
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
Reviewed-by: Marc Schink <dev@zapb.de>
3 years agoREADME.macOS: explain how to install suitable Texinfo 26/6026/3
Paul Fertser [Sat, 23 Jan 2021 10:54:04 +0000 (13:54 +0300)]
README.macOS: explain how to install suitable Texinfo

Change-Id: Ic5906111f412eebd906a9be3fd0e133484def3eb
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/6026
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 years agoconfigure: drop macro 'AC_HEADER_TIME' 10/6010/3
Antonio Borneo [Fri, 8 Jan 2021 22:48:43 +0000 (23:48 +0100)]
configure: drop macro 'AC_HEADER_TIME'

The macro AC_HEADER_TIME has been obsoleted by autoconf 2.70.

Not all systems provide 'sys/time.h', plus some old system didn't
allowed to include both 'time.h' and 'sys/time.h' because 'time.h'
was included by 'sys/time.h' and was not properly protected to
allow multiple inclusion.
The macro AC_HEADER_TIME helps to detect such odd case.
Nowadays all the systems properly protect 'time.h', so its safe to
unconditionally include 'time.h', even if it is also included by
'sys/time.h'.

The case of systems without 'sys/time.h' is already covered by
configure.ac through the directive
AC_CHECK_HEADERS([sys/time.h])

Remove the obsoleted autoconf macro and simplify the code by
including 'time.h' unconditionally and check HAVE_SYS_TIME_H to
include 'sys/time.h'.

Change-Id: Iddb3f3f1d90c22668b97f8e756e1b4f733367a7d
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6010
Tested-by: jenkins
Reviewed-by: Marc Schink <dev@zapb.de>
3 years agoconfigure.ac: drop macro 'AC_PROG_CC_C99' from autoconf 2.70 09/6009/3
Antonio Borneo [Sat, 9 Jan 2021 18:51:42 +0000 (19:51 +0100)]
configure.ac: drop macro 'AC_PROG_CC_C99' from autoconf 2.70

The macro AC_PROG_CC_C99 has been obsoleted by autoconf 2.70 and
triggers a set of warnings from both 'aclocal' and 'autoconf'.
The test of AC_PROG_CC_C99 is now included in AC_PROG_CC.

For autoconf 2.69 and earlier the macro is still required, so
cannot be simply dropped.

Use a conditional test to avoid the warning on autoconf 2.70 but
still use AC_PROG_CC_C99 on older autoconf.

Change-Id: I5e8437f5a826fb63be6d07bcb5bb824f94683020
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6009
Tested-by: jenkins
Reviewed-by: Marc Schink <dev@zapb.de>
3 years agodriver/ftdi: skip trst in swd mode 06/6006/2
Antonio Borneo [Thu, 5 Mar 2020 16:00:50 +0000 (17:00 +0100)]
driver/ftdi: skip trst in swd mode

When using the adapter olimex arm-jtag-swd (to convert to SWD a
JTAG-only FTDI adapter), the pin trst on JTAG side is re-used to
control the direction of pin SWDIO on SWD side.
There is a single reset API at adapter driver to assert/deassert
either srst and/or trst. A request to assert/deassert srst can
cause also trst to change value, hanging the SWD communication.

In SWD mode, ignore the value passed to trst.

Change-Id: I5fe1eed851177d405d77ae6079da9642dc1a08f1
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6006
Tested-by: jenkins
3 years agocortex_m: [FIX] ARMv8-M does not support VECTRESET 14/6014/2
Tarek BOCHKATI [Tue, 12 Jan 2021 10:57:18 +0000 (11:57 +0100)]
cortex_m: [FIX] ARMv8-M does not support VECTRESET

ref: Arm®v8-M Architecture Reference Manual (DDI0553B.m)
     D1.2.3: AIRCR, Application Interrupt and Reset Control Register
             Bit [0] is RES0

Change-Id: I6ef451b2c114487e2732852a60e86c292ffa6a50
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@st.com>
Reviewed-on: http://openocd.zylin.com/6014
Tested-by: jenkins
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 years agotarget/riscv: fix build error with -Werror=maybe-uninitialized 13/6013/2
Tarek BOCHKATI [Mon, 11 Jan 2021 18:23:58 +0000 (19:23 +0100)]
target/riscv: fix build error with -Werror=maybe-uninitialized

using gcc 9.3 on ubuntu focal fossa with -Werror=maybe-uninitialized
we get this error:
  /src/target/riscv/riscv.c: In function ‘riscv_address_translate’:
  /src/target/riscv/riscv.c:1536:13: error: ‘pte’ may be used uninitialized

Change-Id: I51e180b43f9b6996e4e4058db49c179b9f81bcdc
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@st.com>
Reviewed-on: http://openocd.zylin.com/6013
Tested-by: jenkins
Reviewed-by: Tim Newsome <tim@sifive.com>
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 years agoflash/stmqspi: fix build error with -Werror=maybe-uninitialized 12/6012/2
Tarek BOCHKATI [Mon, 11 Jan 2021 18:21:06 +0000 (19:21 +0100)]
flash/stmqspi: fix build error with -Werror=maybe-uninitialized

using gcc 9.3 on ubuntu focal fossa with -Werror=maybe-uninitialized
we get this error:
  /src/flash/nor/stmqspi.c: In function ‘read_flash_id’:
  /src/flash/nor/stmqspi.c:1948:6: error: ‘retval’ may be used uninitialized

Change-Id: Ifd8ae60df847fc61e22ca100c008e3914c9af79b
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@st.com>
Reviewed-on: http://openocd.zylin.com/6012
Tested-by: jenkins
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 years agodoc/manual/primer/autotools.txt: fix doxygen warning 03/6003/2
Antonio Borneo [Sat, 2 Jan 2021 19:42:12 +0000 (20:42 +0100)]
doc/manual/primer/autotools.txt: fix doxygen warning

Commit ab90b8777855 ("configure: remove AM_MAINTAINER_MODE,
effectively always enabling all the rules") removes the configure
flag '--enable-maintainer-mode' and its documentation, but have
left a reference to the removed subsection 'primermaintainermode'
and this triggers a warning in doxygen:
doc/manual/primer/autotools.txt:21: warning: unable to
resolve reference to 'primermaintainermode' for \ref
command

Remove the obsoleted paragraph.

Change-Id: I56e69ef033d546d159745bed1b47c6105827e7ae
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Fixes: ab90b8777855 ("configure: remove AM_MAINTAINER_MODE, effectively always enabling all the rules")
Reviewed-on: http://openocd.zylin.com/6003
Tested-by: jenkins
3 years agoopenocd: fix doxygen parameters of functions 02/6002/2
Antonio Borneo [Sat, 2 Jan 2021 19:35:09 +0000 (20:35 +0100)]
openocd: fix doxygen parameters of functions

Add to doxygen comment the missing parameters.
Remove from doxygen comment any non-existing parameter.
Fix the parameter names in doxygen comment to match the one in the
function prototype.
Where the parameter name in the doxygen description seems better
than the one in the code, change the code.
Escape the character '<' to prevent doxygen to interpret it as an
xml tag.

Change-Id: I22da723339ac7d7a7a64ac4c1cc4336e2416c2cc
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6002
Tested-by: jenkins
3 years agoopenocd: fix incorrect doxygen comments 01/6001/2
Antonio Borneo [Sat, 2 Jan 2021 17:17:20 +0000 (18:17 +0100)]
openocd: fix incorrect doxygen comments

Use '@param' in front of function's parameters and '@a' when the
parameter is recalled in the description.

This fixes doxygen complains:
warning: Found unknown command '@buff16'

While there, fix a minor typo s/occured/occurred/ in a comment and
the typo s/@apram/@param/ in a doxygen comment.

Change-Id: I5cd86a80adef552331310a21c55ec5d11354be21
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6001
Tested-by: jenkins
3 years agoDoxyfile.in: exclude libjaylink from doxygen 00/6000/2
Antonio Borneo [Sat, 2 Jan 2021 16:39:57 +0000 (17:39 +0100)]
Doxyfile.in: exclude libjaylink from doxygen

When build using libjaylink as git submodule, doxygen includes the
libjaylink files and complains for multiple 'mainpage' comment
block, one in OpenOCD and the other in libjaylink:
src/jtag/drivers/libjaylink/libjaylink/core.c:37: warning:
found more than one \mainpage comment block! (first
occurrence: doc/manual/main.txt, line 1), Skipping current
block!

Exclude libjaylink submodule from doxygen.

Change-Id: I5e856817344c9f21f8c26f077a23c00b83cfbcb5
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6000
Tested-by: jenkins
3 years agodoc/manual/primer/jtag.txt: remove duplicated section name 99/5999/2
Antonio Borneo [Sat, 2 Jan 2021 16:32:26 +0000 (17:32 +0100)]
doc/manual/primer/jtag.txt: remove duplicated section name

The section name 'primerjtag' is used twice, causing doxygen to
complain:
warning: multiple use of section label 'primerjtag',
(first occurrence: doc/manual/primer/jtag.txt, line 107)

Rename one of them.

Change-Id: Id307915dbc51a7f647fab4fb28ab431e65344d61
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5999
Tested-by: jenkins
3 years agoDoxyfile.in: fix build out-of-tree 98/5998/2
Antonio Borneo [Sat, 2 Jan 2021 16:13:12 +0000 (17:13 +0100)]
Doxyfile.in: fix build out-of-tree

When doxygen is built out-of-tree, it fails to find the generated
file startup_tcl.inc:
src/openocd.c:59: warning: include file startup_tcl.inc
not found, perhaps you forgot to add its directory to
INCLUDE_PATH?

Add '@builddir@/src' to INCLUDE_PATH.

Change-Id: I51f2f6fe7224bba0f8b3db7219f9831de4e67139
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5998
Tested-by: jenkins
3 years agoflash/nor/max32xxx: fix path of include file 97/5997/2
Antonio Borneo [Sat, 2 Jan 2021 16:00:59 +0000 (17:00 +0100)]
flash/nor/max32xxx: fix path of include file

The relative path should have three times '..'.

Issue identified by doxygen:
src/flash/nor/max32xxx.c:85: warning: include file
../../contrib/loaders/flash/max32xxx/max32xxx.inc not
found, perhaps you forgot to add its directory to
INCLUDE_PATH?

Change-Id: Ie7b4948c6770b8acb9eff26e08eea32945ebb219
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5997
Tested-by: jenkins
3 years agodoc/style: fix doxygen error 96/5996/2
Antonio Borneo [Sat, 2 Jan 2021 15:49:11 +0000 (16:49 +0100)]
doc/style: fix doxygen error

Doxygen complains about non-closed nested comments:
doc/manual/style.txt:423: warning: Reached end of file
while still inside a (nested) comment. Nesting level 1
(probable line reference: 149)

This is caused by the string '/**' that is interpreted as the
beginning of a comment.

Escape the string to not let doxygen consider it as a comment

While there, replace @code/@endcode with @verbatim/@endverbatim to
properly render the line.

Change-Id: If2a27c4cf659326e317cc4ac8c0b313e97e40432
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5996
Tested-by: jenkins
3 years agoudev: fix permission for Ambiq Micro EVK's 04/6004/2
Antonio Borneo [Sun, 3 Jan 2021 11:02:49 +0000 (12:02 +0100)]
udev: fix permission for Ambiq Micro EVK's

Commit 68e204f1e91a ("udev: Add rules for Ambiq Micro EVK's.") was
initially proposed as http://openocd.zylin.com/3429/ then replaced
by http://openocd.zylin.com/3980/
The initial proposal was for file '99-openocd.rules', in which
MODE="664" was the norm.
After merge of http://openocd.zylin.com/2804/ the new udev rules
in '60-openocd.rules' switched to MODE="660", but the evolution of
the above patch missed this change.

Switch udev rules of Ambiq Micro EVK's to MODE="660" and uniform
them to the rest of the file.

Change-Id: I4b4eea535184ee8569da3264bff4f1fafb5bce4d
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Fixes: 68e204f1e91a ("udev: Add rules for Ambiq Micro EVK's.")
Reviewed-on: http://openocd.zylin.com/6004
Tested-by: jenkins
3 years agotarget: fix memory leak on multiple '-gdb-port' flag 05/6005/2
Antonio Borneo [Mon, 4 Jan 2021 18:24:21 +0000 (19:24 +0100)]
target: fix memory leak on multiple '-gdb-port' flag

In the odd case of multiple flags '-gdb-port' during 'target
create' or following 'configure', the new strdup()'ed value will
replace the old one without freeing it.

Free the old value (if it exists) before replacing it.

Change-Id: I1673346613ce7023880046e3a9ba473e75f18b8a
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6005
Tested-by: jenkins
3 years agocontrib: udev file for Cypress SuperSpeed Explorer kit 11/3611/13
Jiri Kastner [Sun, 3 Jan 2021 09:10:11 +0000 (10:10 +0100)]
contrib: udev file for Cypress SuperSpeed Explorer kit

lsusb output:

Bus 003 Device 011: ID 04b4:0007 Cypress Semiconductor Corp.
Couldn't open device, some information will be missing
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0         8
  idVendor           0x04b4 Cypress Semiconductor Corp.
  idProduct          0x0007
  bcdDevice            0.00
  iManufacturer           1
  iProduct                2
  iSerial                 0
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength          114
    bNumInterfaces          4
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0xa0
      (Bus Powered)
      Remote Wakeup
    MaxPower              100mA
    Interface Association:
      bLength                 8
      bDescriptorType        11
      bFirstInterface         0
      bInterfaceCount         2
      bFunctionClass          2 Communications
      bFunctionSubClass       2 Abstract (modem)
      bFunctionProtocol       1 AT-commands (v.25ter)
      iFunction               0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         2 Communications
      bInterfaceSubClass      2 Abstract (modem)
      bInterfaceProtocol      1 AT-commands (v.25ter)
      iInterface              0
      CDC Header:
        bcdCDC               1.10
      CDC ACM:
        bmCapabilities       0x02
          line coding and serial state
      CDC Union:
        bMasterInterface        0
        bSlaveInterface         1
      CDC Call Management:
        bmCapabilities       0x00
        bDataInterface          1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval              10
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass        10 CDC Data
      bInterfaceSubClass      0 Unused
      bInterfaceProtocol      0
      iInterface              0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        2
      bAlternateSetting       0
      bNumEndpoints           3
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      4
      bInterfaceProtocol      0
      iInterface              0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x04  EP 4 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x85  EP 5 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x86  EP 6 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval              10
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        3
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      5
      bInterfaceProtocol      0
      iInterface              0

Change-Id: I62f0300199da3551c8774a4a5a4cd106a3ab2904
Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: Jiri Kastner <cz172638@gmail.com>
Reviewed-on: http://openocd.zylin.com/3611
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 years agoMakefile.am: fix override of target 'check-recursive' 86/5986/2
Antonio Borneo [Wed, 23 Dec 2020 18:15:02 +0000 (19:15 +0100)]
Makefile.am: fix override of target 'check-recursive'

To prevent executing the Jim Tcl tests, the makefile's target
'check-recursive' has been overridden in commit 56d163ce7951
("jimtcl: update to 0.77, the current version, enable only
specific modules").
This causes a runtime warning during build:
Makefile:6332: warning: overriding recipe for target 'check-recursive'
Makefile:5098: warning: ignoring old recipe for target 'check-recursive'

Instead of override the makefile's target 'check-recursive',
prevent the recursion by re-assigning as empty the variable
SUBDIRS for this specific target only.

Change-Id: I03d1c467eba42316a59aeed4612d6bdbe6211282
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Fixes: 56d163ce7951 ("jimtcl: update to 0.77, the current version, enable only specific modules")
Reviewed-on: http://openocd.zylin.com/5986
Tested-by: jenkins
3 years agocontrib: rpc_examples: haskell: fix ftbs with current libraries 87/5987/2
Paul Fertser [Wed, 23 Dec 2020 20:28:52 +0000 (23:28 +0300)]
contrib: rpc_examples: haskell: fix ftbs with current libraries

And get rid of some warnings along the way.

Change-Id: I8fdbe1fa304276be6b0f25249b902b3576aa3793
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/5987
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 years agodoc: fix over/underfull hboxes in PDF 95/5995/2
Paul Fertser [Fri, 1 Jan 2021 11:37:56 +0000 (14:37 +0300)]
doc: fix over/underfull hboxes in PDF

This adds some cosmetic changes to make the PDF User Manual look
proper.

Building it now requires Texinfo 5.0 which shouldn't be problematic
according to [0]. Commit 79fdeb37f486f74658f1eaf658abac8efb3eba6a is
effectively reverted.

[0] https://repology.org/project/texinfo/versions

Change-Id: I990bc23bdb53d24c302b26d74fd770ea738e4096
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/5995
Reviewed-by: Jonathan McDowell <noodles-openocd@earth.li>
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 years agoconfigure.ac: fix build with libusb0 and without libusb1 89/5989/4
Antonio Borneo [Tue, 29 Dec 2020 01:04:25 +0000 (02:04 +0100)]
configure.ac: fix build with libusb0 and without libusb1

Driver 'openjtag' requires both libftdi and libusb1.
The current check is incorrect and the driver is built when
libftdi is present with libusb0 and without libusb1, which causes
the linker to fail resolving the required libusb1 symbols.

Remove the check for libusb0 on driver 'openjtag'.
Create a new adapters group LIBFTDI_USB1_ADAPTERS to hold the
driver 'openjtag'.

Change-Id: I1f5e554b519e51c829d116ede894639cb55a26aa
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5989
Tested-by: jenkins
3 years agoconfigure: do not make Capstone dependency automagic 85/5985/5
Paul Fertser [Wed, 23 Dec 2020 17:49:56 +0000 (20:49 +0300)]
configure: do not make Capstone dependency automagic

This adds regular ./configure options to control dependency on the
Capstone disassembly engine. See [0] for the rationale.

[0] https://wiki.gentoo.org/wiki/Project:Quality_Assurance/Automagic_dependencies

Change-Id: I3e16dc5255d650aa1949ccf896b26dc96e522a75
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/5985
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 years agogdb_server: fix HW thread status at gdb attach 83/5983/2
Antonio Borneo [Sat, 19 Dec 2020 21:31:29 +0000 (22:31 +0100)]
gdb_server: fix HW thread status at gdb attach

At gdb attach, the event TARGET_EVENT_GDB_ATTACH is in charge of
halting the target.
For HW thread, rtos_update_threads() should be called after the
event to detect and record the new 'halted' status. Instead it is
called immediately before the event, thus reading the status
before the halt.

Move after the event the call to rtos_update_threads().

Change-Id: Iab3480ea0f5283ed6580f0f6c11200083197d1e9
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5983
Tested-by: jenkins
3 years agogdb_server: minor fix for indentation 82/5982/2
Antonio Borneo [Sat, 19 Dec 2020 15:15:54 +0000 (16:15 +0100)]
gdb_server: minor fix for indentation

Use a TAB in place of 4 spaces

Change-Id: Ic34b7c3ef24078d2c36a193d4dd079bca5a7ef2e
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Fixes: a4cdce0129a6 ("gdb_server: prevent false positive valgrind report")
Reviewed-on: http://openocd.zylin.com/5982
Tested-by: jenkins
Reviewed-by: Jonathan McDowell <noodles-openocd@earth.li>
3 years agortos/hwthread: fix register list for armv7a 81/5981/2
Antonio Borneo [Sat, 19 Dec 2020 14:44:41 +0000 (15:44 +0100)]
rtos/hwthread: fix register list for armv7a

The targets armv7a in file cortex_a.c inherit the register list
from file armv4_5.c thus, depending on the core status, some
register get marked as not existing.
For HW threads other than current target, the registers in the
list are not checked for existence and are all forwarded to GDB
that in turns complains for too many data:
  Remote 'g' packet reply is too long (expected 68 bytes, got 104 bytes)

Check all the attributes of the registers and pass to GDB only the
valid registers.

To test it, use a SMP cortex-a target (2 cores are enough) and add
-rtos hwthread
to all the cores. Connect GDB to OpenOCD and issue the GDB command
info threads

Change-Id: Ie66119fe83a3c8d53e9d18dda39e60fd97769669
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5981
Tested-by: jenkins
3 years agotcl/target/rk3308.cfg: add defer-examine 80/5980/3
Jiri Kastner [Wed, 16 Dec 2020 19:51:06 +0000 (20:51 +0100)]
tcl/target/rk3308.cfg: add defer-examine

only core0 is brought up by bootloader

Change-Id: I1d6b5e6ba7498beadbf3805f4271f0197e411bd5
Signed-off-by: Jiri Kastner <cz172638@gmail.com>
Reviewed-on: http://openocd.zylin.com/5980
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
Reviewed-by: Jonathan McDowell <noodles-openocd@earth.li>
3 years agocortex-a: fix reset on dapdirect transports 79/5979/2
Antonio Borneo [Wed, 2 Dec 2020 21:04:12 +0000 (22:04 +0100)]
cortex-a: fix reset on dapdirect transports

The target code for assert reset on cortex_a has been patched on
commit b0698501b0e7 ("cortex_a: fix cortex_a_assert_reset() if
srst_gates_jtag") then in cdba6ba0ad63 ("cortex_a: fix reset for
SWD transport") to workaround the mismatch between jtag and swd
implementations. See discussion for the second patch at
http://openocd.zylin.com/3641/

While all of these mismatches should hopefully be cleaned by the
reset framework rework, an extension of the workaround of the
second patch is required for dapdirect transports, either
dapdirect_swd and dapdirect_jtag.

Extend the existing workaround to all non-jtag transports.

Change-Id: Ia6a9d43bab524cbb3de4c37ce24c45f25187353d
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5979
Tested-by: jenkins
3 years agoarmv7m_trace: stop getting traces from adapter at exit 78/5978/3
Antonio Borneo [Mon, 14 Dec 2020 16:08:06 +0000 (17:08 +0100)]
armv7m_trace: stop getting traces from adapter at exit

If OpenOCD is reading trace data from the target, at exit it
should stop the adapter to gather data, but should left the target
still producing them.

Add a helper in armv7m_trace to disable the adapter's trace and
call it during OpenOCD teardown.

This also provides a workaround for an issue in the firmware of
ST-Link V3 till version V3J7. If the SWD connection is closed when
trace is active, at following connection the trace does not work
anymore.

Change-Id: I47ccab61405384938555096c5aca789eaa090d27
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5978
Reviewed-by: Jonathan McDowell <noodles-openocd@earth.li>
Tested-by: jenkins
3 years agoLICENSES: Update GFDL invariant text to match official wording 74/5974/2
Jonathan McDowell [Sun, 13 Dec 2020 10:28:56 +0000 (10:28 +0000)]
LICENSES: Update GFDL invariant text to match official wording

This was flagged by lintian against the Debian package; the text stating
there are no invariant sections deviates from the official GNU wording.
Update it to match the text at the bottom of:

https://www.gnu.org/licenses/old-licenses/fdl-1.2.en.html

Change-Id: Ie222237a8eede24c1b71218b05e1513b74208a47
Signed-off-by: Jonathan McDowell <noodles@earth.li>
Reviewed-on: http://openocd.zylin.com/5974
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 years agoMakefile.am: fix non-POSIX warning from automake 65/5965/2
Antonio Borneo [Mon, 7 Dec 2020 21:51:46 +0000 (22:51 +0100)]
Makefile.am: fix non-POSIX warning from automake

Automake issues a warning
Makefile.am:46: warning: wildcard $(srcdir: non-POSIX variable name
Makefile.am:46: (probably a GNU make extension)
because the GNU make function 'wildcard' is not POSIX.
Also the GNU make function 'shell' triggers a similar warning.

Use the POSIX extension '!=', that executes an arbitrary shell
command, to replace the GNU make 'wildcard'.
Don't include the file 'NEWS' because automake already includes it
by default.

Change-Id: Ice560c3789cec4f3f2197a255d6f5af7b1fde634
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5965
Tested-by: jenkins
Reviewed-by: Jonathan McDowell <noodles-openocd@earth.li>
3 years agoCorrect warning message 56/5956/2
Luca Lindhorst [Thu, 3 Dec 2020 11:34:41 +0000 (12:34 +0100)]
Correct warning message

The warning message regarding wrong verification checksum for LPC2000, claims that the verification will fail, but the checksum written correctly by openocd. Clarify this in the warning message.

Change-Id: I929ac767f7f9fdad9bace250c8c04a776462800a
Signed-off-by: Luca Lindhorst <l.lindhorst@wut.de>
Reviewed-on: http://openocd.zylin.com/5956
Tested-by: jenkins
Reviewed-by: Jonathan McDowell <noodles-openocd@earth.li>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 years agoRestore +dev suffix
Paul Fertser [Wed, 9 Dec 2020 22:43:12 +0000 (01:43 +0300)]
Restore +dev suffix

Signed-off-by: Paul Fertser <fercerpav@gmail.com>
3 years agoThe openocd-0.11.0-rc1 release candidate 07/5707/13 v0.11.0-rc1
Antonio Borneo [Sat, 30 May 2020 11:33:27 +0000 (13:33 +0200)]
The openocd-0.11.0-rc1 release candidate

Change-Id: I111fec1304482f5c0f9d6ee988be8a2ea3de3981
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
3 years agodoc: document adapter drivers linuxgpiod and sysfsgpio 61/5961/2
Antonio Borneo [Sun, 6 Dec 2020 17:19:01 +0000 (18:19 +0100)]
doc: document adapter drivers linuxgpiod and sysfsgpio

Change-Id: If894092a7ae04bb95fa1913d2e3c8465c2d0f75c
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5961
Tested-by: jenkins
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
3 years agoflash/nor/stmsmi: fix compile error with clang 12.0.0 58/5958/2
Antonio Borneo [Sat, 5 Dec 2020 22:28:53 +0000 (23:28 +0100)]
flash/nor/stmsmi: fix compile error with clang 12.0.0

The git preliminarily version of clang 12.0.0_r370171
f067bc3c0ad6 reports an error in the expansion of the macro
SMI_READ_REG():

error: '(' and '{' tokens introducing statement expression
appear in different macro expansion contexts
[-Werror,-Wcompound-token-split-by-macro]

Remove one intermediate macro expansion to make clang happy.

Change-Id: I8ae6d9c18808467ba8044d70cbf0a4f76a18d3e6
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5958
Tested-by: jenkins
Reviewed-by: Xiaofan <xiaofanc@gmail.com>
3 years agojtag/drivers/ulink: auto-detect OpenULINK USB endpoints numbers 45/2445/4
Łukasz Misek [Tue, 6 Jan 2015 12:53:09 +0000 (15:53 +0300)]
jtag/drivers/ulink: auto-detect OpenULINK USB endpoints numbers

This should provide greater compatibility with different OpenULINK
targets which might be using various endpoints numbers. Since they're
advertised in the USB descriptor anyway it makes sense to autodetect
them.

Interface is no longer claimed before attempting to load firmware to a
freshly booted device, so I have no idea if this will break on windows
or other uncommon systems (Paul).

Change-Id: Iee10dcb6911dcf46239c430e174d9f98b5bde3c2
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2445
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)