openocd.git
20 months agotarget/riscv: use struct riscv_info instead of typedef riscv_info_t 98/6998/2
Tomas Vanek [Thu, 26 May 2022 11:08:48 +0000 (13:08 +0200)]
target/riscv: use struct riscv_info instead of typedef riscv_info_t

Make the main RISC-V structure more compliant with OpenOCD coding style.
Other typedefs remains as is.

Change-Id: I5657ad28fea8108fd66ab27b2dfe1c868dc5805b
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/6998
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Tim Newsome <tim@sifive.com>
20 months agoarm_adi_v5: Adding Nuvoton NPCX quirk 30/6630/8
Ben Bender [Tue, 5 Oct 2021 07:58:57 +0000 (10:58 +0300)]
arm_adi_v5: Adding Nuvoton NPCX quirk

We found that the NPCX has an issue with the byte lanes so that non byte
aligned writes aren't working. To overcome this, for byte accesses we
copy the byte to be written to all of the byte lanes.

doc: Document command nu_npcx_quirks

Signed-off-by: benjbender <benjbender@gmail.com>
[Andreas Fritiofson: Squashed commits]
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Change-Id: I9ef63bf692f4e68f57459e1ec33f3abcbf533cd2
Reviewed-on: https://review.openocd.org/c/openocd/+/6630
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
20 months agodrivers/vdebug: add support for DAP level interface 65/6965/6
Jacek Wuwer [Wed, 4 May 2022 08:15:57 +0000 (10:15 +0200)]
drivers/vdebug: add support for DAP level interface

This patch adds support for DAP interface to Cadence vdebug driver.
It implements a new transport layer for dapdirect_swd.

Change-Id: I64b02a9e1ce91e552e07fca692879655496f88b6
Signed-off-by: Jacek Wuwer <jacekmw8@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6965
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
21 months agotarget/semihosting: export semihosting_common_handlers[] from header file 75/7075/2
Erhan Kurubas [Sun, 3 Jul 2022 08:38:17 +0000 (11:38 +0300)]
target/semihosting: export semihosting_common_handlers[] from header file

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: I4add0c1dc7888497ee90fd02754607a16434b66f
Reviewed-on: https://review.openocd.org/c/openocd/+/7075
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
21 months agotcl: ngultra: add target config file 46/7046/3
Adrien Grassein [Wed, 22 Jun 2022 09:23:31 +0000 (11:23 +0200)]
tcl: ngultra: add target config file

ngultra is a Quad-R52 SoC + an FPGA.

Signed-off-by: Adrien Grassein <agrassein@nanoxplore.com>
Change-Id: I6a04eab3d9a7610e9dfa3d9f647868e579b6bd8a
Reviewed-on: https://review.openocd.org/c/openocd/+/7046
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
21 months agohelper/jim-nvp: avoid camelcase error by deprecated API 52/7052/2
Antonio Borneo [Mon, 26 Apr 2021 06:57:28 +0000 (08:57 +0200)]
helper/jim-nvp: avoid camelcase error by deprecated API

Commit b8e18d292eb6 ("helper/jim-nvp: comply with coding style
[1/2]") tags as deprecated the old CamelCase API of jim-nvp, so
that old patches already in gerrit or in user's local git can
still build while dumping a deprecated message.

So far, we have not found any such case, so the deprecated API can
be safely dropped in preparation of v0.12.0-rc1.

Drop the compile flag "-Wno-error=deprecated-declarations" and the
deprecated API.

Change-Id: I52ce47eda69a51c2dd29aac15f16e285492d89b4
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7052
Tested-by: jenkins
21 months agoopenocd: src: replace SPDX to remaining files 73/7073/2
Antonio Borneo [Mon, 27 Jun 2022 14:10:57 +0000 (16:10 +0200)]
openocd: src: replace SPDX to remaining files

With most of the files already processed through scripts, replace
manually the license to the few remaining files.

Change-Id: I3c7131e66b89ddad482f1074b5be5a9a69fdf6fd
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7073
Tested-by: jenkins
21 months agoopenocd: src: replace the GPL-2.0-or-later license tag 72/7072/2
Antonio Borneo [Sun, 26 Jun 2022 23:26:22 +0000 (01:26 +0200)]
openocd: src: replace the GPL-2.0-or-later license tag

Replace the FSF boilerplate with the SPDX tag.

The SPDX tag on files *.c is incorrect, as it should use the C99
single line comment using '//'. But current checkpatch doesn't
allow C99 comments, so keep using standard C comments, by now.

Change-Id: I30cd66ac7d737f1973c68fdbb841ffcf00e917c4
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7072
Tested-by: jenkins
21 months agoopenocd: src/target: replace the GPL-2.0-or-later license tag 71/7071/2
Antonio Borneo [Sun, 26 Jun 2022 23:24:07 +0000 (01:24 +0200)]
openocd: src/target: replace the GPL-2.0-or-later license tag

Replace the FSF boilerplate with the SPDX tag.

The SPDX tag on files *.c is incorrect, as it should use the C99
single line comment using '//'. But current checkpatch doesn't
allow C99 comments, so keep using standard C comments, by now.

Change-Id: I255ad17235ff1e01bf0aa4deed4d944e1d693ddb
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7071
Tested-by: jenkins
21 months agoopenocd: src/rtos: replace the GPL-2.0-or-later license tag 70/7070/2
Antonio Borneo [Sun, 26 Jun 2022 23:10:12 +0000 (01:10 +0200)]
openocd: src/rtos: replace the GPL-2.0-or-later license tag

Replace the FSF boilerplate with the SPDX tag.

The SPDX tag on files *.c is incorrect, as it should use the C99
single line comment using '//'. But current checkpatch doesn't
allow C99 comments, so keep using standard C comments, by now.

Change-Id: If0194089baded7f58dc5d87a35d6e0aff9f43785
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7070
Tested-by: jenkins
21 months agoopenocd: src/jtag: replace the GPL-2.0-or-later license tag 69/7069/2
Antonio Borneo [Sun, 26 Jun 2022 23:06:45 +0000 (01:06 +0200)]
openocd: src/jtag: replace the GPL-2.0-or-later license tag

Replace the FSF boilerplate with the SPDX tag.

The SPDX tag on files *.c is incorrect, as it should use the C99
single line comment using '//'. But current checkpatch doesn't
allow C99 comments, so keep using standard C comments, by now.

Change-Id: Ie873d12bb0fb838d0d6252e6b9ca3c2118853e9a
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7069
Tested-by: jenkins
21 months agoopenocd: src/helper: replace the GPL-2.0-or-later license tag 68/7068/3
Antonio Borneo [Sun, 26 Jun 2022 22:58:56 +0000 (00:58 +0200)]
openocd: src/helper: replace the GPL-2.0-or-later license tag

Replace the FSF boilerplate with the SPDX tag.

The SPDX tag on files *.c is incorrect, as it should use the C99
single line comment using '//'. But current checkpatch doesn't
allow C99 comments, so keep using standard C comments, by now.

Change-Id: I7851617e2682f97ccc3927e3941aadef2df63b54
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7068
Tested-by: jenkins
21 months agoopenocd: src/flash: replace the GPL-2.0-or-later license tag 67/7067/2
Antonio Borneo [Sun, 26 Jun 2022 22:53:35 +0000 (00:53 +0200)]
openocd: src/flash: replace the GPL-2.0-or-later license tag

Replace the FSF boilerplate with the SPDX tag.

The SPDX tag on files *.c is incorrect, as it should use the C99
single line comment using '//'. But current checkpatch doesn't
allow C99 comments, so keep using standard C comments, by now.

Change-Id: Ic7db91fe37d1139d42c99e303b3243b6c8fe3ea2
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7067
Tested-by: jenkins
21 months agoopenocd: src: fix incorrect SPDX tags 66/7066/2
Antonio Borneo [Sun, 26 Jun 2022 21:10:08 +0000 (23:10 +0200)]
openocd: src: fix incorrect SPDX tags

The SPDX tag is aimed at machine handling and it's thus expected
to be placed in the first line in specific format.

Move the SPDX tag to the first line and fix it where needed.

The SPDX tag on files *.c is incorrect, as it should use the C99
single line comment using '//'. But current checkpatch doesn't
allow C99 comments, so keep using standard C comments, by now.

Change-Id: Ie9a05f530009d482a4116eebd147fd7e1ee3d41e
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7066
Tested-by: jenkins
21 months agoopenocd: src: fix incorrect GPL license tag 65/7065/2
Antonio Borneo [Sun, 26 Jun 2022 09:44:00 +0000 (11:44 +0200)]
openocd: src: fix incorrect GPL license tag

Use the standard SPDX tag, where it was incorrectly applied.

The SPDX tag on files *.c is incorrect, as it should use the C99
single line comment using '//'. But current checkpatch doesn't
allow C99 comments, so keep using standard C comments, by now.

Change-Id: Iaec63abc6e0a38e5b0ae0ea7f5ecee7ca007bbbd
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7065
Tested-by: jenkins
21 months agoopenocd: src: replace the GPL-2.0-only license tag 64/7064/2
Antonio Borneo [Sun, 26 Jun 2022 09:38:41 +0000 (11:38 +0200)]
openocd: src: replace the GPL-2.0-only license tag

Replace the FSF boilerplate with the SPDX tag.

Change-Id: I29f51caa5ae9854d05ce7e150d168a7002607cd1
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7064
Tested-by: jenkins
21 months agoopenocd: src: replace the incomplete GPL-2.0-or-later license tag 63/7063/2
Antonio Borneo [Mon, 27 Jun 2022 08:04:43 +0000 (10:04 +0200)]
openocd: src: replace the incomplete GPL-2.0-or-later license tag

Few files have the FSF boilerplate without the latest statement on
where to get the GPL license.

Manually replace the FSF boilerplate with the SPDX tag.
While there, reorganize the copyright statement.

The SPDX tag on files *.c is incorrect, as it should use the C99
single line comment using '//'. But current checkpatch doesn't
allow C99 comments, so keep using standard C comments, by now.

Change-Id: I0c908d01c010e24f9c7e94885e7fbed4ecf26a86
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7063
Tested-by: jenkins
21 months agoopenocd: src: replace the GPL and BSD-Source-Code license tags 62/7062/2
Antonio Borneo [Mon, 27 Jun 2022 13:01:17 +0000 (15:01 +0200)]
openocd: src: replace the GPL and BSD-Source-Code license tags

Add the new license text in the license pool.
Replace the GPL and BSD boilerplates with the SPDX tag.
Add the copyright owner of Atmel, as it was explicitly listed in
the BSD boilerplate text.

The SPDX tag on files *.c is incorrect, as it should use the C99
single line comment using '//'. But current checkpatch doesn't
allow C99 comments, so keep using standard C comments, by now.

Change-Id: Ibb117dbf8402269be3e5ba4f4c472162494d813f
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7062
Tested-by: jenkins
21 months agoopenocd: src: replace the GPL with eCos exception 2.0 license tag 61/7061/2
Antonio Borneo [Mon, 27 Jun 2022 13:44:05 +0000 (15:44 +0200)]
openocd: src: replace the GPL with eCos exception 2.0 license tag

Add the license exception text in the license pool.
Add the exception chapter in license-rules.txt
Replace the boilerplate with the SPDX tag.

The SPDX tag on files *.c is incorrect, as it should use the C99
single line comment using '//'. But current checkpatch doesn't
allow C99 comments, so keep using standard C comments, by now.

Change-Id: Ied513b7c9c0722ed2a9c11dbdff3fbf59f1b41ce
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7061
Tested-by: jenkins
21 months agoopenocd: src: replace the BSD-2-Clause-Views license tag 60/7060/2
Antonio Borneo [Mon, 27 Jun 2022 08:31:09 +0000 (10:31 +0200)]
openocd: src: replace the BSD-2-Clause-Views license tag

Add the license text in the license pool.
Replace the BSD boilerplate with the SPDX tag.
Add the copyright owner of Jim Project, as it was explicitly
listed in the boilerplate text.

The SPDX tag on files *.c is incorrect, as it should use the C99
single line comment using '//'. But current checkpatch doesn't
allow C99 comments, so keep using standard C comments, by now.

Change-Id: I6dd004b1945773c10539016ce733d1fbfe776a9d
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7060
Tested-by: jenkins
21 months agoopenocd: src: replace the BSD-3-Clause license tag 59/7059/2
Antonio Borneo [Mon, 27 Jun 2022 08:32:34 +0000 (10:32 +0200)]
openocd: src: replace the BSD-3-Clause license tag

Replace the BSD boilerplate with the SPDX tag.

The SPDX tag on files *.c is incorrect, as it should use the C99
single line comment using '//'. But current checkpatch doesn't
allow C99 comments, so keep using standard C comments, by now.

Change-Id: I5a8cab2051eee7eb99adf67f9631b0827c1359de
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7059
Tested-by: jenkins
21 months agoopenocd: src: add GPL license tag on files that miss it 58/7058/2
Antonio Borneo [Sun, 26 Jun 2022 09:07:45 +0000 (11:07 +0200)]
openocd: src: add GPL license tag on files that miss it

Some file miss completely the license tag.

Add the SPDX tag, using the same GPL-2.0-or-later license of the
OpenOCD project.

The SPDX tag on files *.c is incorrect, as it should use the C99
single line comment using '//'. But current checkpatch doesn't
allow C99 comments, so keep using standard C comments, by now.

Change-Id: I1fb51e722232d14f050458a820c3041de3dc9138
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7058
Tested-by: jenkins
21 months agoopenocd: src: remove duplicated GPL license tag 57/7057/2
Antonio Borneo [Sun, 26 Jun 2022 08:54:00 +0000 (10:54 +0200)]
openocd: src: remove duplicated GPL license tag

SPDX tag is replacing the FSF boilerplate.
For files that have both, remove the FSF boilerplate and keep only
the SPDX tag.

Change-Id: I04c4764d13d4ca92453f30ed16aeae53cd4c3fc8
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7057
Tested-by: jenkins
21 months agoopenocd: build: add SPDX tag 51/7051/2
Antonio Borneo [Sat, 25 Jun 2022 16:19:46 +0000 (18:19 +0200)]
openocd: build: add SPDX tag

Add the SPDX tag to makefiles, configuration scripts and tcl files
present in the folders under src/

Change-Id: I1e4552aafe46ef4893d510da9d732c5f181784a4
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7051
Tested-by: jenkins
21 months agosemihosting: fix return value of SYS_READ and SYS_WRITE 03/6803/4
Pavel Kirienko [Sun, 9 Jan 2022 19:05:01 +0000 (21:05 +0200)]
semihosting: fix return value of SYS_READ and SYS_WRITE

ARM/RISC-V semihosting calls SYS_READ/SYS_WRITE require
inversion of the result value as described in
"Semihosting for AArch32 and AArch64". Prior to
this patch, this was done correctly only if
(semihosting->is_fileio==false).

This patch has been tested with STM32F446.

Change-Id: I1b34c8d8393f7dfa66ee6539904a2eaf8f9154b0
Signed-off-by: Pavel Kirienko <pavel.kirienko@gmail.com>
Fixes: https://sourceforge.net/p/openocd/tickets/232/
Reviewed-on: https://review.openocd.org/c/openocd/+/6803
Tested-by: jenkins
Reviewed-by: Tim Newsome <tim@sifive.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
21 months agotarget: esp_xtensa_smp: fix clang report 50/7050/3
Antonio Borneo [Sat, 25 Jun 2022 10:40:24 +0000 (12:40 +0200)]
target: esp_xtensa_smp: fix clang report

The variable 'smp_break' is only set and used in case of smp.
But clang cannot track if 'target->smp' get modified between the
set and the use of 'smp_break', so it consider possible to use
'smp_break' uninitialized.

Initialize 'smp_break' to silent clang.

Change-Id: Ifa25a84fe9ffa25b8b58d7920ec77994c3b7ebfe
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Fixes: 77287b8d47b4 ("target: add Espressif ESP32 basic support")
Reviewed-on: https://review.openocd.org/c/openocd/+/7050
Reviewed-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Tested-by: jenkins
21 months agosemihosting: move semihosting_result_t from riscv.h to the semihosting_common.h 39/7039/4
Erhan Kurubas [Mon, 20 Jun 2022 13:34:10 +0000 (15:34 +0200)]
semihosting: move semihosting_result_t from riscv.h to the semihosting_common.h

These enum values are useful for the arch level semihosting call handlers.
Currently riscv uses them, we also need similar return codes for the xtensa.

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: I8f63749cc203c59b07862f33edf3c393cd7e33a9
Reviewed-on: https://review.openocd.org/c/openocd/+/7039
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
21 months agotcl/esp32s3: check memory protection on gdb attach 37/7037/3
Erhan Kurubas [Sat, 18 Jun 2022 21:16:37 +0000 (23:16 +0200)]
tcl/esp32s3: check memory protection on gdb attach

Memory protection must be disabled to allow stub flasher
operate correctly.

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: I6f292ee672ae001cd6e4df5d24eb7bb862639093
Reviewed-on: https://review.openocd.org/c/openocd/+/7037
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
21 months agotcl/esp32s2: check memory protection on gdb attach 36/7036/3
Erhan Kurubas [Sat, 18 Jun 2022 21:01:28 +0000 (23:01 +0200)]
tcl/esp32s2: check memory protection on gdb attach

Memory protection must be disabled to allow stub flasher
operate correctly.

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: I2f239d98fca6882c4361691af306a5652b58ee78
Reviewed-on: https://review.openocd.org/c/openocd/+/7036
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
21 months agojtag: add esp_usb_jtag driver 43/6943/19
Erhan Kurubas [Thu, 21 Apr 2022 19:48:28 +0000 (21:48 +0200)]
jtag: add esp_usb_jtag driver

This driver is used with the ESP32 chips which has builtin USB-JTAG
interface. e.g. with ESP32-C3, ESP32-S3

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: If966268cb8d26f76540dd5440245a17ed0b72c61
Reviewed-on: https://review.openocd.org/c/openocd/+/6943
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
21 months agoconfigure: provide advice if PKG_PROG_PKG_CONFIG unavailable 35/7035/3
R. Diez [Sat, 18 Jun 2022 14:23:00 +0000 (16:23 +0200)]
configure: provide advice if PKG_PROG_PKG_CONFIG unavailable

These are the misleading error messages that this change prevents:
configure.ac:13: error: possibly undefined macro: AC_MSG_WARN
  If this token and others are legitimate, please use m4_pattern_allow.
  See the Autoconf documentation.
configure.ac:48: error: possibly undefined macro: AC_DEFINE
configure.ac:342: error: possibly undefined macro: AC_MSG_ERROR
configure.ac:608: error: possibly undefined macro: AC_MSG_NOTICE

Change-Id: I21bcc7715eeac0f3d0bcc60bba6801e6a895cdd0
Signed-off-by: R. Diez <rdiezmail-openocd@yahoo.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/7035
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
22 months agohelper: fix build with mingw gcc 12.1.0 38/7038/2
Antonio Borneo [Sun, 19 Jun 2022 20:10:47 +0000 (22:10 +0200)]
helper: fix build with mingw gcc 12.1.0

New mingw compiler correctly complains for using a freed memory
area:

src/helper/configuration.c: In function 'get_home_dir':
src/helper/configuration.c:182:29: error: dangling pointer 'home'
to 'homepath' may be used [-Werror=dangling-pointer=]
182 | home_path = alloc_printf("%s/%s", home, append_path);
    |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In fact the variable 'homepath' is declared inside an 'if' branch
and is not available outside.

Move the declaration of 'homepath' to have it available in a wider
context.

Change-Id: I4a43a03c007c9f0d5c4cee962a9f7cc83ca49637
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reported-by: Dietmar May <dietmar.may@outlook.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7038
Tested-by: jenkins
Reviewed-by: Dietmar May <dietmar.may@outlook.com>
22 months agotcl: add SPDX tag 30/7030/2
Antonio Borneo [Sun, 12 Jun 2022 21:51:51 +0000 (23:51 +0200)]
tcl: add SPDX tag

For historical reasons, no license information was added to the
tcl files. This makes trivial adding the SPDX tag through script:
fgrep -rL SPDX tcl | while read a;do \
sed -i '1{i# SPDX-License-Identifier: GPL-2.0-or-later\n
}' $a;done

With no specific license information from the author, let's extend
the OpenOCD project license GPL-2.0-or-later to the files.

Change-Id: Ief3da306a6e1978de7dfb8f552f9ff23151f9944
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7030
Tested-by: jenkins
22 months agotcl/interface: add SPDX tag 29/7029/2
Antonio Borneo [Sun, 12 Jun 2022 21:50:59 +0000 (23:50 +0200)]
tcl/interface: add SPDX tag

For historical reasons, no license information was added to the
tcl files. This makes trivial adding the SPDX tag through script:
fgrep -rL SPDX tcl/interface | while read a;do \
sed -i '1{i# SPDX-License-Identifier: GPL-2.0-or-later\n
}' $a;done

With no specific license information from the author, let's extend
the OpenOCD project license GPL-2.0-or-later to the files.

Change-Id: I7bd6a628e9e153fc477cddf9b97087a39ec48aa7
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7029
Tested-by: jenkins
22 months agotcl/board: add SPDX tag 28/7028/2
Antonio Borneo [Sun, 12 Jun 2022 21:48:05 +0000 (23:48 +0200)]
tcl/board: add SPDX tag

For historical reasons, no license information was added to the
tcl files. This makes trivial adding the SPDX tag through script:
fgrep -rL SPDX tcl/board | while read a;do \
sed -i '1{i# SPDX-License-Identifier: GPL-2.0-or-later\n
}' $a;done

With no specific license information from the author, let's extend
the OpenOCD project license GPL-2.0-or-later to the files.

Change-Id: Ibcf7da62e842aafd036a78db9ea2b9f11f79af16
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7028
Tested-by: jenkins
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
22 months agotcl/target: add SPDX tag 27/7027/2
Antonio Borneo [Sun, 12 Jun 2022 21:42:27 +0000 (23:42 +0200)]
tcl/target: add SPDX tag

For historical reasons, no license information was added to the
tcl files. This makes trivial adding the SPDX tag through script:
fgrep -rL SPDX tcl/ target| while read a;do \
sed -i '1{i# SPDX-License-Identifier: GPL-2.0-or-later\n
}' $a;done

With no specific license information from the author, let's extend
the OpenOCD project license GPL-2.0-or-later to the files.

Change-Id: I7b2610300b24cccd07bfa6fb5f1266970d5d3a1b
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7027
Tested-by: jenkins
22 months agotcl: move SPDX tag as first line 26/7026/2
Antonio Borneo [Sun, 12 Jun 2022 20:59:55 +0000 (22:59 +0200)]
tcl: move SPDX tag as first line

The SPDX tag is aimed at machine handling and it's thus expected
to be placed in the first line.

Change-Id: I3992856eeb28b333c38d010ef286e22471ede263
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7026
Tested-by: jenkins
22 months agotcl: replace FSF boilerplate with SPDX tag 25/7025/2
Antonio Borneo [Sun, 12 Jun 2022 20:55:37 +0000 (22:55 +0200)]
tcl: replace FSF boilerplate with SPDX tag

OpenOCD project is switching to SPDX tags.
Replace the few FSF boilerplate in tcl folder.

Change-Id: I15b146eb77cc491ed7355178f684f3e76fc763b4
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7025
Tested-by: jenkins
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
22 months agotcl/board/steval-idb012v1: fix SPDX tag 24/7024/2
Antonio Borneo [Sun, 12 Jun 2022 22:08:15 +0000 (00:08 +0200)]
tcl/board/steval-idb012v1: fix SPDX tag

Remove trailing '.'
While there, add newline to file's last line.

Change-Id: I3a727e406b572d051b28e17688c24627e55520c4
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7024
Tested-by: jenkins
22 months agotcl/interface/vdebug: add newline to file's last line 23/7023/2
Antonio Borneo [Sun, 12 Jun 2022 22:09:41 +0000 (00:09 +0200)]
tcl/interface/vdebug: add newline to file's last line

Change-Id: I83d2477e8bc837aeac69bd5d08fdd923fd00a37c
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7023
Tested-by: jenkins
22 months agosemihosting: remove comparison with NULL 31/7031/2
Antonio Borneo [Mon, 13 Jun 2022 13:41:22 +0000 (15:41 +0200)]
semihosting: remove comparison with NULL

Commit b9526f140127 ("semihosting: permit redirection of
semihosting I/O to TCP") introduces a new comparison with NULL.

Remove it.

Change-Id: Ice4333c50d16f7592f0ff86b1640217fa42e34f6
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Fixes: b9526f140127 ("semihosting: permit redirection of semihosting I/O to TCP")
Reviewed-on: https://review.openocd.org/c/openocd/+/7031
Tested-by: jenkins
22 months agodrivers/linuxgpiod: simplify gpio release 33/7033/2
Antonio Borneo [Mon, 13 Jun 2022 13:56:14 +0000 (15:56 +0200)]
drivers/linuxgpiod: simplify gpio release

We already have a helper to release the gpio.
Extend it to also release its corresponding gpio chip.

As side effect, remove comparison with NULL.

Change-Id: I47cd446edfaead662d63c3330f25a791b747e882
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7033
Tested-by: jenkins
Reviewed-by: Steve Marple <stevemarple@googlemail.com>
22 months agodrivers/linuxgpiod: release gpio at exit 32/7032/2
Antonio Borneo [Mon, 13 Jun 2022 20:59:42 +0000 (22:59 +0200)]
drivers/linuxgpiod: release gpio at exit

Commit 20adf85f3484 ("linuxgpiod: add SWDIO buffer") introduces an
additional gpio for SWDIO direction, but does not release it at
driver's exit.

Release the gpio at exit.

Change-Id: If7ea31f79ffed04af585864e49bcf1f35e118bdd
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7032
Tested-by: jenkins
Reviewed-by: Steve Marple <stevemarple@googlemail.com>
22 months agoaarch64: fix handling of 'reset halt' 34/7034/3
Antonio Borneo [Mon, 13 Jun 2022 14:41:11 +0000 (16:41 +0200)]
aarch64: fix handling of 'reset halt'

Commit 6c0151623cb0 ("aarch64: add support for "reset halt"")
introduces the register setting to halt at reset vector, but:
- does not consider the case 'srst_pulls_trst' that makes useless
  setting the registers as they will be erased by the pulled trst;
- does not clean sticky errors in case of 'srst_gates_jtag'.

Avoid any register initialization on 'srst_pulls_trst' and move
the cleaning of sticky errors in the common block.

Change-Id: I6f839f06f7b091e234ede31ec18096e51f017bcd
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Fixes: 6c0151623cb0 ("aarch64: add support for "reset halt"")
Reviewed-on: https://review.openocd.org/c/openocd/+/7034
Tested-by: jenkins
Reviewed-by: Christian Hoff <christian.hoff@advantest.com>
22 months agotcl/target/imx8m: use hwthread rtos 19/7019/5
Alvin Å ipraga [Fri, 10 Jun 2022 22:01:01 +0000 (00:01 +0200)]
tcl/target/imx8m: use hwthread rtos

In order to facilitate debugging multiple cores, specify the coreid and
the hwthread rtos in the imx8m target configuration.

Change-Id: Ibd871517a160ceca15002fb10e27cb793f14d086
Signed-off-by: Alvin Å ipraga <alsi@bang-olufsen.dk>
Reviewed-on: https://review.openocd.org/c/openocd/+/7019
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
22 months agosemihosting: add custom user command handler 89/6889/6
Erhan Kurubas [Tue, 5 Apr 2022 11:26:08 +0000 (14:26 +0300)]
semihosting: add custom user command handler

Custom user syscalls can be handled with target events in the TCL scripts.
This patch gives another opportunity to handle custom syscalls in the c files.
Besides that some utility functions are also exported for the custom handlers.

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: Ice13d527540a0de0b2a8abda912ae3dcff3834b7
Reviewed-on: https://review.openocd.org/c/openocd/+/6889
Tested-by: jenkins
Reviewed-by: Ian Thompson <ianst@cadence.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
22 months agoesp32s2: convert counted timeout to timeval_ms 20/7020/2
Erhan Kurubas [Sat, 11 Jun 2022 23:04:08 +0000 (01:04 +0200)]
esp32s2: convert counted timeout to timeval_ms

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: Id685408281478cec0e7e886dbedb3b8972c7b652
Reviewed-on: https://review.openocd.org/c/openocd/+/7020
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Ian Thompson <ianst@cadence.com>
22 months agotarget: add Espressif ESP32-S3 basic support 90/6990/9
Erhan Kurubas [Sun, 22 May 2022 21:17:48 +0000 (23:17 +0200)]
target: add Espressif ESP32-S3 basic support

ESP32-S3 is a dual core Xtensa SoC
Not full featured yet. Some of the missing functionality:
-Semihosting
-Flash breakpoints
-Flash loader
-Apptrace
-FreeRTOS

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: I44e17088030c96a9be9809f6579a4f16dbfc5794
Reviewed-on: https://review.openocd.org/c/openocd/+/6990
Tested-by: jenkins
Reviewed-by: Ian Thompson <ianst@cadence.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
22 months agotarget: add Espressif ESP32 basic support 89/6989/13
Erhan Kurubas [Sat, 21 May 2022 21:49:54 +0000 (23:49 +0200)]
target: add Espressif ESP32 basic support

ESP32 is a dual core Xtensa SoC
Not full featured yet. Some of the missing functionality:
-Semihosting
-Flash breakpoints
-Flash loader
-Apptrace
-FreeRTOS

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: I76fb184aa38ab9f4e30290c038b5ff8850060750
Reviewed-on: https://review.openocd.org/c/openocd/+/6989
Tested-by: jenkins
Reviewed-by: Ian Thompson <ianst@cadence.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
22 months agotarget/board: Add Ampere QS|MQ config files 91/5591/14
Daniel Goehring [Fri, 3 Apr 2020 23:28:03 +0000 (19:28 -0400)]
target/board: Add Ampere QS|MQ config files

Add Ampere Altra ("Quicksilver") and Ampere Altra Max ("Mystique")
target/board configuration files.

The target configuration file supports silicon and emulation.
The board configuration files support 1 and 2 socket platforms.

Tested on Ampere emulation and silicon

Change-Id: I036c798a50624e30ab51ccd2895b6f60c40be096
Signed-off-by: Daniel Goehring <dgoehrin@os.amperecomputing.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/5591
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
22 months agoarm_adi_v5: parse ROM tables behind SoC-600 APv1 adapter 27/6827/3
Antonio Borneo [Mon, 3 Jan 2022 09:08:35 +0000 (10:08 +0100)]
arm_adi_v5: parse ROM tables behind SoC-600 APv1 adapter

Arm "CoreSight System-on-Chip SoC-600" specification describes a
bridge "Access Port v1 adapter" aimed to "connect a legacy Access
Port (AP) ... into an CoreSight Architecture v3 system".

A ROM table can be located in the "legacy" part of the system,
on the legacy AP behind the APv1 adapter.

For the purpose of scanning the ROM tables, consider an ADIv6
SoC-600 APv1 adapter as an ADIv5 AP.

Change-Id: I97d42fb77013c1251fb68d0caa4274086bf38a70
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6827
Tested-by: jenkins
22 months agoadiv6: stay in same AP during dap_lookup_cs_component() 26/6826/3
Antonio Borneo [Sun, 23 Jan 2022 00:25:45 +0000 (01:25 +0100)]
adiv6: stay in same AP during dap_lookup_cs_component()

Configuration file can specify, as target's debug AP, an AP that
contains a ROM table that points, in turn, to other APs.
Current code in cortex_a and aarch64 is not able to handle a
return from dap_lookup_cs_component() that points to another AP.

While it could be interesting to specify 'root' as target's debug
AP, drop any found value if it's not in the starting AP.

Change-Id: Id206e4fa7a29e9402c8e2393026817b410bbb8bd
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6826
Tested-by: jenkins
22 months agoadiv6: add support for ROM tables in AP 67/6467/5
Antonio Borneo [Wed, 11 Aug 2021 13:29:45 +0000 (15:29 +0200)]
adiv6: add support for ROM tables in AP

ADIv6 adds AP that only contain a ROM table in the AP itself, that
can point to other AP containing either another AP level ROM table
or a MEM-AP to be parsed as usual.

Add support for parsing AP level ROM tables.

Change-Id: Ic25863b16463b8a6adc3b15e26db7fdca858d6df
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6467
Tested-by: jenkins
22 months agoadiv6: prepare for AP level ROM tables 66/6466/5
Antonio Borneo [Wed, 11 Aug 2021 09:03:49 +0000 (11:03 +0200)]
adiv6: prepare for AP level ROM tables

ADIv6 adds AP that only contain a ROM table in the AP itself, that
can point to other AP containing either another AP level ROM table
or a MEM-AP to be parsed as usual.

To handle recursive AP access, reorganize the code to:
- pass the depth==0 from the command 'dap info';
- print the AP number as first line, adding proper indentation on
  depth>0;
- align the following print with proper indentation.

Change-Id: I5b811810c807fc51b307bd60f67817d9de2aa095
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6466
Tested-by: jenkins
22 months agoarm_adi_v5: add option 'root' to 'dap info' command 62/6462/5
Antonio Borneo [Mon, 9 Aug 2021 13:31:10 +0000 (15:31 +0200)]
arm_adi_v5: add option 'root' to 'dap info' command

On ADIv6 the system root ROM table is found by reading the DAP DP
registers BASEPTR0 and BASEPTR1.

Add option 'root' to the commands 'dap info' to let it retrieve
the system root ROM table's AP from DAP DP, then use such AP for
following dump.

Change-Id: I1789457a005faa3870c5d14f763378d2f6a5f095
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6462
Tested-by: jenkins
22 months agoadiv6: use struct adiv5_ap->ap_num to contain the AP base address 61/6461/5
Antonio Borneo [Sat, 14 Aug 2021 21:56:12 +0000 (23:56 +0200)]
adiv6: use struct adiv5_ap->ap_num to contain the AP base address

ADIv5 DAP can only have 256 AP, while ADIv6 can provide till
2**40 (1,099,511,627,776) AP per DAP.

Reuse the field ap_num in struct adiv5_ap, currently used on ADIv5
to hold the ADIv5 AP number (apsel), to contain the ADIv6 AP base
address.

Convert struct adiv5_ap->ap_num to 64 bit and initialize it to
DP_APSEL_INVALID for unused AP.
Restrict dap_find_get_ap() to ADIv5 only. To be enhanced.
On ADIv6, let dap_get_ap() return an already allocated AP, or
allocate and return an unused AP.
Add function is_ap_num_valid() and use it.

Change-Id: Ib2fe8c7ec0d08393cd91c29fdac5d632dfc1e438
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6461
Reviewed-by: Daniel Goehring <dgoehrin@os.amperecomputing.com>
Tested-by: jenkins
22 months agoadiv6: add low level swd transport 97/6697/4
Antonio Borneo [Thu, 11 Nov 2021 22:49:23 +0000 (23:49 +0100)]
adiv6: add low level swd transport

During enter in SWD read DP_DPIDR without selecting the register
bank through DP_SELECT_DPBANK.
Handle the different format of DP_SELECT register.

Change-Id: Iea1b8eb6ec94177e16a430d5885595a38e833eeb
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6697
Tested-by: jenkins
22 months agoadi_v5_jtag: extend memaccess_tck to every AP access 60/6460/5
Kevin Burke [Sat, 14 Aug 2021 16:55:28 +0000 (18:55 +0200)]
adi_v5_jtag: extend memaccess_tck to every AP access

ADIv5 reports:
Accessing AP registers or debug resources in connected
device through an AP can be subjected to other variable
response delays in the system. A debugger that can adapt
to these delays and avoid wasting WAIT scans operates more
efficiently and provides higher maximum data throughput.

The existing code in OpenOCD uses extra tck only for accessing
resources through an AP.

Extend the use of extra tck also for accessing an AP register.

Split from change https://review.openocd.org/6077/

Change-Id: I2082362e098d09f4ba0668e01f5196afc965c8f3
Signed-off-by: Kevin Burke <kevinb@os.amperecomputing.com>
Signed-off-by: Daniel Goehring <dgoehrin@os.amperecomputing.com>
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6460
Tested-by: jenkins
22 months agoadiv6: add low level jtag transport 59/6459/5
Kevin Burke [Fri, 6 Aug 2021 09:56:13 +0000 (11:56 +0200)]
adiv6: add low level jtag transport

swd and dap-direct are not implemented yet

Split from change https://review.openocd.org/6077/

Change-Id: I6d73d8adf6a6090001c5d4771325fb1d63c45e3c
Signed-off-by: Kevin Burke <kevinb@os.amperecomputing.com>
Signed-off-by: Daniel Goehring <dgoehrin@os.amperecomputing.com>
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6459
Tested-by: jenkins
22 months agoadi_v5_jtag: clear sticky overrun error 30/6430/6
Antonio Borneo [Fri, 6 Aug 2021 21:37:23 +0000 (23:37 +0200)]
adi_v5_jtag: clear sticky overrun error

By accessing invalid AP in JTAG mode, it's possible to trigger the
error:
JTAG-DP STICKY ERROR
After that the sticky error is never cleared and the whole DAP
gets not anymore accessible.

Clean-up the sticky error once detected.

Change-Id: I8b07263b30f9e46645f0c29084b8f1626e241f45
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6430
Tested-by: jenkins
22 months agoadiv6: read ROM Table address size 58/6458/5
Kevin Burke [Sat, 21 Aug 2021 21:59:38 +0000 (23:59 +0200)]
adiv6: read ROM Table address size

Required for parsing ADIv6 ROM tables.

Split from change https://review.openocd.org/6077/

Change-Id: I849543b7b4a4455b10bd9fc7da38a37849d71700
Signed-off-by: Kevin Burke <kevinb@os.amperecomputing.com>
Signed-off-by: Daniel Goehring <dgoehrin@os.amperecomputing.com>
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6458
Tested-by: jenkins
22 months agoadiv6: re-organize mem_ap registers definition 57/6457/5
Kevin Burke [Sat, 21 Aug 2021 17:12:01 +0000 (19:12 +0200)]
adiv6: re-organize mem_ap registers definition

ADIv5 MEM-AP registers are a subset of ADIv6 MEM-AP registers and
are located at different offset.

To prepare for introducing ADIv6, add 'struct adiv5_dap *' as
argument to ADIv5 registers macro.
Check the ADI version and use the proper address.
Both adapter drivers rshim and stlink are ADIv5 only, so let them
use the ADIv5 macros only.

Split from change https://review.openocd.org/6077/

Change-Id: Ib861ddcdab74637b2082cc9f2612dea0007d77b1
Signed-off-by: Kevin Burke <kevinb@os.amperecomputing.com>
Signed-off-by: Daniel Goehring <dgoehrin@os.amperecomputing.com>
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6457
Tested-by: jenkins
22 months agoadiv6: add dap flags -adiv5 and -adiv6 56/6456/5
Kevin Burke [Fri, 6 Aug 2021 13:01:34 +0000 (15:01 +0200)]
adiv6: add dap flags -adiv5 and -adiv6

Add flags to 'dap create' command and set the field adi_version
in struct adiv5_dap.

Actually only ADIv5 is functional. Other patches are needed to get
ADIv6 working.

Split from change https://review.openocd.org/6077/

Change-Id: I63d3902f99a7f139c15ee4e07c19eae9ed4534b9
Signed-off-by: Kevin Burke <kevinb@os.amperecomputing.com>
Signed-off-by: Daniel Goehring <dgoehrin@os.amperecomputing.com>
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6456
Tested-by: jenkins
22 months agoarm_adi_v5: add ap refcount and add get/put around ap use 55/6455/5
Antonio Borneo [Wed, 4 Aug 2021 21:07:57 +0000 (23:07 +0200)]
arm_adi_v5: add ap refcount and add get/put around ap use

While an ADIv5 DAP can only have 256 AP, ADIv6 can provide till
2**40 (1,099,511,627,776) AP per DAP.
The actual trivial code implementation for ADIv5 (that uses an
array of 256 ap in the struct adiv5_dap) cannot be extended as-is
to handle ADIv6.

The simple array of 256 AP can be reused as a dynamic storage for
ADIv6 ap:
- the ADIv5 AP number is replaced by the ADIv6 base address;
- the index of the array (equal to ADIv5 AP number) has no link to
  any ADIv6 property;
- the ADIv6 base_address has to be searched in the array of AP.

The 256 elements in the AP array should be enough for any device
available today. In future it can be easily increased, if needed.

To efficiently use the 256 elements in the AP array, the code
should associate one element of the array to an ADIv6 AP (through
the AP base address), then cancel the association when the AP is
not anymore needed. This is important to avoid saturating the AP
array while exploring the device through 'dap apreg' commands.

Add a reference counter in the struct adiv5_ap to track how many
times the struct has been associated with the same base address.
Introduce the function dap_get_ap() to associate and return the
struct, and dap_put_ap() to release the struct. For the moment the
code covers ADIv5 only, so the association is through the index.
Use the two functions above and dap_find_get_ap() throughout the
code.
Check the return value of dap_get_ap(). It is always not NULL in
the current ADIv5-only implementation, but can be NULL for ADIv6
when there are no more available AP in the array.
Instrument dap_queue_ap_read() and dap_queue_ap_write() to log an
error message if the AP has reference counter zero, meaning that
the AP has not been 'get' yet. This helps identifying AP used
without get/put, e.g. code missed by this patch, or merged later.
Instrument dap_cleanup_all() to log an error message if an AP has
reference counter not zero at openocd exit, meaning that the AP
has not been 'put' yet.

Change-Id: I98316eb42b9f3d9c9bbbb6c73b1091b53f629092
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6455
Reviewed-by: Daniel Goehring <dgoehrin@os.amperecomputing.com>
Tested-by: jenkins
22 months agosemihosting: fix accessing memory outside the bounds of the fn array 05/7005/4
Erhan Kurubas [Sat, 28 May 2022 06:30:21 +0000 (08:30 +0200)]
semihosting: fix accessing memory outside the bounds of the fn array

There is an accsess to wrong index, when arm semihosting_basedir
command not used or basedir set to empty string.

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: I3afa049d74b30496f5c03ba4ef67431784f81bdc
Fixes: ce5027ab019a ("semihosting: add semihosting_basedir command")
Reviewed-on: https://review.openocd.org/c/openocd/+/7005
Tested-by: jenkins
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
22 months agotcl: add get_bit & get_bitfield memory helper functions 16/7016/3
Erhan Kurubas [Fri, 3 Jun 2022 22:25:19 +0000 (00:25 +0200)]
tcl: add get_bit & get_bitfield memory helper functions

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: I21506526e3ebd9c3a70a25ba60bf83aee431feb6
Reviewed-on: https://review.openocd.org/c/openocd/+/7016
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
22 months agotelnet_server: fix scan-build warning 65/6565/4
Tarek BOCHKATI [Sat, 28 May 2022 17:45:35 +0000 (18:45 +0100)]
telnet_server: fix scan-build warning

fix "Declared variable-length array (VLA) has zero size" warning
raised in .../src/server/telnet_server.c:633:2:

Change-Id: Icff5228b02790c472b212a86a3849b1a3df98fdb
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6565
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
22 months agoarm_adi_v5: check for calloc() return value 14/7014/2
Antonio Borneo [Thu, 2 Jun 2022 09:17:49 +0000 (11:17 +0200)]
arm_adi_v5: check for calloc() return value

In function adiv5_jim_configure() check that calloc() returns a
valid allocated memory pointer.

Change-Id: I97287e168834693900341add9d9eb9a5f38c55b4
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reported-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7014
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
22 months agodrivers/bitbang: silence scan-build warning 13/7013/2
Antonio Borneo [Wed, 1 Jun 2022 17:47:48 +0000 (19:47 +0200)]
drivers/bitbang: silence scan-build warning

The array is partially initialized with buf_set_u32(,5,32,), then
the rest of the array is read from SWD.
But scan-build report the array to have garbage content after the
initialization, due to the offset of 5 bit that only inits part of
the first byte.

Silence the false positive from scan-build by initializing the
array.

Change-Id: Ic38d50280f67939e3ec5fa05741f66d5f993f8c2
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7013
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
22 months agoarm_adi_v5: fix scan-build warning [3/3] 12/7012/2
Antonio Borneo [Wed, 1 Jun 2022 17:21:44 +0000 (19:21 +0200)]
arm_adi_v5: fix scan-build warning [3/3]

While scan-build complains that dap_p or ap_num_p could be NULL,
the current code never passes NULL pointers.
Add an assert() to silent scan-build and prevent any further use
of the function with incorrect parameters.

Change-Id: I656810dddcea61e85d85b13efb114f7607ef837c
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7012
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
22 months agoarm_adi_v5: fix scan-build warning [2/3] 11/7011/2
Antonio Borneo [Wed, 1 Jun 2022 17:02:54 +0000 (19:02 +0200)]
arm_adi_v5: fix scan-build warning [2/3]

Commit d01b3d69ec17 ("arm_adi_v5: separate ROM table parsing from
command output [3/3]") introduces a new scan-build warning because
removing one return in case of error causes using uninitialized
values.

Add back the return on error.

Change-Id: I10ddc548b756d34aaccc0511f091b4caa5ec271a
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Fixes: d01b3d69ec17 ("arm_adi_v5: separate ROM table parsing from command output [3/3]")
Reviewed-on: https://review.openocd.org/c/openocd/+/7011
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
22 months agoarm_adi_v5: fix scan-build warning [1/3] 10/7010/2
Antonio Borneo [Wed, 1 Jun 2022 16:26:35 +0000 (18:26 +0200)]
arm_adi_v5: fix scan-build warning [1/3]

Commit 21f7885d1c2a ("arm_adi_v5: separate ROM table parsing from
command output [1/3]") introduces a new scan-build warning because
continues the execution even when dap_get_debugbase() returns
error. The value of 'apid' can be uninitialized:

5th function call argument is an uninitialized value

Check the return value and quit on error.
While there, remove the useless initialization of 'dbgbase' that
was apparently required for the same problem.

Change-Id: Iade26a152925ee0f1bf114ed829b94f7ed5b254f
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Fixes: 21f7885d1c2a ("arm_adi_v5: separate ROM table parsing from command output [1/3]")
Reviewed-on: https://review.openocd.org/c/openocd/+/7010
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
22 months agoflash/nor/numicro: remove useless architecture check 55/6755/3
Tomas Vanek [Wed, 24 Nov 2021 19:44:49 +0000 (20:44 +0100)]
flash/nor/numicro: remove useless architecture check

target_to_armv7m() just returns a type-cast of target->arch_info,
so the test has no value.

Following target_run_algorithm() checks magic number so
we need not worry about execution on mismatched architecture.

Change-Id: Ic9892a488a42af1d8e8731eddb39240deeb26020
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/6755
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
22 months agotelnet_server: fix valgrind error 06/7006/3
Erhan Kurubas [Sat, 28 May 2022 20:31:34 +0000 (22:31 +0200)]
telnet_server: fix valgrind error

Error: Uninitialised value was created by a heap allocation
at telnet_new_connection (telnet_server.c:227)

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: I698a3648be698c93a2395a718ee1ade028226995
Reviewed-on: https://review.openocd.org/c/openocd/+/7006
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
22 months agoflash/stm32l4x: fix scan-build warnings 70/6470/6
Tarek BOCHKATI [Thu, 26 May 2022 15:20:19 +0000 (16:20 +0100)]
flash/stm32l4x: fix scan-build warnings

fix "Declared variable-length array (VLA) has zero size" warnings

while at there instrument the probe function to ensure the flash bank
contains at least 1 sector

Change-Id: I3ba0e6345881557ad1aab2d1b41eee438b49fe04
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6470
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
22 months agostlink: manage TCP_BUSY status code when using RW MISC 94/6994/2
Tarek BOCHKATI [Tue, 24 May 2022 10:32:51 +0000 (11:32 +0100)]
stlink: manage TCP_BUSY status code when using RW MISC

Change-Id: I4f9eed3781b549742565a3a8ac5245a4b94ceb53
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6994
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
22 months agotarget/riscv: drop unused variable registers_initialized 95/6995/2
Tomas Vanek [Thu, 26 May 2022 07:26:14 +0000 (09:26 +0200)]
target/riscv: drop unused variable registers_initialized

Change-Id: If7bfe38ac273ce9e54003e003807e128cced1568
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/6995
Tested-by: jenkins
Reviewed-by: Tim Newsome <tim@sifive.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
22 months agotarget: add Espressif ESP32-S2 basic support 40/6940/45
Erhan Kurubas [Thu, 21 Apr 2022 05:53:54 +0000 (07:53 +0200)]
target: add Espressif ESP32-S2 basic support

ESP32-S2 is a single core Xtensa chip.
Not full featured yet. Some of the missing functionality:
-Semihosting
-Flash breakpoints
-Flash loader
-Apptrace
-FreeRTOS

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: I2fb32978e801af5aa21616c581691406ad7cd6bb
Reviewed-on: https://review.openocd.org/c/openocd/+/6940
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Ian Thompson <ianst@cadence.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
22 months agocortex_a: get rid of not needed log messages 93/6993/2
Tarek BOCHKATI [Thu, 14 Apr 2022 13:53:10 +0000 (14:53 +0100)]
cortex_a: get rid of not needed log messages

when using semi-hosting with cortex_a this LOG_INFO pollutes openocd
console, so just reduce the log level of this message.

Change-Id: I91aa70492f4e361b25a0e5517d0cf73f2f8ed599
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: https://gerrit.st.com/c/stm32ide/official/openocd/+/248225
Tested-by: Tarek BOCHKATI <tarek.bouchkati@st.com>
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@st.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6993
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
22 months agogithub/workflow: enable libftdi based adapters 08/7008/2
Tarek BOCHKATI [Mon, 30 May 2022 13:48:06 +0000 (14:48 +0100)]
github/workflow: enable libftdi based adapters

Change-Id: I74b07b21573294dd7d9d3caf41c5755622c77149
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7008
Tested-by: jenkins
Reviewed-by: Xiaofan Chen <xiaofanc@gmail.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
22 months agogithub workflow: use libusb 1.0.26 and hidapi 0.11.2 92/6992/2
Tarek BOCHKATI [Mon, 23 May 2022 12:57:16 +0000 (13:57 +0100)]
github workflow: use libusb 1.0.26 and hidapi 0.11.2

Change-Id: Id5348f86026330581d4bae081c9ab2bef435e6a6
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6992
Tested-by: jenkins
Reviewed-by: Xiaofan Chen <xiaofanc@gmail.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
23 months agoflash/nor/core, target: don't ask for working mem if no target algo 65/6765/2
Tomas Vanek [Fri, 19 Nov 2021 21:03:44 +0000 (22:03 +0100)]
flash/nor/core, target: don't ask for working mem if no target algo

The command 'flash erase_check' showed the message
'Running slow fallback erase check - add working memory'
even in the case the target didn't implement blank_check_memory.

Change return code of target_blank_check_memory() in this case
and sense it in default_flash_blank_check() and show a message
without a request for working memory.

Change-Id: I7cf9bf77742964b4f377c9ce48ca689e57d0882f
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/6765
Tested-by: jenkins
Reviewed-by: Tim Newsome <tim@sifive.com>
23 months agoGive each SMP group a unique number. 79/6979/2
Tim Newsome [Mon, 16 May 2022 17:22:32 +0000 (10:22 -0700)]
Give each SMP group a unique number.

This helps e.g. if there are 8 cores, and cores 0--3 are in one SMP
group while 4--7 are in another group. (And there are 2 gdb instances
connected, one debugging the first group, and one the second.)

Signed-off-by: Tim Newsome <tim@sifive.com>
Change-Id: I7b6c9382eadf964529105eaf0411a42d48768668
Reviewed-on: https://review.openocd.org/c/openocd/+/6979
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
23 months agotcl: Add support for Kontron SMARC-sAL28 77/6977/3
Sean Anderson [Fri, 13 May 2022 15:12:58 +0000 (11:12 -0400)]
tcl: Add support for Kontron SMARC-sAL28

This commit is adapted from [1].

[1] https://review.openocd.org/c/openocd/+/4999

Signed-off-by: Michael Walle <michael.walle@kontron.com>
Signed-off-by: Heiko Thiery <heiko.thiery@kontron.com>
[ adapted to use common configuration ]
Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Change-Id: I9a428371694e7864e03055b8de18a55a7843b8c2
Reviewed-on: https://review.openocd.org/c/openocd/+/6977
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
23 months agotarget: Add LS1028A 76/6976/3
Sean Anderson [Fri, 13 May 2022 15:07:29 +0000 (11:07 -0400)]
target: Add LS1028A

The LS1028A is similar to the LS1088A, except that it has 2 CPUs (and
different ethernet capabilities). From a JTAG perspective, all that's
different is the number of CPUs and the TAPID.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Change-Id: Iba3a0ecfbf82cfcfeb7eea42d52121c3b9dc93a2
Reviewed-on: https://review.openocd.org/c/openocd/+/6976
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
23 months agotcl/target/ls1088: Break out common configuration 75/6975/3
Sean Anderson [Fri, 13 May 2022 15:03:41 +0000 (11:03 -0400)]
tcl/target/ls1088: Break out common configuration

Several Layerscape processors (LS1088A, LS2088A, LS2160A, and LS1028A)
share a common architecture. Break out the common setup from the LS1088
config in preparation for adding the LS1028A. There's no official name
for this series of processors, but NXP refers to them as "chassis
generation 3" in U-Boot, so we'll go with that too.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Change-Id: Ic6f89f95c678101f54579bcaa5d79c5b67ddf50a
Reviewed-on: https://review.openocd.org/c/openocd/+/6975
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
23 months agoconfigure: build jimtcl with json extension 90/6890/4
Erhan Kurubas [Tue, 5 Apr 2022 14:19:24 +0000 (17:19 +0300)]
configure: build jimtcl with json extension

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: I5845c240e50ee832c082df3f26fabbd4b14d6edd
Reviewed-on: https://review.openocd.org/c/openocd/+/6890
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
23 months agosemihosting: add semihosting_basedir command 88/6888/5
Erhan Kurubas [Tue, 5 Apr 2022 10:49:28 +0000 (13:49 +0300)]
semihosting: add semihosting_basedir command

This command allows users to set base working directory for the
semihosting I/O operations.Default is the current OpenOCD directory.

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: I80c5979e4c96d66cccdd12cc6fcd5f353e5c6b4d
Reviewed-on: https://review.openocd.org/c/openocd/+/6888
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
23 months agotcl/target/renesas_rz_five: Added RZ/Five 74/6974/4
micbis [Thu, 12 May 2022 13:17:49 +0000 (15:17 +0200)]
tcl/target/renesas_rz_five: Added RZ/Five

Added support for the new Renesas RISC-V
device: RZ/Five

Signed-off-by: micbis <michele.bisogno.ct@renesas.com>
Change-Id: Id8ba29b83528c0bfe4f9b4ed21b0151a6e853bd7
Reviewed-on: https://review.openocd.org/c/openocd/+/6974
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
23 months agotcl/target/renesas_rz_g2: Added RZ/G2LC and RZ/G2UL 72/6972/2
micbis [Tue, 10 May 2022 08:49:31 +0000 (10:49 +0200)]
tcl/target/renesas_rz_g2: Added RZ/G2LC and RZ/G2UL

Added support for two new devices: RZ/G2LC and RZ/G2UL

Change-Id: Iec6ba88c1d279f50808b060343b45c796bbfdbfc
Signed-off-by: micbis <michele.bisogno.ct@renesas.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6972
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
23 months agoflash: fix clang static analyzer build errors 71/6971/3
Erhan Kurubas [Mon, 9 May 2022 21:01:35 +0000 (23:01 +0200)]
flash: fix clang static analyzer build errors

Fixes "variable set but not used" errors.
Tested with Homebrew clang version 13.0.1

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: Ia90baf5b4857db2b5569ebe6adbbb832de772aad
Reviewed-on: https://review.openocd.org/c/openocd/+/6971
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
23 months agotarget: fix clang static analyzer warning 70/6970/2
Tomas Vanek [Mon, 9 May 2022 20:54:59 +0000 (22:54 +0200)]
target: fix clang static analyzer warning

Removes Warning: line 6482, column 12
1st function call argument is an uninitialized value

Use target ptr directly as checked in previous lines instead of
dereferencing head->target

Change-Id: I6804b776fd493af71f3098d702f9cdc7acb50151
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/6970
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
23 months agotarget/riscv: fix 'reset run' after 'reset halt' 61/6961/2
Tomas Vanek [Sun, 1 May 2022 13:20:24 +0000 (15:20 +0200)]
target/riscv: fix 'reset run' after 'reset halt'

'reset halt' does not clear DM_DMCONTROL_HALTREQ at deassert_reset().
If hw reset line is configured e.g. 'reset_config srst_only'
the folowing 'reset run' halts:

 > gd32v.cpu curstate
 running

 > reset halt
 JTAG tap: gd32v.cpu tap/device found: 0x1000563d (mfg: 0x31e ...
 > gd32v.cpu curstate
 halted

 > reset
 JTAG tap: gd32v.cpu tap/device found: 0x1000563d (mfg: 0x31e ...
 > gd32v.cpu curstate
 halted <<<<---- wrong!!!

 > reset
 JTAG tap: gd32v.cpu tap/device found: 0x1000563d (mfg: 0x31e ...
 > gd32v.cpu curstate
 running

Clear DM_DMCONTROL_HALTREQ when acking reset.

Change-Id: Iae0454b425e81e64774b9785bb5ba1d4564d940b
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/6961
Tested-by: jenkins
Reviewed-by: Tim Newsome <tim@sifive.com>
23 months agodoc: prevent writing "topic:" to commit message 83/6683/4
Tomas Vanek [Tue, 9 Nov 2021 18:22:29 +0000 (19:22 +0100)]
doc: prevent writing "topic:" to commit message

First time contributors surprisingly often write "topic:"
instead of "the main part or subsystem the patch touches" as requested
in patchguide.html

To prevent them doing so:
Use longer self-explaing "specify touched area" instead of "topic"
Give some examples in addition to recommended looking at "git log"

Change-Id: I1c307b460d7a79ba3c9918af8dbc9e9f827e1fb9
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/6683
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: Paul Fertser <fercerpav@gmail.com>
23 months agotcl/interface/ftdi: Add config for Tigard board 52/6952/3
Thomas Hebb [Thu, 28 Apr 2022 23:44:05 +0000 (16:44 -0700)]
tcl/interface/ftdi: Add config for Tigard board

Tigard[1] is an FT2232H-based development tool designed for ease of use
with many different protocols and targets. It includes a JTAG header
wired to channel B, with labeled pins for the four required signals as
well as nTRST and nSRST, which are connected through an output buffer to
BDBUS4 and BDBUS5 respectively.

Add an interface config for Tigard. I wrote it by referencing the Tigard
schematic and tested it by debugging a couple of RISC-V development
boards.

[1] https://github.com/tigard-tools/tigard

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>
Change-Id: I34df9f72538ba1e40ad53b568c9cdca96ae4b082
Reviewed-on: https://review.openocd.org/c/openocd/+/6952
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
23 months agodoc: Document linuxgpiod driver commands 62/6962/3
Steve Marple [Sun, 1 May 2022 21:29:43 +0000 (22:29 +0100)]
doc: Document linuxgpiod driver commands

Change-Id: I84ad5dba9ab2099137595b46822bc10a0b089524
Signed-off-by: Steve Marple <stevemarple@googlemail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6962
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
23 months ago.gitignore: add cross-compile *-libtool 60/6960/2
Antonio Borneo [Mon, 13 Dec 2021 15:50:39 +0000 (16:50 +0100)]
.gitignore: add cross-compile *-libtool

While cross-compiling OpenOCD the generated script is not named
"libtool" anymore, but e.g. "arm-linux-gnueabi-libtool".

Ignore all the possible variants "*-libtool".

Change-Id: I7a0dade992dbc13f977610bd4a78f8a4783b0146
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6960
Tested-by: jenkins
23 months agodrivers/am335xgpio: Add AM335x driver for bitbang support on BeagleBones 41/6941/12
Steve Marple [Mon, 18 Apr 2022 22:27:22 +0000 (23:27 +0100)]
drivers/am335xgpio: Add AM335x driver for bitbang support on BeagleBones

Change-Id: Iac1c9f3d380e2474c8b77407c89c2aad96fbf2ea
Signed-off-by: Steve Marple <stevemarple@googlemail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6941
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
23 months agobcm2835gpio: Fix incorrect GPIO validation 38/6938/4
Steve Marple [Tue, 19 Apr 2022 22:22:31 +0000 (23:22 +0100)]
bcm2835gpio: Fix incorrect GPIO validation

Incorrect validation prevented GPIO0 from controlling the direction of
the SWDIO buffer or operating TRST/SRST.

Have all GPIO number validation checks performed by is_gpio_valid().

Change-Id: Ib8fb704ab588a618ac41c111f6168d658891d92c
Signed-off-by: Steve Marple <stevemarple@googlemail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6938
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
23 months agoopenocd: add post-init and pre-shutdown helpers 51/6851/4
Antonio Borneo [Fri, 18 Feb 2022 16:25:58 +0000 (17:25 +0100)]
openocd: add post-init and pre-shutdown helpers

It is a common requirement to automatically execute some command
after "init".
This can be achieved, either in scripts or through OpenOCD command
line, by explicitly calling "init" followed by the commands.
But this approach fails if the request for post-init commands is
spread across configuration files; only one of the files can split
pre-init and post-init status by calling "init".
The common workaround is to "rename" the command "init" and
replace it with a TCL proc that calls the original "init" and the
post-init commands. E.g. in Zephyr script [1].

To simplify and formalize the post-init execution, use a TCL list
that contains the list of commands to be executed. Every script
can contribute adding new commands, e.g. using "lappend".

In the same way, formalize the pre-shutdown execution with a TCL
list of user commands to be executed before OpenOCD exit.

Document them and add trivial examples.

Drop from documentation the suggestion to rename "shutdown".

Change-Id: I9464fb40ccede3e7760d425873adca363b49a64f
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Link: [1] https://github.com/zephyrproject-rtos/zephyr/blob/zephyr-v2.7.1/boards/arm/nucleo_h743zi/support/openocd.cfg#L15
Reviewed-on: https://review.openocd.org/c/openocd/+/6851
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins

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)