openocd.git
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>
3 years agoflash/nor/sfdp|stmqspi: fix build issue with clang on mac OS 40/5940/6
Tarek BOCHKATI [Fri, 20 Nov 2020 19:25:38 +0000 (20:25 +0100)]
flash/nor/sfdp|stmqspi: fix build issue with clang on mac OS

Change-Id: I3b3aa4236125523ad65fd615ada0f5647d26f526
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@st.com>
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5940
Tested-by: jenkins
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
3 years agojimtcl: switch to github 48/5948/3
Antonio Borneo [Thu, 5 Nov 2020 22:02:55 +0000 (23:02 +0100)]
jimtcl: switch to github

The 'historically' main repository of jimtcl in repo.or.cz has
lost sync with the github current main repository since July 2020.
The new tag 0.80 is not present in repo.or.cz.
The developer of jimtcl has been in contact with the admins of
repo.or.cz to fix the not better described sync issues and has now
decided to stop any further tentative. A new README has been added
on 2020-11-19 in the old repository to inform that it is abandoned
in favour of github. The old content in repo.or.cz will remain due
to forks that still exists in the same server.

Switch OpenOCD git submodules to fetch jimtcl code from the main
development repository in github.

Change-Id: Ia2d59f1347ccfe374538b38131badfd46054eb91
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5948
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
3 years agotarget/register: use an array of uint8_t for register's value 37/5937/5
Antonio Borneo [Sun, 15 Nov 2020 21:10:58 +0000 (22:10 +0100)]
target/register: use an array of uint8_t for register's value

The use of 'void *' makes the pointer arithmetic incompatible with
standard C, even if this is allowed by GCC extensions.
The use of 'void *' can also hide incorrect pointer assignments.

Switch to 'uint8_t *' and add GCC warning flag to track any use of
pointer arithmetic extension.

Change-Id: Ic4d15a232834cd6b374330f70e2473a359b1607f
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5937
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
3 years agomips_mips64: fix minor host endianness bug 44/5944/2
Antonio Borneo [Sun, 22 Nov 2020 12:02:32 +0000 (13:02 +0100)]
mips_mips64: fix minor host endianness bug

Commit 80f1a92bd798 ("mips64: Add generic mips64 target support")
adds a log of the target's program counter in function
mips_mips64_debug_entry() by directly casting the little-endian
buffer in pc->value.
This is going to print an incorrect value on big-endian hosts.

Use the function buf_get_u64() to return the register value.

Not tested on real HW. Issue identified with GCC compiler flag
'-Wcast-align=strict' after change http://openocd.zylin.com/5937/
("target/register: use an array of uint8_t for register's value").

Change-Id: Icbda2b54a03fdec287c804e623f5db4252f9cd2a
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Fixes: 80f1a92bd798 ("mips64: Add generic mips64 target support")
Reviewed-on: http://openocd.zylin.com/5944
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
3 years agoarm7_9_common: fix host endianness bug in arm7_9_full_context() 43/5943/2
Antonio Borneo [Sun, 22 Nov 2020 11:29:04 +0000 (12:29 +0100)]
arm7_9_common: fix host endianness bug in arm7_9_full_context()

The original code passes to ->read_core_regs() and to
->read_xpsr() the pointer to the little-endian buffer reg.value.
This is incorrect because the two functions above require a
pointer to uint32_t, since they already run the conversion with
arm_le_to_h_u32() in the jtag callback.
This causes a mismatch on big-endian host and the registers get
read with the incorrect endianness.

Use an intermediate buffer to read the registers as uint32_t and
to track the destination reg.value pointer, then copy the value in
reg.value after the call to jtag_execute_queue().

Tested with qemu-armeb and an OpenOCD built through buildroot
configured for cortex-a7 big-endian.

Note that if jtag_execute_queue() fails, the openocd register
cache is not updated, so the already modified flags 'valid' and
'dirty' are incorrect. This part should be moved after the call to
jtag_execute_queue() too.

Change-Id: Iba70d964ffbb74bf0860bfd9d299f218e3bc65bf
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5943
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
3 years agoarmv4_5: fix output of command 'arm reg' 42/5942/2
Antonio Borneo [Sat, 21 Nov 2020 23:33:59 +0000 (00:33 +0100)]
armv4_5: fix output of command 'arm reg'

Commit fc2abe63fd3c ("armv7m: use generic arm::core_mode") adds
two special modes for ARMv6M and ARMv7M in struct arm_mode_data[].
While these modes do not have any additional register to be dumped
by command 'arm reg', the command still prints an header for these
modes but not followed by any register.

Detect the special modes for ARMv6M and ARMv7M and skip them to
avoid printing the useless header.

Change-Id: I04145769e5742624f143c910eebf9a6f6d8e3cdc
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Fixes: fc2abe63fd3c ("armv7m: use generic arm::core_mode")
Reviewed-on: http://openocd.zylin.com/5942
Tested-by: jenkins
3 years agoarmv4_5: fix segmentation fault in command 'arm reg' 41/5941/3
Antonio Borneo [Sat, 21 Nov 2020 23:15:44 +0000 (00:15 +0100)]
armv4_5: fix segmentation fault in command 'arm reg'

Commit fed713104904 ("armv4_5: support weirdo ARMv6 secure monitor
mode") introduces the secure mode 28 of ARMv6 as a synonymous of
mode 22 (MON), but does not add it in the switch/case in command
'arm reg'.
When command 'arm reg' scans the array arm_mode_data[] on targets
without secure modes, it does not detect the new secure mode as
not supported by the architecture, thus triggers a segmentation
fault when it try to read the register's value from unallocated
memory.
Issue detected with target arm926ejs.

Add the new mode in the switch/case and treat it as the mode MON.

Change-Id: I2b72cc558e097879a7ee6ea601200bfda6b60270
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Fixes: fed713104904 ("armv4_5: support weirdo ARMv6 secure monitor mode")
Reviewed-on: http://openocd.zylin.com/5941
Tested-by: jenkins
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
3 years agojep106: Add new IDs from JEDEC 44/5244/5
Boran Car [Fri, 21 Jun 2019 17:42:17 +0000 (18:42 +0100)]
jep106: Add new IDs from JEDEC

From JEP106AZ, released on May 24, 2019.

Change-Id: I768b7077ec6abcd19ae1530b5715c7ea993add67
Signed-off-by: Boran Car <boran.car@hex-five.com>
Reviewed-on: http://openocd.zylin.com/5244
Tested-by: jenkins
Reviewed-by: Jonathan McDowell <noodles-openocd@earth.li>
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Jiri Kastner <cz172638@gmail.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 years agoAdd initial RTT support 55/4055/13
Marc Schink [Thu, 17 Sep 2020 13:23:31 +0000 (15:23 +0200)]
Add initial RTT support

Real Time Transfer (RTT) is an interface specified by SEGGER based on
basic memory reads and writes to transfer data bidirectionally between
target and host.
Every target that supports so called "background memory access", which
means that the target memory can be accessed by the debugger while the
target is running, can be used.

RTT is especially of interest for targets which do not support Serial
Wire Output (SWO) (e.g. ARM Cortex-M0) or where using semihosting is
not possible (e.g. real-time applications) [1].

The data transfer is organized in channels where each channel consists
of an up- and/or down-channel. See [2] for more details.

Channels are exposed via TCP connections. One or more RTT server can be
assigned to each channel to make them accessible to an unlimited number
of TCP connections.

The current implementation does not respect buffer flags which are used
to determine what happens when writing to a full buffer.

Note that the implementation is designed in a way that the RTT
operations can be directly performed by an adapter (e.g. J-Link).

[1] https://devzone.nordicsemi.com/tutorials/6/
[2] https://www.segger.com/jlink-rtt.html

Change-Id: I8bc8a1b381fb74e08b8752d5cf53804cc573c1e0
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: http://openocd.zylin.com/4055
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 years agoadi_v5_swd: wait for readable DPIDR, ABORT if stalled 30/5730/7
Tomas Vanek [Fri, 1 Mar 2019 20:44:27 +0000 (21:44 +0100)]
adi_v5_swd: wait for readable DPIDR, ABORT if stalled

Reading of DPIDR is the very first operation after JTAG to SWD sequence.
Without this change if DPIDR read fails then swd connect fails.

Keep trying JTAG to SWD sequence and DPIDR read until success
or timeout 0.5 sec. It makes setting of adapter srst delay on SWD transport
mostly unnecessary.

Also test for ERROR_WAIT (which should not occur according to
IHI 0031E B4.3.2 but a quirk is known) and if bus is kept stalled
then issue abort to make the next connect possible.

Change-Id: Id8fe6618605bbeb4fed5061e987ed55de90a35f2
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/5730
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
3 years agoarm_adi_v5: prevent possibly endless recursion in dap_dp_init() 29/5729/5
Tomas Vanek [Mon, 29 Jun 2020 11:34:07 +0000 (13:34 +0200)]
arm_adi_v5: prevent possibly endless recursion in dap_dp_init()

If dap_dp_read_atomic() in 30 trials loop fails, dap->do_reconnect is set.
Following dap_dp_read_atomic() calls dap_queue_dp_read() which in case
of SWD transport calls swd_queue_dp_read(). It starts
with swd_check_reconnect() and it calls swd_connect() because
dap->do_reconnect is set. swd_connect() does some initialization,
reads DPIDR and calls dap_dp_init() again!

Moreover if dap_dp_init() is called from cortex_m_reset_(de)assert()
one level of recursion is necessary to reconnect the target.

Introduce dap_dp_init_or_reconnect() for use in cortex_m reset
and similar.
Remove loop of 30 atomic reads of DP_STAT to prevent unwanted recursion.

Change-Id: I54052fdefe50bf5f7c7b59fe751fe2063d5710c9
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/5729
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
3 years agotcl/target: remove deprecated ${target}_${adapter}.cfg files 29/5929/3
Tarek BOCHKATI [Sun, 8 Nov 2020 20:48:14 +0000 (21:48 +0100)]
tcl/target: remove deprecated ${target}_${adapter}.cfg files

Change-Id: Ic4837ad3bd06eb353020e44638306f341a923c05
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@st.com>
Reviewed-on: http://openocd.zylin.com/5929
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
3 years agohelper/command: disable logging of registered commands [RFC] 28/5928/2
Tomas Vanek [Sun, 8 Nov 2020 12:46:39 +0000 (13:46 +0100)]
helper/command: disable logging of registered commands [RFC]

Every debug log of OpenOCD contains approximately 130 lines like:

Debug: 264 147 command.c:354 register_command_handler(): registering 'flash'...

Because only root name of the command is logged, most of lines is not
too informative. E.g. registering 'flash' is repeated 14 times.

Karl Passon submitted the patch [1] changing the logged cmd name from
root to lowest level. It makes the log better. Unfortunately we also have
'reset_config' and 'cortex_m reset_config' and similar which looks
equal in the log after [1].
Moreover [1] has not been reviewed for 5 years.

So my guess is that nobody uses that crap in debug log.

Save more than 10 kbytes in any debug log and make log analyse easier
by blocking log command in #if 0 block.
If some developer eventually needs to debug cmd registering he can easily
enable logging again.

[1] http://openocd.zylin.com/2765

Change-Id: Ib7e528aadd692fd0da2e3c005b4c5a484551b728
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/5928
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Christopher Head <chead@zaber.com>
3 years agoflash/nor/stm32f1x: fix error message 27/5927/2
Tomas Vanek [Sun, 8 Nov 2020 09:09:33 +0000 (10:09 +0100)]
flash/nor/stm32f1x: fix error message

Backported from gd32vf103.c

Change-Id: I9c5bb7b36e6efcee0473c97047058ef26cc46eb7
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/5927
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
3 years agostm32l4x: cosmetic simplification of get_stm32l4_info 36/5536/6
Tarek BOCHKATI [Sun, 22 Mar 2020 18:36:12 +0000 (19:36 +0100)]
stm32l4x: cosmetic simplification of get_stm32l4_info

Change-Id: I2542f946f64388d908b1502f869643080fce9f9e
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: http://openocd.zylin.com/5536
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Andreas Bolsch <hyphen0break@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
3 years agoflash/stm32l4x: STM32L55/L56xx basic support (non-secure mode) 10/5510/9
Tarek BOCHKATI [Wed, 25 Mar 2020 15:33:30 +0000 (16:33 +0100)]
flash/stm32l4x: STM32L55/L56xx basic support (non-secure mode)

STM32L5 have 512 Kbytes of Flash memory with dual bank architecture.
STM32L5 flash is quite similar to L4 flash, mainly register names
and offsets and some bits are changed.
NON-SECURE flash is located at 0x8000000 like L4 devices, so no
big change is needed (secure flash will be subject of another change).

Note: flash driver name is set stm32l5x, in order to extend the commands
with specific L5 commands (to manage TZEN for example ...)

Note: this works only when TZEN=0

Change-Id: Ie758abb4aa19a3f29eeb0702d7dcb43992e4c639
Signed-off-by: Michael Jung <mijung@gmx.net>
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: http://openocd.zylin.com/5510
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
3 years agoflash/stm32l4x: introduce table with register offsets 09/5509/8
Tarek BOCHKATI [Tue, 3 Nov 2020 00:58:59 +0000 (01:58 +0100)]
flash/stm32l4x: introduce table with register offsets

This change is a preparation for STM32L5 support on top of L4 driver
STM32L5 flash is quite similar to L4 flash, mainly register names
and offsets and some bits are changed.

flash_regs table is introduced within stm32l4_flash_bank struct in order
to get correct register offsets, by using the driver internal function
'stm32l4_get_flash_reg_by_index'.

To use efficiently register indexes, stm32l4 _[get|read|write]_flash_reg
functions are surcharged to accept register indexes.

IMPORTANT: stm32l4_write_option is not surcharged, and they always accept
the option register offset.

tested on NUCLEO-G474RE and STM32L4R9I-DISCO

Change-Id: I739d3e97d63b831af6aa569c5629db0000209551
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: http://openocd.zylin.com/5509
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
3 years ago60-openocd.rules: add ULINKplus CMSIS-DAP based adapter 26/5926/2
Tarek BOCHKATI [Fri, 6 Nov 2020 11:33:14 +0000 (12:33 +0100)]
60-openocd.rules: add ULINKplus CMSIS-DAP based adapter

Change-Id: I5935e0a184b8995122d197046ef8fb4e7eefb884
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@st.com>
Reviewed-on: http://openocd.zylin.com/5926
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
3 years agodoc: document CMSIS-DAP v2 30/5930/2
Tomas Vanek [Sun, 8 Nov 2020 21:34:26 +0000 (22:34 +0100)]
doc: document CMSIS-DAP v2

Change-Id: Ie54e855901c079b456c26a6239177c7678cdcac7
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/5930
Tested-by: jenkins
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
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)