]> www.infradead.org Git - users/borneoa/openocd-next.git/log
users/borneoa/openocd-next.git
2 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
2 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
2 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
2 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>
2 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>
2 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>
2 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>
2 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>
2 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>
2 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
2 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
2 months agotransport: allow transport name jtag/swd for hla and dapdirect
Antonio Borneo [Wed, 12 Feb 2025 15:30:46 +0000 (16:30 +0100)]
transport: allow transport name jtag/swd for hla and dapdirect

The transport used on adapter's wires is either 'jtag' or 'swd'
but, depending on the adapter, in the command 'transport select'
we have to use either 'jtag' or 'swd' or the similar 'hla_jtag',
'hla_swd', 'dapdirect_jtag' or 'dapdirect_swd'.
This becomes cumbersome when we just want to change adapter and we
get forced to modify the 'transport select' command too.

There is no reason for an adapter driver to support two of the
similar transports. In fact 'dapdirect' one is a superset of the
'hla', and the native 'jtag' or 'swd' is a superset of the
'dapdirect' one.
While the adapter could support more than one similar transports,
its adapter driver should only support the most complete of these
similar transports.

Modify the 'transport select' code to accept 'jtag' or 'swd' for
the 'dapdirect' and the 'hla' adapters too.
Issue a deprecated message for the old 'dapdirect' and 'hla'
transport names.
In command 'transport list', print only the transport names that
can be selected through 'transport select' skipping information
about 'dapdirect' and 'hla' versions and avoid duplicated entries.

This improvement was listed in the TODO file. Update it!

Change-Id: I626b50e7a94c141c042eab388cd1ffe77eb864c2
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8677
Tested-by: jenkins
2 months agotransport: store the transports sorted by alphabetic name order
Antonio Borneo [Tue, 31 Dec 2024 16:01:41 +0000 (17:01 +0100)]
transport: store the transports sorted by alphabetic name order

While this operation has no real interest so far, it will be used
later to avoid listing twice protocols with the same name.

Change-Id: I59f3634830f94dc992d28863cf29d5d869726918
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8685
Tested-by: jenkins
Reviewed-by: zapb <dev@zapb.de>
2 months agotransport: use helper/list.h for the list of transports
Antonio Borneo [Tue, 31 Dec 2024 15:29:46 +0000 (16:29 +0100)]
transport: use helper/list.h for the list of transports

No behavioral change, just use the list's helpers.

Change-Id: I69712648ef77689bfe6acc4811adad7293fb9009
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8684
Reviewed-by: zapb <dev@zapb.de>
Tested-by: jenkins
2 months agotransport: validate the transport id's from the driver
Antonio Borneo [Sun, 22 Dec 2024 22:59:19 +0000 (23:59 +0100)]
transport: validate the transport id's from the driver

Verify that it contains only valid transports.

While JTAG and SWD are the more permissive transports, the
respective 'dapdirect' versions are slightly limited, and the
respective 'hla' versions are even more limited.
A driver should not provide two version of the same transport.
Verify that only one JTAG and only one SWD transport is present.
Verify that the preferred transport is valid too.

Change-Id: Iace2f881dd65fc763e81b33e6a7113961a7008af
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8676
Tested-by: jenkins
Reviewed-by: zapb <dev@zapb.de>
Reviewed-by: Jan Matyas <jan.matyas@codasip.com>
2 months agoadapter: use bitmask for driver's transports
Antonio Borneo [Wed, 12 Feb 2025 15:39:18 +0000 (16:39 +0100)]
adapter: use bitmask for driver's transports

In every driver, replace the array of strings with a bitmask that
lists the supported transports.
Add an extra field to carry the former first listed transport as a
"preferred" transport. It would be used as default when no command
'transport select' is used. This keeps backward compatibility with
scripts that do not define the transport, relying on such default.

Change-Id: I4976583f1a38fdcc1f85045023dc7c629001f743
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8675
Tested-by: jenkins
Reviewed-by: zapb <dev@zapb.de>
2 months agotransport: use a bitmask for the transport
Antonio Borneo [Sun, 22 Dec 2024 16:06:12 +0000 (17:06 +0100)]
transport: use a bitmask for the transport

Move the transport's names in a local array in the transport
framework.

Replace the string struct transport::name, that identifies the
transport, with a bitmask where each bit corresponds to one of the
available transports.

Change-Id: I6bdf7264d5979c355299f63fcf80bf54dcd95cee
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8674
Tested-by: jenkins
Reviewed-by: zapb <dev@zapb.de>
2 months agotransport: deprecate auto-selection of transport
Antonio Borneo [Sat, 4 Jan 2025 15:54:14 +0000 (16:54 +0100)]
transport: deprecate auto-selection of transport

Historically, if the user does not specify a transport, OpenOCD
select automatically the first transport listed in the adapter
driver.
This auto-selection can behave differently by changing adapter,
so the transport should be enforced in the configuration file.

Deprecate the auto-selection and print a warning message when a
transport gets auto-selected.
There are two cases:
- adapter offers one transport only. The code early auto-selects
  the transport but does not print anything. If later the user
  selects the transport then no deprecation will be printed during
  'transport init';
- user runs 'transport select', e.g. in 'swj-dp' script, and this
  triggers the auto-selection and the deprecated message.

Change-Id: I2e55b9dcc6da77ca937978fbfb36bc365b803f0d
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8692
Reviewed-by: Jan Matyas <jan.matyas@codasip.com>
Reviewed-by: zapb <dev@zapb.de>
Tested-by: jenkins
2 months agoadapter: list supported transports beside adapter name
Antonio Borneo [Sat, 4 Jan 2025 17:41:41 +0000 (18:41 +0100)]
adapter: list supported transports beside adapter name

Modify the command 'adapter list' to output the list of transports
supported by each adapter driver.
Drop the line number, as there is no real interest on it.
Format the output as a TCL dictionary indexed by the adapter name
and containing the transports in a TCL list. E.g:
dummy          { jtag }
ftdi           { jtag swd }

This format is easily handled by TCL scripts, e.g.:
dict get [adapter list] ftdi

Document the command output.

Change-Id: I69f73b71da2f1756866a63bc2c0ba33459a29063
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8691
Tested-by: jenkins
2 months agoadapter: replace 'interface' with 'adapter driver'
Antonio Borneo [Sun, 16 Mar 2025 13:31:01 +0000 (14:31 +0100)]
adapter: replace 'interface' with 'adapter driver'

Comments and output strings still reference the term 'interface',
while 'adapter driver' should be used.

While there, drop the useless test if CMD_ARGV[0] is an empty
string, as this is not possible when CMD_ARGC > 0.

Change-Id: I7b46b5dd3cec53d8b5b7559d941ee9ae3bd1d89b
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8808
Tested-by: jenkins
Reviewed-by: zapb <dev@zapb.de>
2 months agotarget: stm8: drop include file stm8.h
Antonio Borneo [Sat, 19 Apr 2025 09:03:46 +0000 (11:03 +0200)]
target: stm8: drop include file stm8.h

The file stm8.h is only included by stm8.c and provides some basic
declaration that can be simply part of the C file.

Drop the file stm8.h and move its content in stm8.c
Replace the macro 'STM8_NUM_CORE_REGS' with the existing macro
'STM8_NUM_REGS'.

While there:
- drop the useless include of "hello.h".

Change-Id: Iecd1a27f0630cdbbfd51033d34aa3d468aa63464
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8856
Tested-by: jenkins
Reviewed-by: zapb <dev@zapb.de>
3 months agoflash/nor/rp2xxx: define macro BOOTROM_MAGIC_MASK
Tomas Vanek [Fri, 21 Mar 2025 20:56:39 +0000 (21:56 +0100)]
flash/nor/rp2xxx: define macro BOOTROM_MAGIC_MASK

and use it instead of magic value.

Change-Id: I5d006aaf990d4ef3a82e622b1e41cd2bfec359f7
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reported-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8810
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
3 months agoflash/nor/rp2xxx: fix LOG_xxx messages
Tomas Vanek [Fri, 21 Mar 2025 20:30:13 +0000 (21:30 +0100)]
flash/nor/rp2xxx: fix LOG_xxx messages

Use proper format specifiers for uint16_t and uint32_t arguments.
Use LOG_TARGET_DEBUG instead of target->cmd_name as a parameter.
Use command_print() in command handler.
Drop dots and new lines at end of messages.

Change-Id: I37c7d3680a352210b1d7e69f2c9b4ba0efe6ec15
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reported-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8809
Tested-by: jenkins
3 months agoflash/nor/rp2xxx: fix flash operation after halt in RISC-V bootsel
Luke Wren [Fri, 13 Dec 2024 20:56:45 +0000 (21:56 +0100)]
flash/nor/rp2xxx: fix flash operation after halt in RISC-V bootsel

Calling ROM API set_bootrom_stack() function allows ROM API functionality
after OpenOCD halt or reset halt in RISC-V bootloder (emulated ARM code)

Change-Id: I3b255738d61876e876a94207804d9cbe1a7593c2
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Signed-off-by: Luke Wren <luke@raspberrypi.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8729
Tested-by: jenkins
3 months agotcl/target/rp2040: add flash size override and reset init event
Tomas Vanek [Sat, 17 Aug 2024 14:21:06 +0000 (16:21 +0200)]
tcl/target/rp2040: add flash size override and reset init event

Allow flash size override and suppress flash size detection
by setting FLASHSIZE Tcl variable.

reset-init event calls 'connect XIP' ROM API function to make
flash content accessible at the XIP mapping memory area.

Ported from rp2350.cfg

Change-Id: I9b352b1ef6d4c6d4b78a6b61e900ce01355c8eff
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/8461
Reviewed-by: Jonathan Bell <jonathan@raspberrypi.com>
Tested-by: jenkins
3 months agoflash/nor/rp2xxx: fix endianness error
Tomas Vanek [Fri, 16 Aug 2024 21:35:06 +0000 (23:35 +0200)]
flash/nor/rp2xxx: fix endianness error

struct rp2xxx_rom_call_batch_record consists of uint32_t in the host
endianness. Therefore it should be converted to the target endianness
not just simply copied by target_write_buffer().

Concatenate algo code, converted batch records and terminator
to the host resident buffer and copy it at once to the target and
save some adapter turnaround times.

While on it remove typedef rp2xxx_rom_call_batch_record_t

Change-Id: I0e698396003869bee5dde4141d48ddd7d62b3cbc
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/8460
Reviewed-by: Jonathan Bell <jonathan@raspberrypi.com>
Tested-by: jenkins
3 months agoflash/nor/rp2xxx: drop couple of Java-like const
Tomas Vanek [Fri, 16 Aug 2024 20:53:36 +0000 (22:53 +0200)]
flash/nor/rp2xxx: drop couple of Java-like const

The compiler knows what variable remains constant during its lifetime
and there is no need to emphasise constantness.

Change-Id: Ib515f96a3c77afea87274f33b8ccac7a71bfb932
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/8459
Tested-by: jenkins
Reviewed-by: Jonathan Bell <jonathan@raspberrypi.com>
3 months agoflash/nor/rp2xxx: minor code improvements
Tomas Vanek [Wed, 14 Aug 2024 15:43:13 +0000 (17:43 +0200)]
flash/nor/rp2xxx: minor code improvements

Add error messages and proper error propagation.
Type cleaning.
Use saved chip id.
Cosmetics: separating lines added.

Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Change-Id: I151e684e1fbfc9476ec429036caf85f4c9329547
Reviewed-on: https://review.openocd.org/c/openocd/+/8457
Tested-by: jenkins
Reviewed-by: Jonathan Bell <jonathan@raspberrypi.com>
3 months agodoc: document changes in rp2xxx flash driver
Tomas Vanek [Wed, 14 Aug 2024 15:14:17 +0000 (17:14 +0200)]
doc: document changes in rp2xxx flash driver

Namely the driver name changed from rp2040_flash and added RP2350 support.

Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Change-Id: I2ec9e62786002d71f655dbe0edc9f2e9ac4141b7
Reviewed-on: https://review.openocd.org/c/openocd/+/8456
Tested-by: jenkins
3 months agoflash/nor/rp2040: refactoring: change rp2040 to rp2xxx
Tomas Vanek [Wed, 14 Aug 2024 09:29:21 +0000 (11:29 +0200)]
flash/nor/rp2040: refactoring: change rp2040 to rp2xxx

While on it use calloc() instead of malloc()/memset()
Drop useless implementation of rp2040_flash_free_driver_priv()
- exactly same as default_flash_free_driver_priv()
Code style fixes forced by checkpatch

Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Change-Id: I5c56c4a7d586c0dcab164a45e8f6200ea9a3bd1d
Reviewed-on: https://review.openocd.org/c/openocd/+/8455
Tested-by: jenkins
3 months agoflash/nor/rp2040: refactor finalizing calls and use them after erase
Tomas Vanek [Wed, 14 Aug 2024 08:47:36 +0000 (10:47 +0200)]
flash/nor/rp2040: refactor finalizing calls and use them after erase

Invalidate cache and restore flash XIP mode after erase and also
in error cleanup after write/erase.

Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Change-Id: If7e0c2d75f50f923e6bcbf0aa7bab53fe91b6cc8
Reviewed-on: https://review.openocd.org/c/openocd/+/8454
Tested-by: jenkins
3 months agoflash/nor/rp2040: improve flash write buffer size computation
Tomas Vanek [Wed, 14 Aug 2024 08:41:55 +0000 (10:41 +0200)]
flash/nor/rp2040: improve flash write buffer size computation

While on it:
Define the names for the fixed flash page/sector sizes and use them
instead of magic values.
Fix memory leak on error return.

Partially backported from former upstream rp2040.c

Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Change-Id: If51c912f4d381ee47756a70f616ecdbee1ac0da7
Reviewed-on: https://review.openocd.org/c/openocd/+/8453
Tested-by: jenkins
3 months agoflash/nor/rp2040: add missing TARGET_HALTED checks
Tomas Vanek [Wed, 14 Aug 2024 07:39:42 +0000 (09:39 +0200)]
flash/nor/rp2040: add missing TARGET_HALTED checks

Flash erase and write require this guard, unfortunately it is also
partially needed in the flash probe.

Partially backported from former upstream rp2040.c

Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Change-Id: Ie8a240e66c3ed68e08f872cbbfdd90a6d80e1f1e
Reviewed-on: https://review.openocd.org/c/openocd/+/8452
Tested-by: jenkins
3 months agoflash/nor/rp2040: detect flash size including SFDP
Tomas Vanek [Wed, 14 Aug 2024 07:10:31 +0000 (09:10 +0200)]
flash/nor/rp2040: detect flash size including SFDP

Also keep size override by FLASHSIZE Tcl variable possible.

Partially backported from former upstream rp2040.c

Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Change-Id: I224c3644450e8b46e35714bfc5436219ffdee563
Reviewed-on: https://review.openocd.org/c/openocd/+/8451
Tested-by: jenkins
3 months agotcl/target/rp2350: workarounds for ROM API issues
Tomas Vanek [Tue, 13 Aug 2024 14:23:20 +0000 (16:23 +0200)]
tcl/target/rp2350: workarounds for ROM API issues

A0 chip: remove pad isolation
A2 chip: instead of reset init fixes we will fix the flash driver
with the following patch by Luke Wren:
8729: flash/nor/rp2xxx: fix flash operation after halt in RISC-V bootsel
https://review.openocd.org/c/openocd/+/8729

I don't have A1 version to test.

Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Change-Id: I9e9fab04ead929fe6e0a17c6c2f32a6f02e9beb9
Reviewed-on: https://review.openocd.org/c/openocd/+/8450
Tested-by: jenkins
3 months agotcl/target/rp2350: universal config for any combination of CM/RV cores
Tomas Vanek [Sun, 11 Aug 2024 13:03:05 +0000 (15:03 +0200)]
tcl/target/rp2350: universal config for any combination of CM/RV cores

RP2350 has 2 slots where either Cortex-M33 or RISC-V can be selected.
Tcl variable USE_CORE selects what cores will be configured for debug.

Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Change-Id: I56fe1aa94304bdfd1ec98bba57cc3fa792a35f69
Reviewed-on: https://review.openocd.org/c/openocd/+/8449
Tested-by: jenkins
3 months agoflash/nor/rp2040: flash bank target switching for RP2350
Tomas Vanek [Sat, 10 Aug 2024 14:10:43 +0000 (16:10 +0200)]
flash/nor/rp2040: flash bank target switching for RP2350

RP2350 can switch either core to Cortex-M33 or RISC-V.
The different architectures have to be supported as
distinct targets in OpenOCD.

Introduce 'rp2xxx _switch target' Tcl command to adapt flash
bank to architecture changes.

Keep the target and priv pointers intact until a flash operation
is finished to prevent sudden change in the middle of write/erase.

Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Change-Id: I764354ab469e253042128958dfe70c09d04d6411
Reviewed-on: https://review.openocd.org/c/openocd/+/8448
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 months agoflash/nor/rp2040: allow arbitrary ROM API call from Tcl
Tomas Vanek [Wed, 17 Jul 2024 09:49:55 +0000 (11:49 +0200)]
flash/nor/rp2040: allow arbitrary ROM API call from Tcl

The new flash command could be handy for a reboot to BOOTSEL mode
and for making (Q)SPI flash content visible at 0x10xxxxxx
address mapping area after a rescue reset.

Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Change-Id: I1b532afcc41a4051298313e685658e86c02c53f9
Reviewed-on: https://review.openocd.org/c/openocd/+/8447
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
3 months agoflash/nor/rp2040: allow flash size override from cfg
Tomas Vanek [Tue, 6 Aug 2024 15:39:44 +0000 (17:39 +0200)]
flash/nor/rp2040: allow flash size override from cfg

Do not enforce hard-wired size 32 MiB

Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Change-Id: I54608f75cc13996fda38ebd5d330e3b1893c2fd9
Reviewed-on: https://review.openocd.org/c/openocd/+/8446
Tested-by: jenkins
Reviewed-by: Jonathan Bell <jonathan@raspberrypi.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 months agoflash/nor/rp2040: Fix incorrect erase bounds calculation
Luke Wren [Tue, 6 Aug 2024 10:57:04 +0000 (11:57 +0100)]
flash/nor/rp2040: Fix incorrect erase bounds calculation

when erase region does not start at 0

Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Signed-off-by: Luke Wren <luke@raspberrypi.com>
Change-Id: I2b9db61e8ac837b6c6431aacf3b73ed3a1772fbc
Reviewed-on: https://review.openocd.org/c/openocd/+/8445
Tested-by: jenkins
Reviewed-by: Jonathan Bell <jonathan@raspberrypi.com>
3 months agoflash/nor/rp2040: Avoid ROM call timeout on long erases by splitting into chunks
Luke Wren [Thu, 25 Jul 2024 09:55:41 +0000 (10:55 +0100)]
flash/nor/rp2040: Avoid ROM call timeout on long erases by splitting into chunks

Also add keep_alive() to erase/program to avoid nasty GDB message.

TV: Fixed style problems.

Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Signed-off-by: Luke Wren <luke@raspberrypi.com>
Change-Id: Ibb18775aeed192361ae1585bfdaad03760583cf3
Reviewed-on: https://review.openocd.org/c/openocd/+/8444
Tested-by: jenkins
Reviewed-by: Jonathan Bell <jonathan@raspberrypi.com>
3 months agoflash/nor/rp2040: Fix up ROM table lookup for RP2350 A2
Luke Wren [Fri, 28 Jun 2024 15:41:48 +0000 (16:41 +0100)]
flash/nor/rp2040: Fix up ROM table lookup for RP2350 A2

which has 16-bit well-known pointers.

Change-Id: Ia0838a0b062f73a9c5751abb48f1b4d55100bd1d
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Signed-off-by: Luke Wren <luke@raspberrypi.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8443
Reviewed-by: Jonathan Bell <jonathan@raspberrypi.com>
Tested-by: jenkins
3 months agoflash/nor/rp2040: RP2350 A1 changes
graham sanderson [Sun, 24 Mar 2024 23:33:24 +0000 (18:33 -0500)]
flash/nor/rp2040: RP2350 A1 changes

TV: cortex_m.c changes removed.

Change-Id: I85830f2d64f8afb86690737f9ae70dde5e6143e1
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Signed-off-by: graham sanderson <graham.sanderson@raspberrypi.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8442
Tested-by: jenkins
3 months agoflash/nor/rp2040: Add RISC-V ROM algorithm batch call support
Luke Wren [Wed, 14 Jul 2021 15:36:13 +0000 (16:36 +0100)]
flash/nor/rp2040: Add RISC-V ROM algorithm batch call support

And add support for A1 ROM table.

TV: cortex_m smp change removed.
Fixed style problems.
'uint' replaced by unsigned int

Change-Id: Iff2710fa0734dc7074d8d490d8fae43dc27c0c2a
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Signed-off-by: Luke Wren <wren6991@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8441
Tested-by: jenkins
3 months agoflash/nor/rp2040: add RP2350 support
graham sanderson [Fri, 3 Nov 2023 20:55:41 +0000 (15:55 -0500)]
flash/nor/rp2040: add RP2350 support

TV: Extracted RP2040/2350 flash driver part only.
Fixed style problems.

Change-Id: I88a7d5aa0a239ae93d72bd5671686b19c6ca11ad
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Signed-off-by: graham sanderson <graham.sanderson@raspberrypi.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8440
Tested-by: jenkins
3 months agoflash: stellaris: fix deprecated command
Antonio Borneo [Sun, 6 Apr 2025 12:59:50 +0000 (14:59 +0200)]
flash: stellaris: fix deprecated command

The driver directly runs a TCL command that has been renamed with
commit 4d99e77419e3 ("jtag/hla: Restructure commands"), while the
original name has been deprecated.

Update the TCL command to the new syntax.

Change-Id: I2fc9ef9a209bae1d78951e253d54164b2ac00cdd
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Fixes: 4d99e77419e3 ("jtag/hla: Restructure commands")
Reviewed-on: https://review.openocd.org/c/openocd/+/8832
Reviewed-by: zapb <dev@zapb.de>
Tested-by: jenkins
3 months agotcl/target: Add RCPU support for Spacemit K1
Junhui Liu [Wed, 26 Mar 2025 15:05:39 +0000 (23:05 +0800)]
tcl/target: Add RCPU support for Spacemit K1

Add support for the Real-Time CPU (RCPU) of K1, which is a 32-bit RISC-V
N308 High-Efficiency Processor Core designed by Nuclei System Technology
Co. Ltd.

The JTAG interface can be configured to connect to either X60s or RCPU
processors. To enable JTAG for RCPU, set TARGET to "rcpu".

For example:
openocd -c "set TARGET rcpu" -f interface/cmsis-dap.cfg \
        -f target/spacemit-k1.cfg

Change-Id: I9cd62fac332137afac17efa52702818de8f0b6f5
Signed-off-by: Junhui Liu <junhui.liu@pigmoral.tech>
Reviewed-on: https://review.openocd.org/c/openocd/+/8821
Reviewed-by: liangzhen <zhen.liang@spacemit.com>
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 months agoflash/stm32l4x: support STM32C05/09x devices
HAOUES Ahmed [Tue, 25 Mar 2025 13:29:30 +0000 (14:29 +0100)]
flash/stm32l4x: support STM32C05/09x devices

STM32C05/09x devices are similar to STM32C03/07x devices

Change-Id: I77c803356c32f06699c14622828585609c90a136
Signed-off-by: HAOUES Ahmed <ahmed.haoues@st.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8618
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
3 months agotarget: drop unused parameter to target_create()
Antonio Borneo [Sun, 6 Apr 2025 12:10:28 +0000 (14:10 +0200)]
target: drop unused parameter to target_create()

The parameter Jim_Interp to the target API target_create() is not
used by any target.

Drop it.

Change-Id: I67c492078a6c808db974505f9e297c45165f64d0
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8831
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
3 months agotarget: rewrite function target_configure() as COMMAND_HELPER
Antonio Borneo [Sun, 3 Dec 2023 14:41:27 +0000 (15:41 +0100)]
target: rewrite function target_configure() as COMMAND_HELPER

The function target_configure() is used by the commands
'target create', 'configure' and 'cget', already rewritten as
COMMAND_HANDLER.

Rewrite the common function as COMMAND_HELPER.
While there:
- fix the check on arguments, even if it should be coded better;
- keep jimtcl code for target_type::target_jim_configure() and for
  rtos_create(); these would be rewritten later on.

Change-Id: I7e5699ca6d124e34d3b2199714e3ce584bfcce80
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8829
Tested-by: jenkins
3 months agotarget: rewrite commands 'configure' and 'cget' as COMMAND_HANDLER
Antonio Borneo [Sat, 2 Dec 2023 22:40:56 +0000 (23:40 +0100)]
target: rewrite commands 'configure' and 'cget' as COMMAND_HANDLER

Rewrite only the command, but still use the old jimtcl specific
code shared with 'target create'.

Change-Id: Ie5e1c9eb237531121c2d143d1732cf281dfdc9ff
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8828
Tested-by: jenkins
3 months agotarget: rewrite command 'target create' as COMMAND_HANDLER
Antonio Borneo [Sat, 2 Dec 2023 22:01:44 +0000 (23:01 +0100)]
target: rewrite command 'target create' as COMMAND_HANDLER

Rewrite only the command, but still use the old jimtcl specific
code shared with 'configure' and 'cget'.

Change-Id: I7cf220e494f0ebbf123f8075b1feb9251fd7f569
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8827
Tested-by: jenkins
3 months agotarget: rewrite command 'invoke-event' as COMMAND_HANDLER
Antonio Borneo [Sat, 2 Dec 2023 17:40:47 +0000 (18:40 +0100)]
target: rewrite command 'invoke-event' as COMMAND_HANDLER

The command shares with command 'target create' the
struct jim_nvp nvp_target_event[]

- Convert the 'struct jim_nvp' in 'struct nvp'.
- Create an alias 'struct jim_nvp' to decouple the commands
  'invoke-event' and 'target create', abusing the fact that the
  actual layout of the two struct's type is the same. This alias
  will be dropped in a following change.
- Rewrite the command 'invoke-event' and the helper function
  target_event_name().

Change-Id: I537732fe4c08042cc02bcd0f72142254d7968fa6
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8826
Tested-by: jenkins
3 months agotarget: don't free working areas during 'configure -chain-position'
Antonio Borneo [Sat, 5 Apr 2025 23:20:44 +0000 (01:20 +0200)]
target: don't free working areas during 'configure -chain-position'

Since commit ef1cfb23947b ("Duane Ellis: "target as an [tcl]
object" feature.") merged in 2008, the commands:
$target_name configure -chain-position ...
target create ... -chain-position ...
cause the allocated working area to be freed.

There is no reason for this, it is probably caused by an incorrect
copy/paste from the author.

Drop the call to target_free_all_working_areas().

Change-Id: I61a9303afe7fee6953669218330635c0b965b20d
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8825
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
3 months agolist: silent scan-build false positive
Antonio Borneo [Sat, 5 Apr 2025 15:04:43 +0000 (17:04 +0200)]
list: silent scan-build false positive

With commit c023534e7b6f ("target: use list for target events")
scan build incorrectly states that list_add() would be called with
the field 'next' of the parameter 'head' (thus 'head->next') set
to NULL. Then, list_add() would call linux_list_add() with the
parameter 'next' set to NULL that will cause a NULL dereference.

While this can really happen with broken code, it's not the case
with the code from the change above.

Add assert() in linux_list_add() to silent scan build on this
false positive and to detect future incorrect use of the list.

Change-Id: Iec7f3d70237312b646ac58f76ecaab2fa25eab41
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8824
Tested-by: jenkins
3 months agocommand: rewrite command 'capture' as COMMAND_HANDLER
Antonio Borneo [Sat, 2 Dec 2023 16:34:57 +0000 (17:34 +0100)]
command: rewrite command 'capture' as COMMAND_HANDLER

While there, use Jim_EvalObj() to execute the subcommand, so any
error will correctly report the TCL file and the line number that
have originated the error, instead of the silly:
> capture {bogus command}
command.c:703: Error: invalid command name "bogus"
at file "command.c", line 703

Change-Id: Ic75a6146d6cedf49e808d98501fa1a7d4235b58a
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8587
Tested-by: jenkins
3 months agocommand: rewrite command 'command mode' as COMMAND_HANDLER
Antonio Borneo [Sat, 2 Dec 2023 16:06:17 +0000 (17:06 +0100)]
command: rewrite command 'command mode' as COMMAND_HANDLER

Another step to drop jim_handler.

Change-Id: I85cb567386a5aceb36aa273f8b66cbfd4a637c3f
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8586
Tested-by: jenkins
Reviewed-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
3 months agoMakefile.am: Use SOURCE_DATE_EPOCH environment variable
Sofiane HAMAM [Fri, 28 Mar 2025 11:31:17 +0000 (12:31 +0100)]
Makefile.am: Use SOURCE_DATE_EPOCH environment variable

This package defines PKGBLDDATE as build timestamp which makes
it non reproducible. Use SOURCE_DATE_EPOCH if it is found, otherwise
use build timestamp. Following best practices, see :
https://reproducible-builds.org/docs/source-date-epoch/

The patch is BSD compatible too.

Change-Id: I26c1a00f2e8059ae31fe72a794b5962af5a84f44
Co-developed-by: Yoann Congal <yoann.congal@smile.fr>
Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
Signed-off-by: Sofiane HAMAM <sofiane.hamam@smile.fr>
Reviewed-on: https://review.openocd.org/c/openocd/+/8619
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
Tested-by: jenkins
3 months agoconfigure.ac: show the rshim adapter in the config summary
R. Diez [Sat, 22 Mar 2025 22:35:23 +0000 (23:35 +0100)]
configure.ac: show the rshim adapter in the config summary

Also enable this adapter by default (auto).

Change-Id: Ic302041ecb9e88ca58b03f9675fa92fb3d558821
Signed-off-by: R. Diez <rdiezmail-openocd@yahoo.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8811
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
3 months agoconfigure.ac: show the Remote Bitbang driver in the config summary
R. Diez [Sun, 23 Mar 2025 21:04:20 +0000 (22:04 +0100)]
configure.ac: show the Remote Bitbang driver in the config summary

Also enable this driver by default (auto).

Change-Id: I112d6c8c0796d0dc464651feb1f7f81fa8b93910
Signed-off-by: R. Diez <rdiezmail-openocd@yahoo.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8817
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
3 months agotarget: remove events that are set to empty string
Antonio Borneo [Sun, 23 Mar 2025 14:27:37 +0000 (15:27 +0100)]
target: remove events that are set to empty string

Current code allows replacing the body of an existing event, but
it doesn't provides a way to remove it.
Replacing the event with an empty string makes the event still
present and visible through
$target_name eventlist

The presence of empty events makes more complex checking for the
event not set or set to empty.

Remove the event when set to empty string.

While there, add 'Jim_Length' to the list of allowed CamelCase
symbols, avoiding the associated checkpatch error.

Change-Id: I1ec2e1a71d298a0eba0b6863902645bcc6c4cb09
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8814
Tested-by: jenkins
3 months agotarget: use list for target events
Antonio Borneo [Sun, 23 Mar 2025 11:09:28 +0000 (12:09 +0100)]
target: use list for target events

To simplify removing an event when it's set to an empty string,
switch event list from hardcoded simply linked list to helper's
double linked list.

While there, move the declaration of struct target_event_action
in 'target.c' as it is not anymore visible outside.

Change-Id: I799754c80055dc6d22db55aca483757e833714ff
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8813
Tested-by: jenkins
3 months agotarget: fix memory leak in handle_target_write_memory()
Antonio Borneo [Sat, 29 Mar 2025 21:51:59 +0000 (22:51 +0100)]
target: fix memory leak in handle_target_write_memory()

Commit f55ec6d44922 ("target: rewrite command 'write_memory' as
COMMAND_HANDLER") adds a new return statement without freeing the
allocated buffer.

Add the needed free().

Fixes: f55ec6d44922 ("target: rewrite command 'write_memory' as COMMAND_HANDLER")
Change-Id: I676d658118b32f4d7cc71eda3436bb52f1966cd8
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8822
Tested-by: jenkins
3 months agotcl/target/nordic/nrf54l: minor corrections
Tomas Vanek [Tue, 11 Feb 2025 16:59:00 +0000 (17:59 +0100)]
tcl/target/nordic/nrf54l: minor corrections

Add SWD multidrop setting.
Fix the name of AP #1 to AUX-AP
Set AUX-AP CSW Prot bit[0] to make RISC-V debug accessible on AUX-AP.

Change-Id: I496e07acfe90dd858e4403176a8330d8c1a0b560
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/8752
Tested-by: jenkins
Reviewed-by: zapb <dev@zapb.de>
4 months agotarget: rewrite command 'get_reg' as COMMAND_HANDLER
Antonio Borneo [Sat, 2 Dec 2023 14:04:09 +0000 (15:04 +0100)]
target: rewrite command 'get_reg' as COMMAND_HANDLER

Print one register per line. Repeated registers will be printed
each time.
While there, fix the 'usage' string.

Change-Id: I4eb21696705bdf15cd2cb7a4a9caa41f9ffdbf64
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8583
Tested-by: jenkins
Reviewed-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
4 months agotarget/aarch64: Cleanup on exit
Adrien Grassein [Thu, 18 Jan 2024 10:54:15 +0000 (11:54 +0100)]
target/aarch64: Cleanup on exit

Restore target configuration on exit so that OpenOCD get correct values
when restarting.

Change-Id: I8cbba1fdae1d3c4a580197b7a97691443780ed06
Signed-off-by: Adrien Grassein <agrassein@nanoxplore.com>
Signed-off-by: Adrien Charruel <acharruel@nanoxplore.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8654
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
4 months agotcl/target: Add Renesas R-Car Gen4 R8A779G0 V4H and R8A779H0 V4M targets
Marek Vasut [Thu, 22 Aug 2024 23:29:12 +0000 (01:29 +0200)]
tcl/target: Add Renesas R-Car Gen4 R8A779G0 V4H and R8A779H0 V4M targets

Add support for Renesas R-Car Gen4 R8A779G0 V4H and R8A779H0 V4M SoCs.
Those contain 4x CA76 and 3x CR52 cores.

Change-Id: I4a701f0fec4dd574fc099a221d464ccc55db6252
Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8807
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
4 months agotarget: drop last instances of 'target->cmd_name'
Antonio Borneo [Sun, 16 Mar 2025 10:50:04 +0000 (11:50 +0100)]
target: drop last instances of 'target->cmd_name'

The helper function 'target_name()' or, better, the log functions
'LOG_TARGET_xxx(target, ...)' should be used in place of taking
the target name directly from 'target->cmd_name'.

Replace the remaining instances in the code.

While there:
- address some indentation,
- drop trailing punctuation in log message,
- replace one LOG WARNING with LOG_TARGET_WARNING.

Change-Id: Ie6cf4c174ffe91b975c983e4697c735766267041
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8806
Tested-by: jenkins
Reviewed-by: zapb <dev@zapb.de>
4 months agotarget/armv8: Handle instruction cache invalidate
Adrien Grassein [Thu, 18 Jan 2024 10:58:38 +0000 (11:58 +0100)]
target/armv8: Handle instruction cache invalidate

Some armv8 target have separate i-cache and d-cache.
The actual code only handles the flush of the d-cache.

Change-Id: I61a223b43c71646bbbed8fa63825360c67700988
Signed-off-by: Adrien Grassein <agrassein@nanoxplore.com>
Signed-off-by: Adrien Charruel <acharruel@nanoxplore.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8655
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
4 months agoflash/stm32l4x: support STM32U5F/U5Gx devices
HAOUES Ahmed [Wed, 12 Mar 2025 13:37:46 +0000 (14:37 +0100)]
flash/stm32l4x: support STM32U5F/U5Gx devices

STM32U5F/U5Gx devices are similar to STM32U59/U5Ax devices
while at there update STM32U5xx revisions

Change-Id: I4f1c302cc91739a89cf4869401e9f5015dbc72b9
Signed-off-by: HAOUES Ahmed <ahmed.haoues@st.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8616
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
4 months agocommand: factorize jim_command_mode()
Antonio Borneo [Sat, 2 Dec 2023 15:50:14 +0000 (16:50 +0100)]
command: factorize jim_command_mode()

During 'help' dump, to determine the mode (e.g. COMMAND_CONFIG) of
a command, the current code executes the OpenOCD TCL command
"command mode", while it could directly call the implementation of
the TCL command above.

Factorize jim_command_mode() and call the inner implementation
instead of executing "command mode".

Change-Id: Id8c33d0ed1373b5744dcc3ac354c3e0a88576f75
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8585
Reviewed-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
Tested-by: jenkins
4 months agotarget: rewrite command 'write_memory' as COMMAND_HANDLER
Antonio Borneo [Sat, 2 Dec 2023 13:21:42 +0000 (14:21 +0100)]
target: rewrite command 'write_memory' as COMMAND_HANDLER

While there:
- drop the command name from the error messages;
- check the returned value from Jim_GetWide() to detect incorrect
  numeric values.

Change-Id: I399402ac11b6d459f1771e59e44210aef3e2a637
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8582
Tested-by: jenkins
Reviewed-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
4 months agotarget: read_memory: drop command name from error messages
Antonio Borneo [Sat, 23 Nov 2024 17:35:51 +0000 (18:35 +0100)]
target: read_memory: drop command name from error messages

The error message should not report the command name as it
should be already clear from the context.

Change-Id: I219e31be808bf6ff1924ce60f3025fb48ed7b125
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8803
Tested-by: jenkins
4 months agohelper: command: return correct error on command 'echo'
Antonio Borneo [Sat, 23 Nov 2024 17:15:40 +0000 (18:15 +0100)]
helper: command: return correct error on command 'echo'

In case of incorrect syntax, return ERROR_COMMAND_SYNTAX_ERROR so
the command framework will print the usage string.

Change-Id: I348debc77f470551d54fa77b4da780a48ff539c0
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8802
Tested-by: jenkins
4 months agotarget/armv8: regularly send keep_alive packet.
Adrien Grassein [Thu, 18 Jan 2024 14:12:12 +0000 (15:12 +0100)]
target/armv8: regularly send keep_alive packet.

Flushing all d-cache may be a long operation.
We need to send keep_alive regularly to keep the connection alive.
If not done a warning is emitted.

Change-Id: I52c3ee9a9f9b8a1dc0b8d5439e8b71212f56165a
Signed-off-by: Adrien Grassein <agrassein@nanoxplore.com>
Signed-off-by: Adrien Charruel <acharruel@nanoxplore.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8659
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
4 months agotcl/ngultra: Use newly created armv8r target
Adrien Grassein [Thu, 18 Jan 2024 11:04:02 +0000 (12:04 +0100)]
tcl/ngultra: Use newly created armv8r target

ngultra cores are cortex-r52, so use armv8r target now its created.

Change-Id: If2d22593ab1e200ac15e7b883c70937acf1d2a59
Signed-off-by: Adrien Grassein <agrassein@nanoxplore.com>
Signed-off-by: Adrien Charruel <acharruel@nanoxplore.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8658
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
4 months agoadapter: simplify command 'adapter list'
Antonio Borneo [Sat, 30 Nov 2024 23:01:00 +0000 (00:01 +0100)]
adapter: simplify command 'adapter list'

The code of command 'adapter list' is called by command 'adapter
driver' to list the available drivers in case of error.
This dual possible entry points require a conditional check on the
number of command line arguments, reducing the code readability.

Split the command in a simpler code for the command 'adapter list'
that only checks the command line, and move in a common helper the
code that list the drivers.

While there, fix the output and the comments to report 'adapter
driver' instead of 'debug adapters'; we are not parsing the HW to
know which adapter is present.

Change-Id: I17538e86dc4a31a9589d404e49dcc65a29393390
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8672
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
4 months agoadapter: drop command 'adapter transports'
Antonio Borneo [Sun, 22 Dec 2024 16:13:59 +0000 (17:13 +0100)]
adapter: drop command 'adapter transports'

The commit 93f2afa45f4c ("initial "transport" framework") that
added the transport framework in 2010 was overly optimistic on the
possibility to dynamically add, at runtime, a new adapter and to
specify with the command 'adapter transports' the list of the
transports supported by the new adapter.

Such feature has never become part of OpenOCD, and the command
above has never become useful nor ever been used.

Drop the command 'adapter transports' and its documentation.
Drop the helper 'transport_list_parse', now unused.

Change-Id: Ie3d71c74d068fba802839b116bb9bc9af77cc83d
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8671
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
4 months agodoc: drop mention of not implemented SPI transport
Antonio Borneo [Mon, 23 Dec 2024 19:59:28 +0000 (20:59 +0100)]
doc: drop mention of not implemented SPI transport

The commit 93f2afa45f4c ("initial "transport" framework") adds a
dedicated chapter in the documentation about a possible SPI
transport for flashing.
This transport has never been part of OpenOCD and should not be
listed in the documentation.

Drop the chapter.

Change-Id: I9b406754399abda4dc7c2f8cf09dd47730a7e1d9
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8670
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
4 months agohelper/log: mark `fmt` argument of `alloc_vprintf()` as format string
Evgeniy Naydanov [Fri, 14 Feb 2025 16:20:58 +0000 (19:20 +0300)]
helper/log: mark `fmt` argument of `alloc_vprintf()` as format string

Building on Ubuntu 22.04 with `-fsanitize=undefined` (GCC 12.3.0)
results in an error:
Checkpatch-ignore: COMMIT_LOG_LONG_LINE
```
In file included from /usr/include/stdio.h:894,
                 from <openocd>/src/helper/system.h:23,
                 from <openocd>/src/helper/replacements.h:18,
                 from <openocd>/src/helper/log.c:20:
In function ‘vsnprintf’,
    inlined from ‘alloc_vprintf’ at <openocd>/src/helper/log.c:347:8:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:85:10: error: null format string [-Werror=format-truncation=]
   85 |   return __builtin___vsnprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   86 |                                     __glibc_objsize (__s), __fmt, __ap);
      |                                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
```

The error mentiones the call site `src/helper/log.c:347`. There
`vsnprintf()` is called passing `fmt` as format string.

To mitigate this, mark the format string with the corresponding
attribute in `alloc_vprintf()`

Change-Id: I91011490715998ef5a931c19c3c9d74a1a304e5d
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8764
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
4 months agobcm2835gpio.c: change adapter init order
R. Diez [Sun, 3 Nov 2024 11:24:20 +0000 (12:24 +0100)]
bcm2835gpio.c: change adapter init order

Make also sure that the struct bitbang_interface with callbacks
that we pass to the bitbang driver is const.

Change-Id: I954014f062d6d9185db45f5fbd2ad0b0955aab82
Signed-off-by: R. Diez <rdiezmail-openocd@yahoo.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8536
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
4 months agoconfigure.ac: show the JTAG DPI and VPI adapters in the config summary
R. Diez [Sun, 16 Feb 2025 18:59:27 +0000 (19:59 +0100)]
configure.ac: show the JTAG DPI and VPI adapters in the config summary

Also enable these adapters by default (auto).

Change-Id: Icbbcd470eaf1d1bfb33900885776c1dbd0cccb5f
Signed-off-by: R. Diez <rdiezmail-openocd@yahoo.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8758
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
4 months agortos/linux: fix name overwrite in `linux_thread_extra_info()`
Evgeniy Naydanov [Fri, 14 Feb 2025 16:31:38 +0000 (19:31 +0300)]
rtos/linux: fix name overwrite in `linux_thread_extra_info()`

commit 908ee4dc9641bd3df2eb00264575501867da539d ("build: remove clang
unused variable assignment warnings") introduced an error:
```
-            tmp_str_ptr += sprintf(tmp_str_ptr, "%s", name);
+            sprintf(tmp_str_ptr, "%s", name);
             sprintf(tmp_str_ptr, "%s", temp->name);
```
This results in `name` being overwritten by `temp->name`.
Fix this, adding OOM handling along the way.

Change-Id: Id41f73247c3f7e6194d7c92187ad3163a9ea6c89
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8761
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
4 months agotarget/arm_adiv5: print DAP name if not found
Marc Schink [Wed, 4 Dec 2024 07:26:04 +0000 (08:26 +0100)]
target/arm_adiv5: print DAP name if not found

If a DAP is not found, include its name in the error message.

Change-Id: Icffc52894a1c5573f938b1f3e3b53441167f085e
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8636
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
4 months agotcl/board: Add TI AM261 launchpad config
Shivasharan Nagalikar [Fri, 21 Feb 2025 11:03:37 +0000 (16:33 +0530)]
tcl/board: Add TI AM261 launchpad config

Add basic connection details with AM261 Launchpad.

For further details, see https://www.ti.com/tool/LP-AM261

Signed-off-by: Shivasharan Nagalikar <shivasharan.nagalikar@ti.com>
Change-Id: Ibf1270a8e470cc6ab5846dc3da64e451a8a769fd
Reviewed-on: https://review.openocd.org/c/openocd/+/8793
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
Reviewed-by: Nishanth Menon <nm@ti.com>
4 months agotcl/target/ti_k3: Add support for AM261
Shivasharan Nagalikar [Wed, 19 Feb 2025 08:28:43 +0000 (13:58 +0530)]
tcl/target/ti_k3: Add support for AM261

AM261[1] is a optimized cutdown of AM263P SoC. The key difference is
the reduced number of R5F cores which is now dropped down to 2, and
the DIE ID is different from AM263p, but all other definitions are
compatible, so reuse the definition.

[1] https://www.ti.com/product/AM2612

Change-Id: Ib6ca0b59d0b8991df6e4ab349d371187438cb393
Signed-off-by: Shivasharan Nagalikar <shivasharan.nagalikar@ti.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8792
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Nishanth Menon <nm@ti.com>
Tested-by: jenkins
4 months agotcl/board: Add TI AM263P launchpad config
Shivasharan Nagalikar [Fri, 21 Feb 2025 11:01:03 +0000 (16:31 +0530)]
tcl/board: Add TI AM263P launchpad config

Add basic connection details with AM263P Launchpad

For further details, see: https://www.ti.com/tool/LP-AM263P

Change-Id: I7232a0b9337583eab499bc72929bd059624b4ff1
Signed-off-by: Shivasharan Nagalikar <shivasharan.nagalikar@ti.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8771
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Nishanth Menon <nm@ti.com>
Tested-by: jenkins
4 months agotcl/target/ti_k3: Add support for AM263P
Shivasharan Nagalikar [Wed, 19 Feb 2025 08:27:35 +0000 (13:57 +0530)]
tcl/target/ti_k3: Add support for AM263P

AM263P[1] adds additional features to AM263 SoC. [2] provides a
detailed list of differences, however, the key difference from
processor usage perspective is the increased SRAM and Remote L2(RL2)
Cache for improved performance of R5F. To differentiate the DIE ID
is different, however rest of the processor description remain
compatible to AM263, hence reuse the definition.

[1] https://www.ti.com/product/AM263P4
[2] https://www.ti.com/lit/pdf/spradb3

Change-Id: If47935caf1f995d7e606547e0d6545c39544678a
Signed-off-by: Shivasharan Nagalikar <shivasharan.nagalikar@ti.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8770
Reviewed-by: Nishanth Menon <nm@ti.com>
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
4 months agotcl/target/ti_k3: Add support for system reset using powerAP
Shivasharan Nagalikar [Wed, 19 Feb 2025 08:23:03 +0000 (13:53 +0530)]
tcl/target/ti_k3: Add support for system reset using powerAP

TI K3 Debug systems have a Power Access Port (Power-AP) which allows
for functionality such as reset via debugger that using the SPREC
register. SoCs/Boards that do not have support for SRST or TRST can
make use of this to force a system reset via debug access.

Change-Id: Ic5f9cc7f7fba77b353b0c0b42d8afc02502251a0
Signed-off-by: Shivasharan Nagalikar <shivasharan.nagalikar@ti.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8769
Reviewed-by: Nishanth Menon <nm@ti.com>
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
4 months agotcl/board: Add TI am62levm config
Nishanth Menon [Mon, 3 Mar 2025 12:57:23 +0000 (06:57 -0600)]
tcl/board: Add TI am62levm config

Add basic connection details with AM62l SK/EVM

For further details, see: https://www.ti.com/tool/TMDS62LEVM

Change-Id: Ic957a904dfe01951396f9767479884f2a121b181
Co-developed-by: Bryan Brattlof <bb@ti.com>
Signed-off-by: Bryan Brattlof <bb@ti.com>
Signed-off-by: Nishanth Menon <nm@ti.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8799
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
4 months agotcl/target/ti_k3: Add AM62L SoC
Nishanth Menon [Mon, 3 Mar 2025 12:47:28 +0000 (06:47 -0600)]
tcl/target/ti_k3: Add AM62L SoC

Add support for the TI K3 family AM62L SoC.

For further details, see https://www.ti.com/lit/pdf/sprujb4

Change-Id: I31e4e89507a1cd70a8c8c3242dd0a9dd7d0f2a06
Co-developed-by: Bryan Brattlof <bb@ti.com>
Signed-off-by: Bryan Brattlof <bb@ti.com>
Signed-off-by: Nishanth Menon <nm@ti.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8798
Tested-by: jenkins
Reviewed-by: Bryan Brattlof <bryanbrattlof@gmail.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
4 months agotarget/armv8: fix 128-bit register writes
Daniel Goehring [Thu, 6 Mar 2025 15:55:20 +0000 (10:55 -0500)]
target/armv8: fix 128-bit register writes

Assert checking was recently added to the "buf_get_u64()"
procedure for the buffer size argument.

For 128-bit register writes, instead of calling "buf_get_u64()" with
a 128-bit argument which fails the assert check, use two 64-bit calls.

Change-Id: I32ddbdb7bbe68c43f3b0a27738537391a227b08c
Signed-off-by: Daniel Goehring <dgoehrin@os.amperecomputing.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8801
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
4 months agotarget/target: fix RTOS thread awareness support
Daniel Goehring [Wed, 5 Mar 2025 22:48:01 +0000 (17:48 -0500)]
target/target: fix RTOS thread awareness support

This prior patch replaces "LOG_xxx()" with "LOG_TARGET_xxx()"
to indicate which target the message belongs to.

commit 7f2db80ebc16 ("rtos/hwthread: Use LOG_TARGET_xxx()")

To support this change for hardware thread awareness,
the target command name needs to be established before
calling the "target_configure()" routine.

Change-Id: I0dc70c23b84e983a2ee694fb5b9d01758f5c84a3
Signed-off-by: Daniel Goehring <dgoehrin@os.amperecomputing.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8800
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
4 months agotcl/board: Add MSPM0 Launchpad support
Nishanth Menon [Thu, 28 Sep 2023 08:37:03 +0000 (03:37 -0500)]
tcl/board: Add MSPM0 Launchpad support

Add basic connection details for TI's MSPM0 Launchpad series of
evaluation kits:
https://www.ti.com/tool/LP-MSPM0L1306
https://www.ti.com/tool/LP-MSPM0C1104
https://www.ti.com/tool/LP-MSPM0G3507

Change-Id: I33499f2d5fef846185ff6c330f9bfd0251117eb6
Co-developed-by: Henry Nguyen <h-nguyen8@ti.com>
Signed-off-by: Henry Nguyen <h-nguyen8@ti.com>
Signed-off-by: Nishanth Menon <nm@ti.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8386
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
4 months agotcl/target: Add support for TI MSPM0
Nishanth Menon [Thu, 28 Sep 2023 08:37:03 +0000 (03:37 -0500)]
tcl/target: Add support for TI MSPM0

Add basic support for Texas Instruments MSPM0L, C and G family of
Cortex-M0 based micro-controllers.

Change-Id: If2b5b1eca001f74d501ede67ec621c7497548a85
Co-developed-by: Henry Nguyen <h-nguyen8@ti.com>
Signed-off-by: Henry Nguyen <h-nguyen8@ti.com>
Signed-off-by: Nishanth Menon <nm@ti.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8385
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: zapb <dev@zapb.de>
4 months agoflash/nor: Add basic support for TI's MSPM0L/G family
Nishanth Menon [Thu, 28 Sep 2023 08:37:03 +0000 (03:37 -0500)]
flash/nor: Add basic support for TI's MSPM0L/G family

Add basic flashing support for Texas Instruments MSPM0L, C and G
family of Cortex-M0 based micro-controllers.

This initial basic flashing support allows for controlling protection,
erase, write and read of non-main flash region.

This has been tested with:
* Valgrind (3.22.0):
  valgrind --leak-check=full --show-leak-kinds=all \
--track-origins=yes --verbose
* Ubuntu clang version 20.0.0
 (++20241014053649+ed77df56f272-1~exp1~20241014053827.1987)

Valgrind-clean, no new Clang analyzer or sparse warnings have been
introduced.

Change-Id: I29b8055ea6da9c38c5b7b91bea1ec7581c5bc8ff
Co-developed-by: Henry Nguyen <h-nguyen8@ti.com>
Signed-off-by: Henry Nguyen <h-nguyen8@ti.com>
Signed-off-by: Nishanth Menon <nm@ti.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8384
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: zapb <dev@zapb.de>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
4 months agortos/linux: handle OOM in `linux_gdb_thread_packet()`
Evgeniy Naydanov [Fri, 14 Feb 2025 16:30:55 +0000 (19:30 +0300)]
rtos/linux: handle OOM in `linux_gdb_thread_packet()`

Return an error in case `calloc()` fails.

Change-Id: Id1b758a1edbae3d71d625d1992579b99720d77d6
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8762
Tested-by: jenkins
Reviewed-by: zapb <dev@zapb.de>
4 months agortos/rtos: handle OOM in `rtos_thread_packet()`
Evgeniy Naydanov [Fri, 14 Feb 2025 16:29:08 +0000 (19:29 +0300)]
rtos/rtos: handle OOM in `rtos_thread_packet()`

Return an error in case `calloc()` fails.

Change-Id: Ibb21a62991be83be8b219887953ccf27156f8af5
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8763
Tested-by: jenkins
Reviewed-by: zapb <dev@zapb.de>
4 months agortt: Raise error if control block was not found
Marc Schink [Thu, 13 Feb 2025 22:37:40 +0000 (22:37 +0000)]
rtt: Raise error if control block was not found

Since RTT is not started if the control block was not found, an error
must be raised instead of just informing the user.

Change-Id: I2873e72f142ca572da97ee1fe91f6f1301307555
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8757
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
4 months agotarget: fix wrap-around detection for read_memory/write_memory
Parshintsev Anatoly [Fri, 8 Nov 2024 04:12:46 +0000 (07:12 +0300)]
target: fix wrap-around detection for read_memory/write_memory

while at it change the order of checks for requested region sizes to
get rid of potential overflow during multiplication.

Change-Id: I97dac68e7024591cfd7abb70c8c62dff791298fe
Signed-off-by: Parshintsev Anatoly <anatoly.parshintsev@syntacore.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8572
Tested-by: jenkins
Reviewed-by: zapb <dev@zapb.de>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>