]> www.infradead.org Git - users/borneoa/openocd-next.git/log
users/borneoa/openocd-next.git
3 months agoconfigure.ac: rename M4 macro 'adapter' to prevent accidental conflicts
R. Diez [Sat, 21 Jun 2025 20:05:17 +0000 (22:05 +0200)]
configure.ac: rename M4 macro 'adapter' to prevent accidental conflicts

Also remove a comment about such a conflict which had been already noticed.

Change-Id: I6f301ccbd1261ea1c15c44a02d3f34f0cf5cb9f4
Signed-off-by: R. Diez <rdiez-2006@rd10.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8972
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
3 months agohelper: types: fix proper return type in example of ARRAY_SIZE()
Antonio Borneo [Sat, 21 Jun 2025 10:11:24 +0000 (12:11 +0200)]
helper: types: fix proper return type in example of ARRAY_SIZE()

The example in the comment above the declaration of the macro
ARRAY_SIZE() assigns the value to a variable of type 'unsigned'
that is not allowed by the coding style (should be 'unsigned int')
and is not correct since the macro uses 'sizeof()' and the type
returned is 'size_t'.

Fix the comment.

Change-Id: I18c32b5328a229ab74b56dafab46a064ce5d23c5
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8970
Reviewed-by: zapb <dev@zapb.de>
Tested-by: jenkins
3 months agojtag: drivers: xlnx-pcie-xvc: use correct TMS polarity during pathmove
Henrik Brix Andersen [Wed, 11 Dec 2024 08:34:57 +0000 (09:34 +0100)]
jtag: drivers: xlnx-pcie-xvc: use correct TMS polarity during pathmove

The xlnx_pcie_xvc_execute_pathmove() function checks whether TMS
should be high or low for transitioning from the current state to the
next state, but then calls xlnx_pcie_xvc_transact() with the opposite
level, leading to invalid state transitions.

Fix the polarity of TMS in the calls to xlnx_pcie_xvc_transact() to
match the required TMS level.

Change-Id: I2383e41fb70063e26aa69fabcf728df597607934
Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8613
Reviewed-by: Moritz Fischer <moritzf@google.com>
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Nicolas Derumigny <nicolas.derumigny@inria.fr>
3 months agotcl/board: Add config for TMS570LS12x development kit
Marc Schink [Fri, 20 Jun 2025 09:18:03 +0000 (11:18 +0200)]
tcl/board: Add config for TMS570LS12x development kit

Tested on the corresponding hardware.

Change-Id: Ic98141c450bb981cc7853c93b38195c7930bc7d3
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8969
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 months agotarget/armv4: Use command_print() instead of LOG_ERROR()
Marc Schink [Fri, 20 Jun 2025 08:47:23 +0000 (10:47 +0200)]
target/armv4: Use command_print() instead of LOG_ERROR()

Use command_print() in order to provide an error message to the caller.

Change-Id: I9f1a2ef07a102e1d6e755f3680bed0f7183b5c9c
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8968
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
3 months agotarget/armv4: Use LOG_TARGET_xxx()
Marc Schink [Fri, 20 Jun 2025 08:44:21 +0000 (10:44 +0200)]
target/armv4: Use LOG_TARGET_xxx()

Use LOG_TARGET_xxx() for log messages as it is used for other targets.

While at it, rework the log messages. For example by removing spaces or
punctuation marks at the end of the message.

Change-Id: I295001876d40527ec8f35c2aec8d562a29e57b26
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8967
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 months agotarget/armv7a: Use LOG_TARGET_xxx()
Marc Schink [Fri, 20 Jun 2025 08:30:03 +0000 (10:30 +0200)]
target/armv7a: Use LOG_TARGET_xxx()

Use LOG_TARGET_xxx() to indicate which target the message belongs to.

Change-Id: Ic40c61a779c1a1ebdc96ebc56b27541fff5e6205
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8966
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
3 months agotarget/armv7a: Hide multiprocessing support message
Marc Schink [Fri, 20 Jun 2025 08:53:09 +0000 (10:53 +0200)]
target/armv7a: Hide multiprocessing support message

Print a debug message about missing multiprocessing support rather than
an error message.

Change-Id: Ia1581f7284747d8a92096d6f5515f891c8069f71
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8965
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 months agotarget/arm_dpm: Use LOG_TARGET_xxx()
Marc Schink [Fri, 20 Jun 2025 08:17:12 +0000 (10:17 +0200)]
target/arm_dpm: Use LOG_TARGET_xxx()

Use LOG_TARGET_xxx() to indicate which target the message belongs to.

While at it, rework the log messages. For example, using correct format
specifiers.

Change-Id: I05031e0ae25fe9e7bc38dfb781b6623a967fd533
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8964
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 months agoopenocd.c: 'init' should fail if GDB service cannot be created
Jan Matyas [Tue, 17 Jun 2025 11:17:23 +0000 (13:17 +0200)]
openocd.c: 'init' should fail if GDB service cannot be created

If it is not possible to create a GDB service for a certain target
(for example the given TCP port is already occupied), the "init"
command should fail, but it currently does not.

Fix this by checking the return code of gdb_target_add_all().

Steps to reproduce:

1) Make the port 3333/tcp occupied. For example by:

   nc -l 3333

2) In another terminal, launch OpenOCD. Use the gdb_port
   3333 (which is the default). For example:

   path/to/your/openocd \
      -c "adapter driver ..." \
      -c "jtag newtap ..."
      -c "target create ..."

3) Observe the outcome:

   Before this patch:

   Error "couldn't bind gdb to socket on port 3333: Address already in use"
   is displayed but OpenOCD keeps running.

   After this patch:

   The error message is displayed and OpenOCD exits - as expected.

Change-Id: I63c283a9a1095167b78e69e9ee879c378a6b9f2a
Signed-off-by: Jan Matyas <jan.matyas@codasip.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8957
Tested-by: jenkins
Reviewed-by: zapb <dev@zapb.de>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 months agortos: sort the rtos by alphabetic order
Antonio Borneo [Sat, 14 Jun 2025 13:07:50 +0000 (15:07 +0200)]
rtos: sort the rtos by alphabetic order

Add comments to require the list of rtos to be kept sorted.

Change-Id: Iecf9250a14f6593d0a24a9f9b8930c0ec8d74bd2
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8953
Tested-by: jenkins
3 months agotarget: use array size to constraint the loop
Antonio Borneo [Sat, 14 Jun 2025 13:02:04 +0000 (15:02 +0200)]
target: use array size to constraint the loop

Instead of using NULL terminated arrays to determine the last
element of the array, use the size of the array.

Change-Id: I3cdc0f6aef8a5110073aeef333c439e61fc54032
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8952
Tested-by: jenkins
Reviewed-by: Brandon Martin
3 months agotarget: sort the targets by alphabetic order
Antonio Borneo [Sat, 14 Jun 2025 12:51:43 +0000 (14:51 +0200)]
target: sort the targets by alphabetic order

Add comments to require the list of targets to be kept sorted.

Change-Id: Ie3d7e3f5d55a9f9214dc179c5c986b6682f59412
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8951
Tested-by: jenkins
3 months agojtag: interfaces: sort the drivers by alphabetic order
Antonio Borneo [Sat, 14 Jun 2025 12:39:37 +0000 (14:39 +0200)]
jtag: interfaces: sort the drivers by alphabetic order

Add comments to require the list of drivers to be kept sorted.
While there:
- align the check on BUILD_PRESTO and BUILD_USB_BLASTER;
- fix indentation of the closing parenthesis.

Change-Id: Ic78281b1cdfb5bf72ea41427233e76516001b429
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8950
Tested-by: jenkins
3 months agoflash: nand: use array size to constraint the loop
Antonio Borneo [Sat, 14 Jun 2025 11:58:38 +0000 (13:58 +0200)]
flash: nand: use array size to constraint the loop

Instead of using NULL terminated arrays to determine the last
element of the array, use the size of the array.

Change-Id: I532a51a223061348e57bae3bd66ee6b346c1b070
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8949
Tested-by: jenkins
Reviewed-by: Brandon Martin
3 months agoflash: nand: sort the drivers by alphabetic order
Antonio Borneo [Sat, 14 Jun 2025 11:53:50 +0000 (13:53 +0200)]
flash: nand: sort the drivers by alphabetic order

Add comments to require the list of drivers to be kept sorted.

Change-Id: I21b52cc1f5e679b0ebf7797e204248507f53557b
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8948
Tested-by: jenkins
3 months agoflash: nor: use array size to constraint the loop
Antonio Borneo [Sat, 14 Jun 2025 12:02:25 +0000 (14:02 +0200)]
flash: nor: use array size to constraint the loop

Instead of using NULL terminated arrays to determine the last
element of the array, use the size of the array.

Change-Id: Ia3d739b0a9f201ba2e7b1d1244d60c8e5546c9c1
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8947
Reviewed-by: Brandon Martin
Tested-by: jenkins
3 months agoflash: nor: sort the drivers by alphabetic order
Antonio Borneo [Sat, 14 Jun 2025 10:36:07 +0000 (12:36 +0200)]
flash: nor: sort the drivers by alphabetic order

Add comments to require the list of drivers to be kept sorted.

Change-Id: I57382605edc6a38d6c1ac18393421b18ae72215b
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8946
Tested-by: jenkins
3 months agotcl/target/lsch3_common: Remove 'mem2array'
Marc Schink [Thu, 19 Jun 2025 08:28:36 +0000 (10:28 +0200)]
tcl/target/lsch3_common: Remove 'mem2array'

The 'mem2array' function is deprecated and replaced by 'read_memory'.

Change-Id: Iea54a390d67978d20dbb99ab6f7f4178dda481c2
Reported-by: Paul Fertser <fercerpav@gmail.com>
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8962
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 months agojlink: add nickname support
Vitaly Cheptsov [Sun, 18 May 2025 05:49:30 +0000 (08:49 +0300)]
jlink: add nickname support

Using nicknames provides a human-readable alternative to serial
numbers for convenience purposes. Allow matching adapter serial
with device nickname.

Change-Id: I03b8d28a6c89412a825d42f4f66b3b528f217d9c
Signed-off-by: Vitaly Cheptsov <vit9696@protonmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8886
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: zapb <dev@zapb.de>
3 months agodoc: Fix 'add_help_text' and 'add_usage_text' usage
Marc Schink [Thu, 19 Jun 2025 21:44:23 +0000 (23:44 +0200)]
doc: Fix 'add_help_text' and 'add_usage_text' usage

Remove the quotation marks as they are used for strings and not
parameter names.

Change-Id: I7bb25eb251427e89256b73cf697d8ec5c1b401dc
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8963
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 months agodoc: Fix 'find' and 'ocd_find' usage
Marc Schink [Mon, 16 Jun 2025 08:04:44 +0000 (10:04 +0200)]
doc: Fix 'find' and 'ocd_find' usage

Remove the quotation marks as they are used for strings and not
parameter names.

Change-Id: Ib0629e1465f821f91cd1e837f4ef8c752013b6b7
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8955
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 months agodoc: Fix 'add_script_search_dir' usage
Marc Schink [Sun, 15 Jun 2025 20:44:53 +0000 (22:44 +0200)]
doc: Fix 'add_script_search_dir' usage

The 'directory' parameter is not optional.

Change-Id: Ifbc7b311692157dae0621dfa6d35a24b8fe8cbb2
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8954
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
3 months agotarget/cortex_m: fix debug reason after reset halt
Tomas Vanek [Sat, 14 Jun 2025 10:18:53 +0000 (12:18 +0200)]
target/cortex_m: fix debug reason after reset halt

[1] removed target_halt() from cortex_m_assert_reset()
It broke debug_reason tracking and the previous reason
was shown after reset halt.

Set debug_reason to DBG_REASON_DBGRQ during reset halt
preparation.

Fixes: [1] commit 226085065bdf ("target/cortex_m: drop useless target_halt() call")
Reported-by: Marc Schink <dev@zapb.de>
Change-Id: I685618ed158abde11f6e00eeeee1dfa8ed90952d
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/8945
Tested-by: jenkins
Reviewed-by: zapb <dev@zapb.de>
3 months agoconfigure.ac: show 5 ARM adapters in config summary
R. Diez [Sun, 8 Jun 2025 08:37:21 +0000 (10:37 +0200)]
configure.ac: show 5 ARM adapters in config summary

Adapters: bcm2835gpio, imx_gpio, am335xgpio, ep93xx and at91rm9200
Allow the user to enable them regardless of the target architecture.

Change-Id: I9fbc7cbefe770ea2e2239b95a3305fd29127fa85
Signed-off-by: R. Diez <rdiez-2006@rd10.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8892
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
3 months agotarget/armv8: update MPIDR decoding
Daniel Goehring [Tue, 18 Jan 2022 17:34:25 +0000 (12:34 -0500)]
target/armv8: update MPIDR decoding

Update MPIDR decode to support the multithreading (MT) bit.

If detected, socket, cluster, core and multithread affinity levels are
decoded and displayed.

Change-Id: I43569141fa0eef8ee8fc16c187a4af3c23e97db8
Signed-off-by: Daniel Goehring <dgoehrin@os.amperecomputing.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7190
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
4 months agojep106: update to revision JEP106BM Jun 2025
Antonio Borneo [Sat, 14 Jun 2025 07:52:57 +0000 (09:52 +0200)]
jep106: update to revision JEP106BM Jun 2025

Update to latest available document.

Change-Id: Ic1c892b42d3efbb35ad4a6c85deb17ab31ad9997
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8944
Tested-by: jenkins
4 months agoconfigure.ac: remove usage of obsolete Automake macro AM_PROG_CC_C_O
R. Diez [Sun, 8 Jun 2025 09:22:39 +0000 (11:22 +0200)]
configure.ac: remove usage of obsolete Automake macro AM_PROG_CC_C_O

Macro AM_PROG_CC_C_O has been obsolete since Automake 1.14,
released in June 2013 (12 years ago).

It used to check whether the C compiler supports the -c and -o options,
but that is now included in AC_PROG_CC.

Increase the minimum required Automake version to 1.14 accordingly.

Also remove the "not a GNU package" comment,
which does not really make sense.

Change-Id: I987ba8686721c7f36fba81e100f1c3ddf77f636d
Signed-off-by: R. Diez <rdiez-2006@rd10.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8942
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
4 months agocmsis-dap: Fix freeing pending transfers on close
kryvosheiaivan [Wed, 28 May 2025 13:52:42 +0000 (16:52 +0300)]
cmsis-dap: Fix freeing pending transfers on close

Freeing pending transfers on shutdown is done in openOCD
and on libusb side. This created concurrency in freeing
memory and segmentation faults:
https://github.com/libusb/libusb/issues/1627
Bug is reproduced better if many targets are laucnhed.
Bug was reproduced with CMSIS-DAP on targets:
cyw20829, psoc4, stm32l5 if launching multiple times.
Proposed working fix: if some transfers pending/in-flight
on 'shutdown' then apply libusb_handle_events_timeout_completed()
to make transfer complete. In all cases transfer completed
due to tests.

Change-Id: I44621ac6096791714910220d04614d0a19ce47bd
Signed-off-by: kryvosheiaivan <Ivan.Kryvosheia@infineon.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8876
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
4 months agoadapter: Deprecate Gateworks GW16012 driver
Marc Schink [Wed, 9 Oct 2024 09:14:21 +0000 (11:14 +0200)]
adapter: Deprecate Gateworks GW16012 driver

The adapter is not available for years now. There is also no information
about this device from Gateworks. The poor hardware availability and the
lack of users prevents testing, maintenance and adaptations to future
changes.

Mark the adapter as deprecated as a first step to give potential users
the opportunity to upgrade the hardware until the next OpenOCD release.

Change-Id: I037325a6b018b26608733a36bef30db2785858f8
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8651
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
4 months agoadapter: Deprecate Amontec JTAG Accelerator driver
Marc Schink [Wed, 9 Oct 2024 09:13:42 +0000 (11:13 +0200)]
adapter: Deprecate Amontec JTAG Accelerator driver

The adapter is not available for years now and Amontec is not even a
company anymore. The poor hardware availability and the lack of users
prevents testing, maintenance and adaptations to future changes.

Mark the adapter as deprecated as a first step to give potential users
the opportunity to upgrade the hardware until the next OpenOCD release.

Change-Id: Idd9fb75588246bc39e12ea17a71435ed77f0f50b
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8349
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
4 months agoHACKING: describe keeping the 'Change-Id' on new patch versions
Antonio Borneo [Tue, 3 Jun 2025 09:52:59 +0000 (11:52 +0200)]
HACKING: describe keeping the 'Change-Id' on new patch versions

We often get on Gerrit a new version of an old patch with a new
'Change-Id' value. This breaks the history of the review, adding
more work to the review process.

Describe in HACKING why the hook 'commit-msg' is required and how
to handle the 'Change-Id' on new patch versions.

Change-Id: I5c060b19f966add7422704912b38e1ab2f788e5f
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8940
Tested-by: jenkins
4 months agotcl/board/orange_pi_zero_3: Add Orange Pi Zero 3 board
Electric Worry [Thu, 29 May 2025 10:31:59 +0000 (11:31 +0100)]
tcl/board/orange_pi_zero_3: Add Orange Pi Zero 3 board

The Orange Pi Zero 3 is an SBC that uses an Allwinner H618
SoC. As such, JTAG support is fully available, however the
SoC multiplexes JTAG function with UART1 and microSD.
Unfortunately Xunlong has used UART1 for the Wifi-BT
chip, leaving JTAG accessible only via the microSD using
a microSD breakout board (for example).

Change-Id: I0dc078cd2f3176815271917eb5e948cc8ef94525
Signed-off-by: Electric Worry <me@electricworry.net>
Reviewed-on: https://review.openocd.org/c/openocd/+/8938
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
4 months agotarget: add support for Allwinner H618 SoC
Electric Worry [Thu, 29 May 2025 09:51:59 +0000 (10:51 +0100)]
target: add support for Allwinner H618 SoC

The Allwinner H618 is an updated H616 but appears functionally
equivalent. It is used in small boards such as Orange Pi Zero 3.

Change-Id: I299a42be746189f3e8e31070aa26b83ab7d806a4
Signed-off-by: Electric Worry <me@electricworry.net>
Reviewed-on: https://review.openocd.org/c/openocd/+/8936
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
4 months agoflash/bluenrg-x: support programming without loader
HAOUES Ahmed [Tue, 27 May 2025 10:42:42 +0000 (11:42 +0100)]
flash/bluenrg-x: support programming without loader

fallback programming without loader when resources are not available
while at there refactor reused code
(wait for interrupt and command execution)

Change-Id: I2cba0f53d3470bc324f4a72614c236cebf196f64
Signed-off-by: BOCHKATI Tarek <tarek.bochkati@st.com>
Signed-off-by: HAOUES Ahmed <ahmed.haoues@st.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8883
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
4 months agoflash/bluenrg-x: fix programming for devices with 512k flash
HAOUES Ahmed [Thu, 29 May 2025 09:01:20 +0000 (10:01 +0100)]
flash/bluenrg-x: fix programming for devices with 512k flash

flash ADDRESS register is encoded in 17 bits (was 16),
so fix the cast to uint32_t

Change-Id: I13384ee8967e65890577b12a42a0eb4f1e2a7467
Signed-off-by: HAOUES Ahmed <ahmed.haoues@st.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8882
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
4 months agoflash/bluenrg-x: Support STM32WB09 AKA BlueNRG-LPF device
HAOUES Ahmed [Tue, 27 May 2025 10:34:24 +0000 (11:34 +0100)]
flash/bluenrg-x: Support STM32WB09 AKA BlueNRG-LPF device

The BlueNRG-LPF has a flash size up to 512 Kb

Change-Id: I4c71b716330351004f4f2ab8bf8eac7d5bb694eb
Signed-off-by: HAOUES Ahmed <ahmed.haoues@st.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8881
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
4 months agoflash/bluenrg-x: Add blueNRG alternate names
HAOUES Ahmed [Tue, 27 May 2025 10:22:09 +0000 (11:22 +0100)]
flash/bluenrg-x: Add blueNRG alternate names

BlueNRG-LP -> STM32WB07
BlueNRG-LPS -> STM32WB05

Change-Id: I8e05ea29e84d3a7842e145fb66f448d0c82bd004
Signed-off-by: HAOUES Ahmed <ahmed.haoues@st.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8880
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
4 months agoconfigure: hide build issue of amt_jtagaccel driver by disabling it
Antonio Borneo [Tue, 3 Jun 2025 08:34:29 +0000 (10:34 +0200)]
configure: hide build issue of amt_jtagaccel driver by disabling it

With commit d8a2f6dbcf5f ("configure.ac: show the Amontec
JTAG-Accelerator driver in the config summary") the driver
amt_jtagaccel is now build by default on Linux.
This highlights the dependency of some include files, dependency
that is not properly managed and that can cause build failure.

The driver is queued to be dropped soon, so there is no real
interest to fix the dependencies.

Change the default so the driver is not built if the user does not
require it at configure time.

Change-Id: Ifb74e2c802abda290efbf59ca4ce02048c94e6f8
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8939
Reviewed-by: R. Diez <rdiez-2006@rd10.de>
Tested-by: jenkins
4 months agoconfigure: fix for missing include files on Linux
Antonio Borneo [Wed, 28 May 2025 14:58:44 +0000 (16:58 +0200)]
configure: fix for missing include files on Linux

By merging [1] and [2], the drivers 'xlnx-pcie-xvc' and 'linuxspidev'
are now build by default on Linux.
This highlights the dependency of some include files under subfolder
'linux' that are not installed by default in all Linux boxes.

Add the check in 'configure' for the presence of the include file
and conditionally enable the build of the driver.

Change-Id: Ie88645c3455ab07622f069a0cc7bf09d1a5a2c75
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Link: [1] 7214c8be46f7 ("configure: show adapter Xilinx XVC/PCIe in the configuration summary")
Link: [2] 83e0293f7ba3 ("Add Linux SPI device SWD adapter support")
Reviewed-on: https://review.openocd.org/c/openocd/+/8935
Tested-by: jenkins
4 months agotarget/armv8: Handle modeswitch for aarch32 secure EL3
Kevin Yang [Mon, 12 Oct 2020 20:22:47 +0000 (13:22 -0700)]
target/armv8: Handle modeswitch for aarch32 secure EL3

For aarch32 secure EL3
- Change target_el to 3 for SVC/ABT/IRQ/FIQ/UND/SYS for aarch32 secure
EL3
- Do not update SPSR for SYS, behavior is UNPREDICTABLE (ARMv8-A F5.1.121)
- Do not execute DRPS for SYS, behavior is UNPREDICTABLE (ARMv8-A
F5.1.51)

Change-Id: Ic1484665cd53afcccb5c20b152993a3f0407f8a2
Signed-off-by: Kevin Yang <kangyang@google.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/5854
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
Reviewed-by: Plamena Marinova <pmarinova@hilscher.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
4 months agotcl: fix broken Raspberry Pi website links
Jonathan Bell [Wed, 21 May 2025 14:37:25 +0000 (15:37 +0100)]
tcl: fix broken Raspberry Pi website links

raspberrypi.com is the home for technical information, raspberrypi.org
is the Foundation's site (though there are intelligent redirects).

Several pages have moved around, fix these.

Also tweak a few comments for style and correctness.

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
Change-Id: I7f52bcc362fb213b50987e3a42866fe4a6fec883
Reviewed-on: https://review.openocd.org/c/openocd/+/8885
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
4 months agodoc: bcm2835gpio: remove broken link and clarify usage
Jonathan Bell [Wed, 21 May 2025 14:26:20 +0000 (15:26 +0100)]
doc: bcm2835gpio: remove broken link and clarify usage

The peripheral address details have been removed from the documentation
part of the website (instead presented in the SoC datasheets).

Pi 5 GPIOs are provided by the RP1 southbridge, which requires the use
of libgpiod. The associated Linux driver for the GPIO interface must be
used when bitbashing on Pi 5, as the timing of pin state changes is not
guaranteed across the PCIe link without special treatment.

Using libgpiod, the typical maximum swclk speed is 1MHz.

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
Change-Id: I8b2c44ec5edd71abaa0a763ba4d4f4603a211348
Reviewed-on: https://review.openocd.org/c/openocd/+/8884
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
4 months agoflash/nor/tcl: Add 'read_memory' command
Marc Schink [Sat, 23 Nov 2024 14:43:51 +0000 (14:43 +0000)]
flash/nor/tcl: Add 'read_memory' command

This command allows to read non-memory mapped flash content directly
via Tcl script. The API is the same as for the 'read_memory' command
for targets.

Change-Id: I4a8d0d7ea2f778ac8f1501227b60b964c881cb84
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8634
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
4 months agojtag/vdebug: implement a polling mechanism
Jacek Wuwer [Wed, 24 Apr 2024 08:15:38 +0000 (10:15 +0200)]
jtag/vdebug: implement a polling mechanism

This change adds a polling mechanism to the driver. When not busy
the driver issues a wait, allowing the target to advance time.
The wait period gets adjusted to match the polling setting.

Change-Id: I67f481d05d7c5ce5352b5cb97de78dbaa97d82ae
Signed-off-by: Jacek Wuwer <jacekmw8@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8221
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
4 months agotcl/target/stm32f4x: Enable the trace port clock
Marc Schink [Tue, 1 Apr 2025 04:34:27 +0000 (04:34 +0000)]
tcl/target/stm32f4x: Enable the trace port clock

Enable the trace port (GPIOE) clock, otherwise the following pin
configurations have no effect.

Change-Id: I3942d2527c64340463c3b6c607addb4214f83081
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8823
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
4 months agoflash/nor/spi: add puya p25q flash devices
Matthias Breithaupt [Thu, 25 Apr 2024 14:36:20 +0000 (16:36 +0200)]
flash/nor/spi: add puya p25q flash devices

P25Q16 can be found in the Efinix T13/20Q100F3, so that one is necessary
for jtagspi on those chips. The other ones were added for completeness.

Change-Id: Ifb6f3c6fbd23938d6fd26bce7742c3484ece130c
Signed-off-by: Matthias Breithaupt <m.breithaupt@vogl-electronic.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8223
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
4 months agohelper: configuration: check for empty search dirs
Antonio Borneo [Thu, 22 May 2025 00:02:19 +0000 (02:02 +0200)]
helper: configuration: check for empty search dirs

The function find_file() is supposed to be called when the search
dirs in 'script_search_dirs' has already been populated.

This is not the case when the command 'ocd_find' is used in one of
the embedded scripts 'startup.tcl'. It then triggers SIGSEGV.

Check for 'script_search_dirs' and eventually skip searching in
the dirs.

Change-Id: I9e75a8739c94de72041fb64487910d60dffcb2bd
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8931
Tested-by: jenkins
4 months agotcl/board: Add config for nRF5340 development kit
Marc Schink [Thu, 24 Apr 2025 07:51:42 +0000 (07:51 +0000)]
tcl/board: Add config for nRF5340 development kit

Tested with nRF5340 development kit.

Change-Id: I44f1ba176dd4ac491b5dccea4c4d6d6d9bfaf479
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8867
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
4 months agotcl/board: Add config for nRF9160 development kit
Marc Schink [Thu, 24 Apr 2025 06:24:24 +0000 (06:24 +0000)]
tcl/board: Add config for nRF9160 development kit

Tested with nRF9160 development kit.

Change-Id: I367b869b9707bef0547b5d3575b24e19db74cd21
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8866
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
4 months agotcl/board: Deprecate nordic_nrf52_ftx232.cfg
Marc Schink [Mon, 21 Apr 2025 18:10:20 +0000 (18:10 +0000)]
tcl/board: Deprecate nordic_nrf52_ftx232.cfg

Board configuration files for specific external debug adapters are not /
no longer supported.

Checkpatch-ignore: LONG_LINE_STRING

Change-Id: I0f391dfb1a2d7ceb92c2ad3e34eaeb8a85b2cdc5
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8865
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
4 months agotcl/board: Deprecate old nordic configuration files
Marc Schink [Mon, 12 May 2025 08:43:19 +0000 (10:43 +0200)]
tcl/board: Deprecate old nordic configuration files

Add the old configuration files to the 'file_renaming' list in order to
ensure backwards compatibility.

Change-Id: Ia61df8e5cd8c19cee19a494635c8025e36f3f4a7
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8907
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
4 months agotcl/board: Move nordic configuration files
Marc Schink [Mon, 12 May 2025 08:42:11 +0000 (10:42 +0200)]
tcl/board: Move nordic configuration files

Move board configuration files into a dedicated vendor directory as
required by the new guideline for configuration files.

Change-Id: Icbf368d7a453c82813e685d2935b186eb738c3ea
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8864
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
4 months agotcl/board: Use moved nordic target files
Marc Schink [Mon, 12 May 2025 08:54:49 +0000 (10:54 +0200)]
tcl/board: Use moved nordic target files

Use the moved nordic target configuration files.

Change-Id: Ie0e2eb7f9514eedb1ae6678eeee59291856c2674
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8906
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
4 months agotcl/target: Deprecate old nordic configuration files
Marc Schink [Mon, 12 May 2025 04:53:16 +0000 (06:53 +0200)]
tcl/target: Deprecate old nordic configuration files

Keep the old configuration files to ensure backwards compatibility.

Change-Id: Ia1d06b5a8a646d65f2cdc5a9415df3014a93b7d7
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8863
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
4 months agotcl/target: Move nordic configuration files
Marc Schink [Mon, 12 May 2025 04:47:22 +0000 (06:47 +0200)]
tcl/target: Move nordic configuration files

Move target configuration files into a dedicated vendor directory as
required by the new guideline for configuration files.

Note that the moved files are still accessible via the old path to ensure
backwards compatibility. This works because of the extended file search in
vendor folders.

Change-Id: If3935985769dc543e8c7d72cda590c9d79303abb
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8905
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
4 months agostartup.tcl: extend the file search in vendor folders
Antonio Borneo [Wed, 21 May 2025 13:19:28 +0000 (15:19 +0200)]
startup.tcl: extend the file search in vendor folders

The TCL configuration files are going to be dispatched in vendor
specific folders.
Old user configuration files will fail to find the new files to
include, so a set of fallback files reporting the deprecation
should replace the renamed files.

To prevent such enormous proliferation of fallback files, extend
the search of files in the vendor folders too.
For non-trivial renames, a dedicated table is added in the file
tcl/file_renaming.cfg to track old --> new file names.
The deprecated message is then part of the extended search.

E.g.:
old file names:
- path/to/a/certain/vendor_config_file
- path/to/a/certain/vendor-config_file
trigger search of:
- path/to/a/certain/vendor/config_file

and
- path/to/a/certain/config_file
trigger search of:
- path/to/a/certain/${vendor}/config_file
among a possible vendors list.

This is a temporarily feature that should be removed as soon as
possible to prevent clashing on files with the same name.
The names in tcl/file_renaming.cfg are for demonstration purpose
only and should be dropped when the first real entries are added.

Change-Id: If4793fef27dc570d5df4ff4d77a5e36004f394f6
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8929
Tested-by: jenkins
4 months agotcl/target: Add support for TMS570LS1xxx
Lucien Dufour [Tue, 20 May 2025 15:39:19 +0000 (17:39 +0200)]
tcl/target: Add support for TMS570LS1xxx

Added support for TMS570LS1xxx series parts. This uses the existing
ti_tms570.cfg as parent.

Change-Id: I40567bfb8dc052532807df68ef3d42f8e7a8ecf4
Signed-off-by: Lucien Dufour <lucien.buchmann@dufour.aero>
Reviewed-on: https://review.openocd.org/c/openocd/+/8928
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: zapb <dev@zapb.de>
4 months agocortex_a: Use endianness for soft breakpoints
Lucien Dufour [Thu, 15 May 2025 12:31:25 +0000 (14:31 +0200)]
cortex_a: Use endianness for soft breakpoints

Fix endianness for cortex_r4 and cortex_r5 when inserting software
breakpoints. Because the cortex_a target is used by the cortex_r
architecture and some chips start in BE by default (e.g. TMS570)

Change-Id: I68b7fe7c4604de67fee2e64fff0fad2691659a58
Signed-off-by: Lucien Dufour <lucien.buchmann@dufour.aero>
Reviewed-on: https://review.openocd.org/c/openocd/+/8909
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
4 months agortos/hwthread: use printf format specifier
Tomas Vanek [Mon, 19 May 2025 15:10:00 +0000 (17:10 +0200)]
rtos/hwthread: use printf format specifier

instead of typecast.

Change-Id: I62e3a0faebd915615f6b72a456667c49970a4091
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/8926
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
4 months agortos/hwthread: Nicer debug message in hwthread_update_threads()
Tim Newsome [Sun, 18 May 2025 09:11:07 +0000 (11:11 +0200)]
rtos/hwthread: Nicer debug message in hwthread_update_threads()

Imported from
https://github.com/riscv-collab/riscv-openocd/pull/763

Change-Id: Ia5931a772476a2ae186ed87cd70d7e4be2f196fb
Signed-off-by: Tim Newsome <tim@sifive.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8917
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
4 months agodoc: list target unavailable state
Tomas Vanek [Mon, 19 May 2025 14:00:52 +0000 (16:00 +0200)]
doc: list target unavailable state

Fixes: 8911: target: Add TARGET_UNAVAILABLE state | https://review.openocd.org/c/openocd/+/8911
Change-Id: I6d152aea5bb449f79fd0f829252442b8b9f8ed9c
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/8923
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
4 months agogdb_server: Operate on available targets.
Tim Newsome [Thu, 27 Oct 2022 21:42:23 +0000 (14:42 -0700)]
gdb_server: Operate on available targets.

When SMP is enabled, gdb will always use the first target in the SMP
group. That doesn't work when that first target is unavailable, but
others in the SMP group are still available.

For cases where gdb expects an operation to affect the entire group (run
control, memory access), find the first available target in an SMP group
and use that.

Imported from
https://github.com/riscv-collab/riscv-openocd/pull/767

Change-Id: I4bed600da3ac0fdfe4287d8fdd090a58452db501
Signed-off-by: Tim Newsome <tim@sifive.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8912
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
4 months agortos/hwthread: Hide unavailable targets from thread list.
Tim Newsome [Wed, 7 Sep 2022 18:55:52 +0000 (11:55 -0700)]
rtos/hwthread: Hide unavailable targets from thread list.

Imported from
https://github.com/riscv-collab/riscv-openocd/pull/767

Change-Id: I53c6e2876d9bab70800a0f080e72a2abe0499120
Signed-off-by: Tim Newsome <tim@sifive.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8919
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
4 months agotarget: Add TARGET_UNAVAILABLE state
Tim Newsome [Thu, 27 Oct 2022 22:21:31 +0000 (15:21 -0700)]
target: Add TARGET_UNAVAILABLE state

This is added for future RISC-V changes. The RISC-V debug interface can
explicitly tell a debugger when a hart is unavailable. This is used for
instance when that hart is powered down (or yet to be powered up out of
reset).

Imported from
https://github.com/riscv-collab/riscv-openocd/pull/752

Change-Id: I8a062d59eea1e5b3c788281a75159592db024683
Signed-off-by: Tim Newsome <tim@sifive.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8911
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Bernhard Rosenkränzer <bero@baylibre.com>
4 months agoserver: gdb_server: use a macro for CTRL-C value
Antonio Borneo [Mon, 19 May 2025 13:23:23 +0000 (15:23 +0200)]
server: gdb_server: use a macro for CTRL-C value

The numeric value '3' for the ASCII character CTRL-C is not
immediately readable, even if the lines that follow explicitly
mention CTRL-C.

Use the same macro present in `telnet_server.c` to replace the
numeric value.

Change-Id: Iaf4296b1f0e384f8122d8a4875cad17e8ddaf66a
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8922
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
4 months agoserver/gdb_server: do not discard Ctrl-C if _DEBUG_GDB_IO_
Tomas Vanek [Sun, 18 May 2025 19:25:35 +0000 (21:25 +0200)]
server/gdb_server: do not discard Ctrl-C if _DEBUG_GDB_IO_

GDB server debug logging eat Ctrl-C when gdb user issues interrupt
in time of communication between OpenOCD and gdb.
E.g. Ctrl-C after `next` gdb command taking many
gdb remote protocol $vCont;s (steps)

Change-Id: I4a65446a9bb25a28e50566607b3dec116fa7d2cd
Suggested-by: Tim Newsome <tim@sifive.com>
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/8920
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
4 months agoflash, target: avoid logging of numeric target state
Tomas Vanek [Sun, 18 May 2025 09:49:31 +0000 (11:49 +0200)]
flash, target: avoid logging of numeric target state

Replace it by target_state_name() helper.

Change-Id: I720f2bf121e6fd2c6987a7e8fa9e52593888ee6c
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/8918
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
4 months agotarget: arm_cti: fix return values in handle_cti_dump()
Antonio Borneo [Sat, 10 May 2025 21:52:30 +0000 (23:52 +0200)]
target: arm_cti: fix return values in handle_cti_dump()

Since the initial commit f444c57bf2d6 ("arm_cti: add cti command
group") the helper handle_cti_dump() return JIM error codes.

Fix it by returning standard OpenOCD error codes.

Change-Id: Ia36b82083d213aff90fe22fcfe7fbe26172806a3
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8904
Tested-by: jenkins
4 months agotarget: drop struct target_type::target_jim_commands()
Antonio Borneo [Sat, 10 May 2025 12:14:05 +0000 (14:14 +0200)]
target: drop struct target_type::target_jim_commands()

The API was introduced in 2008 by commit 8d73c2a9b0c0 ("duan ellis
target tcl work in progress") and never used.

Drop it!

Change-Id: Icbc5789f59696bd28f9d1151bc3e29f4adb74670
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8903
Tested-by: jenkins
4 months agocheckpatch: drop camelcase symbols not used anymore
Antonio Borneo [Thu, 22 Dec 2022 11:34:41 +0000 (12:34 +0100)]
checkpatch: drop camelcase symbols not used anymore

With the rewrite of jim_handler commands as COMMAND_HANDLER, some
camelcase symbol from jimtcl are not referenced anymore in OpenOCD
code.

Drop such symbols from the camelcase whitelist.

Change-Id: I723be1820f13fe2cec7e4f0512a5e9da12889199
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8902
Tested-by: jenkins
4 months agocommand: drop Jim Command handler, at last
Antonio Borneo [Sat, 16 Dec 2023 16:39:12 +0000 (17:39 +0100)]
command: drop Jim Command handler, at last

With all OpenOCD commands converted to COMMAND_HANDLER, we can
drop the management of jim_handler commands.
Drop also from documentation the subsection on Jim Command
Registration.

Change-Id: I4d13abc7e384e64ecb155cb40bbbd52bb79ec672
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8901
Tested-by: jenkins
4 months agotarget/arm_tpiu_swo: rewrite commands 'configure' and 'cget' as COMMAND_HANDLER
Antonio Borneo [Sat, 16 Dec 2023 16:29:43 +0000 (17:29 +0100)]
target/arm_tpiu_swo: rewrite commands 'configure' and 'cget' as COMMAND_HANDLER

Rewrite only the command, but still use the old jimtcl specific
code in arm_tpiu_swo_configure(), shared with command 'create'.

Change-Id: If2258f048403f54faf229e602d9b395b71894f97
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8900
Tested-by: jenkins
4 months agotarget/arm_tpiu_swo: rewrite command 'swo create' as COMMAND_HANDLER
Antonio Borneo [Sun, 26 May 2024 10:34:58 +0000 (12:34 +0200)]
target/arm_tpiu_swo: rewrite command 'swo create' as COMMAND_HANDLER

Rewrite only the command, but still use the old jimtcl specific
code in arm_tpiu_swo_configure(), shared with commands 'configure'
and 'cget'.

Change-Id: I39c69b1cdc23f7b5f875df3e15be987c715b0bcf
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8899
Tested-by: jenkins
4 months agotarget: arm_cti: rewrite commands 'cti create' as COMMAND_HANDLER
Antonio Borneo [Tue, 5 Dec 2023 00:10:10 +0000 (01:10 +0100)]
target: arm_cti: rewrite commands 'cti create' as COMMAND_HANDLER

Rewrite only the command, but still use the old jimtcl specific
code in cti_configure().

Change-Id: I29fb952a7c8148416b301cbf78b6e342979af7d3
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8898
Tested-by: jenkins
4 months agotarget: arm_dap: rewrite commands 'dap create' as COMMAND_HANDLER
Antonio Borneo [Mon, 4 Dec 2023 23:45:54 +0000 (00:45 +0100)]
target: arm_dap: rewrite commands 'dap create' as COMMAND_HANDLER

Rewrite only the command, but still use the old jimtcl specific
code in dap_configure().

Change-Id: I3360884616367aae52f5b32247d9864000c53fdc
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8897
Tested-by: jenkins
4 months agocortex-a: fix single-step on infinite loop
Antonio Borneo [Fri, 2 May 2025 14:10:39 +0000 (16:10 +0200)]
cortex-a: fix single-step on infinite loop

On ARMv7a/r the single-step is implemented through a HW breakpoint
that hits instructions at any address except the address of the
current instruction.

The method above fails in case of an infinite loop coded by a
single instruction that jumps on itself; in such case, the same
instruction (at the same address) is executed over and over and
the breakpoint never hits. In current code this case is wrongly
considered as an error.

Reduce the timeout while waiting for the HW breakpoint being hit,
then halt.

The jump on itself would be executed several times before the
timeout and the halt, but this is not an issue. There are few
"pathological" instructions in ARMv7a/r that jumps on itself and
that can have side effects if executed more than once. They are
listed in the code. We do not consider these as real use cases
generated by a compiler.

Document the method in the code.

Report that the single-step function is not properly managing the
HW breakpoints if it exits on error. To be fixed in the future.

Change-Id: I9641a4a3e2f68b83897ccf3a12d3c34e98a7805c
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8871
Tested-by: jenkins
5 months agohelper: add base64 encoding/decoding helpers from FreeBSD
Bernhard Rosenkränzer [Mon, 5 May 2025 23:07:06 +0000 (01:07 +0200)]
helper: add base64 encoding/decoding helpers from FreeBSD

These helpers are needed by the updated RISC-V target files.

Change-Id: I5aa9f4e58eb75e1c7a1e8e0e3961725e2a915ebb
Signed-off-by: Bernhard Rosenkränzer <bero@baylibre.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8895
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
5 months agohelper: add bitfield helper macros
Walter Ji [Mon, 4 Mar 2024 09:29:15 +0000 (17:29 +0800)]
helper: add bitfield helper macros

This patch ports FIELD_{GET,PREP,FIT} macros and related macro
from FreeBSD, referenced file:
- `src/tree/sys/compat/linuxkpi/common/include/linux/bitfield.h`

Checkpatch-ignore: MACRO_ARG_REUSE

Change-Id: I6fdf4514d3f95d62fadf7654409a4878d470a600
Signed-off-by: Walter Ji <walter.ji@oss.cipunited.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8171
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
5 months agoLICENSES: add dual/CC-BY-4.0
Antonio Borneo [Mon, 5 May 2025 08:00:10 +0000 (10:00 +0200)]
LICENSES: add dual/CC-BY-4.0

The license CC-BY-4.0 is not compatible with GPLv2, but files can
be dual licensed with a GPLv2 compatible license 'OR' CC-BY-4.0.

This is the case for some file auto-generated by riscv project.

Change-Id: I4313d85a569a5e6423392129a730d1e22ef17c51
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8894
Reviewed-by: Bernhard Rosenkraenzer <bero@baylibre.com>
Tested-by: jenkins
5 months agotesting/tcl_commands: test `target create`, `cget`, `configure`
Evgeniy Naydanov [Fri, 29 Nov 2024 14:44:50 +0000 (17:44 +0300)]
testing/tcl_commands: test `target create`, `cget`, `configure`

Introduce basic testing of error-handling in target configuration
related commands.

The tests can be run via `make check` when JTAG `dummy` adapter is
enabled.

Change-Id: Id0f382046dd70007d8e696d82d2396a7ccab7a33
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8644
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
5 months agotarget: improve error reporting for `-event` option
Evgeniy Naydanov [Mon, 28 Apr 2025 13:55:35 +0000 (16:55 +0300)]
target: improve error reporting for `-event` option

`target create` calls can get quite long and an indication what is the
option that caused the error can be helpful.

Also, there can be multiple `-event` options for different events,
therefore indicating which one is it is also helpful.

Change-Id: I5ea61437ca9705e790ed8343183883a3fdfebc80
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8861
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
5 months agotarget: improve error messaging in `target create`
Evgeniy Naydanov [Mon, 28 Apr 2025 13:46:08 +0000 (16:46 +0300)]
target: improve error messaging in `target create`

There are a couple of issues with the usage string for `target create`,
namely:
* `-chain-position` is allowed to be not the first option.
* `-chain-position` should be ommited alltogether on ARM targets when
  DAP is specified.

Before the patch:
```
> openocd -c 'target create name testee'
...
  target create name type '-chain-position' name [options ...]
```

After the patch:
```
> openocd -c 'target create name testee'
...
-chain-position ?name? required when creating target
> openocd -c 'target create'
...
  target create name type [options ...]
```

Change-Id: Ia21a99ce6a4086e2e0676f5ef4685da3514a4f69
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8860
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
5 months agotarget: cget command fix for result output
Daniel Goehring [Thu, 1 May 2025 02:38:15 +0000 (22:38 -0400)]
target: cget command fix for result output

Function target_configure() when processing a "cget" command needs
to print the result to the console. Currently the result is only printed
when an error occurs. To fix this, move the command print statement from
the error handling section to the common code section.

The code was tested by executing a "$target_name cget -dap" command
and reviewing the result.

Change-Id: Iff1999de8c8e9a837055ba95714137aa03e68d4b
Signed-off-by: Daniel Goehring <dgoehrin@os.amperecomputing.com>
Fixes: 61890e3dc320 ("target: rewrite function target_configure() as COMMAND_HELPER")
Reviewed-on: https://review.openocd.org/c/openocd/+/8870
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
5 months agotcl: board: convert transport select dapdirect_swd to swd
Antonio Borneo [Thu, 1 May 2025 16:41:51 +0000 (18:41 +0200)]
tcl: board: convert transport select dapdirect_swd to swd

Two new boards were added after the commit ad53fe659b46 ("tcl:
convert transport select to jtag and swd")

Align them too.

Change-Id: I53e36a3a1a7730822521f0239922682c7b2fcef6
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8869
Tested-by: jenkins
5 months agotransport: fix incorrect statement
Antonio Borneo [Thu, 1 May 2025 17:38:42 +0000 (19:38 +0200)]
transport: fix incorrect statement

Commit 236208a5ff2d ("transport: use a bitmask for the transport")
has an incorrect C statement in place of a return.
The code is working thanks to the previous condition never true.

The issue has been detected by clang scan-build in OpenOCD ACI
since the missing return can make the following statement
dereferencing a NULL pointer.

Fix it!

Change-Id: I3bbe04d99ad9b1288f55ba3c45e2e487aef9ae40
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Fixes: 236208a5ff2d ("transport: use a bitmask for the transport")
Reviewed-on: https://review.openocd.org/c/openocd/+/8868
Tested-by: jenkins
5 months agotarget: armv7a: use proper type for struct armv7a_cache_common::outer_cache
Antonio Borneo [Sat, 19 Apr 2025 15:05:16 +0000 (17:05 +0200)]
target: armv7a: use proper type for struct armv7a_cache_common::outer_cache

The field 'outer_cache' is always initialized and used as a
pointer to 'struct armv7a_l2x_cache'.
There is no reason for using type 'void *' for it.

Change the type of 'outer_cache'.
Drop the useless cast while reading 'outer_cache'.

Change-Id: Iaea9d02e247da26e230f887c85fbf8e9d7be34d5
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8858
Tested-by: jenkins
5 months agotarget: armv7a: drop command 'cache_config l2x'
Antonio Borneo [Sat, 19 Apr 2025 14:28:50 +0000 (16:28 +0200)]
target: armv7a: drop command 'cache_config l2x'

The command was already tagged as deprecated in 2015 with commit
0df557728216 ("armv7a: remove l1 flush all data handler") but has
never been removed.
An equivalent command 'cache l2x conf' was introduced at the same
time in commit cd440bd32a12 ("add armv7a_cache handlers").

Drop it and deprecate it.
Replace the old command in the Tcl script.

Change-Id: Ie24eccc99a78786903704d10ee1d9f6c924529b5
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8857
Tested-by: jenkins
5 months agortos/FreeRTOS: fix next pointer member offset in FreeRTOS lists
Chien Wong [Tue, 8 Apr 2025 12:33:56 +0000 (20:33 +0800)]
rtos/FreeRTOS: fix next pointer member offset in FreeRTOS lists

Currently, we are using offset of xListEnd.pxPrevious in List_t for
list_next_offset and offset of pxPrevious in ListItem_t for
list_elem_next_offset. This is confusing. Fix this.
As the related lists are doubly linked lists, only iteration order is
changed without breaking functionality.
Also document those offsets.

Change-Id: I8beacc235ee781ab4e3b415fccad7b72ec55b098
Signed-off-by: Chien Wong <m@xv97.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8833
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
5 months agortos: rework rtos_types[] and rtos_try_next()
Antonio Borneo [Fri, 18 Apr 2025 15:04:47 +0000 (17:04 +0200)]
rtos: rework rtos_types[] and rtos_try_next()

Drop the NULL sentinel at the end of the array and use ARRAY_SIZE()
to bound the loops.
Adapt rtos_try_next() to use ARRAY_SIZE().

While there:
- change to bool the return type of rtos_try_next();
- move rtos_try_next() to avoid the forward declaration.

Change-Id: I1bee11db943b670789e62f1bebe2509bbef451a0
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8855
Tested-by: jenkins
5 months agortos: rework rtos_create()
Antonio Borneo [Sun, 3 Dec 2023 21:54:51 +0000 (22:54 +0100)]
rtos: rework rtos_create()

To simplify the caller of rtos_create(), convert the code from
jimtcl oriented to OpenOCD commands.

While there, fix inconsistencies in almost every rtos create()
method and reset rtos_auto_detect to better cooperate on run-time
rtos configuration.

Change-Id: I59c443aaed77a48174facdfc86db75d6b28c8480
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8830
Tested-by: jenkins
5 months agogithub/workflow: fix warnings for github actions
Samuel Obuch [Thu, 13 Feb 2025 13:28:27 +0000 (14:28 +0100)]
github/workflow: fix warnings for github actions

- update runner to ubuntu-latest
- pass GITHUB_TOKEN to delete-tag-and-release as input

Change-Id: I83d69cfd7af7c44e67b1115ac843a0b41d6f87b9
Signed-off-by: Samuel Obuch <samuel.obuch@espressif.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8756
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
5 months agodoc/manual: Add guideline for configuration files
Marc Schink [Sat, 17 Aug 2024 10:35:30 +0000 (12:35 +0200)]
doc/manual: Add guideline for configuration files

The goal of this guideline is to have consistent and well-structured
configurations files. The focus of this patch is on filenames and
directory structure. A guideline for the content of the files should be
included in a subsequent patch.

This patch addresses a long outstanding task listed in 'Pending and Open
Tasks'.

Change-Id: Ib32dd8b9ed15c3f647cd8d74cfc79edf0e79a3df
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8854
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
5 months agodoc/manual: Fix Tcl spelling
Marc Schink [Mon, 14 Apr 2025 07:11:36 +0000 (09:11 +0200)]
doc/manual: Fix Tcl spelling

Use 'Tcl' because it is the official spelling.

While at it, fix some misspellings of 'Jim Tcl'.

Change-Id: I2d96f63b0dbc96ae62fe00ae41d2eb16897250fb
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8853
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
5 months agodoc/openocd: Fix Tcl spelling
Marc Schink [Mon, 14 Apr 2025 07:09:49 +0000 (09:09 +0200)]
doc/openocd: Fix Tcl spelling

Use 'Tcl' because it is the official spelling.

While at it, fix some misspellings of 'Jim Tcl'.

Change-Id: I084541a1cc0276d15a263b843ba740da04efc30a
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8852
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
5 months agotcl/board: Add config for NUCLEO-U083RC
Marc Schink [Fri, 13 Dec 2024 07:34:38 +0000 (07:34 +0000)]
tcl/board: Add config for NUCLEO-U083RC

Tested with NUCLEO-U083RC development board.

Change-Id: I5e7ed1a9a19dbab70ee3155f92d67874c33b1ac2
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8649
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
5 months agoconfigure.ac: show the sysfsgpio adapter in the config summary
R. Diez [Thu, 10 Apr 2025 18:57:49 +0000 (20:57 +0200)]
configure.ac: show the sysfsgpio adapter in the config summary

Also enable this adapter by default (auto).

Change-Id: I43b9f1a1873b381d015114da57efc1d78e6e7780
Signed-off-by: R. Diez <rdiez-2006@rd10.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8834
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
5 months agoconfigure.ac: show the Amontec JTAG-Accelerator driver in the config summary
R. Diez [Fri, 11 Apr 2025 13:30:22 +0000 (15:30 +0200)]
configure.ac: show the Amontec JTAG-Accelerator driver in the config summary

Also enable this driver by default (auto).

Change-Id: I7f592dd697c6ee150a81e151ff2333447cd9130d
Signed-off-by: R. Diez <rdiez-2006@rd10.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8835
Tested-by: jenkins
Reviewed-by: zapb <dev@zapb.de>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
5 months agostlink: simplify the use of deprecated HLA transport
Antonio Borneo [Mon, 23 Dec 2024 19:20:08 +0000 (20:20 +0100)]
stlink: simplify the use of deprecated HLA transport

Commit 34ec5536c0ba ("stlink: deprecate HLA support") makes hard
to use the still functional HLA transport with the stlink listed
in board config files.
Now that the prefixes 'hla_' and 'dapdirect_' has been dropped
from the transport name, allow overriding the transport by using
the 'stlink-hla' script in front of the board file, e.g.:

openocd -f interface/stlink-hla.cfg -f board/st_nucleo_f4.cfg

Revert the documentation changes of the change above.
Improve the documentation to explain how to use the compatibility
HLA mode.
Improve the error message in stlink driver to guide the user to
update the stlink firmware and to use the compatibility HLA mode.

Change-Id: I5d0bc7954511692cebe024bda2aaa72767b97681
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8679
Tested-by: jenkins
5 months agotcl: convert transport select to jtag and swd
Antonio Borneo [Mon, 23 Dec 2024 17:10:10 +0000 (18:10 +0100)]
tcl: convert transport select to jtag and swd

Convert every transport select command:
- hla_swd -> swd
- dapdirect_swd -> swd
- hla_jtag -> jtag
- dapdirect_jtag -> jtag

Change-Id: I81971e06f7aefd21a570a4e098cf3822a775464b
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8678
Reviewed-by: zapb <dev@zapb.de>
Tested-by: jenkins