openocd.git
13 months agosvf: make command 'svf' syntax consistent 34/7534/2
Antonio Borneo [Fri, 10 Mar 2023 10:41:54 +0000 (11:41 +0100)]
svf: make command 'svf' syntax consistent

The command 'svf' is the only command in OpenOCD that accepts
options in both forms 'option' and '-option'.

Deprecate the option format without the leading '-'.
Update the documentation and fix the on-line help.
While there:
- switch to use the new nvp.h helper;
- return ERROR_COMMAND_ARGUMENT_INVALID on invalid command args;
- fix some minor coding style rule.

Change-Id: I5b944403d92a3fa1e12d5faafc1d2a139bc16a7d
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7534
Tested-by: jenkins
13 months agosvf: fix memory leak on error during command execution 33/7533/2
Antonio Borneo [Fri, 10 Mar 2023 11:01:03 +0000 (12:01 +0100)]
svf: fix memory leak on error during command execution

If svf_set_padding() returns error, jump to free_all label to
prevent any memory leak.
Propagate the error reported by svf_set_padding() instead of
overwriting it.
Use command_print() instead of LOG_ERROR() for command output.

Change-Id: I61fd89cad10652f2f9ef1f9d48a040e35253c3d4
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7533
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
13 months agosvf: fix leaking file descriptor 32/7532/2
Antonio Borneo [Fri, 10 Mar 2023 10:50:08 +0000 (11:50 +0100)]
svf: fix leaking file descriptor

The file descriptor svf_fd is not closed on command error, thus
leaking memory.

Close svf_fd on errors.
While there, properly initialize svf_fd using NULL instead of 0.

Change-Id: I5efe9ce576a3a50588b30000222665e26161dfdc
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7532
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: <kai.schmitz@advantest.com>
13 months agotarget/adi_v5_jtag: fix endianness error in transaction replay 40/7540/3
Tomas Vanek [Tue, 14 Mar 2023 14:11:14 +0000 (15:11 +0100)]
target/adi_v5_jtag: fix endianness error in transaction replay

The code for JTAG WAIT recovery did not handle DP_SELECT
endianness.

While on it, mark missing ADIv6 DP SELECT1 handling as TODO.

Change-Id: I44f3bc8fc9fd2483c0293b6d4f2c51a60ca01873
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7540
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
13 months agotarget/adi_v5_swd: update comment about SWD capability 37/7537/2
Tomas Vanek [Tue, 14 Mar 2023 18:43:21 +0000 (19:43 +0100)]
target/adi_v5_swd: update comment about SWD capability

The multidrop SWD is also supported.

Change-Id: I9fefc54fc9d40a75194285cd6e0f10c5c347d9b6
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7537
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
13 months agotarget/espressif: check common_magic instead of gdb_arch string 36/7536/2
Erhan Kurubas [Tue, 14 Mar 2023 22:22:10 +0000 (01:22 +0300)]
target/espressif: check common_magic instead of gdb_arch string

The value returned by target_get_gdb_arch() is something specific for GDB.
There could be several variants of the same CPU.
If we start implementing all the variants, checking the string value,
could become incorrect.
It's better to check for xtensa->common_magic == XTENSA_COMMON_MAGIC

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: I20f3fdced176c3b9ab00f889743161ecad7280f9
Reviewed-on: https://review.openocd.org/c/openocd/+/7536
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
13 months agortos/nuttx: add Espressif target support and refactoring 44/7444/9
Erhan Kurubas [Sun, 22 Jan 2023 22:43:03 +0000 (23:43 +0100)]
rtos/nuttx: add Espressif target support and refactoring

Almost written from the beginning in a modern OpenOCD way.
- Endiannes support
- Proper variable types
- Align with the other rtos implementations

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: I0868a22da2ed2ab664c82b17c171dc59ede78d10
Reviewed-on: https://review.openocd.org/c/openocd/+/7444
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
13 months agohelper/compiler: fix build on MacOS 44/7544/2
Antonio Borneo [Sun, 19 Mar 2023 09:57:04 +0000 (10:57 +0100)]
helper/compiler: fix build on MacOS

On MacOS, clang defines [1]:
#define __nonnull _Nonnull
that creates incompatibility with GCC and with the macro __nonnull
defined in some libc.

Detect clang on MacOS and undefine __nonnull.

Change-Id: I64fcf51b102ea91c196e657debd8c267943a2b08
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Links: [1] https://github.com/llvm/llvm-project/blob/llvmorg-16.0.0/clang/lib/Frontend/InitPreprocessor.cpp#L1226
Reviewed-on: https://review.openocd.org/c/openocd/+/7544
Tested-by: jenkins
13 months agosvf: new command line options -noreset and -addcycles 33/7433/7
Kai Schmitz [Thu, 5 Jan 2023 12:50:53 +0000 (13:50 +0100)]
svf: new command line options -noreset and -addcycles

-noreset: when using several SVF input files in a sequence it is not always
 desireable to have a JTAG reset between the execution of the files.
 The -noreset option skips this unwanted reset.

-addcycles <x>: some tests rely on a certain number of extra clock cycles
 between the actual JTAG commands. The -addcycles option injects a number
 x cycles after each SDR instruction.

Signed-off-by: Kai Schmitz <kai.schmitz@advantest.com>
Change-Id: I31932d6041dbc803be00016cd0a4f23fb2e7dbe1
Reviewed-on: https://review.openocd.org/c/openocd/+/7433
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
13 months agotcl: remove exec permission to tcl config files 30/7530/2
Antonio Borneo [Mon, 6 Mar 2023 22:18:35 +0000 (23:18 +0100)]
tcl: remove exec permission to tcl config files

With the new checkpatch we will not get this type of issues
anymore.
In mean time, let's fix what we have missed during the review
process.

Change-Id: Iecebf9d43f51a29ee09505d360792793afd24b40
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Fixes: 53556fcded05 ("tcl/interface: add Ashling Opella-LD FTDI config files")
Reviewed-on: https://review.openocd.org/c/openocd/+/7530
Tested-by: jenkins
13 months agotcl/tools/test_cpu_speed: Fix register name 73/7473/2
Marc Schink [Thu, 9 Feb 2023 10:23:28 +0000 (11:23 +0100)]
tcl/tools/test_cpu_speed: Fix register name

Use correct register name after it has beed changed
in commit 11ee500bffe4 ("target/armv7m: Rename xPSR to xpsr")

Change-Id: I3648848f4b47af2d20d60c3e0ecef78f75f6d605
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/7473
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
13 months agojimtcl: update to version 0.82 17/7517/4
Antonio Borneo [Sat, 4 Mar 2023 11:08:58 +0000 (12:08 +0100)]
jimtcl: update to version 0.82

The new version modifies it's auto configure in change
https://github.com/msteveb/jimtcl/commit/ccd47be13019
stating:
configure: Default to --full
Now use --minimal and/or --without-ext to disable things.

With such change jimtcl doesn't build anymore as OpenOCD submodule
because of errors linking with new dependencies openssl and zlib.

Use option --minimal to keep the same build configuration as with
former jimtcl 0.81.
Add option --disable-ssl to avoid a build error on system with no
ssl libraries installed. This is already fixed in jimtcl upstream
but not part of 0.82. Note that ssl is not currently used by
OpenOCD.

Change-Id: I0879891dbd083bfbff1e904daf6cd549c3329bbf
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7517
Tested-by: jenkins
13 months agobuild: fix distcheck for jimtcl 27/7527/2
Antonio Borneo [Sun, 5 Mar 2023 23:27:58 +0000 (00:27 +0100)]
build: fix distcheck for jimtcl

The issues have been highlighted while integrated jimtcl 0.82,
but were already present.

While building jimtcl as submodule, OpenOCD generates the file
jimtcl/configure.gnu to pass specific configure flags.
Issue 1: this file is not included in the distribution.
This causes the rebuild from the distribution to have a jimtcl
built with different (the default) configure flags.
With jimtcl 0.82 the new default is to enable all the features,
but a bug causes the build to fail when openssl is not installed
in the build system (the bug is already fixed but after 0.82 [1]).
All these together cause OpenOCD Jenkins to fail the build for
target 'distcheck' with jimtcl 0.82.

Add jimtcl/configure.gnu to OpenOCD distribution's file list.

The build system considers jimtcl/configure.gnu as a temporarily
file that should be removed during 'distclean'.
Issue 2: 'distcheck' set read-only permission to the source files,
including jimtcl/configure.gnu, so 'distclean' fails removing it.

Add a leading '-' to ignore errors while trying to remove the
file.

Issue 3: Now that 'distcheck' properly configures and builds
jimtcl, 'distcheck' still fails because we have enabled jimtcl
json support in [2] and jimtcl 'distclean' fails to properly
remove one object file (fixed after 0.82 [3]).

Make OpenOCD removing the file jimtcl/jsmn/jsmn.o to complete
the execution of 'distcheck'. Add a comment specifying which of
the jimtcl versions are affected.

Change-Id: I2f9153c5a41ba66b989b27c7bc57b38d1744cc29
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Link: [1] https://github.com/msteveb/jimtcl/commit/22277943a19c
Link: [2] 0a36acbf6ac6 ("configure: build jimtcl with json extension")
Link: [3] https://github.com/msteveb/jimtcl/commit/32a488587a3e
Reviewed-on: https://review.openocd.org/c/openocd/+/7527
Tested-by: jenkins
Reviewed-by: zapb <dev@zapb.de>
13 months agoopenocd: drop JIM_EMBEDDED macro 18/7518/3
Antonio Borneo [Sat, 4 Mar 2023 18:19:16 +0000 (19:19 +0100)]
openocd: drop JIM_EMBEDDED macro

The macro JIM_EMBEDDED was required to be defined before including
jim.h in applications that embed jimtcl.
This requirement has been dropped in 2010 by removing the file
dos/Embedder-HOWTO.txt from jimtcl in
https://github.com/msteveb/jimtcl/commit/2d8564100c86#diff-3e93fa55e666

Drop the macro definition and the comment that mandates it.

Change-Id: I36883f60f25bb25839e4ebf908159569659764dd
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7518
Tested-by: jenkins
13 months agohelper: add compiler.h to handle compiler specific workarounds 19/7519/3
Antonio Borneo [Sat, 4 Mar 2023 22:56:35 +0000 (23:56 +0100)]
helper: add compiler.h to handle compiler specific workarounds

Not all compilers nor compiler versions supports the attributes
used in OpenOCD code.
Collect in a single file the workaround to handle them.

Change-Id: I92d871337281169134ce8e40b2064591518be71f
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7519
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
13 months agotarget/xtensa: add NX support 56/7356/4
Ian Thompson [Fri, 4 Nov 2022 21:54:24 +0000 (14:54 -0700)]
target/xtensa: add NX support

- Manual integration of NX support from xt0.2 release
- No new clang static analysis warnings

Signed-off-by: Ian Thompson <ianst@cadence.com>
Change-Id: I95b51ccc83e56c0d4dbf09e01969ed6a4a93d497
Reviewed-on: https://review.openocd.org/c/openocd/+/7356
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
13 months agotarget/image: zero-initialize ELF segments up to p_memsz 13/7513/6
Peter Collingbourne [Thu, 2 Mar 2023 04:20:29 +0000 (20:20 -0800)]
target/image: zero-initialize ELF segments up to p_memsz

We were previously not zero-initializing ELF segments between p_filesz
and p_memsz (aka BSS). However, this may be necessary depending on the
user's application. Therefore, start doing so.

Change-Id: I5a743390069583aca7ee276f53afeccf2cac0855
Signed-off-by: Peter Collingbourne <pcc@google.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7513
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
13 months agodoc: add missing FreeRTOS symbol 31/7531/2
Chao Du [Wed, 8 Mar 2023 07:17:13 +0000 (07:17 +0000)]
doc: add missing FreeRTOS symbol

A new FreeRTOS symbol xSchedulerRunning was added into the symbol list.
But the doc was not updated accordingly.

Signed-off-by: Chao Du <duchao@eswincomputing.com>
Change-Id: If1b18591e2681477ad96f1dea566cc2547097767
Reviewed-on: https://review.openocd.org/c/openocd/+/7531
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
13 months agoflash/nor/at91samd: add missing SAMR34/35 part numbers 21/7521/2
Andrew Lalaev [Sun, 5 Mar 2023 19:41:14 +0000 (20:41 +0100)]
flash/nor/at91samd: add missing SAMR34/35 part numbers

All DIDs are taken from "SAM R34/R35 Errata Sheet" (DS80000834A).

Signed-off-by: Andrew Lalaev <andrey.lalaev@gmail.com>
Change-Id: Ie35f58e61bb02919c0676c91938c90192481d995
Reviewed-on: https://review.openocd.org/c/openocd/+/7521
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
13 months agoflash/nor/at91samd: fix RAM size for SAMR34/35 20/7520/3
Andrew Lalaev [Sun, 5 Mar 2023 19:36:32 +0000 (20:36 +0100)]
flash/nor/at91samd: fix RAM size for SAMR34/35

According to the datasheets these MCUs have 40Kb RAM.

Signed-off-by: Andrew Lalaev <andrey.lalaev@gmail.com>
Change-Id: I52b8a0c86035bccd6f3c1a478bb2e558bca4ae86
Reviewed-on: https://review.openocd.org/c/openocd/+/7520
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
13 months agodrivers/ftdi: prevent misleading error msg when more vid/pids configured 29/7529/2
Tomas Vanek [Mon, 6 Mar 2023 14:37:43 +0000 (15:37 +0100)]
drivers/ftdi: prevent misleading error msg when more vid/pids configured

The driver tries to open mpsse engine for each vid pid
pair in sequence. If more vid/pid pairs are configured and
the USB device does not correspond to the first pair,
the driver shows 'unable to open ftdi device ...' error.

Match vid pid with the whole list as used in jtag_libusb_open()
instead of multiple mpsse_open() in for loop over vid/pid pairs.

Change-Id: I8ef55205be221c727607fe25b81ae21de0d96f02
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7529
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Wolfram Sang <wsa@kernel.org>
13 months agodrivers/libusb_helper: allow external use of jtag_libusb_match_ids() 28/7528/4
Tomas Vanek [Mon, 6 Mar 2023 14:31:08 +0000 (15:31 +0100)]
drivers/libusb_helper: allow external use of jtag_libusb_match_ids()

Can be employed by a driver with custom libusb open.

Change-Id: I00c8a01df8780891a8b7c30e2e34ab191acdf9a8
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7528
Tested-by: jenkins
Reviewed-by: Wolfram Sang <wsa@kernel.org>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
13 months agoTODO: remove outdated AT91SAM92xx entry 26/7526/2
Wolfram Sang [Fri, 3 Mar 2023 16:00:19 +0000 (17:00 +0100)]
TODO: remove outdated AT91SAM92xx entry

SAM9260 gained good generic infrastructure since 2009. And we always
want "improvements", no need for a TODO item.

Signed-off-by: Wolfram Sang <wsa@kernel.org>
Change-Id: I92551ef9d42ee47ad7441f2354587bbb45edc97e
Reviewed-on: https://review.openocd.org/c/openocd/+/7526
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
13 months agotcl/board/at91sam9g20-ek: remove outdated FIXME 25/7525/2
Wolfram Sang [Fri, 3 Mar 2023 15:50:38 +0000 (16:50 +0100)]
tcl/board/at91sam9g20-ek: remove outdated FIXME

It was fixed by e94180571 ("at91sam9: factorise cpu support") in 2011.

Signed-off-by: Wolfram Sang <wsa@kernel.org>
Change-Id: I95ea149b45a9902424bf9068b4a2830c17ddc6be
Reviewed-on: https://review.openocd.org/c/openocd/+/7525
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
13 months agotlc/interface: does fix source of raspberrypi-gpio-connector.cfg 12/7512/2
Tomas Deingruber [Tue, 28 Feb 2023 23:17:56 +0000 (23:17 +0000)]
tlc/interface: does fix source of raspberrypi-gpio-connector.cfg
in raspberrypi-native.cfg

Fixes: bec6c0eb094f (tcl/interface: universal config for all Raspberry Pi models)
Signed-off-by: Tomas Deingruber <Deingruber.Tomas@gmail.com>
Change-Id: I632c8acd84974937849b5fdf2943239def17bd6d
Reviewed-on: https://review.openocd.org/c/openocd/+/7512
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
14 months agojtag/drivers/cmsis_dap: run queue on reaching transaction limit 83/7483/3
Peter Collingbourne [Sat, 18 Feb 2023 02:26:05 +0000 (18:26 -0800)]
jtag/drivers/cmsis_dap: run queue on reaching transaction limit

We currently fail the transfer when issuing more than 255 transactions
at once, e.g.

> read_memory 0x10000000 32 256
CMSIS-DAP transfer count mismatch: expected 257, got 1

This is because the protocol only supports 255 transactions per packet
(65535 for block transactions), and as a result we truncate the
transaction count when assembling the packet. Fix it by running the
queue when we hit the limit.

Change-Id: Ia9e01e3af5ad035f2cf2a32292c9d66e57eafae9
Signed-off-by: Peter Collingbourne <pcc@google.com>
Fixes: 40bac8e8c4e5 ("jtag/drivers/cmsis_dap: improve USB packets filling")
Reviewed-on: https://review.openocd.org/c/openocd/+/7483
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
14 months agohelper: command: drop last LF ('\n') from sequence of command_print() 71/7471/3
Antonio Borneo [Mon, 19 Dec 2022 18:41:46 +0000 (19:41 +0100)]
helper: command: drop last LF ('\n') from sequence of command_print()

The OpenOCD commands produce their TCL text result through the
pair command_print() and command_print_sameline().
The latter is used to concatenate output in a single line.

At the end of a sequence of command_print(), the last LF is taken
as part of the command result, while it is not always needed, and
it is even annoying when the output of two commands needs to be
concatenate in a single line.

Using command_print_sameline() in place of the last call to
command_print() would solve the problem but it's quite expensive
in term of coding to fix all the existing commands.

Drop the last LF, if present.
Commands that would specifically need a LF as last char, can add
an extra LF at the end of the output.
Document this behavior in command.h.

Change-Id: I6757c20fbfce923dd393083146e8d5a1f3b790b4
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7471
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
14 months agoflash/nor/spi: add 25pe{10/20/40/80/16} 16/7416/4
Daniel Anselmi [Thu, 22 Dec 2022 21:28:21 +0000 (22:28 +0100)]
flash/nor/spi: add 25pe{10/20/40/80/16}

Change-Id: Ic5660bff83b8636ef397482a3313971ecdff72c0
Signed-off-by: Daniel Anselmi <danselmi@gmx.ch>
Reviewed-on: https://review.openocd.org/c/openocd/+/7416
Tested-by: jenkins
Reviewed-by: Andreas Bolsch <hyphen0break@gmail.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
14 months agonew SPI memory devices, continuation code for manufacturer id 29/6929/4
Andreas Bolsch [Wed, 9 Mar 2022 16:22:50 +0000 (17:22 +0100)]
new SPI memory devices, continuation code for manufacturer id

A bunch of new SPI flash (Adesto, Cypress, XTX Tech, mainly octal)
IDs and SPI FRAM (Infineon) IDs added. Backward compatible change
of ID interpretation: The previously unused 4th byte now acts
as continuation code (0x7F) count for manufacturer id, cf.
JEDEC JEP106BC. Currently this affects only some recent octal flash
and FRAM devices, which are only supported by stmqspi and cmspi
flash drivers.

Change-Id: Ibdcac81a84c636dc68439add4461b959df429bca
Signed-off-by: Andreas Bolsch <hyphen0break@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6929
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
14 months agoREADME: Remove statement about libjaylink Git submodule 70/7470/2
Marc Schink [Thu, 2 Feb 2023 13:25:27 +0000 (14:25 +0100)]
README: Remove statement about libjaylink Git submodule

Change-Id: I552c08979849c66d7f8f559ccfd49d27f8b68bb8
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/7470
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
14 months agoflash/nor/stm32l4x: Add revision 'Z' for STM32L552/562 devices 68/7468/2
Marc Schink [Mon, 30 Jan 2023 15:38:45 +0000 (16:38 +0100)]
flash/nor/stm32l4x: Add revision 'Z' for STM32L552/562 devices

Change-Id: Icc6058ef1f43e969a2a9baadfaf382ac820a7b76
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/7468
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
14 months agotarget: arc: rewrite command 'arc add-reg' as COMMAND_HANDLER 26/7426/4
Antonio Borneo [Tue, 27 Dec 2022 01:38:25 +0000 (02:38 +0100)]
target: arc: rewrite command 'arc add-reg' as COMMAND_HANDLER

While there, fix some coding style error and remove the now unused
function jim_arc_read_reg_name_field() and the macro
JIM_CHECK_RETVAL().

Change-Id: I140b4b929978b2936f2310e0b7d1735ba726c517
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7426
Tested-by: jenkins
Reviewed-by: Evgeniy Didin <didin@synopsys.com>
14 months agotarget: arc: rewrite command 'arc add-reg-type-struct' as COMMAND_HANDLER 25/7425/4
Antonio Borneo [Mon, 26 Dec 2022 23:56:55 +0000 (00:56 +0100)]
target: arc: rewrite command 'arc add-reg-type-struct' as COMMAND_HANDLER

Use a COMMAND_HELPER() to avoid memory leaks when the helper
COMMAND_PARSE_NUMBER() returns due to an error.

While there:
- fix potential SIGSEGV due to dereference 'type' before checking
  it's not NULL;
- fix an incorrect NUL byte termination while copying to
  type->data_type.id and to bitfields[cur_field].name;
- fix some coding style error;
- remove the now unused function jim_arc_read_reg_type_field().

Change-Id: I7158fd93b5d4742f11654b8ae4a7abd409ad06e2
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7425
Tested-by: jenkins
Reviewed-by: Evgeniy Didin <didin@synopsys.com>
14 months agotarget: arc: rewrite command 'arc add-reg-type-flags' as COMMAND_HANDLER 24/7424/4
Antonio Borneo [Mon, 26 Dec 2022 23:28:16 +0000 (00:28 +0100)]
target: arc: rewrite command 'arc add-reg-type-flags' as COMMAND_HANDLER

Use a COMMAND_HELPER() to avoid memory leaks when the helper
COMMAND_PARSE_NUMBER() returns due to an error.

While there:
- fix potential SIGSEGV due to dereference 'type' before checking
  it's not NULL;
- fix an incorrect NUL byte termination while copying to
  type->data_type.id and to bitfields[cur_field].name;
- fix some coding style error.

Change-Id: Ide4cbc829871a6a523026ccc0d3100dadc2afd06
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7424
Tested-by: jenkins
Reviewed-by: Evgeniy Didin <didin@synopsys.com>
14 months agohelper: nvp: add openocd nvp files 23/7423/4
Antonio Borneo [Mon, 26 Dec 2022 20:59:56 +0000 (21:59 +0100)]
helper: nvp: add openocd nvp files

Long ago jim_nvp was part of jimtcl. When jimtcl dropped it,
OpenOCD kept copy of it in its code base. Current code of jim_nvp
is still related with jimtcl data types and functions.

With the target of better isolating OpenOCD code from jimtcl,
create a new file nvp.c that re-proposes only the core of the old
jim_nvp, dropping any link with jimtcl and removing the string
'jim' either from the filename and from the code.
Keep the same license from the old code, as the new files are
clearly derived from it.

Change-Id: I273448cf1f1484b10f6b6113ed7bb0fcf946482b
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7423
Tested-by: jenkins
Reviewed-by: Evgeniy Didin <didin@synopsys.com>
14 months agotarget: arc: fix error handling in command 'arc set-reg-exists' 13/7413/2
Antonio Borneo [Mon, 19 Dec 2022 16:20:06 +0000 (17:20 +0100)]
target: arc: fix error handling in command 'arc set-reg-exists'

The command is specified through COMMAND_HANDLER. It should not
return JIM_OK / JIM_ERR.

Change-Id: I56666414d49b0298ecc23ec7ef30c77e1e27afa8
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7413
Tested-by: jenkins
Reviewed-by: Evgeniy Didin <didin@synopsys.com>
14 months agotarget: arc: rewrite command 'arc num-actionpoints' as COMMAND_HANDLER 12/7412/2
Antonio Borneo [Mon, 19 Dec 2022 16:14:15 +0000 (17:14 +0100)]
target: arc: rewrite command 'arc num-actionpoints' as COMMAND_HANDLER

Also drop arc_cmd_jim_get_uint32() that is now unused.

Change-Id: Ic26c3f008376db3f01215bf736fca736dd1c1a4f
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7412
Tested-by: jenkins
Reviewed-by: Evgeniy Didin <didin@synopsys.com>
14 months agotarget: arc: rewrite command 'arc get-reg-field' as COMMAND_HANDLER 11/7411/2
Antonio Borneo [Mon, 19 Dec 2022 16:03:03 +0000 (17:03 +0100)]
target: arc: rewrite command 'arc get-reg-field' as COMMAND_HANDLER

This also fixes several incorrect return ERROR_xxx from a jim
command.

Change-Id: I34fe3552d3dc344eac67bf504c5d5709b707fdfd
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7411
Tested-by: jenkins
Reviewed-by: Evgeniy Didin <didin@synopsys.com>
14 months agotarget: arc: rewrite command 'arc jtag set-core-reg' as COMMAND_HANDLER 10/7410/2
Antonio Borneo [Mon, 19 Dec 2022 12:44:00 +0000 (13:44 +0100)]
target: arc: rewrite command 'arc jtag set-core-reg' as COMMAND_HANDLER

This also fixes an incorrect return ERROR_OK from a jim command.

Change-Id: I72a522645f62b99b313573c8bad6d4f674c5ae53
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7410
Tested-by: jenkins
Reviewed-by: Evgeniy Didin <didin@synopsys.com>
14 months agotarget: arc: rewrite command 'arc jtag get-core-reg' as COMMAND_HANDLER 09/7409/2
Antonio Borneo [Mon, 19 Dec 2022 12:38:58 +0000 (13:38 +0100)]
target: arc: rewrite command 'arc jtag get-core-reg' as COMMAND_HANDLER

This also fixes an incorrect return ERROR_OK from a jim command.

Change-Id: I1f9cf5d1dfa38b8a06042b5f54209e6ee2fc4e0e
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7409
Tested-by: jenkins
Reviewed-by: Evgeniy Didin <didin@synopsys.com>
14 months agotarget: arc: rewrite command 'arc jtag set-aux-reg' as COMMAND_HANDLER 08/7408/2
Antonio Borneo [Mon, 19 Dec 2022 12:32:56 +0000 (13:32 +0100)]
target: arc: rewrite command 'arc jtag set-aux-reg' as COMMAND_HANDLER

This also fixes an incorrect return ERROR_OK from a jim command.

Change-Id: Iab9bc7c25181341a632f608a8ef2d8b0bea72520
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7408
Tested-by: jenkins
Reviewed-by: Evgeniy Didin <didin@synopsys.com>
14 months agotarget: arc: rewrite command 'arc jtag get-aux-reg' as COMMAND_HANDLER 07/7407/2
Antonio Borneo [Mon, 19 Dec 2022 12:27:10 +0000 (13:27 +0100)]
target: arc: rewrite command 'arc jtag get-aux-reg' as COMMAND_HANDLER

This also fixes an incorrect return ERROR_OK from a jim command.

Change-Id: I3c51355e7e05965327ce819a3114e370f2de5249
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7407
Tested-by: jenkins
Reviewed-by: Evgeniy Didin <didin@synopsys.com>
14 months agoflash/nor/spi: Add some zbit flash chips. 45/7445/6
Daniel Serpell [Wed, 25 Jan 2023 02:54:43 +0000 (23:54 -0300)]
flash/nor/spi: Add some zbit flash chips.

I have a RP2020 board from aliexpress that uses the ZB25VQ32 flash, this
allows openocd to correctly identify it with the full flash size.

I also added other models, the datasheets can be found at:

Link: https://datasheet.lcsc.com/lcsc/2203210916_Zbit-Semi-ZB25VQ16ASIG_C2982491.pdf
Link: https://datasheet.lcsc.com/lcsc/2003141132_Zbit-Semi-ZB25VQ32BSIG_C495744.pdf
Link: https://datasheet.lcsc.com/lcsc/2003141132_Zbit-Semi-ZB25VQ64ASIG_C495745.pdf
Link: https://datasheet.lcsc.com/lcsc/2006151421_Zbit-Semi-ZB25VQ128ASIG_C609616.pdf
As noted by Andreas Bolsch, the devices supporting QSPI have different
ID in QPI mode than SPI, so two entries are needed in the table for each
one.

Use 0x0B as qread command, as this does not need the dummy M7-0
parameters.

Signed-off-by: Daniel Serpell <daniel.serpell@gmail.com>
Change-Id: Id99187b1963b02ac1a786b66bb352f5f48ed0ac2
Reviewed-on: https://review.openocd.org/c/openocd/+/7445
Reviewed-by: Andreas Bolsch <hyphen0break@gmail.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
14 months agotcl/target: add rescue mode to RP2040 config 27/7327/3
Tomas Vanek [Sun, 2 Oct 2022 12:46:11 +0000 (14:46 +0200)]
tcl/target: add rescue mode to RP2040 config

Integrate a rescue mode inspired by [1].

The current OpenOCD must be restarted before normal work with the RP2040
because the rescue debug port must not be activated (or the target
is reset every 'dap init'). To continue without restarting OpenOCD
we would need to switch off the configured rescue dap.

Change-Id: Ia05b960f06747063550c166e461939d92e232830
Link: [1] https://github.com/raspberrypi/openocd/blob/rp2040/tcl/target/rp2040-rescue.cfg
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7327
Reviewed-by: Jonathan Bell <jonathan@raspberrypi.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
14 months agojtag/drivers/jlink: allow SWD multidrop 83/7383/3
Tomas Vanek [Mon, 28 Nov 2022 09:54:48 +0000 (10:54 +0100)]
jtag/drivers/jlink: allow SWD multidrop

SW-DPv2 and SWJ-DPv2 devices do not reply to DP_TARGETSEL write cmd.

Ignore the received ACK after TARGETSEL write.

While on it, use swd_ack_to_error_code() for unified error code
translation of the received ACK value for all other commands.

Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Change-Id: If978c88c8496e31581175385e59c32faebfd20aa
Reviewed-on: https://review.openocd.org/c/openocd/+/7383
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: zapb <dev@zapb.de>
14 months agortos: remove config.h includes from stackings headers 41/7441/2
Erhan Kurubas [Sat, 21 Jan 2023 11:46:33 +0000 (12:46 +0100)]
rtos: remove config.h includes from stackings headers

And add its own header to the rtos_xxx_stackings.c

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: I084130fde7ee8645129a7cf60bb7bf59448e2f39
Reviewed-on: https://review.openocd.org/c/openocd/+/7441
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
14 months agotcl/interface: universal config for all Raspberry Pi models 64/7264/4
Tomas Vanek [Fri, 14 Oct 2022 09:16:58 +0000 (11:16 +0200)]
tcl/interface: universal config for all Raspberry Pi models

Speed calibration coeffs are computed from cpufreq/scaling_max_freq
and from the device-tree compatibility information.

Raspberry Pi linux offers /dev/gpiomem for non-root access
to the GPIO registers since ~2016.
Do not configure 'bcm2835gpio peripheral_base' as it is necessary
only if /dev/mem is used - it requires running OpenOCD as root
- it's a security risk so it should be avoided.

The configuration of the GPIO connector (40-pin header)
is factored out and ready to use in interface configuration
for other driver (e.g. linux gpiod).

Mark raspberrypi2-native.cfg as deprecated and redirect
it to raspberrypi-native.cfg

Change-Id: Icce856fb660b45374e94174da279feb51f529908
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7264
Tested-by: jenkins
Reviewed-by: Jonathan Bell <jonathan@raspberrypi.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
14 months agojtag/drivers/bcm2835gpio: refactor delays to inline function 62/7262/4
Tomas Vanek [Thu, 13 Oct 2022 20:33:12 +0000 (22:33 +0200)]
jtag/drivers/bcm2835gpio: refactor delays to inline function

No functional change, the delay is unchanged.

Change-Id: I5b5e837d741ac01fc573657357c5fe61ad901319
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7262
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
14 months agojtag/drivers/bcm2835gpio: use rounding in delay math 61/7261/4
Tomas Vanek [Thu, 13 Oct 2022 14:46:31 +0000 (16:46 +0200)]
jtag/drivers/bcm2835gpio: use rounding in delay math

After setting adapter speed to some values, the driver
shows the real speed little bit higher.
Although it does not impose a problem from technical point
of view because the difference is smaller than usual speed error,
it looks at least strange to the user. The documentation reads
that real frequency should be same or lower than requested.

Use proper rounding in speed -> delay and delay -> speed
conversions.

Change-Id: I1831112cc58681875548d2aeb688391fb79fa37f
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7261
Tested-by: jenkins
Reviewed-by: Jonathan Bell <jonathan@raspberrypi.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
14 months agojtag/drivers/bitbang: avoid mostly harmless glitch on SWDIO 60/7260/4
Tomas Vanek [Fri, 14 Oct 2022 07:19:29 +0000 (09:19 +0200)]
jtag/drivers/bitbang: avoid mostly harmless glitch on SWDIO

bitbang_swd_exchange(rnw=true,...) calls bitbang_interface->swd_write()
with swdio clamped to 0.
bitbang_swd_write_reg() reads 1 turnaround bit, 3 ack bits
and 1 turnaround by one call to bitbang_swd_exchange()
and then switches SWDIO to output.
AFAIK all bitbang interfaces switch SWDIO GPIO direction immediately
in bitbang_interface->swdio_drive().
The GPIO now drives SWDIO line to the value stored in the output register
which is always zero from previous bitbang_swd_exchange(rnw=true,...).
In case the following data bit (bit 0) is 1 we can observe a glitch
on SWDIO:
                                         _____ out 1 ____
HiZ/pull-up ----\                       /
                 \                     /
                  \______ out 0 ______/
          swdio_drive(true)   swd_write(0,1)

The glitch fortunately takes place far enough from SWCLK rising edge
where SWDIO is sampled by the target, so I believe it is harmless
except some corner cases where the reflected wave is delayed on long
line.

Anyway keeping electrical signals glitch free is a good practice.
To keep performance penalty minimal, pre-write the first data
bit to SWDIO GPIO output buffer while clocking the turnaround bit.
Following swdio_drive(true) outputs the pre-written value
and the same value is rewritten by the next swd_write()
instead of glitching SWDIO.

Change-Id: I72ea9c0b2fae57e8ff5aa616859182c67abc924f
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7260
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
14 months agojtag/drivers/openjtag: fix annoying num_cycles > 16 warning 20/7420/2
N S [Sat, 24 Dec 2022 00:59:18 +0000 (16:59 -0800)]
jtag/drivers/openjtag: fix annoying num_cycles > 16 warning

The OpenJTAG driver logs "num_cycles > 16 on run test" warning
whenever the JTAG_RUNTEST operation cycle count is larger than 16.

Instead of logging the warning and only running the first 16 TCLK
cycles, remove the warning and queue up multiple operations of up
to 16 cycles each.

Signed-off-by: N S <nlshipp@yahoo.com>
Change-Id: Id405fa802ff1cf3db7a21e76bd6df0c2d3a0fe61
Reviewed-on: https://review.openocd.org/c/openocd/+/7420
Tested-by: jenkins
Reviewed-by: Jonathan McDowell <noodles-openocd@earth.li>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
14 months agortos: Fix constness of struct rtos_type 80/6680/4
Andreas Fritiofson [Mon, 8 Nov 2021 18:35:27 +0000 (19:35 +0100)]
rtos: Fix constness of struct rtos_type

Change-Id: Iaa89f2ff4036c23f944ffb4f37fe0c7afaf5069b
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6680
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
14 months agortos: Support rt-kernel 68/6668/9
Andreas Fritiofson [Fri, 15 Apr 2016 10:38:43 +0000 (12:38 +0200)]
rtos: Support rt-kernel

Works for the proprietary rt-kernel from rt-labs.

See: https://rt-labs.com/product/rt-kernel/
Change-Id: Id2c2e292c15fb17eab25e3d07db05014daa2a2b0
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6668
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
14 months agortos/nuttx: add stacking info for Espressif Xtensa chips 43/7443/2
Erhan Kurubas [Sat, 21 Jan 2023 19:23:07 +0000 (20:23 +0100)]
rtos/nuttx: add stacking info for Espressif Xtensa chips

ESP32, ESP32-S2 and ESP32-S3 stack register offsets added

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: Ic6215c1d0152853fd08f82cbd3c138c7d62dbc46
Reviewed-on: https://review.openocd.org/c/openocd/+/7443
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
14 months agortos: add custom stack read function 42/7442/2
Erhan Kurubas [Sat, 21 Jan 2023 19:10:21 +0000 (20:10 +0100)]
rtos: add custom stack read function

This is optional field for the targets which has to implement
their custom stack read function.

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: Icbc9ed66a052fc2cc0ef67e3ec4d85ab0c2c1b94
Reviewed-on: https://review.openocd.org/c/openocd/+/7442
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
14 months agortos/nuttx: add riscv stacking info 51/7251/4
Erhan Kurubas [Wed, 5 Oct 2022 16:38:23 +0000 (18:38 +0200)]
rtos/nuttx: add riscv stacking info

Tested with Espressif ESP32-C3 MCU

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: Ia71ace4909f2dc93ddc07a2ec5524cf374f1937c
Reviewed-on: https://review.openocd.org/c/openocd/+/7251
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
14 months agortos/nuttx: move stacking info to the new nuttx stackings file 50/7250/5
Erhan Kurubas [Wed, 5 Oct 2022 15:59:54 +0000 (17:59 +0200)]
rtos/nuttx: move stacking info to the new nuttx stackings file

Other OSes have separate files to keep stack register offsets.
Adding them for NuttX as well will provide a clearer way to expand.

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: I1428fefefa199a95431f2073c0279dd7028ad8da
Reviewed-on: https://review.openocd.org/c/openocd/+/7250
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
14 months agodoc:usb_adapters: add lsusb dump of esp_usb_jtag 40/7440/3
Erhan Kurubas [Fri, 20 Jan 2023 17:33:43 +0000 (18:33 +0100)]
doc:usb_adapters: add lsusb dump of esp_usb_jtag

Also, esp_usb_jtag added to the supported driver list of
"adapter serial" command.

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: Ie65cbf9b44f5de6d7995102d1a281161468f6103
Reviewed-on: https://review.openocd.org/c/openocd/+/7440
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
14 months agodoc: fix broken link to IgnoreHardwareSerialNumber in README.Windows 39/7439/3
N S [Thu, 19 Jan 2023 05:58:43 +0000 (21:58 -0800)]
doc: fix broken link to IgnoreHardwareSerialNumber in README.Windows

   URL for Microsoft documentation on IgnoreHardwareSerialNumber
   redirects to generic USB driver landing page instead of specific
   article. Update link to go to correct page.

Signed-off-by: N S <nlshipp@yahoo.com>
Change-Id: Ifac6c730a1438242cdfe0a0a2867e043e03ceec7
Reviewed-on: https://review.openocd.org/c/openocd/+/7439
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
15 months agostm32f3x: Allow overriding the flash bank size 38/7438/2
Andreas Fritiofson [Wed, 18 Jan 2023 08:23:32 +0000 (09:23 +0100)]
stm32f3x: Allow overriding the flash bank size

Same mechanism as in stm32f1x.cfg reused here.

Change-Id: I81f02feb2b655e8259341b22180f3a8b82e28d05
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7438
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
15 months agohelper: Add generic little endian CRC32 function 15/7415/3
Marian Buschsieweke [Thu, 22 Dec 2022 12:20:07 +0000 (13:20 +0100)]
helper: Add generic little endian CRC32 function

This generalizes the little endian CRC32 function used in the OR1K
target and moves it to a common helper, so that other places do not need
to reinvent the wheel. It is directly used in the OR1K target.

Change-Id: I0e55340281a5bfd80669bb1994f3a96fecc1248a
Signed-off-by: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/7415
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
15 months agoflash/nor/psoc4: drop jtag_poll_mask() from flash write 62/7162/2
Tomas Vanek [Sun, 4 Sep 2022 12:18:26 +0000 (14:18 +0200)]
flash/nor/psoc4: drop jtag_poll_mask() from flash write

Polling the target makes no harm during PSoC 4 flash write in the current
OpenOCD code. Don't mask it.

Change-Id: I6625ded0162ee3a96b92188844d0d2d6c30101c2
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7162
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
15 months agojtag: hla: use generic helper for commands 'jtag newtap' 'swd newdap' 28/7428/2
Antonio Borneo [Sun, 1 Jan 2023 18:17:18 +0000 (19:17 +0100)]
jtag: hla: use generic helper for commands 'jtag newtap' 'swd newdap'

The commands 'jtag newtap' and 'swd newdap' have to work either on
HLA transport and on standard JTAG/SWD. Having a dedicated
implementation for HLA is a non-sense.

Reuse the generic code jim_jtag_newtap() and drop the files
hla_tcl.[ch] as they are now empty.

Change-Id: I9dabbdc2a6f338f23b2fd3ed1a4dc3da0200c080
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7428
Tested-by: jenkins
15 months agojtag: parse command options in 'swd newdap' 27/7427/2
Antonio Borneo [Sun, 1 Jan 2023 17:26:53 +0000 (18:26 +0100)]
jtag: parse command options in 'swd newdap'

The same code is currently used for commands 'jtag newtap' and
'swd newdap' (plus dapdirect versions), but for SWD case the code
skips the parsing of the command line as not every flag is used.
This has the drawback that syntax errors get unchecked.

Move the check about the transport so the command line get always
parsed even when the corresponding flags are not useful.

Change-Id: I596c3beb04e9e8a9ebe6ee68a61395b679d43b3e
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7427
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
15 months ago.gitignore: Add .cache and compile_commands.json 14/7414/2
Marian Buschsieweke [Wed, 21 Dec 2022 10:00:53 +0000 (11:00 +0100)]
.gitignore: Add .cache and compile_commands.json

Enhancing the editor / IDE experience with the use of the language
server protocol (lsp) is getting more and more common. The most widely
used lsp implementation for C/C++ outside of Redmond is clangd.

Clangd uses compile_commands.json, that contains the compiler invocation
for each compilation unit, to get the required $CFLAGS to successfully
located header files etc. This is best automatically generated from with
bear on Makefile based build systems. Hence, there is little value in
adding it to the git repo.

In addition, clangd generates cache files in the .cache folder. Again,
there is no reason in tracking it with git.

Change-Id: Ic5165d10aca3a1cc9e9398af9dd2fbf0977608b3
Signed-off-by: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/7414
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
15 months agoflash/nor/stm32l4x: Add revision 'X' and 'C' for STM32U575/585 devices 90/7390/2
Marc Schink [Wed, 7 Dec 2022 12:13:04 +0000 (13:13 +0100)]
flash/nor/stm32l4x: Add revision 'X' and 'C' for STM32U575/585 devices

Change-Id: I4d950dc0a1421036418f2e5c1f0ed8eca86efc1a
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/7390
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
15 months agotcl/target: enable -rtos hwthread 84/7384/2
Antonio Borneo [Mon, 28 Nov 2022 23:34:44 +0000 (00:34 +0100)]
tcl/target: enable -rtos hwthread

The rtos hwthread has been merged in 2019 with commit 85ba2dc4c6ab
("rtos/hwthread: add hardware-thread pseudo rtos").
During review in patchset 19 the name of the rtos has been changed
from 'hawt' to 'hwthread'.

Some target config file was already merged ready for hwthread, but
keeping the relevant lines commented and still reporting the old
name.

Enable rtos hwtread to the target that were supposed to use it.
Fix the name of the rtos.

Change-Id: I877862dcdba39f26462bb542bac06d1a5f5f222d
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7384
Tested-by: jenkins
15 months agojtag/drivers/cmsis_dap: prevent conn/discon workaround before line reset 81/7381/2
Tomas Vanek [Thu, 24 Nov 2022 13:21:59 +0000 (14:21 +0100)]
jtag/drivers/cmsis_dap: prevent conn/discon workaround before line reset

The line reset SWD sequence is used quite often in SWD multidrop mode.
Prevent the ugly connect/disconnect adapter firmware bug workaround
to be called before each line reset.

Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Change-Id: Id85bff075dba9077e4e501e2cdcfd64d5d9d0531
Reviewed-on: https://review.openocd.org/c/openocd/+/7381
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
15 months agojtag/drivers/cmsis_dap: speed up long transfers using DAP_TransferBlock 72/7372/4
Tomas Vanek [Tue, 22 Nov 2022 11:29:52 +0000 (12:29 +0100)]
jtag/drivers/cmsis_dap: speed up long transfers using DAP_TransferBlock

DAP_TransferBlock command saves n - 3 bytes in comparison to DAP_Transfer,
where n is number of transfers.

Use DAP_TransferBlock optionaly to save some USB bandwidth.

The change increases the speed of the write transfer
from 40 KiB/s to 42 KiB/s @ USB FS, adapter speed 1000.

Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Change-Id: Ifde0159cfd44481d2b81b90daa088e731c03e26d
Reviewed-on: https://review.openocd.org/c/openocd/+/7372
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
15 months agojtag/drivers/cmsis_dap: improve USB packets filling 64/7364/4
Tomas Vanek [Sat, 19 Nov 2022 06:21:10 +0000 (07:21 +0100)]
jtag/drivers/cmsis_dap: improve USB packets filling

DAP write transaction occupies 5 bytes of a command packet.
DAP read transaction needs just one byte in a command packet
and expect 4 bytes in a response.

The fixed maximal number of transactions in a packet caused
packet filling less than optimal.

Compute both command and expected response sizes based on
read or write direction of each transaction.
Run the queue if one of sizes does not fit into a packet.

The change increases the speed of the mostly read transfer
from 36 KiB/s to almost 40 KiB/s @ USB FS, adapter speed 1000
due to reduction of adapter inserted RDBUFF reads.

Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Change-Id: Ib70812600eaae0403b8ee8673b6f897348496569
Reviewed-on: https://review.openocd.org/c/openocd/+/7364
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
15 months agojtag/drivers/cmsis_dap: introduce packet_usable_size 63/7363/4
Tomas Vanek [Sat, 19 Nov 2022 06:16:30 +0000 (07:16 +0100)]
jtag/drivers/cmsis_dap: introduce packet_usable_size

USB bulk backend needs to avoid zero sized USB packets
sent after each full sized packed for performance reasons.

HID backend uses fixed size HID reports so the full size
of the report can be utilized.

Introduce packet_usable_size to reflect it.

Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Change-Id: I34094c9edac5730624480711cbd6aa65883c47c7
Reviewed-on: https://review.openocd.org/c/openocd/+/7363
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
15 months agojtag/drivers/cmsis_dap: use unsigned types 62/7362/4
Tomas Vanek [Sat, 19 Nov 2022 06:08:32 +0000 (07:08 +0100)]
jtag/drivers/cmsis_dap: use unsigned types

Not all variables converted, JTAG part is left as is.

Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Change-Id: Ie9cc890769a2f53cb3a07fd457030e1b98910d44
Reviewed-on: https://review.openocd.org/c/openocd/+/7362
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
15 months agojtag/drivers/cmsis_dap: use dap parameter instead of cmsis_dap_handle 61/7361/3
Tomas Vanek [Sat, 19 Nov 2022 06:08:32 +0000 (07:08 +0100)]
jtag/drivers/cmsis_dap: use dap parameter instead of cmsis_dap_handle

Replace the direct dereference of cmsis_dap_handle by dereference
of the dap function parameter wherever possible.

Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Change-Id: I32601dbe0270267642720a8524706aa76d187c3b
Reviewed-on: https://review.openocd.org/c/openocd/+/7361
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
15 months agojtag/drivers/cmsis_dap: move pending request FIFO 60/7360/3
Tomas Vanek [Sat, 19 Nov 2022 05:57:56 +0000 (06:57 +0100)]
jtag/drivers/cmsis_dap: move pending request FIFO

Move all pending request FIFO related variables to
the struct cmsis_dap

Pure refactoring, no functional changes.

Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Change-Id: I2cea9c1e265ac102ec0f314767b8b9afdcda9ee9
Reviewed-on: https://review.openocd.org/c/openocd/+/7360
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
15 months agotools: add disassembler helper for files .inc 47/7347/3
Antonio Borneo [Sun, 13 Nov 2022 14:46:19 +0000 (15:46 +0100)]
tools: add disassembler helper for files .inc

We are moving the binary helpers in files .inc in contrib/loaders/
but we have no support to disassemble them for checking their
content, nor documentation to give any hint.

Add a simple script that uses objdump to directly disassemble a
file .inc
Use Cortex-M settings as default, but provide the flexibility to
reuse the script for any other target CPU.

Change-Id: I12e79580f2936b1622fb7231d9a2484a763ba72a
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7347
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
15 months agodoc: usb_adapters: add other adapters 98/7298/3
Antonio Borneo [Sat, 22 Oct 2022 15:58:28 +0000 (17:58 +0200)]
doc: usb_adapters: add other adapters

Mainly get from web or from OpenOCD users

Change-Id: Id4d6354bc9b6972622adfacf3549c7c3e0549bc2
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7298
Tested-by: jenkins
15 months agodoc: usb_adapters: add lsusb dump of few adapters 97/7297/3
Antonio Borneo [Sat, 22 Oct 2022 16:16:59 +0000 (18:16 +0200)]
doc: usb_adapters: add lsusb dump of few adapters

Real dumps from adapters I have access to.
Serial numbers have been manually edited but are still consistent.

Change-Id: Iee2d16e09615746e29588f91fdfb77eb9fad4daa
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7297
Tested-by: jenkins
15 months agodoc: usb_adapters: add container for lsusb dump of adapters 96/7296/3
Antonio Borneo [Sat, 22 Oct 2022 16:12:16 +0000 (18:12 +0200)]
doc: usb_adapters: add container for lsusb dump of adapters

When extending an existing adapter driver, developer has to
carefully avoid to break backward compatibility.
But not all developers have access to many adapters for testing.

Prepare a folder aimed at containing 'lsusb -v' dumps of adapters
to be used as reference.
Add documentation and a simple dump script.

Change-Id: Ia3a9132d65ec8869734721f9605cebcebcf33608
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7296
Tested-by: jenkins
15 months agoflash/nor, contrib/loaders: move numicro M0 write assembly to contrib/loaders 46/7346/3
Jian-Hong Pan [Sun, 13 Nov 2022 04:43:14 +0000 (12:43 +0800)]
flash/nor, contrib/loaders: move numicro M0 write assembly to contrib/loaders

Simply move numicro M0 flash write assembly to contrib/loaders. Also,
modify corresponding Makefile and generated numicro_m0.inc.

To make the path more general, this patch rename the path
"contrib/loaders/flash/numicro_m4" to "contrib/loaders/flash/numicro" as
well.

Signed-off-by: Jian-Hong Pan <chienhung.pan@gmail.com>
Change-Id: I9adea24c2b3c97319a9b015cf50257f3d131dc26
Reviewed-on: https://review.openocd.org/c/openocd/+/7346
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
15 months agoflash/nor, contrib/loaders: move numicro M4 write assembly to contrib/loaders 43/7343/3
Jian-Hong Pan [Wed, 9 Nov 2022 16:14:10 +0000 (00:14 +0800)]
flash/nor, contrib/loaders: move numicro M4 write assembly to contrib/loaders

Simply move numicro M4 flash write assembly to contrib/loaders. Also,
add corresponding Makefile and generated numicro_m4.inc.

Signed-off-by: Jian-Hong Pan <chienhung.pan@gmail.com>
Change-Id: I22b8be0a245857335b11bd0b538db415fc34748d
Reviewed-on: https://review.openocd.org/c/openocd/+/7343
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
15 months agotcl: add a configuration file for Nuvoton M541 & NUC442/472 series 30/7330/7
Zale Yu [Fri, 4 Nov 2022 15:07:29 +0000 (23:07 +0800)]
tcl: add a configuration file for Nuvoton M541 & NUC442/472 series

This patch is picked from the tcl part of OpenOCD-Nuvoton's commit
("flash: supported Nuvoton M4 series. jtag: Used HW reset instead of
auto reset. tcl: added a configuration file for Nuvoton M4 series.") [1]
to support the communication with Nuvoton's Cortex-M4 chips: M541 &
NUC442/472 series.

This patch has been tested with Nuvoton's NuTiny-SDK-NUC472 development
board [2].

The code comes from the commit basically. Jian-Hong Pan tweaked for the
compatibility with current OpenOCD. So, leave the author as Zale Yu.

[1]: https://github.com/OpenNuvoton/OpenOCD-Nuvoton/commit/c2d5b8bfc705
[2]: https://www.nuvoton.com/export/resource-files/UM_NuTiny-SDK-
     NUC472_EN_Rev1.02.pdf

Signed-off-by: Zale Yu <cyyu@nuvoton.com>
Signed-off-by: Jian-Hong Pan <chienhung.pan@gmail.com>
Change-Id: I27ac58dd1c98a76e791a4f1117c31060cf5522e8
Reviewed-on: https://review.openocd.org/c/openocd/+/7330
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
15 months agoflash: support Nuvoton M541 & NUC442/472 series 29/7329/7
Zale Yu [Sun, 6 Nov 2022 15:32:22 +0000 (23:32 +0800)]
flash: support Nuvoton M541 & NUC442/472 series

This patch is picked from the flash part of OpenOCD-Nuvoton's commit
("flash: supported Nuvoton M4 series. jtag: Used HW reset instead of
auto reset. tcl: added a configuration file for Nuvoton M4 series.") [1]
to support flashing Nuvoton's Cortex-M4 chips: M541 & NUC442/472 series.

The code comes from the commit basically. Jian-Hong Pan tweaked for the
compatibility with current OpenOCD. So, leave the author as Zale Yu.

[1]: https://github.com/OpenNuvoton/OpenOCD-Nuvoton/commit/c2d5b8bfc705

Signed-off-by: Zale Yu <cyyu@nuvoton.com>
Signed-off-by: Jian-Hong Pan <chienhung.pan@gmail.com>
Change-Id: I9dc69eccb851df14c1b0ce2f619d7b3da0aa92aa
Reviewed-on: https://review.openocd.org/c/openocd/+/7329
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
15 months agoflash/nor/numicro: reorder the parts list 39/7339/3
Zale Yu [Sun, 6 Nov 2022 14:54:37 +0000 (22:54 +0800)]
flash/nor/numicro: reorder the parts list

This patch is picked from the flash part of OpenOCD-Nuvoton's commit
("flash: supported Nuvoton M4 series. jtag: Used HW reset instead of
auto reset. tcl: added a configuration file for Nuvoton M4 series.") [1]
It reorders Nuvoton MCU part list and spreads out the way to define the
banks' base address & size of the parts.

The code comes from the commit basically. Jian-Hong Pan tweaked for the
compatibility with current OpenOCD. So, leave the author as Zale Yu.

[1]: https://github.com/OpenNuvoton/OpenOCD-Nuvoton/commit/c2d5b8bfc705

Signed-off-by: Zale Yu <cyyu@nuvoton.com>
Signed-off-by: Jian-Hong Pan <chienhung.pan@gmail.com>
Change-Id: I1f21f54dfdf53e5b8ea04d803347d1dbc8c321a0
Reviewed-on: https://review.openocd.org/c/openocd/+/7339
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
15 months agotarget/armv7m: Rename xPSR to xpsr 92/7292/2
Boris-Chengbiao Zhou [Wed, 26 Oct 2022 01:10:17 +0000 (03:10 +0200)]
target/armv7m: Rename xPSR to xpsr

The org.gnu.gdb.arm.m-system GDB feature defines the name in lowercase
letters.[1] Not adhering to the definition can cause issues with tools
interacting with the GDB which expect the correct casing.

[1]: https://sourceware.org/gdb/onlinedocs/gdb/ARM-Features.html

Change-Id: I0b6584a78f86b053947d79686baad5dac3ec4a00
Signed-off-by: Boris-Chengbiao Zhou <bobo1239@web.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/7292
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
15 months agoflash/stm32l4x: avoid multiple assignments 82/7282/2
Tarek BOCHKATI [Thu, 20 Oct 2022 19:48:48 +0000 (20:48 +0100)]
flash/stm32l4x: avoid multiple assignments

Change-Id: I6d8e0fbfa7e05f26295fc22733c65c11f7460b51
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@st.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7282
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
15 months agoadapter: Improve three adapter-related prints 69/7269/3
Jan Matyas [Mon, 17 Oct 2022 06:24:05 +0000 (08:24 +0200)]
adapter: Improve three adapter-related prints

- Do not warn the user about adapter speed not being set
  if the selected adapter does not support configurable speed.
  This would be confusing to users.

- Minor reword in the "adapter speed is not selected" warning.

- Print the adapter name in the "adapter doesn't support
  configurable speed" log entry

- Another minor reword: autoselect --> autoselecting

Signed-off-by: Jan Matyas <matyas@codasip.com>
Change-Id: I4c198b547544fd8199921f092153562c5f159134
Reviewed-on: https://review.openocd.org/c/openocd/+/7269
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
15 months agoriscv: drop deprecated command 'riscv test_sba_config_reg' 72/7272/2
Antonio Borneo [Mon, 17 Oct 2022 10:34:23 +0000 (12:34 +0200)]
riscv: drop deprecated command 'riscv test_sba_config_reg'

Change-Id: I51c1b1cb3de8cb86ee38280fa3f035f6f7a63dbc
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7272
Reviewed-by: Jan Matyas <matyas@codasip.com>
Reviewed-by: Tim Newsome <tim@sifive.com>
Tested-by: jenkins
15 months agoriscv: drop deprecated command 'riscv set_prefer_sba' 71/7271/2
Antonio Borneo [Mon, 17 Oct 2022 10:28:57 +0000 (12:28 +0200)]
riscv: drop deprecated command 'riscv set_prefer_sba'

Change-Id: I546efe4e1a6b673b26cfb4a74b5c3809fecda49c
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7271
Tested-by: jenkins
Reviewed-by: Jan Matyas <matyas@codasip.com>
15 months agotcl/target: remove rp2040-core0.cfg 26/7326/2
Tomas Vanek [Thu, 3 Nov 2022 09:32:36 +0000 (10:32 +0100)]
tcl/target: remove rp2040-core0.cfg

rp2040-core0.cfg configuration file was intended for a special adapter
which selects a SWD multidrop target on its own. This means
that rp2040-core0.cfg is totally unusable with a standard SWD
adapter. The file was marked as deprecated in 0.12 release.

The reworked rp2040.cfg can be restricted to use just one core:
  openocd ... -c 'set USE_CORE 0' -f target/rp2040.cfg

Remove the obsoleted config.

Change-Id: Id886471622bb4a8cb83f5c4c3660657407aaaf74
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7326
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
15 months agotcl/target: add SMP mode to rp2040.cfg 42/7242/6
Tomas Vanek [Sun, 2 Oct 2022 12:46:11 +0000 (14:46 +0200)]
tcl/target: add SMP mode to rp2040.cfg

Add the variable selected configuration for SMP debug with rtos hwthread.

Use SMP by default.

Change-Id: I1c37d91688a3ab58d65c15686737892965711adc
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7242
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
15 months agoflash/nor/rp2040: make SPI flash ID detection optional 41/7241/6
Tomas Vanek [Sun, 2 Oct 2022 09:21:42 +0000 (11:21 +0200)]
flash/nor/rp2040: make SPI flash ID detection optional

Do not read ID from SPI flash and suppress autodetection
if non-zero flash bank size is configured.

Change-Id: Idcf9ee6ca17f9fa89964a60da7bf11e47b4af5e7
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7241
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
15 months agotarget/cortex_m: add SMP support for Cortex-M 39/7239/5
Tomas Vanek [Sat, 1 Oct 2022 15:10:31 +0000 (17:10 +0200)]
target/cortex_m: add SMP support for Cortex-M

Cortex-M support for SMP multicore targets.

This SMP implementation unlike older ones does not act
on the first halted target found. It polls targets
until a SMP group is finished and stores eventual
'halted' events instead of emitting them. As soon as polling
of a group is done, poll proceeds with SMP related tasks.
This approach improves detection of a reason why debug
stopped - a correct reason is detected for all targets,
not only for the first found.
Drawback: SMP target group should be defined in the same
order as the targets were defined.

Obsolete gdb 'J' packet/smp_gdb command core switching is not implemented,
use with rtos hwthread.

Only one core is resumed if debug_execution is requested.

Some ideas taken from Graham Sanderson's [4936]
and src/target/aarch64.c

Added error checking of armv7m_restore_context().

Change-Id: I60f5b79e74b624dc2b5835ff10e38ac2ccb23792
Link: [4936]: target/cortex_m: Add smp support for Cortex M | https://review.openocd.org/c/openocd/+/4936
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7239
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
15 months agotarget/armv7m: check error in armv7m_restore_context() 38/7238/4
Tomas Vanek [Sat, 1 Oct 2022 15:00:51 +0000 (17:00 +0200)]
target/armv7m: check error in armv7m_restore_context()

Return error if arm.write_core_reg() fails.

Change-Id: Ide8f5aa5958532b202dc9f5e13d3250a706d832d
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7238
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
15 months agoarmv8: Add support of pointer authentication 48/7248/4
Koudai Iwahori [Tue, 4 Oct 2022 11:21:35 +0000 (04:21 -0700)]
armv8: Add support of pointer authentication

When pointer authentication is enabled, some upper bits of the link
register (LR[63:VA_SIZE]) are used to store a signature. Therefore, GDB
need to remove the signature to get backtraces.
GDB has support of pointer authentication. When pointer authenticaion is
enabled, GDB requests 8-bytes mask to the target to remove the
signature. mask[63:VA_SIZE] should be all set and mask[VA_SIZE-1:0]
should be all cleared. GDB removes the signature by addr&~mask or
addr|mask.
I added a feature to provide the mask for pointer authentication.

Signed-off-by: Koudai Iwahori <koudai@google.com>
Change-Id: I56fbbf9cc23619b6536ecd326f350c8bf137f322
Reviewed-on: https://review.openocd.org/c/openocd/+/7248
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
15 months agosrc/rtos/eCos : Support per-build configuration specific structure layouts 75/6275/13
James G. Smith [Wed, 26 May 2021 09:08:26 +0000 (10:08 +0100)]
src/rtos/eCos : Support per-build configuration specific structure layouts

Extended feature. This is a large patch, but is self-contained to the
eCos support and does not affect any other openocd functionality. It
does NOT affect existing eCos RTOS plugin users where their
applications do not provide the extended symbolic helper
information. If the helper symbols are not available the rtos support
code will behave as before. This "dynamic" functionality is *required*
because eCos does NOT have a fixed/hardwired, known, layout for the
thread descriptor structure. The per-application build eCos
configuration can affect the shape of the thread descriptor structure
(field presence, and hence offsets of subsequent fields) such that
constant values cannot be used to consistently interpret all possible
eCos application configurations. For historical reasons, there is not
yet a consistent namespace for the helper symbols across eCos HALs
hence the support is currently limited to specific architectures
(Cortex-M and ARM/Cortex-A). No new Clang analyser warnings are raised
by this changeset.

Change-Id: Ib3a36877326eeb56595cbca55e21b9e59a59c98a
Signed-off-by: James G. Smith <jsmith@rallysmith.co.uk>
Reviewed-on: https://review.openocd.org/c/openocd/+/6275
Reviewed-by: Alex Schuilenburg <alex.schuilenburg@gmail.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
15 months agoflash/nor/spi: Add issi is25lq040b to device list 35/7135/9
Fawaz Tirmizi [Fri, 19 Aug 2022 21:22:06 +0000 (14:22 -0700)]
flash/nor/spi: Add issi is25lq040b to device list

The HiFive Inventor uses this flash chip, so adding it will allow for
openocd to be used to program it. These values were taken from the
chip's documentation.

Signed-off-by: Fawaz Tirmizi <fawaz@rivosinc.com>
Change-Id: I15c9d35f99d4500f73134cdc2d1b9ab6279b491c
Reviewed-on: https://review.openocd.org/c/openocd/+/7135
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
15 months agotarget/xtensa: remove needless target_was_examined check 31/7231/2
Erhan Kurubas [Wed, 28 Sep 2022 22:22:00 +0000 (00:22 +0200)]
target/xtensa: remove needless target_was_examined check

In any case flag will be set as examined.

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: I5177ee656f726a807269e2f4725223f50e49e855
Reviewed-on: https://review.openocd.org/c/openocd/+/7231
Tested-by: jenkins
Reviewed-by: Ian Thompson <ianst@cadence.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
15 months agoflash/nor/avrf: add ATmega32U4 support 81/7081/2
Kyle Schwarz [Sun, 10 Jul 2022 19:58:14 +0000 (15:58 -0400)]
flash/nor/avrf: add ATmega32U4 support

Add new chip info and tcl target

Change-Id: Ib9d33d1b145a8659857b7a6cc9c5acba047f41d1
Signed-off-by: Kyle Schwarz <zeranoe@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7081
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
15 months agoopenocd: revert workarounds for 'expr' syntax change 05/7405/2
Antonio Borneo [Sun, 18 Dec 2022 18:15:57 +0000 (19:15 +0100)]
openocd: revert workarounds for 'expr' syntax change

With OpenOCD v0.12.0 released, drop the workarounds for 'expr'
syntax change by reverting:
- commit 320043c054dc ("openocd: fix for polling during "expr"
  computation");
- commit c7eaaf620488 ("openocd: prepare for jimtcl 0.81 'expr'
  syntax change").

Replace the call to target_call_timer_callbacks_now() with call
to target_call_timer_callbacks().

Change-Id: Iae5afc50e3f688e11176a52648efc9a6577a9a11
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7405
Tested-by: jenkins
15 months agonds32: drop it, together with aice adapter driver 82/7382/2
Antonio Borneo [Mon, 19 Sep 2022 21:14:41 +0000 (23:14 +0200)]
nds32: drop it, together with aice adapter driver

The target nds32 and its companion adapter aice have not received
any real improvement since 2013.
It has been hard to keep them aligned during the evolution of
OpenOCD code, with no way for maintainers to really check if they
are still working.
No real documentation is present for them in OpenOCD.
The nds32 code triggers ~50 errors/warnings with scan-build.

The arch nds32 has been dropped from Linux kernel v5.18-rc1.

For all the reasons above, this code has been deprecated with
commit 2e5df83de7f2 ("nds32: deprecate it, together with aice
adapter driver") and tagged to be dropped before v0.13.0.

Let it r.i.p. in OpenOCD git history.

While there, drop from checkpatch list the camelcase symbols that
where only used in this code.

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