openocd.git
4 days agodoc: describe tcl port consistently. 85/7385/2 master
Karl Palsson [Tue, 29 Nov 2022 13:12:14 +0000 (13:12 +0000)]
doc: describe tcl port consistently.

One place described the tcl port as 5555, which was changed in 163bd86071a
Reported on IRC.

Change-Id: If740a29443793d6a4d4f8c9db54f0fc8344a6c1c
Signed-off-by: Karl Palsson <karlp@tweak.net.au>
Reviewed-on: https://review.openocd.org/c/openocd/+/7385
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
4 days agoFix jim_target_smp for smp rtos target 44/7244/9
Evgeniy Naydanov [Fri, 16 Sep 2022 13:01:46 +0000 (16:01 +0300)]
Fix jim_target_smp for smp rtos target

If multiple targets are specified as -rtos <rtos_type>, the
rtos_update_threads was called only if the last target was specified as
rtos, which is inconsistent with other checks of whether or not smp target
is an rtos one.

Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
Change-Id: Ie52bc6b6c8f841d31b9590fcbc44e985d3cba0eb
Reviewed-on: https://review.openocd.org/c/openocd/+/7244
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
4 days agohwthread: Restore current_threadid in hwthread_update_threads 58/7358/5
Koudai Iwahori [Fri, 18 Nov 2022 14:18:17 +0000 (06:18 -0800)]
hwthread: Restore current_threadid in hwthread_update_threads

When OpenOCD receives a step-execution command from GDB and the target
is configured as rtos=hwthread, OpenOCD reconstructs the thread-info.
However, OpenOCD does not restore the thread id which is currently
selected by GDB. Due to this issue, OpenOCD sends the information of
wrong thread to GDB after the step execution.
This commit fixes the above issue by adding a code to save/restore the
thread id selected by GDB.

Signed-off-by: Koudai Iwahori <koudai@google.com>
Change-Id: I761a1141c04d48f1290e4f09baa7c7024f86f36a
Reviewed-on: https://review.openocd.org/c/openocd/+/7358
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
4 days agohwthread: Add register validity check in get_thread_reg_list 57/7357/2
Koudai Iwahori [Fri, 18 Nov 2022 09:23:43 +0000 (01:23 -0800)]
hwthread: Add register validity check in get_thread_reg_list

When OpenOCD receives 'g' packet (read general registers) from GDB and
target is configured as rtos=hwthread, hwthread_get_thread_reg_list is
called. However, it does not check if the register valid or not. Due to
this issue, OpenOCD returns invalid register values to GDB.
This commit adds a validity check to hwthread_get_thread_reg_list. If
the register is not valid, it tries to read the register from the
target.

Signed-off-by: Koudai Iwahori <koudai@google.com>
Change-Id: Iad6424b62124271ec411b1dfc044b57dfc460280
Reviewed-on: https://review.openocd.org/c/openocd/+/7357
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
4 days agojtag: xds110: fix clang error core.StackAddressEscape 80/7380/2
Antonio Borneo [Wed, 16 Nov 2022 22:06:12 +0000 (23:06 +0100)]
jtag: xds110: fix clang error core.StackAddressEscape

Clang ignores that xds110_swd_write_reg() is always called with
bit SWD_CMD_RNW in 'cmd' set to zero.
It then complains that the local variable 'value' gets passed by
address to xds110_swd_queue_cmd() and in case of 'read request'
such stack address get stored for later use:
src/jtag/drivers/xds110.c:1363:1: warning: Address of
 stack memory associated with local variable 'value' is
 still referred to by the global variable 'xds110' upon
 returning to the caller. This will be a dangling
 reference [core.StackAddressEscape]

To both xds110_swd_write_reg() and xds110_swd_read_reg(), add an
assert() to inform Clang about the state of bit SWD_CMD_RNW.

Change-Id: I7687c055ec71424b642e152f478723a930966e3a
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7380
Tested-by: jenkins
4 days agoflash: lpc2900: fix clang error 'dead assignment' 79/7379/2
Antonio Borneo [Wed, 16 Nov 2022 00:02:02 +0000 (01:02 +0100)]
flash: lpc2900: fix clang error 'dead assignment'

The variable retval is assigned a value that is never used.
Scan-build reports:
Although the value stored to 'retval' is used in the
enclosing expression, the value is never actually read
from 'retval'.

Drop the dead assignment.

Change-Id: I11588dee748a55d52aa7f35bc1967b7df55af7fc
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7379
Tested-by: jenkins
8 days agoflash/nor/stm32lx: Add revision '1, X' for Cat.2 devices 78/7378/2
Marc Schink [Thu, 24 Nov 2022 11:54:57 +0000 (12:54 +0100)]
flash/nor/stm32lx: Add revision '1, X' for Cat.2 devices

Change-Id: I0ff1e2102175ee952b066b325c9acbcb598b3af7
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/7378
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
8 days agotcl: max326xx: fix target scripts for latest version of OpenOCD 73/7373/3
Rocco Marco Guglielmi [Wed, 23 Nov 2022 08:54:30 +0000 (09:54 +0100)]
tcl: max326xx: fix target scripts for latest version of OpenOCD

Change-Id: Iec5aba3a082f2e25f21d7ca173ed710894b370a4

Signed-off-by: Rocco Marco Guglielmi <roccomarco.guglielmi@gmail.com>
Change-Id: Ia83850e326661c8acb0712a280fdf961258322a4
Reviewed-on: https://review.openocd.org/c/openocd/+/7373
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
8 days agojtag/drivers/cmsis_dap.c: Fix Length of SWO Baudrate Command 70/7370/2
Nick Kraus [Mon, 21 Nov 2022 14:55:11 +0000 (09:55 -0500)]
jtag/drivers/cmsis_dap.c: Fix Length of SWO Baudrate Command

The command should now send the full 5 byte command length, which
includes the command tag (0x19) and the 4-byte baudrate word, instead
of only the last 3 bytes of the baudrate.

Signed-off-by: Nick Kraus <nick@nckraus.com>
Change-Id: Idd6e084efd7492489aa900cdbf08f540944041cb
Reviewed-on: https://review.openocd.org/c/openocd/+/7370
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 weeks agotarget/armv7m: fix feature name of ARMv8M security extension regs 65/7265/3
Tomas Vanek [Sun, 16 Oct 2022 09:34:57 +0000 (11:34 +0200)]
target/armv7m: fix feature name of ARMv8M security extension regs

gdb requires this feature to enable stack unwinding of secure/nonsecure
interstate calls and exceptions on an ARMv8M target with
the security extension.

Tested on STM32L5 (Cortex-M33).

Change-Id: Ib09780c011afbc095b352074068597559ad14fcd
Link: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=ae7e2f45aa4798be449f282bbf75ad41e73f055e
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7265
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 weeks agortos/ThreadX: added check for NULL-named tasks 28/7328/4
Giulio Fieramosca [Thu, 3 Nov 2022 19:38:20 +0000 (20:38 +0100)]
rtos/ThreadX: added check for NULL-named tasks

Thread name loading was not correctly handled if a ThreadX task has a NULL
name.

Signed-off-by: Giulio Fieramosca <giulio@glgprograms.it>
Change-Id: I03071930182bc2585b61ce5d8c67491710883dd6
Reviewed-on: https://review.openocd.org/c/openocd/+/7328
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 weeks agoFix for segfault and some clang reported problems in stmqspi 45/7345/2
Andreas Bolsch [Sat, 12 Nov 2022 15:29:18 +0000 (16:29 +0100)]
Fix for segfault and some clang reported problems in stmqspi

Change-Id: Id003adb574085cdd603cc13aeb6f2efec73593f1
Signed-off-by: Andreas Bolsch <hyphen0break@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7345
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 weeks agojep106: update to revision JEP106BF.01 Oct 2022 41/7341/2
Antonio Borneo [Tue, 8 Nov 2022 10:25:27 +0000 (11:25 +0100)]
jep106: update to revision JEP106BF.01 Oct 2022

Change-Id: Ia1f19dcce48da997c036ccffa65e76e179de2eb9
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7341
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
3 weeks agoflash/nor/stm32f1x: adjust size of the flash loader buffer 42/7342/2
Simon Smiganovski [Wed, 9 Nov 2022 15:32:26 +0000 (16:32 +0100)]
flash/nor/stm32f1x: adjust size of the flash loader buffer

target_run_flash_async_algorithm expects the source_buffer to have
at least 2 words reserved for read and write pointers in addition to the
FIFO buffer. If the size of the data to be flashed is <= 8 bytes then
the flash function will fail with "corrupted fifo read pointer" error.

Ensure the allocated buffer is big enough to hold both FIFO buffer and
read/write pointers.

Change-Id: I09c22eaac517b8cfea8e0b463f5deb6b98afd267
Signed-off-by: Simon Smiganovski <simon.smiganovski@fruitcore.de>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7342
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 weeks agotarget/armv7m: prevent saving and restoring non existent regs 76/7276/3
Tomas Vanek [Tue, 18 Oct 2022 20:00:18 +0000 (22:00 +0200)]
target/armv7m: prevent saving and restoring non existent regs

armv7m_start_algorithm() saves register values to arch_info->context.
armv7m_wait_algorithm() restores register values from arch_info->context.
Exclude registers with flag exist = false from both loops.

While on it refactor the register restore: introduce 'struct reg' pointer
and dereference it instead of numerous accesses by a full path
from armv7m pointer.

Change-Id: I1600084db84809ee13bcf8e7828b79f8c9ff9077
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7276
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 weeks agotcl/interface: fix raspberrypi2-native.cfg speed coefficient 05/7305/2
Tomas Vanek [Thu, 3 Nov 2022 07:48:53 +0000 (08:48 +0100)]
tcl/interface: fix raspberrypi2-native.cfg speed coefficient

The speed coefficient for Raspberry Pi 2 was probably calibrated
for a scaled down clock frequency.

To prevent JTAG/SWD overclocking, use the value corresponding
to the 'official' maximum CPU clock.

Change-Id: Iaff58b092198dce6d6552c9d31d6a3ba4aaaa2d5
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7305
Tested-by: jenkins
Reviewed-by: Jonathan Bell <jonathan@raspberrypi.com>
3 weeks agotcl/cpld/xilinx-xcu: fix typo 33/7333/2
George Voicu [Sat, 5 Nov 2022 09:59:43 +0000 (10:59 +0100)]
tcl/cpld/xilinx-xcu: fix typo

Fix typo in comments

Signed-off-by: George Voicu <razvanvg@hotmail.com>
Change-Id: Icc2d770e73f896e20dd347de324328030544bdb9
Reviewed-on: https://review.openocd.org/c/openocd/+/7333
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 weeks agopld/virtex2: small doc extension 03/7303/2
Daniel Anselmi [Wed, 2 Nov 2022 16:21:18 +0000 (17:21 +0100)]
pld/virtex2: small doc extension

Change-Id: I174cd702388be04268b38178fbfacb90db452f72
Signed-off-by: Daniel Anselmi <danselmi@gmx.ch>
Reviewed-on: https://review.openocd.org/c/openocd/+/7303
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 weeks agortos: hwthread: fix clang error core.NullDereference 37/7337/2
Antonio Borneo [Thu, 3 Nov 2022 23:32:20 +0000 (00:32 +0100)]
rtos: hwthread: fix clang error core.NullDereference

Clang spots a potential NULL pointer dereferencing that is instead
an incorrect use of an array of pointers:

src/rtos/hwthread.c:254:32: warning: Dereference of null pointer
  [core.NullDereference]
(*rtos_reg_list)[j].number = (*reg_list)[i].number;
                             ^~~~~~~~~~~~~~~~~~~~~
The error has not been spotted before because:
- this function is not called for the first core of the SMP node,
- for the other cores on Cortex-A it still returns valid register
  value for the first 12 ARM registers, then it diverges.

Also Valgrind does not spot any issue at runtime.

Address the array correctly.

While there, use DIV_ROUND_UP() macro for the computation.

Change-Id: Ib87e60e0edfd9671091f5dcfa9aedaf1aed800d1
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7337
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
3 weeks agoRevert "Remove duplicate of a counter in hwthread_update_threads" 07/7307/5
Tomas Vanek [Sun, 30 Oct 2022 08:22:37 +0000 (08:22 +0000)]
Revert "Remove duplicate of a counter in hwthread_update_threads"

Commit 0cedf10f8fd6 ("Remove duplicate of a counter in
hwthread_update_threads") introduced a code bug.

In the second foreach_smp_target() loop, variable "threads_found"
gets passed to routine hwthread_fill_thread(). By removing the
counting of threads_found from the second loop, the
incorrect thread counter value gets passed to hwthread_fill_thread().

Change-Id: Ie89e53ccd28bb72b6838ef2f12106a1fe8d00994
Suggested-by: Daniel Goehring <dgoehrin@os.amperecomputing.com>
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7307
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 weeks agojtag/drivers/cmsis_dap: prevent CDC missdetect as CMSIS-DAP bulk 79/7279/2
Tomas Vanek [Thu, 20 Oct 2022 09:43:10 +0000 (11:43 +0200)]
jtag/drivers/cmsis_dap: prevent CDC missdetect as CMSIS-DAP bulk

The autodetection of CMSIS-DAP v2 bulk interface is tricky
as not all adapters conform CMSIS-DAP specs.

If an interface has a string descriptor containing CMSIS-DAP,
then OpenOCD did not insisted on the correct interface class
LIBUSB_CLASS_VENDOR_SPEC.

However the relaxed test caused false autodetection of v2 bulk
interface on some CMSIS-DAP v1 adapters with an additional serial
interface with the string descriptor stupidly containing
CMSIS-DAP text.

Make the test less relaxed, refuse autodetection of the interfaces
with the class number of well known functions including CDC and MSC.

Link: https://sourceforge.net/p/openocd/tickets/368/
Change-Id: I917cb257eb42aab93560cc39c61ec35a60ce52e3
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7279
Tested-by: jenkins
Reviewed-by: SilverFox <yyjdelete@126.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 weeks agoflash: stmqspi: fix clang error 'dead assignment' 04/7304/2
Antonio Borneo [Wed, 2 Nov 2022 22:11:19 +0000 (23:11 +0100)]
flash: stmqspi: fix clang error 'dead assignment'

The variable retval is assigned a value that is never used, as it
is reassigned few lines below.

Drop the dead assignment.

Change-Id: Id4e9134408fab3e04936d36e95724bf8d3ab55aa
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7304
Tested-by: jenkins
3 weeks agodsp5680xx: fix clang error core.UndefinedBinaryOperatorResult 02/7302/2
Antonio Borneo [Wed, 2 Nov 2022 00:13:49 +0000 (01:13 +0100)]
dsp5680xx: fix clang error core.UndefinedBinaryOperatorResult

Clang get confused by initializing the array uint16_t lock_word[],
casting it to (uint8_t *), then accessing the second element of
the uint8_t pointer.

  src/target/dsp5680xx.c:2046:41: warning: The left operand of '<<'
    is a garbage value [core.UndefinedBinaryOperatorResult]
        uint16_t tmp = (buffer[0] | (buffer[1] << 8));
                                     ~~~~~~~~~ ^
Fix it by replacing the array with a single uint16_t.

The code is still depending on host endianness; no fix for this is
proposed.

Change-Id: I16dfd60cab117dd145aeecf10d9593574ff233a2
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7302
Tested-by: jenkins
3 weeks agoesirisc_jtag: fix clang error core.VLASize 01/7301/2
Antonio Borneo [Tue, 1 Nov 2022 23:57:17 +0000 (00:57 +0100)]
esirisc_jtag: fix clang error core.VLASize

The function esirisc_jtag_recv() can be called with argument
num_in_fields = 0, for example as consequence of calling
esirisc_jtag_continue().
In this case, num_in_bytes is zero and the allocation of the
variable-length array 'r' requires size zero.

  src/target/esirisc_jtag.c:133:2: warning: Declared variable-length
    array (VLA) has zero size [core.VLASize]
        uint8_t r[num_in_bytes * 2];
        ^~~~~~~~~ ~~~~~~~~~~~~~~~~

Fix it by forcing size one when num_in_bytes is zero.

Change-Id: Id764c7b5ec4f5b3c18c7da650bbff39fc98ed049
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7301
Tested-by: jenkins
3 weeks agoopenrisc: fix clang error core.CallAndMessage 00/7300/2
Antonio Borneo [Tue, 1 Nov 2022 23:33:16 +0000 (00:33 +0100)]
openrisc: fix clang error core.CallAndMessage

Clang assumes that size could assume a value that is not 1 nor 2
nor 4. In such condition the buffer in t is allocated (size != 1)
and not initialized. This triggers an error:
  src/target/openrisc/or1k_du_adv.c:655:14: warning: 2nd function
    call argument is an uninitialized value [core.CallAndMessage]
                crc_calc = adbg_compute_crc(crc_calc, data[i], 8);
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Add the default case to cover other values of size.

After this fix, clang still complains on the same line, this time
misunderstanding the limits of the loop and considering that
buf_bswap16() only swaps the first 16 bits, thus passing not
initialized value data[2] to adbg_compute_crc()

Replace malloc() with calloc() to silent it.

Change-Id: I358d7fb2ebefd69255670641bd435b770762a301
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7300
Tested-by: jenkins
3 weeks agohelper/types: use unsigned type for all h_u64_to_le() and similar 99/7299/2
Antonio Borneo [Tue, 1 Nov 2022 18:21:35 +0000 (19:21 +0100)]
helper/types: use unsigned type for all h_u64_to_le() and similar

All the converters functions:
h_u64_to_le()
h_u64_to_be()
h_u32_to_le()
h_u32_to_be()
h_u24_to_le()
h_u24_to_be()
h_u16_to_le()
h_u16_to_be()
have signed type in their prototype, while the function name and
all the current use cases pass an unsigned value.

Change the prototypes to use unsigned types.

Change-Id: I76dcfdd7912b81f60902184712b2907eae9843f7
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7299
Tested-by: jenkins
4 weeks agoThreadX: set current_thread for kernel execution 80/7280/2
Ben McMorran [Thu, 20 Oct 2022 22:39:24 +0000 (15:39 -0700)]
ThreadX: set current_thread for kernel execution

If we just invented thread 1 to represent the current execution, we
need to make sure the RTOS object also claims it's the current thread
so that threadx_get_thread_reg_list() doesn't attempt to read a
thread control block at 0x00000001.

Signed-off-by: Ben McMorran <bemcmorr@microsoft.com>
Change-Id: I7f71e730d047858898297e4cb31db8e47e0c371c
Reviewed-on: https://review.openocd.org/c/openocd/+/7280
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
6 weeks agoRestore +dev suffix
Paul Fertser [Wed, 26 Oct 2022 13:43:49 +0000 (16:43 +0300)]
Restore +dev suffix

Signed-off-by: Paul Fertser <fercerpav@gmail.com>
6 weeks agoThe openocd-0.12.0-rc2 release candidate v0.12.0-rc2
Paul Fertser [Wed, 26 Oct 2022 10:45:09 +0000 (13:45 +0300)]
The openocd-0.12.0-rc2 release candidate

Signed-off-by: Paul Fertser <fercerpav@gmail.com>
6 weeks agotcl/target: add basic RP2040 target config 75/7275/2
Tomas Vanek [Tue, 18 Oct 2022 19:19:20 +0000 (21:19 +0200)]
tcl/target: add basic RP2040 target config

The existing 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.

To fix the problem, mark rp2040-core0.cfg as deprecated and
add rp2040.cfg, a basic config file with multidrop target selection.

Change-Id: I5194e42f529a2d9645481424b7c66ab61efa44ee
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7275
Tested-by: jenkins
Reviewed-by: Jonathan Bell <jonathan@raspberrypi.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
6 weeks agodoc: fix semihosting_redirect command documentation 78/7278/2
Tarek BOCHKATI [Wed, 19 Oct 2022 13:26:28 +0000 (14:26 +0100)]
doc: fix semihosting_redirect command documentation

Change-Id: I78c82a21e4160851a5c0b58394ac7897479808ff
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@st.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7278
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
6 weeks agotcl/stm32l5x|u5x: support HLA adapters in non-secure mode only 46/6546/9
Tarek BOCHKATI [Fri, 24 Sep 2021 12:47:14 +0000 (13:47 +0100)]
tcl/stm32l5x|u5x: support HLA adapters in non-secure mode only

instrument "target/stm32x5x_common.cfg" used by both STM32L5x/U5x
to support HLA adapters like "interface/stlink.cfg" in non-secure mode

if the device switches to secure mode, the debug session will be
stopped immediately (with an explanatory message).

Change-Id: I645fdd55e3448ef82d0ddcc396f42fd7b2f39ac3
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reported-by: Patrik Bachan <diggit@users.sourceforge.net>
Fixes: https://sourceforge.net/p/openocd/tickets/317/
Reviewed-on: https://review.openocd.org/c/openocd/+/6546
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
6 weeks agotarget/xtensa: remove redundant call for `TARGET_EVENT_HALTED` 74/7274/2
Erhan Kurubas [Tue, 18 Oct 2022 15:23:15 +0000 (17:23 +0200)]
target/xtensa: remove redundant call for `TARGET_EVENT_HALTED`

`xtensa_do_step` is invoked from `xtensa_prepare_resume` to silently
step over BP/WP before resuming.
For example; in the case of WPs (DEBUGCAUSE_DB), in the current
implementation `xtensa_do_step` will generate one more
`TARGET_EVENT_HALTED` after the original one caused by WP itself.

This patch moves the halted event cb call after
the step is done successfully.

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: I9048e14fb316dc124847a42cfaefb1f76b5ce53e
Reviewed-on: https://review.openocd.org/c/openocd/+/7274
Tested-by: jenkins
Reviewed-by: Ian Thompson <ianst@cadence.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
6 weeks agodoc: fix riscv commands 68/7268/5
Antonio Borneo [Sun, 16 Oct 2022 21:56:23 +0000 (23:56 +0200)]
doc: fix riscv commands

- Fix the declaration of riscv command 'set_mem_access'.
- Remove non existing riscv command 'set_scratch_ram'.
- Add riscv commands 'info', 'reset_delays'; copy the description
  from the 'help' text.
- Don't add riscv commands 'set_prefer_sba' and 'test_sba_config_reg'
  as they are marked as deprecated.
- Ensure that 'test_sba_config_reg' prints a deprecation warning
  when used.

Change-Id: I39dc3aec4e7f13b69ac19685f1b593790acdde83
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Signed-off-by: Jan Matyas <matyas@codasip.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7268
Reviewed-by: Tim Newsome <tim@sifive.com>
Tested-by: jenkins
6 weeks agodoc: remove unreferenced anchors 70/7270/2
Antonio Borneo [Mon, 17 Oct 2022 10:19:18 +0000 (12:19 +0200)]
doc: remove unreferenced anchors

Remove the @anchor{} tags that are not referenced in the
documentation.

Change-Id: Ia8e9f75afb08e08ef99d0c8fd82115d689e4a267
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7270
Tested-by: jenkins
6 weeks agodoc: fix espusbjtag commands type 67/7267/2
Antonio Borneo [Sun, 16 Oct 2022 22:08:52 +0000 (00:08 +0200)]
doc: fix espusbjtag commands type

Exec commands should be reported as {Command}.

Change-Id: Iacb50d77b354617ecd24b0f1c2ec24e240179698
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7267
Tested-by: jenkins
Reviewed-by: Erhan Kurubas <erhan.kurubas@espressif.com>
6 weeks agodoc: fix xtensa commands type 66/7266/2
Antonio Borneo [Sun, 16 Oct 2022 21:36:15 +0000 (23:36 +0200)]
doc: fix xtensa commands type

Config commands should be reported as {Config Command}

Change-Id: Ic778df31bb1dc9aefdbe3d8006b06bb370d25e6f
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7266
Tested-by: jenkins
Reviewed-by: Ian Thompson <ianst@cadence.com>
Reviewed-by: Erhan Kurubas <erhan.kurubas@espressif.com>
6 weeks agojtag/drivers: bcm2835gpio: implement memory barriers when bitbashing 58/7258/4
Jonathan Bell [Thu, 13 Oct 2022 09:38:53 +0000 (10:38 +0100)]
jtag/drivers: bcm2835gpio: implement memory barriers when bitbashing

This GPIO driver is common to SoCs that have in-order ARM cores
(BCM2835) as well as superscalar (BCM2836-7) and speculative
out-of-order cores (BCM2711).

For BCM2837 and BCM2711, the processor can dual-issue stores and
is free to merge writes to peripheral memory for pages mapped
MT_NORMAL_NC, which is the default provided by /dev/[gpio]mem.

This can cause glitches (or missing edges) on GPIO pins when
toggled with no delay, as pipelined writes to the same address
can get arbitrarily squelched.

To prevent this happening, make sure the preceding write ops are
flushed outside the shareable domain by using a memory barrier.

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
Change-Id: I8805cc0911667bcb9b7f4ca340d7f4f1cb25d096
Reviewed-on: https://review.openocd.org/c/openocd/+/7258
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
7 weeks agoREADME: update build dependency list 56/7256/4
Antonio Borneo [Sun, 9 Oct 2022 15:22:37 +0000 (17:22 +0200)]
README: update build dependency list

Add info on what is optional,

Change-Id: Iedfa969243d95736aaf1b236caa2c2b33f563fe7
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7256
Tested-by: jenkins
7 weeks agoREADME: cleanup requirements for pkg-config 55/7255/3
Antonio Borneo [Sun, 9 Oct 2022 15:16:16 +0000 (17:16 +0200)]
README: cleanup requirements for pkg-config

FreeBSD fully supports pkg-config; the .pc files for the internal
libusb has been added with
https://cgit.freebsd.org/src/commit/?id=041d3f3f09b8
and became part of FreeBSD 10.0 in 2014-01-16.

Remove the obsoleted requirements for adding .pc files.

While there, add pkgconf as an alternative to pkg-config.

Change-Id: I16aea735c44107cb71945f225a979682c8c92d0a
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7255
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
Tested-by: jenkins
7 weeks agotarget/xtensa: fill register number field in the cache 46/7246/2
Erhan Kurubas [Tue, 4 Oct 2022 20:54:58 +0000 (22:54 +0200)]
target/xtensa: fill register number field in the cache

Currently 'number' field is zero in the register cache and
this causes an issue on `rtos get_thread_reg_list` calls.

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: Iaef11e01f55d012969bbc1933f82847d5e02fec5
Reviewed-on: https://review.openocd.org/c/openocd/+/7246
Tested-by: jenkins
Reviewed-by: Ian Thompson <ianst@cadence.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
7 weeks agotarget/esp32s2: check xtensa_poll return value 47/7247/2
Erhan Kurubas [Tue, 4 Oct 2022 22:49:23 +0000 (00:49 +0200)]
target/esp32s2: check xtensa_poll return value

Although scan build couldn't catch, return value overwritten
without checking.

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: I02b10002b03640604315047e8a8a639824724c16
Reviewed-on: https://review.openocd.org/c/openocd/+/7247
Tested-by: jenkins
Reviewed-by: Ian Thompson <ianst@cadence.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
7 weeks agotcl/xtensa: some fixes at xtensa-core-esp32s3.cfg 54/7254/2
Erhan Kurubas [Tue, 4 Oct 2022 21:23:55 +0000 (23:23 +0200)]
tcl/xtensa: some fixes at xtensa-core-esp32s3.cfg

Some config changes required to run ESP32-S3 with full feature set

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: I38022bb5ff5830e1cf9d11d6fe795ea99d91e9db
Reviewed-on: https://review.openocd.org/c/openocd/+/7254
Tested-by: jenkins
Reviewed-by: Ian Thompson <ianst@cadence.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
7 weeks agotcl/xtensa: some fixes at xtensa-core-esp32s2.cfg 53/7253/2
Erhan Kurubas [Tue, 4 Oct 2022 21:22:34 +0000 (23:22 +0200)]
tcl/xtensa: some fixes at xtensa-core-esp32s2.cfg

Some config changes required to run ESP32-S2 with full feature set

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: Ie0a742442254ec6e95d4e05be40213b079a94dab
Reviewed-on: https://review.openocd.org/c/openocd/+/7253
Tested-by: jenkins
Reviewed-by: Ian Thompson <ianst@cadence.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
7 weeks agotcl/xtensa: some fixes at xtensa-core-esp32.cfg 52/7252/2
Erhan Kurubas [Tue, 4 Oct 2022 21:20:32 +0000 (23:20 +0200)]
tcl/xtensa: some fixes at xtensa-core-esp32.cfg

Some config changes required to run ESP32 with full feature set

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: I484324f8497ec7934bb73164c638fc5f6460fcc4
Reviewed-on: https://review.openocd.org/c/openocd/+/7252
Tested-by: jenkins
Reviewed-by: Ian Thompson <ianst@cadence.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
8 weeks agotcl/target: fix rp2040-core0.cfg work area backup. 57/7257/2
Tomas Vanek [Tue, 11 Oct 2022 17:04:15 +0000 (19:04 +0200)]
tcl/target: fix rp2040-core0.cfg work area backup.

The work area should be backed up.
The flash probe runs an algorithm on the target CPU.
The flash is probed during gdb connect if gdb_memory_map is enabled
(is enabled by default).
Without backup the target memory gets corrupted on gdb connect.

Change-Id: I3344b9dc6cbf904d49f3b05ab104b541d1d63422
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7257
Tested-by: jenkins
Reviewed-by: Jonathan Bell <jonathan@raspberrypi.com>
8 weeks agotarget: re-examine before arp_waitstate in ocd_process_reset_inner 30/7230/3
Tomas Vanek [Wed, 28 Sep 2022 21:19:00 +0000 (23:19 +0200)]
target: re-examine before arp_waitstate in ocd_process_reset_inner

arp_waitstate will not work on not-examined state

Change-Id: I56c3e1c7e63af108e4ed1dbacebb567f9bf46264
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7230
Tested-by: jenkins
Reviewed-by: Erwan Gouriou
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
8 weeks agotarget/hla_target: try to re-examine under reset in hl_assert_reset() 29/7229/5
Tomas Vanek [Wed, 28 Sep 2022 21:32:00 +0000 (23:32 +0200)]
target/hla_target: try to re-examine under reset in hl_assert_reset()

An application often idling in real sleep mode may make a Cortex-M target
hard to access as CPU clock are gated and debug requests are responded
by WAIT ack.

Try to examine the target under reset as the last resort.

Change-Id: I7c3de39fb1e6c23b76e2a0a85ab75f23aac94c4d
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7229
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
8 weeks agotarget/cortex_m: try to re-examine under reset in cortex_m_assert_reset() 28/7228/4
Tomas Vanek [Wed, 28 Sep 2022 21:01:39 +0000 (23:01 +0200)]
target/cortex_m: try to re-examine under reset in cortex_m_assert_reset()

An application often idling in real sleep mode may make a Cortex-M target
hard to access as CPU clock are gated and debug requests are responded
by WAIT ack.

Try to examine the target under reset as the last resort.

Change-Id: Ife875a966a838c37dde987bc584ad0a1f4d020d6
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7228
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
8 weeks agotarget/cortex_m: make reset robust again 45/6745/4
Tomas Vanek [Tue, 23 Nov 2021 09:06:51 +0000 (10:06 +0100)]
target/cortex_m: make reset robust again

After merging [1] 'reset halt' does not work on not responding Cortex-M.

Relax the examined tests and try to set vector catch VC_CORERESET
if debug_ap is available.

While on it add an info about examination state to debug logs.

Fixes: [1] commit 98d9f1168cbd ("target: reset target examined flag if target::examine() fails")
Change-Id: Ie2e018610026180af5997d70231061a275f05c76
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/6745
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
8 weeks agoopenocd: fix build with 'configure --without-capstone' 24/7224/3
Antonio Borneo [Mon, 26 Sep 2022 13:32:24 +0000 (15:32 +0200)]
openocd: fix build with 'configure --without-capstone'

When configure option --without-capstone is used, the macro
HAVE_CAPSTONE is not defined in config.h, and the following lines
are instead present:
/* 1 if you have Capstone disassembly framework. */
/* #undef HAVE_CAPSTONE */

This cause compile error with message:
arm_disassembler.h:190:5: error: "HAVE_CAPSTONE" is not
defined, evaluates to 0 [-Werror=undef]
  190 | #if HAVE_CAPSTONE
      |     ^~~~~~~~~~~~~

This is caused by configure.ac that does not call AC_DEFINE when
--without-capstone option is present.

Fix configure.ac to always provide the autoconf macro
HAVE_CAPSTONE, with either value 0 or 1.

Change-Id: Ie5ac98b2c25746dd721812c91baaac61ec877ecd
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7224
Tested-by: jenkins
8 weeks agotarget/adiv5: 64-bit TAR setup bugfix 45/7245/2
Daniel Goehring [Tue, 4 Oct 2022 07:03:42 +0000 (00:03 -0700)]
target/adiv5: 64-bit TAR setup bugfix

For 64-bit TAR setup, if 'tar_valid == false' perform the upper 32-bit
write even if the cached copy matches the upper TAR value to be written.

Signed-off-by: Daniel Goehring <dgoehrin@os.amperecomputing.com>
Change-Id: I320377dc90a9d1d7b64cbb281b2527e56c7621ee
Reviewed-on: https://review.openocd.org/c/openocd/+/7245
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
8 weeks agotcl/target/ti_k3: Handle swd vs jtag 90/7090/4
Nishanth Menon [Thu, 14 Jul 2022 21:37:54 +0000 (16:37 -0500)]
tcl/target/ti_k3: Handle swd vs jtag

Since all the device definition when accessing device from jtag is also
valid when accessing from swd, lets make sure the configuration can
handle the same.

Signed-off-by: Nishanth Menon <nm@ti.com>
Change-Id: I5af071137fd8c3b52cc4ef72401f8eba952f9cad
Reviewed-on: https://review.openocd.org/c/openocd/+/7090
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
8 weeks agofix leaky file-handle in virtex2 driver 43/7243/2
Daniel Anselmi [Sun, 2 Oct 2022 15:15:41 +0000 (17:15 +0200)]
fix leaky file-handle in virtex2 driver

Change-Id: I2784a66c42be71f2982dff7746f9fb2eb1dc8ca6
Signed-off-by: Daniel Anselmi <danselmi@gmx.ch>
Reviewed-on: https://review.openocd.org/c/openocd/+/7243
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
8 weeks agodon't return ERROR_OK in error cases 36/7236/2
Daniel Anselmi [Sun, 2 Oct 2022 00:16:28 +0000 (02:16 +0200)]
don't return ERROR_OK in error cases

Change-Id: I7e046df85838692c9044fe9c9d67e8b2c821eb0f
Signed-off-by: Daniel Anselmi <danselmi@gmx.ch>
Reviewed-on: https://review.openocd.org/c/openocd/+/7236
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
8 weeks agofix memory leak in virtex2 driver 35/7235/2
Daniel Anselmi [Sat, 1 Oct 2022 23:17:15 +0000 (01:17 +0200)]
fix memory leak in virtex2 driver

Change-Id: Ia08f7aaad25631132885acd5898477c1106f0ec4
Signed-off-by: Daniel Anselmi <danselmi@gmx.ch>
Reviewed-on: https://review.openocd.org/c/openocd/+/7235
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
8 weeks agotarget/xtensa: pass correct buffer on read memory retry 26/7226/3
Erhan Kurubas [Wed, 28 Sep 2022 19:18:49 +0000 (21:18 +0200)]
target/xtensa: pass correct buffer on read memory retry

Read values must be at albuff so that can be copied to buffer
on function exit.

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: I74a533e8f12f1002ca06a98a7c7cd928552b4cc5
Reviewed-on: https://review.openocd.org/c/openocd/+/7226
Tested-by: jenkins
Reviewed-by: Ian Thompson <ianst@cadence.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
8 weeks agotarget/xtensa: rename pc and ps macro names 27/7227/2
Erhan Kurubas [Wed, 28 Sep 2022 19:38:05 +0000 (21:38 +0200)]
target/xtensa: rename pc and ps macro names

Actually they are the base of epc and eps

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: I4f43b9609a9929399fb5d3fa0203efc8a98e94c9
Reviewed-on: https://review.openocd.org/c/openocd/+/7227
Tested-by: jenkins
Reviewed-by: Ian Thompson <ianst@cadence.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
8 weeks agoflash/nor/at91samd: Use 32-bit register writes for ST-Link compat 34/7234/3
Keith Packard [Wed, 28 Sep 2022 21:02:52 +0000 (14:02 -0700)]
flash/nor/at91samd: Use 32-bit register writes for ST-Link compat

ST-Link v2 dongles can be used with many cortex-m parts, but they have
one limitation -- they can only perform 8-bit and 32-bit writes to the
target. 16-bit writes are done using a pair of 8-bit writes. While not
usually an issue, in the case of the at91samd flash driver, the 16-bit
'command' register must have both halves written in the same
operation.

Fortunately, this register has two pad bytes above it in the address
space, making it safe to always access with 32-bit operations.

Change-Id: I44b0db9406982a8db5818c0533d3101618741db2
Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7234
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
8 weeks agoRemove duplicate of a counter in hwthread_update_threads 23/7223/3
Evgeniy Naydanov [Wed, 14 Sep 2022 14:56:20 +0000 (17:56 +0300)]
Remove duplicate of a counter in hwthread_update_threads

There is no need to count number of examined threads twice.

Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
Change-Id: Id32ead853d1ddcd4e67062d6f795700feb20cb4b
Reviewed-on: https://review.openocd.org/c/openocd/+/7223
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
8 weeks agojtag/drivers/bitbang: reduce debug verbosity 20/7220/2
Tomas Vanek [Wed, 21 Sep 2022 12:46:27 +0000 (14:46 +0200)]
jtag/drivers/bitbang: reduce debug verbosity

The bitbang driver floods the log by many messages with very
little informational value.

Remove some LOG_DEBUGs, convert some others to LOG_DEBUG_IO.

Change-Id: I0c7539467b45543e12932c67dc71e86d58c8c6cd
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7220
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Jonathan Bell <jonathan@raspberrypi.com>
Tested-by: jenkins
8 weeks agojtag/drivers/cmsis_dap: add LOG_DEBUG_IO to cmsis_dap_metacmd_targetsel 19/7219/2
Tomas Vanek [Wed, 21 Sep 2022 07:47:05 +0000 (09:47 +0200)]
jtag/drivers/cmsis_dap: add LOG_DEBUG_IO to cmsis_dap_metacmd_targetsel

Make write to DP_TARGETSEL is logged the similar way as other DP register
read/writes.

While on it fix checkpatch message
'Concatenated strings should use spaces between elements'

Change-Id: I98f724c984e8c4610cc461340f4c4a7cc9627ed9
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7219
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Jonathan Bell <jonathan@raspberrypi.com>
Tested-by: jenkins
8 weeks agotarget/armv7m: show target name in 'halted' message 37/7237/3
Tomas Vanek [Fri, 30 Sep 2022 11:56:59 +0000 (13:56 +0200)]
target/armv7m: show target name in 'halted' message

Change-Id: I13e9a33677632d52122585203252fc4ef0c52a2a
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7237
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
8 weeks agotarget/armv7m: prevent storing invalid register 40/7240/2
Tomas Vanek [Sun, 2 Oct 2022 07:30:50 +0000 (09:30 +0200)]
target/armv7m: prevent storing invalid register

armv7m_start_algorithm() stored all non-debug execution
registers from register cache without checking validity.

Check if the register cache is valid.
Try to read from CPU if not valid.
Issue a warning if register read fails.

Change-Id: I365f86d65243230cf521b13909575e5986a87a50
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7240
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Jonathan Bell <jonathan@raspberrypi.com>
8 weeks agoflash/nor/rp2040: fix setting sp 25/7225/2
Tomas Vanek [Tue, 27 Sep 2022 08:13:18 +0000 (10:13 +0200)]
flash/nor/rp2040: fix setting sp

The num_reg_params parameter of target_run_algorithm() was not
updated when setting "sp" was introduced. Therefore "sp" as the last
register parameter was not passed to a target algo.

Introduce a new helper variable with correct count of register parameters
and use it everywhere needed.

Change-Id: I934a71380783d98917167f1569145808ef23540f
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7225
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Jonathan Bell <jonathan@raspberrypi.com>
2 months agoflash/nor/rp2040: remove new line from error message 16/7216/3
Tomas Vanek [Wed, 21 Sep 2022 05:49:00 +0000 (07:49 +0200)]
flash/nor/rp2040: remove new line from error message

Change-Id: Idf3bce842b4507c1f12692b5fbcd6730637de9db
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7216
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Jonathan Bell <jonathan@raspberrypi.com>
Tested-by: jenkins
2 months agoflash/nor/rp2040: use LOG_TARGET_xxx to show core name 88/7188/4
Tomas Vanek [Sun, 11 Sep 2022 14:35:54 +0000 (16:35 +0200)]
flash/nor/rp2040: use LOG_TARGET_xxx to show core name

Change-Id: Ic76e1c6306ece18b3590beaad4d5b224d4449aa0
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7188
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2 months agoflash/nor/rp2040: check target halted before flash operation 15/7215/3
Tomas Vanek [Wed, 21 Sep 2022 05:46:15 +0000 (07:46 +0200)]
flash/nor/rp2040: check target halted before flash operation

Flash read_id/erase/write operation on running target failed
in target_run_algorithm() anyway. It generated lot of error messages.

Check the target state and bail out early if target is running.

Change-Id: I903f5f38c8e61016e5002b235e5f07803bd2ec4e
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7215
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Jonathan Bell <jonathan@raspberrypi.com>
2 months agoflash/nor/rp2040: fix flash erase timeout 14/7214/3
Tomas Vanek [Wed, 21 Sep 2022 04:32:21 +0000 (06:32 +0200)]
flash/nor/rp2040: fix flash erase timeout

SPI flash erase often takes longer than the fixed timeout 3 seconds.

Introduce a configurable timeout_ms parameter to rp2040_call_rom_func().
Compute the erase timeout from the number of blocks to be erased.

While on it make the timeouts shorter for connect flash, flush cache and
enter/exit xip (1 second is enough).

Change-Id: I552bfa317ee17064de3a54ec2f0c63e84ba87222
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7214
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Jonathan Bell <jonathan@raspberrypi.com>
2 months agoflash/nor/rp2040: fix size of flash write buffer 87/7187/4
Tomas Vanek [Sun, 11 Sep 2022 10:11:31 +0000 (12:11 +0200)]
flash/nor/rp2040: fix size of flash write buffer

The size of the flash write buffer should be rounded
down to the multiply of flash page size.
Using write chunks of unadjusted size results in write of chunks
unaligned to flash pages.

Change-Id: If7931362ee193dff4dc2df7ec78f13530658cf08
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7187
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 months agoflash/nor/rp2040: fix memory leak of target stack workarea 86/7186/4
Tomas Vanek [Sun, 11 Sep 2022 09:18:29 +0000 (11:18 +0200)]
flash/nor/rp2040: fix memory leak of target stack workarea

While on it restore memory-mapped mode also after flash erase
(originally was restored after flash write only).

Change-Id: I5e153b79ac27a8439f57239ce90ce8a79c0bb8a1
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7186
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 months agoflash/nor/rp2040: preparatory refactoring 85/7185/5
Tomas Vanek [Sun, 11 Sep 2022 08:47:03 +0000 (10:47 +0200)]
flash/nor/rp2040: preparatory refactoring

Prepend stack_grab_and_prep() function name by rp2040_ prefix.

Introduce target helper variable in rp2040_stack_grab_and_prep()
and use it instead of dereferencing bank->target several times.

Move flash ID reading code to the new rp2040_spi_read_flash_id()
function.

Change-Id: I9d6e51e17e36e6230155a586065499f2f260089a
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7185
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 months agotarget/adi_v5_swd: suppress reconnect in swd_multidrop_select() 17/7217/2
Tomas Vanek [Wed, 21 Sep 2022 11:54:01 +0000 (13:54 +0200)]
target/adi_v5_swd: suppress reconnect in swd_multidrop_select()

swd_multidrop_select() uses its own retry loop.
If select fails, do_reconnect flag remains set on exit and causes
useless reconnect.

Clear do_reconnect flag in retry loop.

Change-Id: Ie06d6967d7f4a977774c8530bb8d4b3e5ab4f62c
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7217
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Jonathan Bell <jonathan@raspberrypi.com>
Tested-by: jenkins
2 months agotarget/adi_v5_swd: fix SWD multidrop 13/7213/3
Tomas Vanek [Tue, 20 Sep 2022 16:55:51 +0000 (18:55 +0200)]
target/adi_v5_swd: fix SWD multidrop

Implementation of ADI v6 introduced banking of DP reg 0.
The accompanying change preventing DP SELECT write before
DP IDR read during connect was added to swd_connect_single() only.
Unchanged swd_connect_multidrop() / swd_multidrop_select_inner()
was broken as it emited DP SELECT and put DP to protocol error state.

Copy dap->select handling to swd_multidrop_select_inner().

Fixes: 72fb88613f02 (adiv6: add low level swd transport)
Change-Id: I514cd6d9ae2ba97ce3657b459df22638c278a0b1
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7213
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Jonathan Bell <jonathan@raspberrypi.com>
2 months agotarget/stm32l5x,stm32u5x: fix trace settings 17/7117/2
Tomas Vanek [Mon, 15 Aug 2022 09:15:43 +0000 (11:15 +0200)]
target/stm32l5x,stm32u5x: fix trace settings

The STM32L5 and U5 devices have DBGMCU_CR trace related bits changed
wrt other STM32 devices.
Fix the setting in configuration script.

Change-Id: I0bbc48e7b1290b603c6966cf5ddd42df389e6ede
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/7117
Tested-by: jenkins
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 months agotarget/target: read_memory 64-bit bugfix 21/7221/2
Daniel Goehring [Wed, 21 Sep 2022 23:17:04 +0000 (17:17 -0600)]
target/target: read_memory 64-bit bugfix

Increase "value_buf" size so it can hold a 64-bit number represented
as a string. Previous size could only hold a 32-bit number string.

Signed-off-by: Daniel Goehring <dgoehrin@os.amperecomputing.com>
Change-Id: If6fbc875236e6ddc59522fbc25db0129eb60ee27
Reviewed-on: https://review.openocd.org/c/openocd/+/7221
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2 months agotarget/xtensa: fix final clang analyzer warning 11/7211/3
Ian Thompson [Mon, 19 Sep 2022 19:39:50 +0000 (12:39 -0700)]
target/xtensa: fix final clang analyzer warning

Reworked xtensa_read_memory() logic to always allocate
and initialize working buffer with sufficient padding.

Signed-off-by: Ian Thompson <ianst@cadence.com>
Change-Id: Ia9ab53336537adebf99f8156f481ca8279a7cd5d
Reviewed-on: https://review.openocd.org/c/openocd/+/7211
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Erhan Kurubas <erhan.kurubas@espressif.com>
2 months agotarget/riscv: fix use of uninitialized value 10/7210/2
Antonio Borneo [Mon, 19 Sep 2022 13:39:50 +0000 (15:39 +0200)]
target/riscv: fix use of uninitialized value

Scan-build reports:
Logic error: Uninitialized argument value
riscv.c:2688 2nd function call argument is an uninitialized value

This is a real error cause by running the command "riscv
authdata_write" without arguments. In such case 'value' is not
initialized and is passed to and used by r->authdata_write().

Reorganize the code to:
- detect the correct amount or command's arguments;
- drop the LOG_ERROR() on ERROR_COMMAND_SYNTAX_ERROR;
- drop the 'else' after 'return'.

Change-Id: I62e031220593b8308bc674b753e15d16d4c5c9ac
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7210
Tested-by: jenkins
Reviewed-by: Jan Matyas <matyas@codasip.com>
Reviewed-by: Tim Newsome <tim@sifive.com>
2 months agotarget/riscv: fix undefined operation 09/7209/2
Antonio Borneo [Mon, 19 Sep 2022 13:28:15 +0000 (15:28 +0200)]
target/riscv: fix undefined operation

Scan-build reports:
Logic error: Result of operation is garbage or undefined
riscv.c:1614 The result of the left shift is undefined due
to shifting by '4294967281', which is greater or
equal to the width of type 'target_addr_t'

This is a false warning due to clang that considers the impossible
case of 32 bits hart (xlen = 32) in SATP_MODE_SV48 mode
(info->va_bits = 48).
Under such case:
riscv.c:1614 ... ((target_addr_t)1 << (xlen - (info->va_bits - 1))) ...
the shift amount wraps around the unsigned type and assumes the
value 4294967281 (0xfffffff1).

Use assert() to prevent clang from complaining.

Change-Id: I08fdd2a806c350d061641e28cf15a51b397db099
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7209
Reviewed-by: Tim Newsome <tim@sifive.com>
Reviewed-by: Jan Matyas <matyas@codasip.com>
Tested-by: jenkins
2 months agotarget/riscv: fix dead assignment 08/7208/2
Antonio Borneo [Mon, 19 Sep 2022 13:02:36 +0000 (15:02 +0200)]
target/riscv: fix dead assignment

Scan-build reports:
Unused code: Dead nested assignment
riscv.c:459 Although the value stored to 'ir_user4_raw' is
used in the enclosing expression, the value is
never actually read from 'ir_user4_raw'

This is caused by the value reassigned in 'ir_user4_raw':
riscv.c:459 ir_user4[3] = (uint8_t)(ir_user4_raw >>= 8);
but never used.

Drop the DIY conversion in favor of h_u32_to_le() that does not
reassign the input value.

Change-Id: Ifad29f4c46d4a2d0a2f5a5c4104d768cc3db2794
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7208
Reviewed-by: Tim Newsome <tim@sifive.com>
Reviewed-by: Jan Matyas <matyas@codasip.com>
Tested-by: jenkins
2 months agotarget/riscv: fix unused initialization 07/7207/2
Antonio Borneo [Mon, 19 Sep 2022 12:55:55 +0000 (14:55 +0200)]
target/riscv: fix unused initialization

Scan-build reports:
Unused code: Dead assignment
riscv.c:716 Value stored to 'result' is never read

Remove the initialization of variable 'result'.

Change-Id: Ied67bb4fcfa5bace186522074247ead43a5d5cd5
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7207
Reviewed-by: Tim Newsome <tim@sifive.com>
Reviewed-by: Jan Matyas <matyas@codasip.com>
Tested-by: jenkins
2 months agotarget/riscv-013: fix unused initialization 06/7206/2
Antonio Borneo [Mon, 19 Sep 2022 12:50:26 +0000 (14:50 +0200)]
target/riscv-013: fix unused initialization

Scan-build reports:
Unused code: Dead initialization
riscv-013.c:2362 Value stored to 'control' during its
initialization is never read

Remove the initialization of variable 'control'.

Change-Id: I548f8175530b9a2aa4c1788549d6467bf9824584
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7206
Reviewed-by: Tim Newsome <tim@sifive.com>
Reviewed-by: Jan Matyas <matyas@codasip.com>
Tested-by: jenkins
2 months agotarget/riscv-013: fix unchecked return code 05/7205/2
Antonio Borneo [Mon, 19 Sep 2022 12:37:24 +0000 (14:37 +0200)]
target/riscv-013: fix unchecked return code

Scan-build complains about variable 'sbcs_orig' that can be used
not initialized.
Logic error: Assigned value is garbage or undefined
riscv-013.c:4468 Assigned value is garbage or undefined
This is caused by not checking the return value of the call
riscv-013.c:4466 dmi_read(target, &sbcs_orig, DM_SBCS);
In fact when dmi_read() returns error, the variable 'sbcs_orig' is
not assigned.

Check the returned value.

Change-Id: Ia9032a0229aa243138f95f4e13f765726a4ceae9
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7205
Reviewed-by: Tim Newsome <tim@sifive.com>
Reviewed-by: Jan Matyas <matyas@codasip.com>
Tested-by: jenkins
2 months agotarget/dsp563xx: fix scan-build warning 03/7203/3
Antonio Borneo [Mon, 19 Sep 2022 09:36:06 +0000 (11:36 +0200)]
target/dsp563xx: fix scan-build warning

Scan-build triggers a warning:
Unix API: Allocator sizeof operand mismatch
dsp563xx.c:2143 Result of 'calloc' is converted to a pointer
of type 'uint8_t', which is incompatible with sizeof
 operand type 'uint32_t'

It's a false positive because calloc() is properly used in this
case, as the uint8_t array is used in blocks of 4 elements to read
or write uint32_t values.

Either
calloc(sizeof(uint32_t), count);
and
malloc(count * sizeof(uint32_t));
keep triggering the same warning.

Drop the warning by using the constant '4' as size of uint32_t, as
already used few lines below.

Change-Id: I5bb1ece177774eefdc5d9cd049338f8f2be87cd7
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7203
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2 months agojtag/adapter: fix doxygen warning 02/7202/2
Antonio Borneo [Mon, 19 Sep 2022 08:31:30 +0000 (10:31 +0200)]
jtag/adapter: fix doxygen warning

Doxygen complains about:
adapter.h:120: warning: Unsupported xml/html tag <signal_name> found

Move the text in double quote to remove the warning.

Change-Id: Ia4ead5caa83c84e10ee2b2359048c282892170b0
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Fixes: 82fd4005427b ("jtag/adapter: Add command 'adapter gpio'")
Reviewed-on: https://review.openocd.org/c/openocd/+/7202
Tested-by: jenkins
2 months agodoc: fix copyright dates 01/7201/2
Antonio Borneo [Mon, 19 Sep 2022 08:29:20 +0000 (10:29 +0200)]
doc: fix copyright dates

The copyright date for OpenOCD project has never been updated.

Add the range till current year.

Change-Id: I42c7e3b2bf2e3a486bf836d063460dfa7b40d24d
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7201
Tested-by: jenkins
2 months agocheckpatch: fix for flag --no-tree 12/7212/2
Antonio Borneo [Tue, 20 Sep 2022 10:08:55 +0000 (12:08 +0200)]
checkpatch: fix for flag --no-tree

When checkpatch is run with command line flag --no-tree, it cannot
find local 'companion' files and has to skip loading them.

This has caused issues with change https://review.openocd.org/7211
on jenkins.

Skip loading 'tools/scripts/camelcase.txt' with flag --no-tree.
While there, rewrite the associated error message.

Change-Id: I6ede7b16f9ccd77b9118fd9be7ada07a1ac96952
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7212
Tested-by: jenkins
2 months agoRestore +dev suffix
Paul Fertser [Sun, 18 Sep 2022 17:40:13 +0000 (20:40 +0300)]
Restore +dev suffix

Signed-off-by: Paul Fertser <fercerpav@gmail.com>
2 months agoThe openocd-0.12.0-rc1 release candidate 92/6192/13 v0.12.0-rc1
Antonio Borneo [Wed, 10 Mar 2021 22:10:51 +0000 (23:10 +0100)]
The openocd-0.12.0-rc1 release candidate

Change-Id: I790a6b13962649037c97e32d562dffd58d3daf3c
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2 months agoopenocd: fix SPDX tag format for files .c 53/7153/3
Antonio Borneo [Tue, 30 Aug 2022 15:01:12 +0000 (17:01 +0200)]
openocd: fix SPDX tag format for files .c

With the old checkpatch we cannot use the correct format for the
SPDX tags in the file .c, in fact the C99 comments are not allowed
and we had to use the block comment.

With the new checkpatch, let's switch to the correct SPDX format.

Change created automatically through the command:
sed -i \
's,^/\* *\(SPDX-License-Identifier: .*[^ ]\) *\*/$,// \1,' \
$(find src/ contrib/ -name \*.c)

Change-Id: I6da16506baa7af718947562505dd49606d124171
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7153
Tested-by: jenkins
2 months agoHACKING: add chapter on checkpatch 09/5609/11
Antonio Borneo [Sat, 4 May 2019 15:01:23 +0000 (17:01 +0200)]
HACKING: add chapter on checkpatch

Include hints on how to skip some of the tests in some really
exceptional case.

Note: the file includes an example of commit message with a signed
off tag that triggers a checkpatch error.
Let checkpatch to ignore BAD_SIGN_OFF error.

Checkpatch-ignore: BAD_SIGN_OFF
Change-Id: I05bf0ab8008649f3f9b38452e056dc3df83a1a4f
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/5609
Tested-by: jenkins
2 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
2 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
2 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
2 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
2 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
2 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
2 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
2 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
2 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

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)