openocd.git
18 months agocheckpatch: fix path of documentation 22/7022/4
Antonio Borneo [Sun, 12 Jun 2022 12:36:35 +0000 (14:36 +0200)]
checkpatch: fix path of documentation

In OpenOCD documentation is in folder "doc".
Fix search path of 'checkpatch.rst'.
This file is used to provide verbose explanation of failing
checks while using command line flag '-v'.

Change-Id: Id864369d371cbd5a24e76bf90c54ff03159051c3
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7022
Tested-by: jenkins
18 months agocheckpatch: extend check for camel[0-9_]*CASE 52/7152/3
Antonio Borneo [Tue, 30 Aug 2022 13:28:56 +0000 (15:28 +0200)]
checkpatch: extend check for camel[0-9_]*CASE

Linux has some automatically generated macros that can trigger
camelCASE check. This forces checkpatch to only detect the pattern
[A-Z][a-z]|[a-z][A-Z]
for adjacent case transition.

In OpenOCD we do not have such case, so extend the check to
[A-Z][0-9_]*[a-z]|[a-z][0-9_]*[A-Z]
and remove the detection of Linux special cases.

Change-Id: I82cb6dc668edbb093f68991337da1f4b933f1fac
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7152
Tested-by: jenkins
18 months agocheckpatch: enable CAMELCASE test 70/6170/6
Antonio Borneo [Sat, 17 Apr 2021 20:37:12 +0000 (22:37 +0200)]
checkpatch: enable CAMELCASE test

OpenOCD has to deal with CamelCase API, mainly from inttypes.h,
jimtcl, libusb and Windows.

Modify checkpatch script to load from a file the list of allowed
CamelCase symbols.
Populate the file 'camelcase.txt' with the symbols that OpenOCD
has to get from external library, plus some of the symbols that
should be fixed later.
Enable CAMELCASE test in configuration script.
Add generated files to .gitignore.
Remove the check for 'known' CamelCase symbols from include folder
as this will not work on OpenOCD Jenkins, as it run checkpatch on
already patched code.

Change-Id: I0415af673ed9f985394405ff8f1eeec81135410a
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6170
Tested-by: jenkins
18 months agocheckpatch: add commit-message field to ignore some check 69/6169/5
Antonio Borneo [Fri, 16 Apr 2021 21:57:06 +0000 (23:57 +0200)]
checkpatch: add commit-message field to ignore some check

The script 'checkpatch.pl' is part of the automatic tests used by
Linux Maintainers and developers to test new patches.
The Linux development process is e-mail base. An error reported by
checkpatch is not a blocking point; the developer can explain in
the e-mail why he is submitting a patch that fails at checkpatch
or that is in violation of the coding style. It's up to the
maintainer to decide to accept or reject the explanation and then
the patch.

The OpenOCD development process relies on Gerrit and Jenkins as
front-end tools. Jenkins tests every new patch with checkpatch
and then builds the new code. If checkpatch fails, Jenkins adds a
failure label to the patch; this often causes the patch to get
ignored by maintainers that considers it as 'not ready'.

Checkpatch can be instrumented to ignore some test, but this has
to be specified in the command line or in the configuration file.

Let checkpatch extract from the patch's commit message the new
field 'Checkpatch-ignore:' that lists the additional tests that
has to be ignored for that patch only.
The developer that detects as error or a limitation in checkpatch
can add the field and the problematic test in the commit message
and re-push the patch.
The maintainer should check the list of tests and decide how to
proceed.

Change-Id: Iafc1b2893a07c7b3fc7e3ad15bd694aba9bd8519
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6169
Tested-by: jenkins
18 months agocheckpatch: increase the max indentation level 67/6167/6
Antonio Borneo [Mon, 6 May 2019 13:30:54 +0000 (15:30 +0200)]
checkpatch: increase the max indentation level

OpenOCD uses longer lines (120 char vs 100) and smaller tab size
(4 char vs 8) wrt Linux kernel coding style.
Clearly deep level of indentation is bad for code readability,
but let's be more permissive on the indentation level.

Change-Id: I16cf0b761145ec6072509dc26bb09c693e89e608
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6167
Tested-by: jenkins
18 months agocheckpatch: adapt shell script to the tool's new version 66/6166/6
Antonio Borneo [Wed, 27 Jan 2021 18:00:38 +0000 (19:00 +0100)]
checkpatch: adapt shell script to the tool's new version

With the new checkpatch it's not possible to send in one shot a
set of patches through stdin because the Signed-off-by tag present
in each patch will trigger the error of duplicated Signed-off-by.

Use the new command-line flag '--git' to let checkpatch to extract
the patches from git and analyse them one-by-one.

While there, add the SPDX tag to the script.

Change-Id: I74791b627b8cd68f2d49146d15ae35bbc610e64e
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6166
Tested-by: jenkins
18 months agocheckpatch: check for SPDX tags of licenses in use 08/5608/10
Antonio Borneo [Sun, 26 Apr 2020 14:03:45 +0000 (16:03 +0200)]
checkpatch: check for SPDX tags of licenses in use

Fix the patch of the external helper spdxcheck.py accordingly to
OpenOCD folder structure.
List only the current LICENSES subfolders in spdxcheck.py .
Enable the check for SPDX headers.
Extend the check for TCL and Makefile.am files.

Change-Id: I0a40da0127746217ee0ac416058d5ceb922428ff
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/5608
Tested-by: jenkins
18 months agocheckpatch: add list of typedef used in OpenOCD 07/5607/7
Antonio Borneo [Mon, 6 May 2019 08:24:52 +0000 (10:24 +0200)]
checkpatch: add list of typedef used in OpenOCD

The new checkpatch from Linux kernel does not recognizes the
specific types used in OpenOCD, e.g. "fd_set" and "Jim_Obj".
As consequence, it consider "fd_set" as the name of a variable,
then misinterpret the asterisk for the pointer "fd_set *" as a
multiplication, thus suggest to add a space after the asterisk
and replace "fd_set *x" with "fd_set * x".

Let checkpatch recognize the typedef used in OpenOCD.

Change-Id: Ibc295e6a8b47ffa88b50a6d510b7970760e5199d
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/5607
Tested-by: jenkins
18 months agocheckpatch: fix check for the FSF address 28/5128/9
Paul Fertser [Sun, 21 Apr 2019 21:48:08 +0000 (23:48 +0200)]
checkpatch: fix check for the FSF address

Replace s/Linux/OpenOCD/ in the message about FSF address.

This is part of the old commit a9a5c17cf5e1 ("checkpatch: fix
check for the FSF address").

Change-Id: I79b79769ef723f86690862277612ea8ab7855c07
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/5128
Tested-by: jenkins
18 months agocheckpatch: don't spell-check the spelling file 23/5123/8
Antonio Borneo [Wed, 17 Apr 2019 06:00:38 +0000 (08:00 +0200)]
checkpatch: don't spell-check the spelling file

Prevent checkpatch to complain for commits that add new entries
in the dictionary of misspelled words.

Remove the ignore flag TYPO_SPELLING from .checkpatch.conf, now
spelling is functional.

Change-Id: I911dedafc243e34f753d2be687977066719ff2eb
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/5123
Tested-by: jenkins
18 months agocheckpatch: check for OpenOCD tree, not for kernel tree 22/5122/9
Antony Pavlov [Wed, 10 Apr 2019 12:53:56 +0000 (14:53 +0200)]
checkpatch: check for OpenOCD tree, not for kernel tree

checkpatch.pl looks for Linux kernel specific paths and files
to check source tree. As openocd misses kernel files it ends
with this error message:

Must be run from the top-level dir. of a kernel tree

This patch also renames 'kernel' -> 'openocd'
in source tree-related messages.

This is the old commit c5d89883165e ("checkpatch.pl: check for
openocd tree, not for kernel tree") re-applied.
Also remove the flag "--no-tree" from .checkpatch.conf, not
required anymore.

Change-Id: I336a66558c75494b7ae339ea63559c31f23aad84
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/5122
Tested-by: jenkins
18 months agocheckpatch: correct false positives reporting instructions 21/5121/9
Paul Fertser [Sat, 26 Oct 2013 07:34:22 +0000 (11:34 +0400)]
checkpatch: correct false positives reporting instructions

This is the old commit 75b4cbe35646 ("checkpatch: correct false
positives reporting instructions") re-applied.

Change-Id: I348ae549e9d2587093b0fb6652aadf34724f0aab
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/5121
Tested-by: jenkins
18 months agocheckpatch: treat jenkins as valid email 20/5120/9
Paul Fertser [Sat, 26 Oct 2013 07:24:43 +0000 (11:24 +0400)]
checkpatch: treat jenkins as valid email

This is needed to avoid checkpatch barking on already committed patches.

This is the old commit cadd51971535 ("checkpatch: treat jenkins as
valid email") re-applied.

Remove the flag BAD_SIGN_OFF, not anymore needed.

Change-Id: I6744f80de982f7934f3a5197ac2df1c29962cbd0
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/5120
Tested-by: jenkins
18 months agocheckpatch: add logging functions 19/5119/9
Paul Fertser [Mon, 14 Oct 2013 06:03:00 +0000 (10:03 +0400)]
checkpatch: add logging functions

It's commonly considered that user-visible strings should not be split
to different lines in the sources to ease grepping for them. Hence,
checkpatch traditionally makes an exception for logging functions,
lines having them can be of arbitrary length.

OpenOCD uses different (from Linux, the kernel) names, so they need to
be added to avoid false positives.

This is the old commit bb3cd6ec438d ("checkpatch: add logging functions")
re-applied and updated.

Change-Id: Ib18e4532cf7e1f79821b74c9bb6134a8a4e8be1b
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/5119
Tested-by: jenkins
18 months agocheckpatch: add variable $OpenOCD 21/7021/4
Antonio Borneo [Sat, 11 Jun 2022 20:41:17 +0000 (22:41 +0200)]
checkpatch: add variable $OpenOCD

The script checkpatch.pl require some adaptation for OpenOCD that
cannot be achieved through the config file .checkpatch.conf; the
script's code has to be modified.
To merge new version of the script from Linux kernel it becomes
relevant highlighting the changes, while minimizing the diff wrt
the initial script.

Add the perl variable '$OpenOCD' and suggest how to highlight
changes.

Change-Id: Ia8d26426850008f0465858a1d84cc774bc1146ed
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7021
Tested-by: jenkins
18 months agocheckpatch: add OpenOCD specific config flags 17/5117/9
Antonio Borneo [Wed, 17 Apr 2019 07:50:27 +0000 (09:50 +0200)]
checkpatch: add OpenOCD specific config flags

This initial setup covers the old commits:
commit 09571d62bc1e ("checkpatch: disable extern and switch indent checks")
commit 2f6f7c442d24 ("checkpatch: remove typedef check")
commit 9ad57e96b3c1 ("checkpatch: remove volatile check")
commit 3da783f62854 ("checkpatch: increase line length to 120")
commit 2af5b97ba31f ("checkpatch: remove __packed and __aligned checks")
commit 164450a01576 ("Change checkpatch.pl tab expanding to 4 characters.")

It also skips the check for SPDX_LICENSE_TAG, not implemented in
OpenOCD yet.
Extend to the check in 'strict' mode and skip all the check that
cannot apply on OpenOCD project.

Change-Id: I6c3bdf27465dc563464fbc8fafbaec696e287624
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/5117
Tested-by: jenkins
18 months agocheckpatch: import new script version from kernel v6.0-rc3 16/5116/9
Antonio Borneo [Tue, 16 Apr 2019 21:10:45 +0000 (23:10 +0200)]
checkpatch: import new script version from kernel v6.0-rc3

Replace existing checkpatch script with the one available in the
latest Linux kernel.
Add also from the same kernel version the spelling database and
the script spdxcheck.py, even if the script cannot be found by
checkpatch in the current path.
Add an empty "const_structs.checkpatch" file and an initial
"spdxexclude" file.

The script as is doesn't work properly in OpenOCD project.
Further patches in this series are required.

Gerrit will use the checkpatch in this commit to test/build the
commit itself. A minimal configuration file is then required to
avoid a failure in the test/build process.

This commit includes the OpenOCD commits:
commit 164450a01576 ("Change checkpatch.pl tab expanding to 4 characters.")
commit 667d510dabd5 ("checkpatch: fix false indent trigger")
already merged in upstream checkpatch in kernel v6.0-rc3.

Change-Id: Ic9cdecff2df0a1e23cdb01d10f14c5988480b8d6
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/5116
Tested-by: jenkins
18 months agotarget/xtensa: invalidate register cache on reset 97/7197/2
Ian Thompson [Thu, 15 Sep 2022 21:14:15 +0000 (14:14 -0700)]
target/xtensa: invalidate register cache on reset

Resolves issues where registers are accessed when poll() logic is inactive or has not yet been triggered.

Signed-off-by: Ian Thompson <ianst@cadence.com>
Change-Id: If7a4d00938fb188b008325249627f7773c3484c5
Reviewed-on: https://review.openocd.org/c/openocd/+/7197
Tested-by: jenkins
Reviewed-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
18 months agotarget/xtensa: fix clang analyzer warning 98/7198/3
Ian Thompson [Thu, 15 Sep 2022 23:24:33 +0000 (16:24 -0700)]
target/xtensa: fix clang analyzer warning

Reworked xtensa_queue_exec_ins_wide() logic to properly handle endian issues while executing arbitrary instructions.

Signed-off-by: Ian Thompson <ianst@cadence.com>
Change-Id: I5752dd254ce8b8822886ffc7edecaa242a93cce8
Reviewed-on: https://review.openocd.org/c/openocd/+/7198
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
19 months agoflash/nor/stm32lx: Add revision 'X' for Cat.4/3 devices 96/7196/2
Marc Schink [Thu, 15 Sep 2022 06:56:27 +0000 (08:56 +0200)]
flash/nor/stm32lx: Add revision 'X' for Cat.4/3 devices

Change-Id: I18c62ddb3963c357c7ce5dfc067c8d63fbc82b99
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/7196
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
19 months agortos: Support looking up .lto_priv.0 appended to symbol name 79/7179/10
Tim Nordell [Wed, 7 Sep 2022 16:59:47 +0000 (11:59 -0500)]
rtos: Support looking up .lto_priv.0 appended to symbol name

When FreeRTOS (at least) is compiled with -flto, this leaves certain
static symbols with .lto_priv.0 appended to their name.  Arguably this
could be considered to be a gdb or gcc bug, but one place to resolve it
for OpenOCD usage is here at symbol lookup time.

Note that the ".0" is for the first such instance of the variable as a
static; additional ones would end up as ".1", ".2", etc, and are not
considered here.

Signed-off-by: Tim Nordell <tnordell@airgain.com>
Change-Id: I03580b45e8ea364392ef4e05c96276416b390cb0
Reviewed-on: https://review.openocd.org/c/openocd/+/7179
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
19 months agortos: Fold is_symbol_mandatory into rtos_qsymbol(..) 78/7178/3
Tim Nordell [Wed, 7 Sep 2022 16:52:09 +0000 (11:52 -0500)]
rtos: Fold is_symbol_mandatory into rtos_qsymbol(..)

This is in preparation for a future commit that looks for an optional
suffix of .lto_priv.0 on the symbol name.

Signed-off-by: Tim Nordell <tnordell@airgain.com>
Change-Id: If803332373825b73bc986bd4ea7dfaee9c625c0a
Reviewed-on: https://review.openocd.org/c/openocd/+/7178
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
19 months agortos: Create a new helper function find_symbol(...) 77/7177/3
Tim Nordell [Wed, 7 Sep 2022 16:35:33 +0000 (11:35 -0500)]
rtos: Create a new helper function find_symbol(...)

This will be utilized for an upcoming refactorization to support -flto
compiled programs.

Signed-off-by: Tim Nordell <tnordell@airgain.com>
Change-Id: Id523c0b3ac2dad8b248ea0d2cac7b4dd2f83d293
Reviewed-on: https://review.openocd.org/c/openocd/+/7177
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
19 months agotarget/xtensa: populate PS correctly during fetch 95/7195/2
Ian Thompson [Wed, 14 Sep 2022 16:59:47 +0000 (09:59 -0700)]
target/xtensa: populate PS correctly during fetch

Read PS from EPS[debuglevel] during fetch such that it reflects the correct value when read via telnet (not just via gdb_server).

Signed-off-by: Ian Thompson <ianst@cadence.com>
Change-Id: I8504f68989bc6d5fe451a8cb69d01c86f4ec0100
Reviewed-on: https://review.openocd.org/c/openocd/+/7195
Tested-by: jenkins
Reviewed-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
19 months agoflash/nor/rsl10: Check return value 94/7194/2
Toms Stūrmanis [Wed, 14 Sep 2022 12:13:59 +0000 (15:13 +0300)]
flash/nor/rsl10: Check return value

Change-Id: Id1ad72e74d6a1bddc4dfe46dcf715ef74e19a27f
Signed-off-by: Toms Stūrmanis <toms.sturmanis@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7194
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
19 months agoFreeRTOS: Fix thread reg list for Cortex-M7 39/6939/2
Frank Dischner [Thu, 21 Apr 2022 02:49:44 +0000 (21:49 -0500)]
FreeRTOS: Fix thread reg list for Cortex-M7

This updates the FreeRTOS module to use the M4F FPU stacking also for the
FPV5_SP and FPV5_DP FPUs, which are found on the Cortex-M7. The FPUs are
in fact different than the FPV4_SP found on the M4, but the register
stacking is the same.

Signed-off-by: Frank Dischner <frank.dischner@gmail.com>
Change-Id: I74c45d2cfb55f55e6c557f2450068ad3c2fe9497
Reviewed-on: https://review.openocd.org/c/openocd/+/6939
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
19 months agomips64: remove empty mips_mips64_soft_reset_halt() 84/7184/2
Antonio Borneo [Sat, 10 Sep 2022 12:34:51 +0000 (14:34 +0200)]
mips64: remove empty mips_mips64_soft_reset_halt()

The method soft_reset_halt is optional; no need to add an
empty function.

Remove mips_mips64_soft_reset_halt() and move the TODO comment
in struct target_type.

Change-Id: Id541a75e7a08645568961d59b73a120c2238701f
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7184
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
19 months agotarget/xtensa: fully initialize buffers for PWRSTAT read 83/7183/2
Ian Thompson [Fri, 9 Sep 2022 19:10:20 +0000 (12:10 -0700)]
target/xtensa: fully initialize buffers for PWRSTAT read

Read buffer is sized for 32-bit APB version of PWRSTAT/PWRCTL registers. Initialize to zero so 8-bit JTAG register mirrors are accurate.

Signed-off-by: Ian Thompson <ianst@cadence.com>
Change-Id: I81310649fa7180893d0188aab3c8a14315aaea0a
Reviewed-on: https://review.openocd.org/c/openocd/+/7183
Tested-by: jenkins
Reviewed-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
19 months agotcl: board: mini2440: fix to work with the current version 74/4574/3
Paul Fertser [Sun, 24 Jun 2018 17:48:35 +0000 (20:48 +0300)]
tcl: board: mini2440: fix to work with the current version

Change-Id: I5cf3ab09dbf100d40ce40a4599cd8d2af18a5567
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/4574
Tested-by: jenkins
19 months agodrivers/bcm2835gpio: Fully restore GPIOs after use 25/7125/5
Steve Marple [Mon, 15 Aug 2022 14:45:02 +0000 (15:45 +0100)]
drivers/bcm2835gpio: Fully restore GPIOs after use

Restore outputs to their initial output level.

Signed-off-by: Steve Marple <stevemarple@googlemail.com>
Change-Id: I82402fd7b59d944f81c0ea7859ac499943901f82
Reviewed-on: https://review.openocd.org/c/openocd/+/7125
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
19 months agodrivers/bcm2835gpio: Add support for activity LED 24/7124/4
Steve Marple [Sun, 14 Aug 2022 10:01:08 +0000 (11:01 +0100)]
drivers/bcm2835gpio: Add support for activity LED

Signed-off-by: Steve Marple <stevemarple@googlemail.com>
Change-Id: I472385753507167c93328b9b4dc62d5d61c86f74
Reviewed-on: https://review.openocd.org/c/openocd/+/7124
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
19 months agodrivers/bcm2835gpio: Migrate to adapter gpio commands 23/7123/4
Steve Marple [Sat, 25 Jun 2022 22:45:18 +0000 (23:45 +0100)]
drivers/bcm2835gpio: Migrate to adapter gpio commands

Use the new "adapter gpio" commands to configure the GPIOs used by the
bcm2835gpio driver. The driver supports only 1 chip (gpiochip0).

The reset function now honours the srst_open_drain and trst_open_drain
options.

Signed-off-by: Steve Marple <stevemarple@googlemail.com>
Change-Id: I5b6c68b16362000cf5141a83394549d2bf3af108
Reviewed-on: https://review.openocd.org/c/openocd/+/7123
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
19 months agodrivers/bcm2835gpio: Release resources on error and when quitting 22/7122/4
Steve Marple [Sat, 25 Jun 2022 16:02:14 +0000 (17:02 +0100)]
drivers/bcm2835gpio: Release resources on error and when quitting

The /dev/mem file descriptor can be closed without invalidating the
mappings so close as soon as possible.

munmap() all memory, either on error or from quit.

Signed-off-by: Steve Marple <stevemarple@googlemail.com>
Change-Id: I2b6a8365f554e332520fa77ccf076188083a932f
Reviewed-on: https://review.openocd.org/c/openocd/+/7122
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
19 months agotcl/interface: replace last deprecated commands 81/7181/2
Antonio Borneo [Fri, 9 Sep 2022 09:23:04 +0000 (11:23 +0200)]
tcl/interface: replace last deprecated commands

Still some config file uses deprecated commands.
Replace them with the new commands.

Change-Id: I6ccbfb832e0ad2012e9af160bd2d92ad104af2bb
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7181
Tested-by: jenkins
19 months agosrc/jtag/drivers/ep93xx: fix GCC 12 warning 80/7180/3
Antonio Borneo [Thu, 8 Sep 2022 12:37:55 +0000 (14:37 +0200)]
src/jtag/drivers/ep93xx: fix GCC 12 warning

New GCC reports 5 warning:

src/jtag/drivers/ep93xx.c: In function 'set_gonk_mode':
src/jtag/drivers/ep93xx.c:123:47: warning: pointer of type 'void *' used in arithmetic [-Wpointer-arith]
  123 |         devicecfg = *((volatile int *)(syscon + 0x80));
      |                                               ^
src/jtag/drivers/ep93xx.c:124:35: warning: pointer of type 'void *' used in arithmetic [-Wpointer-arith]
  124 |         *((volatile int *)(syscon + 0xc0)) = 0xaa;
      |                                   ^
src/jtag/drivers/ep93xx.c:125:35: warning: pointer of type 'void *' used in arithmetic [-Wpointer-arith]
  125 |         *((volatile int *)(syscon + 0x80)) = devicecfg | 0x08000000;
      |                                   ^
src/jtag/drivers/ep93xx.c: In function 'ep93xx_init':
src/jtag/drivers/ep93xx.c:182:46: warning: pointer of type 'void *' used in arithmetic [-Wpointer-arith]
  182 |         gpio_data_register = gpio_controller + 0x08;
      |                                              ^
src/jtag/drivers/ep93xx.c:183:56: warning: pointer of type 'void *' used in arithmetic [-Wpointer-arith]
  183 |         gpio_data_direction_register = gpio_controller + 0x18;
      |                                                        ^

Change pointer type to allow pointer arithmetic.

Change-Id: Idd78a7156bdf99df2624043e924b8e54a0588ace
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7180
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
19 months agoconfigure.ac: drop unneeded dependency check 75/7175/2
Antonio Borneo [Tue, 6 Sep 2022 15:55:44 +0000 (17:55 +0200)]
configure.ac: drop unneeded dependency check

The script configure.ac checks for the presence of system include
files required to build OpenOCD.

It incorrectly check for:
dirent.h
pthread.h
ifaddrs.h
net/if.h
that are never included by OpenOCD source code, plus the generated
macros:
HAVE_DIRENT_H
HAVE_PTHREAD_H
HAVE_IFADDRS_H
HAVE_NET_IF_H
are never used in OpenOCD source code.

It also checks for the system function:
vasprintf()
that is never called by OpenOCD source code, plus the generated
macro:
HAVE_VASPRINTF
is never used in OpenOCD source code.

Drop the checks for the unused system include files and the unused
system function.

Change-Id: I68c1b1a1be268a830247fc489f210877c32d7d23
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7175
Tested-by: jenkins
19 months agoopenocd: fix for polling during "expr" computation 74/7174/2
Antonio Borneo [Tue, 6 Sep 2022 12:44:57 +0000 (14:44 +0200)]
openocd: fix for polling during "expr" computation

Commit c7eaaf620488 ("openocd: prepare for jimtcl 0.81 'expr'
syntax change") replaces the jimtcl command "expr" with an openocd
version that detects the TCL syntax change and prints a warning.
The openocd "expr" command will be dropped after v0.12.0,

One side effect is that openocd invokes polling the target after
every openocd command, causing scripts that use several "expr"
commands to run much slower; see [1].

The proper fix would require openocd to invoke polling only at the
time period deadline, instead of at each command. Such fix is too
risky to be applied now, due to short time before v0.12.0-rc1.

As a temporarily workaround, let openocd to detect the "expr"
command and skip the polling.
This will be dropped together with the openocd "expr" command.

Change-Id: I8151aa28694817001046165a15475d64896f985e
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Fixes: https://sourceforge.net/p/openocd/tickets/362/ [1]
Fixes: c7eaaf620488 ("openocd: prepare for jimtcl 0.81 'expr' syntax change")
Reviewed-on: https://review.openocd.org/c/openocd/+/7174
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
19 months agotarget: don't export local symbols 73/7173/2
Antonio Borneo [Mon, 5 Sep 2022 23:28:09 +0000 (01:28 +0200)]
target: don't export local symbols

Symbols that are not used outside the file should not be exported
and should be declared as static.

Change-Id: Icbe7f7bce287b903edec9dc9db3370722c51fbd5
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7173
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
19 months agoflash/nor: move variable's declaration in C file 72/7172/2
Antonio Borneo [Mon, 5 Sep 2022 22:57:11 +0000 (00:57 +0200)]
flash/nor: move variable's declaration in C file

Variables should not be declared in the include file, otherwise
multiple include will cause multiple instances.

Move the declaration in the C file and make it static.

Change-Id: I8b4884cba643a792a78df4e123aa324b19d92279
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7172
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
19 months agousbprog: remove unused variable 71/7171/2
Antonio Borneo [Mon, 5 Sep 2022 22:43:17 +0000 (00:43 +0200)]
usbprog: remove unused variable

Change-Id: I96b2c0ad36073f7e5bed37b96e0244f1760472bc
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7171
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
19 months agoriscv: don't export local symbols 70/7170/3
Antonio Borneo [Mon, 5 Sep 2022 22:20:41 +0000 (00:20 +0200)]
riscv: don't export local symbols

Symbols that are not used outside the file should not be exported
and should be declared as static.
Move the existing comments to the static declarations.

Change-Id: Idf208e3fda4b3f8df789553cf03ebf5f20d811bb
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7170
Reviewed-by: Jan Matyas <matyas@codasip.com>
Reviewed-by: Tim Newsome <tim@sifive.com>
Tested-by: jenkins
19 months agoflash/nor/npcx: make local symbols static 69/7169/2
Antonio Borneo [Mon, 5 Sep 2022 22:43:44 +0000 (00:43 +0200)]
flash/nor/npcx: make local symbols static

Symbols that are not exported should be declared as static.

Change-Id: I6a059080bbba9b3559d26c641b217be8be3b199e
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7169
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
19 months agotarget: make local symbols static 68/7168/2
Antonio Borneo [Mon, 5 Sep 2022 21:56:18 +0000 (23:56 +0200)]
target: make local symbols static

Symbols that are not exported should be declared as static.

Change-Id: I2475524f4c14520e3163572560f4a9f276356ed5
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7168
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
19 months agoxtensa: make local symbols static 67/7167/2
Antonio Borneo [Mon, 5 Sep 2022 21:55:25 +0000 (23:55 +0200)]
xtensa: make local symbols static

Symbols that are not exported should be declared as static.

Change-Id: Ieb627f7f896e4663b0d5b18c4ab1853b39d23d03
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7167
Reviewed-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Reviewed-by: Ian Thompson <ianst@cadence.com>
Tested-by: jenkins
19 months agoriscv: make local symbols static 66/7166/2
Antonio Borneo [Mon, 5 Sep 2022 21:54:41 +0000 (23:54 +0200)]
riscv: make local symbols static

Symbols that are not exported should be declared as static.

Change-Id: Ie3bd17535c8cb2a0fec5d3bedfe7de3e0a702613
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7166
Tested-by: jenkins
Reviewed-by: Tim Newsome <tim@sifive.com>
Reviewed-by: Jan Matyas <matyas@codasip.com>
19 months agojtag: make local symbols static 65/7165/2
Antonio Borneo [Mon, 5 Sep 2022 21:53:10 +0000 (23:53 +0200)]
jtag: make local symbols static

Symbols that are not exported should be declared as static.

Change-Id: I6224ae89ebda3230dfee2413e3823be9b8716bba
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7165
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
19 months agolog: remove unused set_log_output() 64/7164/2
Antonio Borneo [Mon, 5 Sep 2022 22:24:39 +0000 (00:24 +0200)]
log: remove unused set_log_output()

The function set_log_output() has never been used after the drop
of eCos build with commit 39650e2273bc ("ecosboard: delete
bit-rotted eCos code") in 2012.

Drop it!

Change-Id: I070b688061776c7ced5db18f738d78a4a7623726
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7164
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
19 months agotcl/board: add ESP32-S3 config for ESP USB Bridge board 77/7077/2
Erhan Kurubas [Sun, 3 Jul 2022 09:28:12 +0000 (12:28 +0300)]
tcl/board: add ESP32-S3 config for ESP USB Bridge board

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: I97d0f01f342dddb31b2d454858fe854f002cf567
Reviewed-on: https://review.openocd.org/c/openocd/+/7077
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
19 months agotcl/board: add ESP32 config for ESP USB Bridge board 76/7076/2
Erhan Kurubas [Sun, 3 Jul 2022 09:24:24 +0000 (12:24 +0300)]
tcl/board: add ESP32 config for ESP USB Bridge board

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: Ie1a56a398052f6f0e0eb2fe96777effeb59918f6
Reviewed-on: https://review.openocd.org/c/openocd/+/7076
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
19 months agotarget/xtensa: fix step state transition 50/7150/3
Ian Thompson [Mon, 29 Aug 2022 14:34:18 +0000 (07:34 -0700)]
target/xtensa: fix step state transition

For some configurations, notably on DAP systems, resolve issue where single-stepping does not always transition into the HALTED state.

Signed-off-by: Ian Thompson <ianst@cadence.com>
Change-Id: I053f4eaffad8c3228878ba87580ada640e4bd2fe
Reviewed-on: https://review.openocd.org/c/openocd/+/7150
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
19 months agotarget/xtensa: DAP-based Xtensa config files 45/7145/3
Ian Thompson [Thu, 25 Aug 2022 15:55:00 +0000 (08:55 -0700)]
target/xtensa: DAP-based Xtensa config files

- Config files for DAP/JTAG and DAP/SWD systems
- Xtensa core config definitions for NXP RT685 with Xtensa HiFi DSP

Signed-off-by: Ian Thompson <ianst@cadence.com>
Change-Id: I9c3280052073d86e09c7553de661eb8662a95c4a
Reviewed-on: https://review.openocd.org/c/openocd/+/7145
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
19 months agotarget/xtensa: enable DAP/SWD for generic xtensa 44/7144/6
Ian Thompson [Thu, 25 Aug 2022 15:45:14 +0000 (08:45 -0700)]
target/xtensa: enable DAP/SWD for generic xtensa

- Enable ADIv5 DAP systems via JTAG or SWD transport
- Select correct PWRCTL/PWRSTAT bits for XDM/APB

Signed-off-by: Ian Thompson <ianst@cadence.com>
Change-Id: I5894210c804f85075da868d0cfc6fb20b589d99f
Reviewed-on: https://review.openocd.org/c/openocd/+/7144
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
19 months agosrc/flash/nor: flash driver for RSL10 15/7115/22
Toms Stūrmanis [Thu, 11 Aug 2022 17:22:09 +0000 (20:22 +0300)]
src/flash/nor: flash driver for RSL10

Add new flash driver for internal flash of onsemi RSL10 device.

Valgrind-clean. Clang AddressSanitizer shows no errors.

Signed-off-by: Toms Stūrmanis <toms.sturmanis@gmail.com>
Change-Id: I8030542cb9805e94f56d7a69404cef5d88d6dd5a
Reviewed-on: https://review.openocd.org/c/openocd/+/7115
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
19 months ago.gitignore: remove cross-compile *-libtool 61/7161/2
Antonio Borneo [Sun, 4 Sep 2022 09:38:07 +0000 (11:38 +0200)]
.gitignore: remove cross-compile *-libtool

This reverts commit dac90163a287 (".gitignore: add cross-compile
*-libtool") [1] merged in May 2022.

The old build system of OpenEmbedded used to rebuild and rename
plenty of tools to discriminate between host's and target's tools.
This creates, among others, the odd file "$CROSS_COMPILE-libtool"
that was addressed by the patch [1].
OpenEmbedded has dropped this odd behavior with patch [2], present
in OpenEmbedded 4.0 "kirkstone" tagged on April 2022.

In current situation:
- old OpenEmbedded use OpenOCD v0.11.0 or older, so will not use
  the patch [1];
- new OpenEmbedded has [2] applied, so will never take benefit
  from the patch [1].

As consequence, patch [1] is completely useless and keeping it in
OpenOCD can even be misleading.

Revert patch [1].

Change-Id: I75793fce82a5297d74af72e620c4e63cd5b15f90
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Fixes: https://review.openocd.org/6960 [1]
Fixes: dac90163a287 (".gitignore: add cross-compile *-libtool")
Link: https://git.openembedded.org/openembedded-core/commit/?id=4b308773eca7
Reviewed-on: https://review.openocd.org/c/openocd/+/7161
Tested-by: jenkins
19 months agocontrib: add GPL license tag on files that miss it 60/7160/2
Antonio Borneo [Tue, 30 Aug 2022 22:20:16 +0000 (00:20 +0200)]
contrib: 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: I24bd362eeb6b74f09aceb9b757d45cbfa4afe334
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7160
Tested-by: jenkins
19 months agocontrib: replace the GPLv2-or-later license tag 59/7159/2
Antonio Borneo [Tue, 30 Aug 2022 20:18:31 +0000 (22:18 +0200)]
contrib: replace the GPLv2-or-later license tag

Replace the GPLv2-or-later 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: I380d552940f1c405309a3346454251c0e80b5a45
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7159
Tested-by: jenkins
19 months agocontrib: replace the BSD-3-Clause license tag 58/7158/2
Antonio Borneo [Tue, 30 Aug 2022 21:21:52 +0000 (23:21 +0200)]
contrib: replace the BSD-3-Clause license tag

Replace the BSD-3-Clause boilerplate with the SPDX tag.
Add the SPDX tag and the copyright to two makefiles that were
added by TI with the other files in their respective folder.

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: I3ad1b2dbdb6054b74dcc26e394c9223ba0427caf
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7158
Tested-by: jenkins
19 months agocontrib: replace the GPLv3-or-later license tag 57/7157/2
Antonio Borneo [Tue, 30 Aug 2022 15:25:24 +0000 (17:25 +0200)]
contrib: replace the GPLv3-or-later license tag

These files are not built in OpenOCD and are not in conflict with
OpenOCD license.

Replace the GPL boilerplate with the SPDX tag.
Add 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: I934e4add24098f0e8574120b3bc32e9bcf166abd
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7157
Tested-by: jenkins
19 months agoopenocd: fix syntax of SPDX tags 56/7156/2
Antonio Borneo [Tue, 30 Aug 2022 15:15:32 +0000 (17:15 +0200)]
openocd: fix syntax of SPDX tags

Put the SPDX tag alone in a comment in the first line of the file.
Replace the obsolete GPL-2.0+ 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: Ia91b0f7da42c439b6340bbe81983b86b68f6d65c
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7156
Tested-by: jenkins
19 months agoopenocd: remove CamelCase symbols *xPSR* 55/7155/2
Antonio Borneo [Tue, 30 Aug 2022 14:10:19 +0000 (16:10 +0200)]
openocd: remove CamelCase symbols *xPSR*

We have left the camelcase symbols *xPSR* for some time, to avoid
any conflict with possibly pending patches in gerrit.
With the approaching v0.12.0-rc1, it's time to revisit it.
The patches in gerrit that conflict with this rename are all not
merge-able due to conflicts or due to negative review.

Drop these CamelCase symbols.

Change-Id: Ifbac4c1df9cc55994e024971a2aaebeed2ea4ed3
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7155
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
19 months agoopenocd: remove recently added CamelCase symbols 54/7154/2
Antonio Borneo [Tue, 30 Aug 2022 14:36:07 +0000 (16:36 +0200)]
openocd: remove recently added CamelCase symbols

Without the help of checkpatch, some CamelCase symbol passed
through the filter of maintainer's review.

Drop them.

Change-Id: If5fb07b2ffb89e853dd2a61f20d4134aa6e20d24
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Fixes: 48f267d4adea ("flash/stm32l4x: avoid using magic numbers for device ids")
Fixes: 5ab74bde0654 ("semihosting: User defined operation, Tcl command exec on host")
Reviewed-on: https://review.openocd.org/c/openocd/+/7154
Tested-by: jenkins
19 months agotarget/xtensa: virtualize XDM registers 43/7143/5
Ian Thompson [Wed, 24 Aug 2022 13:51:51 +0000 (06:51 -0700)]
target/xtensa: virtualize XDM registers

Use indirect enum IDs to access XDM registers in preparation for supporting both NAR (JTAG) and APB (DAP).  No new clang static analysis warnings.

Signed-off-by: Ian Thompson <ianst@cadence.com>
Change-Id: I0b742fe4661ff3cf609454b8650493d141a1e1ff
Reviewed-on: https://review.openocd.org/c/openocd/+/7143
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
19 months agojep106: update to revision JEP106BE Jan 2022 48/7148/2
Antonio Borneo [Sat, 27 Aug 2022 17:29:55 +0000 (19:29 +0200)]
jep106: update to revision JEP106BE Jan 2022

Change-Id: I687c653517133c114a66f628cce58178ce6707cd
Signed-off-by: Antonio Borneo <antonio.borneo@st.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7148
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
19 months agojep106: add SPDX tag and JEDEC copyright 47/7147/2
Antonio Borneo [Sat, 27 Aug 2022 16:58:42 +0000 (18:58 +0200)]
jep106: add SPDX tag and JEDEC copyright

As a follow-up of talks between JEDEC and STMicroelectronics,
JEDEC agrees to let OpenOCD project including the manufacturer's
identification code list extracted from JEDEC JEP106 document and
to let OpenOCD being updated regularly using the future JEDEC
JEP106 document versions. JEDEC requires OpenOCD to report the
origin of the JEDEC JEP106 manufacturer's identification code list
together with the JEDEC copyright.

As agreed with JEDEC, add in the file jep106.inc:
- the SPDX tag with the GPL license of the OpenOCD project;
- the JEDEC copyright;
- the text provided by JEDEC reporting the origin of the JEDEC
  JEP106 manufacturer's identification code list.

While there:
- add a line reporting the version of the JEP106 document that was
  used for the current code list extraction;
- remove the obsolete comment, as the script for extraction is not
  working anymore; keep the script as example.

Change-Id: Iaa76716db14e15ffca04fcf7d8c27bb85a27ba10
Signed-off-by: Antonio Borneo <antonio.borneo@st.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7147
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
19 months agojtag/vdebug: remove BSD-2-Clause boilerplate 46/7146/2
Antonio Borneo [Mon, 22 Aug 2022 17:47:05 +0000 (19:47 +0200)]
jtag/vdebug: remove BSD-2-Clause boilerplate

The full text of the license is already available in the file
LICENSES/preferred/BSD-2-Clause
and there is no need to replicate it in the source code.

Remove the BSD-2-Clause boilerplate but, preserved the copyright
notice because it provides the info on the copyright holder.

Change-Id: I162aa4ad06b551f1a71a28d049cb797ee8ab5a01
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7146
Tested-by: jenkins
Reviewed-by: Jacek Wuwer <jacekmw8@gmail.com>
19 months agolibjaylink: Update to 0.3.1 release 19/7119/3
Marc Schink [Tue, 16 Aug 2022 08:39:14 +0000 (10:39 +0200)]
libjaylink: Update to 0.3.1 release

Change-Id: If4c13767de033a221e80fc26ee38f67c6c3d746c
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/7119
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
19 months agoserver: add function to get openocd shutdown status 42/7142/3
Erhan Kurubas [Thu, 25 Aug 2022 14:06:40 +0000 (17:06 +0300)]
server: add function to get openocd shutdown status

In the app-trace module we are polling the target in the while loops
outside of the server.c
In that loops, we need to catch ctrl+c signal by checking shutdown_openocd
status

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: Id87c709a01470bf6d3642078b160a68ca85f4406
Reviewed-on: https://review.openocd.org/c/openocd/+/7142
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
19 months agotarget/espressif: add semihosting support 74/7074/8
Erhan Kurubas [Thu, 30 Jun 2022 10:14:27 +0000 (13:14 +0300)]
target/espressif: add semihosting support

ARM semihosting + some custom syscalls implemented for
Espressif chips (ESP32, ESP32-S2, ESP32-S3)

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: Ic8174cf1cd344fa16d619b7b8405c9650e869443
Reviewed-on: https://review.openocd.org/c/openocd/+/7074
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
19 months agotarget/arm: Add support with identify STAR-MC1 36/7136/4
iysheng [Sat, 20 Aug 2022 00:30:59 +0000 (08:30 +0800)]
target/arm: Add support with identify STAR-MC1

Tested with an PLUS-F5270 board which uses the MM32F5277E9PV.

Signed-off-by: iysheng <iyysheng@gmail.com>
Change-Id: Icb75ae8337fdc6fa60e39d3d74dd8bc163707bdd
Reviewed-on: https://review.openocd.org/c/openocd/+/7136
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
19 months agoflash/nor/kinetis: fix clang scan-build error format-truncation 40/7140/3
Erhan Kurubas [Sun, 21 Aug 2022 18:57:32 +0000 (21:57 +0300)]
flash/nor/kinetis: fix clang scan-build error format-truncation

kinetis.c:994:61: error: '%u' directive output may be truncated
writing between 1 and 10 bytes into a region of size 4
[-Werror=format-truncation=]

tested with scan-build-14

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: I72d141a3f8e19ca3596beee2be8434fc8492946f
Reviewed-on: https://review.openocd.org/c/openocd/+/7140
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
19 months agotarget/riscv: Update with latest encoding from riscv-opcodes 84/7084/5
Tim Newsome [Fri, 8 Jul 2022 20:02:13 +0000 (13:02 -0700)]
target/riscv: Update with latest encoding from riscv-opcodes

This gets us a clearly labeled BSD-3-Clause header, which should be
compatible with OpenOCD and Fedora, and also make it clear what the
license actually is.

See https://github.com/riscv/riscv-openocd/pull/710,
https://github.com/riscv/riscv-openocd/pull/713, and
https://github.com/riscv/riscv-openocd/pull/717.

Change-Id: I992b4f3bb230edb9f281e2278dd41c712098ed4c
Signed-off-by: Tim Newsome <tim@sifive.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7084
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
19 months agotarget/xtensa: fix clang analyzer warnings 41/7141/2
Ian Thompson [Sun, 21 Aug 2022 22:56:41 +0000 (15:56 -0700)]
target/xtensa: fix clang analyzer warnings

Scan-build of target/xtensa/ has no clang analyzer warnings from xtensa source files.

Signed-off-by: Ian Thompson <ianst@cadence.com>
Change-Id: I11a125c923ece9a6fd0d9ee1698f742f88ee5cab
Reviewed-on: https://review.openocd.org/c/openocd/+/7141
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
19 months agoflash/nor/bluenrg-x: clarify target algo stack usage 32/7132/2
Tomas Vanek [Wed, 17 Aug 2022 10:24:41 +0000 (12:24 +0200)]
flash/nor/bluenrg-x: clarify target algo stack usage

While on it rename misleading write_algorithm_sp to write_algorithm_stack
and change messages referring 'stack pointer' instead of stack.

No functional change.

Change-Id: Ibb9897d3f01734812ed0f8bc8cd43b935a573f8a
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7132
Tested-by: jenkins
Reviewed-by: Salvatore Giorgio Pecorino <salvatore-giorgio.pecorino@st.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
19 months agoflash/nor/nrf5: don't misuse uint32_t for refcount 31/7131/2
Tomas Vanek [Wed, 17 Aug 2022 08:42:47 +0000 (10:42 +0200)]
flash/nor/nrf5: don't misuse uint32_t for refcount

Change-Id: I016fc9ae037fae75528850d35da059d1db5a4d45
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7131
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
19 months agoflash/nor/core: remove unused define 21/7121/2
Tomas Vanek [Tue, 16 Aug 2022 12:10:26 +0000 (14:10 +0200)]
flash/nor/core: remove unused define

FLASH_MAX_ERROR_STR is not used since commit 815c3b353307
(merged in ~2008)

Change-Id: Ic117a2e3d22235c31dc14533b6564ebf5a13ae58
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7121
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
19 months agoflash/nor: remove empty command definitions 20/7120/2
Antonio Borneo [Tue, 16 Aug 2022 09:42:32 +0000 (11:42 +0200)]
flash/nor: remove empty command definitions

The value of struct flash_driver::command can be NULL when the
flash driver does not need to add any new command.

Remove empty command definitions.

Change-Id: I5413967d4069030234469822d24e9825425ae012
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7120
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
19 months agodoc: how to use QEMU to test big-endian build 68/6968/7
Antonio Borneo [Thu, 5 May 2022 15:23:49 +0000 (17:23 +0200)]
doc: how to use QEMU to test big-endian build

Document the process of using buildroot to build a big-endian
binary of OpenOCD and using QEMU User Mode Emulation for running
the big-endian binary on a little-endian host PC.

Change-Id: Ic5fe26e353a4cf69e57af3c23ae7fa4b25347b2b
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6968
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
19 months agoserver/server: fix target timer timing 18/7118/3
Tomas Vanek [Mon, 15 Aug 2022 17:18:18 +0000 (19:18 +0200)]
server/server: fix target timer timing

The change 6363: Call poll at a fixed interval
switched from target_call_timer_callbacks() to target_call_timer_callbacks_now().
It breaks the timing as all timers callbacks are called every time
one timer expires.

Revert this part of change and use target_call_timer_callbacks().

Fixes: db16b3dc5b06 (Call poll at a fixed interval.)
Change-Id: Ib5b7774de9694d40c55d2a4109d0d1582fc5008b
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7118
Tested-by: jenkins
Reviewed-by: Tim Newsome <tim@sifive.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
19 months agotcl/target: stm32[fl]4x: document the settings for trace 45/6945/2
Antonio Borneo [Sat, 23 Apr 2022 14:14:15 +0000 (16:14 +0200)]
tcl/target: stm32[fl]4x: document the settings for trace

While reviewing on gerrit the change
https://review.openocd.org/6932/
it get clear that the missing documentation on stm32f4x's code
was triggering errors in the new change.

OpenOCD is currently unable to read traces, but these can be
hopefully be read with some other tool.

Document the settings for enabling trace on stm32[fl]4x.

Change-Id: Ibae77a53de16375d3d500e728678740095547009
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6945
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
19 months agotcl/target: replace event trace-config 81/6681/3
Antonio Borneo [Mon, 8 Nov 2021 19:14:46 +0000 (20:14 +0100)]
tcl/target: replace event trace-config

With commit dc7b32ea4a00 ("armv7m_trace: get rid of the old tpiu
code") the target's event "trace-config" has been deprecated.

Create the TPIU device.
Replace the target's event "trace-config" with tpiu's event
"pre-enable" in the STM32 devices that require enabling the trace
clock _before_ programming the TPIU.
Make the script multi-instance-able in case it's used for JTAG
chained devices.
Uniform the code in STM32F4x with the other scripts.
Remove the empty event from STM32WLx.

Change-Id: Ifda219c3c5f37e03072a88168611cf505eb630b7
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6681
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
19 months agojtag/drivers/kitprog: workaround serious firmware problem 07/7107/2
Tomas Vanek [Tue, 2 Aug 2022 07:16:21 +0000 (09:16 +0200)]
jtag/drivers/kitprog: workaround serious firmware problem

Since commit 88f429ead019fd6df96ec15f0d897385f3cef0d0
5321: target/cortex_m: faster reading of all CPU registers
debugging with a kitprog adapter freezes at debug entry.

How to replicate:
 openocd -f interface/kitprog.cfg -f target/psoc4.cfg

Connect to telnet server.
Make sure the target is running:
 resume

Halt the target:
 halt

Without this patch OpenOCD freezes in kitprog_hid_command()
in library call hid_write().

Reduce the number of SWD transactions sent in one USB bulk write
as a workaround, simply use shorter buffer.
For details see the comment in src/jtag/drivers/kitprog.c

Change-Id: I0116894d5ebf1655f6011f0d35acdbbc178cd48c
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7107
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
19 months agojtag/drivers/kitprog: use HID read timeout 06/7106/2
Tomas Vanek [Mon, 1 Aug 2022 21:16:47 +0000 (23:16 +0200)]
jtag/drivers/kitprog: use HID read timeout

Use hid_read_timeout() instead of hid_read().
Improve error messages.

Change-Id: Ia75b4fcd610442ab926bc454341f928d59843fcf
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7106
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
19 months agoflash: nor: use binary prefixes consistently 16/6416/3
Paul Fertser [Sat, 7 Aug 2021 18:55:30 +0000 (21:55 +0300)]
flash: nor: use binary prefixes consistently

When printing memory sizes standard ISO 80000-1 prefixes should be used.
Also a space should be added between any number and its unit according
to papers publication rules.

Change-Id: Id1d35e210766b55c201de4e80ac165d8d0414d0a
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/6416
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
19 months agotarget/xtensa: fix clang analyzer warnings and gcc12 build errors 37/7137/2
Erhan Kurubas [Sat, 20 Aug 2022 20:22:47 +0000 (23:22 +0300)]
target/xtensa: fix clang analyzer warnings and gcc12 build errors

Fix Unused code Dead assignment at line 657
Fix Memory error Double free at line 2851
Fix Memory error Memory leak at line 2530
Fix error: 'a3' may be used uninitialized at line 758
Fix error: '%04x' directive writing between 4 and 8 bytes
into a region of size 5 at line 2471

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: I0382a622bc7c4108a335fd741816577e79240397
Reviewed-on: https://review.openocd.org/c/openocd/+/7137
Tested-by: jenkins
Reviewed-by: Ian Thompson <ianst@cadence.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
19 months agoGeneric Xtensa target config files 83/7083/3
Ian Thompson [Mon, 11 Jul 2022 00:35:50 +0000 (17:35 -0700)]
Generic Xtensa target config files

- Add new Xtensa TCL board files
- Add new Xtensa KC705 on-board FTDI interface
- Add new generic Xtensa and VDebug Xtensa target files

Signed-off-by: Ian Thompson <ianst@cadence.com>
Change-Id: I4acb15c83d1b7b8e6063833ce829530cb22a795e
Reviewed-on: https://review.openocd.org/c/openocd/+/7083
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
19 months agotarget: add generic Xtensa LX support 55/7055/18
Ian Thompson [Sat, 25 Jun 2022 05:27:32 +0000 (22:27 -0700)]
target: add generic Xtensa LX support

Generic Xtensa LX support extends the original Espressif/Xtensa
patch-set to support arbitrary Xtensa configurations, as defined in
a core-specific .cfg file.  Not yet fully-featured.  Additional
functionality to be added:
- Xtensa NX support
- DAP/SWD support
- File-IO support
- Generic Xtensa multi-core support

Valgrind-clean, no new Clang analyzer warnings

Signed-off-by: Ian Thompson <ianst@cadence.com>
Change-Id: I08e7bf8fa57c25b5d0cb75a1aa7a2ac13a380c52
Reviewed-on: https://review.openocd.org/c/openocd/+/7055
Tested-by: jenkins
Reviewed-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
19 months agotcl/interface: add linuxgpiod cfg for Aspeed AST2600 12/7112/4
Jae Hyun Yoo [Thu, 20 Jan 2022 20:07:58 +0000 (12:07 -0800)]
tcl/interface: add linuxgpiod cfg for Aspeed AST2600

Add linuxgpiod cfg for Aspeed AST2600 for a case if JTAG master needs
to be implemented using linuxgpiod intead of hardware JTAG master mode.

These AST2600 GPIOs will be mapped to JTAG/SWD signals.
+-----------+-------------+-------------+
| signal    | GPIO name   | gpio offset |
+-----------+-------------+-------------+
| TCK/SWCLK | GPIOI2      | 66          |
| TMS/SWDIO | GPIOI3      | 67          |
| TDI       | GPIOI1      | 65          |
| TDO       | GPIOI4      | 68          |
| nTRST     | GPIOI0      | 64          |
+-----------+-------------+-------------+

Signed-off-by: Jae Hyun Yoo <quic_jaehyoo@quicinc.com>
Change-Id: I19278402b0895be12d38c0ecea8fdbc56fd491b8
Reviewed-on: https://review.openocd.org/c/openocd/+/7112
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
19 months agotcl/fpga: add Lattice MachXO3 family support 13/7113/5
Jae Hyun Yoo [Thu, 20 Jan 2022 20:31:18 +0000 (12:31 -0800)]
tcl/fpga: add Lattice MachXO3 family support

Add support for Lattice MachXO3 FPGA family.

Signed-off-by: Jae Hyun Yoo <quic_jaehyoo@quicinc.com>
Change-Id: I01fcec0ee458e809246e4505019d15047655dd47
Reviewed-on: https://review.openocd.org/c/openocd/+/7113
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
19 months agoserver/gdb_server: Add support for default thread, use by IDA debugger 17/7017/9
MadSquirrel [Sat, 4 Jun 2022 20:01:11 +0000 (22:01 +0200)]
server/gdb_server: Add support for default thread, use by IDA debugger

Signed-off-by: Benoit Forgette <benoit.forgette@ci-yow.com>
Change-Id: Ia3a29a3377be650f0ccad11a0ae4fe4da78b3ab4
Reviewed-on: https://review.openocd.org/c/openocd/+/7017
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
19 months agotarget/semihosting: drop type casting from semihosting->result 11/7111/3
Erhan Kurubas [Wed, 10 Aug 2022 23:32:25 +0000 (01:32 +0200)]
target/semihosting: drop type casting from semihosting->result

Also used type helper (PRId64) to specify format of int64_t

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: I594863eab594aff621c26fefcc69a1872e9730ee
Reviewed-on: https://review.openocd.org/c/openocd/+/7111
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
20 months agotarget/espressif: remove author lines from esp32xx and xtensa files 04/7104/4
Erhan Kurubas [Mon, 1 Aug 2022 23:15:12 +0000 (01:15 +0200)]
target/espressif: remove author lines from esp32xx and xtensa files

Some files have author info some doesn't. For the consistency we removed all.

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: Ie6f1ec012302e3a954c75c5106f12820722cb715
Reviewed-on: https://review.openocd.org/c/openocd/+/7104
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
20 months agodrivers/linuxgpiod: Migrate to adapter gpio commands 48/7048/9
Steve Marple [Tue, 21 Jun 2022 22:06:25 +0000 (23:06 +0100)]
drivers/linuxgpiod: Migrate to adapter gpio commands

Use the new "adapter gpio" commands to configure the GPIOs used by the
linuxgpiod driver.

Adds support for drive mode and resistor pull options on all signals.

Change-Id: Ic90cb4f06db82435294228b6793330107a9f3606
Signed-off-by: Steve Marple <stevemarple@googlemail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7048
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
20 months agodrivers/am335xgpio: Release resources on error and when quitting 47/7047/8
Steve Marple [Wed, 22 Jun 2022 14:43:51 +0000 (15:43 +0100)]
drivers/am335xgpio: Release resources on error and when quitting

The /dev/mem file descriptor can be closed without invalidating the
mappings so close as soon as possible.

munmap() all memory, either on error or from quit.

Change-Id: I9466edd2f43791e64f2dce719957c67728f3ec06
Signed-off-by: Steve Marple <stevemarple@googlemail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7047
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
20 months agodrivers/am335xgpio: Migrate to adapter gpio commands 84/6984/16
Steve Marple [Tue, 17 May 2022 20:51:17 +0000 (21:51 +0100)]
drivers/am335xgpio: Migrate to adapter gpio commands

Use the new "adapter gpio" commands to configure the GPIOs used by the
am335xgpio driver. The AM335x has 4 GPIO 'chips' (chip number 0-3
inclusive), with each one providing 32 GPIOs (gpio_num 0-31 inclusive).

Change-Id: I7c63c0e4763657ea51790c43fc40d32b7c3580bb
Signed-off-by: Steve Marple <stevemarple@googlemail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6984
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
20 months agojtag/adapter: Add command 'adapter gpio' 67/6967/21
Steve Marple [Wed, 4 May 2022 21:51:48 +0000 (22:51 +0100)]
jtag/adapter: Add command 'adapter gpio'

Most adapters define their own commands to obtain the GPIO number and
other GPIO configuration information such as chip number, output drive
type, active high/low.

Define a general command 'adapter gpio' as replacement for the
driver-specific ones.

Change-Id: I1ca9ca94f0c7df5713172e9f62ffb0ad64e9ee97
Signed-off-by: Steve Marple <stevemarple@googlemail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6967
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
20 months agotarget/cortex_m: supress historical reset detection 09/7109/4
Tomas Vanek [Tue, 2 Aug 2022 09:44:43 +0000 (11:44 +0200)]
target/cortex_m: supress historical reset detection

The S_RESET_ST sticky bit is reset after DHCSR read.
It is set at power-on reset and keeps active until the debuger reads DHCSR.

Ignore S_RESET_ST at the very first read after OpenOCD start
and suppress possibly misleading message "external reset detected"
if we cannot guarantee the reset happened recently.

While on it add a TODO comment.

Change-Id: I15217c2ca6f69ac97aff8be86bce67cba94a42cd
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7109
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
20 months agoloaders/reset/espressif: replace the GPL-2.0-or-later license tag 05/7105/4
Erhan Kurubas [Mon, 1 Aug 2022 23:38:09 +0000 (01:38 +0200)]
loaders/reset/espressif: replace the GPL-2.0-or-later license tag

Replace the FSF boilerplate with the SPDX tag.

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: Iddccae2bd8906a3587a2aa2684124356a340fc74
Reviewed-on: https://review.openocd.org/c/openocd/+/7105
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
20 months agogdb_server: custom target-specific GDB queries 82/7082/4
Ian Thompson [Mon, 11 Jul 2022 00:14:10 +0000 (17:14 -0700)]
gdb_server: custom target-specific GDB queries

Provide a customizable hook for handling target-specific GDB queries

Valgrind-clean, no new Clang analyzer warnings

Signed-off-by: Ian Thompson <ianst@cadence.com>
Change-Id: I684a259ed29f3651cbce668101cff421e522f79e
Reviewed-on: https://review.openocd.org/c/openocd/+/7082
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
20 months agogdb_server: support sparse register maps 03/7103/3
Ian Thompson [Mon, 1 Aug 2022 22:47:52 +0000 (15:47 -0700)]
gdb_server: support sparse register maps

Add additional error handling for targets where gaps may exist in reg_list[]

Signed-off-by: Ian Thompson <ianst@cadence.com>
Change-Id: I65232429e2de08f5d54eeca53aea0db8ce2b58af
Reviewed-on: https://review.openocd.org/c/openocd/+/7103
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
20 months agoopenocd: prevent target polling during 'init' 07/7007/4
Antonio Borneo [Mon, 30 May 2022 13:32:24 +0000 (15:32 +0200)]
openocd: prevent target polling during 'init'

The command 'init' causes the execution of few lower level
commands, e.g. 'target init', and switches from command mode
COMMAND_CONFIG to COMMAND_EXEC, with an intermediate switch back
to mode COMMAND_CONFIG.

A timed target polling can occur during the execution of 'init'
and the target's status can trigger the execution of some events.
E.g. if a target has been left halted by a previous execution of
OpenOCD, the first poll will find the target halted, calling the
corresponding 'halted' event.
The event handler can use commands that can only be executed in
mode COMMAND_EXEC. If the poll happens while OpenOCD is in mode
COMMAND_CONFIG, the triggered handler will fail.

Prevent the target polling to operate during the execution of the
'init' command.

Change-Id: Ia435a5d2039be9b247e2336616dab53ed5d983ac
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7007
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)