Commit Graph

11270 Commits

Author SHA1 Message Date
Marc Schink
91799d0579 README.Windows: Avoid multiple top-level headings
Refactor the document structure to avoid multiple top-level headings in
the same file.

The document is now free of Markdown linter [1] errors.

[1] https://github.com/jackdewinter/pymarkdown

Change-Id: I70122453c23c6230617c72d45986c88bb646edf5
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/9402
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2026-02-01 14:57:01 +00:00
Marc Schink
7d6f3ede0e README: Rework installation section
Document the OpenOCD installation with specific examples for package
managers and move the installation section to the beginning of the
document to make it more prominent.

Change-Id: I86e175fdd4060b49070a5c8d2b92ec1c6cfe6acf
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/9395
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2026-02-01 14:56:39 +00:00
Marc Schink
c348b9f2d7 README.macOS: Use Markdown syntax
Refurbish the document and use only Markdown syntax according to the
specification in [1].

[1] https://www.markdownguide.org/

Change-Id: I7ef0d4b7359ba12fd6f2fbf2c4ea1d092dcd71bd
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/9391
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2026-02-01 14:55:47 +00:00
Marc Schink
3ba83c76a2 README.Windows: Use Markdown syntax
Refurbish the document and use only Markdown syntax according to the
specification in [1].

[1] https://www.markdownguide.org/

Change-Id: I7baa9a25621155ff4acabcfde724f233578c9ee1
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/9390
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2026-02-01 14:55:23 +00:00
Marc Schink
bcfa2bc6b5 README: Use Markdown extension
Ensures proper rendering on GitHub [1] / GitLab, clarifies that Markdown
syntax is expected from contributors, and enables editor syntax
highlighting.

[1] https://github.com/openocd-org/openocd

Change-Id: Icaff52ed2bf7d6f32b5812b5aff1c081e8b7507a
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/9388
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2026-02-01 14:55:01 +00:00
Antonio Borneo
5e7182368e server: close the TCP socket while stopping a service
The function free_service() does not close the TCL socket when the
service is shutdown.

Add the necessarily code.

Change-Id: I58c5c4fee3111949fcc143c6226522c29d976493
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/9376
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2026-02-01 14:51:20 +00:00
Antonio Borneo
00e4fb653d target: openrisc: jsp_server: check for out of memory, fix memory leak
During JSP service start, check that memory is properly allocated
and if add_service() fails release the allocated memory.

Change-Id: I7eb2ea8a10dbeccd27fd39485080552c5d0736d3
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/9375
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2026-02-01 14:51:09 +00:00
Antonio Borneo
b10372f0d2 server: gdb_server: check for out of memory and fix a memory leak
During GDB service start, check that memory is properly allocated
and if add_service() fails release the allocated memory.

While there, modify the code following the coding style.

Change-Id: Iebd1481a82f7391c110c5f6ad9878ba4abf052b3
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/9374
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2026-02-01 14:50:58 +00:00
Antonio Borneo
70d4ac0395 target: arm_tpiu_swo: fix memory leak on add_service() failure
When add_service() fails, the caller has to free() the private
data.

Add the missing free().

Change-Id: I998782ad3a2612dd289e269e889a3c6912fd8461
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/9373
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2026-02-01 14:50:38 +00:00
Antonio Borneo
f275432b27 server: fix double free() on add_service() early return
The function add_service() can return on error when cannot create
the new service. In this case the caller cannot assume that the
parameter 'priv' has been taken in consideration and it should
take care of free() it.
To avoid a double free(), add_service() should not free() the
parameter 'priv' if it exits with error.

Replace the call to free_service() with a dedicated exit path on
error.

Change-Id: I340ec3ee46f471f31170c6717ed74fb632f0da20
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reported-by: Karl Palsson <karlp@tweak.au>
Fixes: 171454fffa ("server: fix a new double free()")
Fixes: 5ff384be08 ("semihosting: fix memory leak and double free")
Reviewed-on: https://review.openocd.org/c/openocd/+/9372
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2026-02-01 14:50:13 +00:00
HAOUES Ahmed
b9e4016161 flash/stm32l4x: Fix flash size address for STM32WBA5
Update fsize_addr parameter to reference non-secure memory address

Change-Id: I5098f478169bfaac726b96b071b99ca63d25d531
Signed-off-by: HAOUES Ahmed <ahmed.haoues@st.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/9357
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2026-01-25 09:29:05 +00:00
Antonio Borneo
b36de4f539 doc: add STM32WBA as supported by flash driver 'stm32l4x'
The flash driver 'stm32l4x' supports the device STM32WBA too.

Add it in the list of supported devices.

Change-Id: I5e2ba0c9ea198eb22d1bd329dd932bc0b1b3e886
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/9392
Reviewed-by: Marc Schink <dev@zapb.de>
Tested-by: jenkins
Reviewed-by: Ahmed Haoues <ahmed.haoues@st.com>
2026-01-25 09:28:38 +00:00
HAOUES Ahmed
eea1bb4d30 flash: nor: keep Windows backslashes in flash list output
Wrap the name field in braces when formatting the flash list Tcl structure
so that Tcl does not interpret backslash escape sequences.
This ensures Windows paths are preserved verbatim in the output and
can be reliably matched in Tcl scripts.

Fixes: 80fc9fabc6 ("flash: nor: rewrite command 'flash list' as COMMAND_HANDLER")
Change-Id: Ibd0a4b292828f084122e4a02732dc69ac0885f3c
Signed-off-by: HAOUES Ahmed <ahmed.haoues@st.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/9360
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2026-01-25 09:28:21 +00:00
R. Diez
c60bb56bb6 log: avoid incrementing 'count' for discarded log lines
This matches the behaviour of code which calls LOG_DEBUG_IO etc. instead.

Change-Id: I7679f0fc67222f947a4d0f1d53aa627a186ebcd3
Signed-off-by: R. Diez <rdiez-2006@rd10.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/9318
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2026-01-25 09:27:30 +00:00
Marc Schink
f36ab02a80 tcl/target: Move GigaDevice configs into vendor directory
Move the configuration files into a dedicated vendor folder as required
by the developer guidelines.

Change-Id: I9ed39e32b6281a9cb8510914690f3f7751b795c8
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/9271
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2026-01-25 09:26:39 +00:00
Mark O'Donovan
22a7bda336 tcl/target: Fix include paths and standardise max32 configs
Corrected the include path for max32xxx_common.cfg in some files.
Cleaned up and standarised some comments in the max32... files.

Change-Id: I94dcc7ba6868bdd9730f03d3aa76fcdbbae33c3e
Signed-off-by: Mark O'Donovan <shiftee@posteo.net>
Reviewed-on: https://review.openocd.org/c/openocd/+/9323
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2026-01-23 11:19:32 +00:00
Mark O'Donovan
f9ec0ed51f tcl/target: Add max32662.cfg
Config file added and tested on max32662evkit

Change-Id: I20cff70aaf8bb4577ba1e6f658afdd3b96e13145
Signed-off-by: Mark O'Donovan <shiftee@posteo.net>
Reviewed-on: https://review.openocd.org/c/openocd/+/9325
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
2026-01-23 11:19:02 +00:00
Mark O'Donovan
ab718d66ce tcl/target: Add max32660.cfg
Config file added and tested on max32660evsys

Change-Id: Ia9b77408be881f8b393e833c66762e0deb31221c
Signed-off-by: Mark O'Donovan <shiftee@posteo.net>
Reviewed-on: https://review.openocd.org/c/openocd/+/9324
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2026-01-23 11:18:42 +00:00
Mark O'Donovan
46f7b185a1 tcl/target: Stop setting adapter speed in max32680.cfg
The assignment of adapter speed 500 was getting overwritten when
max32xxx_common.cfg is sourced at the end.

Also removed incorrect comment.

Change-Id: I49d69073d93dedf28ed69d63ece35758f4707137
Signed-off-by: Mark O'Donovan <shiftee@posteo.net>
Reviewed-on: https://review.openocd.org/c/openocd/+/9322
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2026-01-23 11:18:25 +00:00
Mark O'Donovan
8f22bf7712 tcl/target: Stop setting adapter speed in max32xxx_common.cfg
Using the default speed is common and is preferred by OpenOCD.
Change-Id: I10f4ab7981aa6f9ae8e0882494287cc4b26b0398
Signed-off-by: Mark O'Donovan <shiftee@posteo.net>
Reviewed-on: https://review.openocd.org/c/openocd/+/9382
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2026-01-23 11:18:05 +00:00
Marc Schink
60d11a881f adapter/jlink: Use new log level for adapter I/O
Use the new adapter I/O log level to more easily distinguish
adapter I/O messages from other debug messages.

Change-Id: Ib3aa2bf84871c038aef937452cfeb28de232d821
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/9387
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2026-01-18 22:46:20 +00:00
R. Diez
ea9afa9e3e configure.ac: Replace --enable-verbose-usb-comms with a new runtime log level.
--enable-verbose actually did the same as --enable-verbose-usb-comms,
so the new code replaces it too.

Change-Id: I1d1ddd5d681009663e0c52a75ad76fe71dbc172a
Signed-off-by: R. Diez <rdiez-2006@rd10.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/9281
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
Reviewed-by: Marc Schink <dev@zapb.de>
2026-01-18 22:46:06 +00:00
Antonio Borneo
50fdce21a0 jep106: update to revision JEP106BN Jan 2026
Update to latest available document.

Change-Id: Iff4a3bc21394d72a5bb4754c62a0f5fdc4e5e78c
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/9383
Tested-by: jenkins
2026-01-18 22:45:40 +00:00
HAOUES Ahmed
7d688bc500 tcl/target: Add STM32N6x support
Add configuration file for STM32N6

Change-Id: Ia59786858724b6be141ec5f40a8d30459fb26dfb
Signed-off-by: HAOUES Ahmed <ahmed.haoues@st.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/9355
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2026-01-18 22:42:48 +00:00
Guillaume Faussard
df14f58662 flash/stm32l4x: support STM32WBA6xx devices
STM32WBA6xx support, based on ST Reference Manual RM0515 Rev 4.

Change-Id: I0ddeadd5008a9f81ec638c9ad230b2f6f0349b5a
Signed-off-by: Guillaume Faussard <guillaume.faussard@withings.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/9329
Reviewed-by: Ahmed Haoues <ahmed.haoues@st.com>
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2026-01-18 22:36:21 +00:00
Guillaume Faussard
b074fea079 tcl/target/stm32wba5x: Fix wrong addresses
According to ST Reference Manual RM093	Rev 7:
- OTP is 0x0BF90000
  2.3.2 Memory map and register boundary addresses, page 84
- DBGMCU registers starts at 0xE0044000
  43.5.1 System debug ROM table, page 1736

Change-Id: I735c6184d9f3fd767d9d776b238e88fcfbe8cc8d
Signed-off-by: Guillaume Faussard <guillaume.faussard@withings.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/9328
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
Reviewed-by: Ahmed Haoues <ahmed.haoues@st.com>
2026-01-18 22:36:07 +00:00
Guillaume Faussard
dab933b3ae tcl/target/stm32wba5x: Update post rename
This configuration file is not for all stm32wbax anymore.

Change-Id: I4399ba7cfdaeaff65a705b6d67e014614aef1b72
Signed-off-by: Guillaume Faussard <guillaume.faussard@withings.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/9327
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
Reviewed-by: Ahmed Haoues <ahmed.haoues@st.com>
2026-01-18 22:35:56 +00:00
Guillaume Faussard
c36f59d9b4 tcl/target/stm32wba5x: Rename configuration file
Prepare to add stm32wba6x support.
The OTP address is different between the stm32wb5xxx and stm32wb6xxx
microcontrollers, so the configuration file can't be the same for both.

Change-Id: Ib7485e0211779d98cca56e73397197b712460c69
Signed-off-by: Guillaume Faussard <guillaume.faussard@withings.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/9326
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Ahmed Haoues <ahmed.haoues@st.com>
2026-01-18 22:35:44 +00:00
HAOUES Ahmed
89ded3d2f0 flash/bluenrg-x: Support STM32WL33 AKA Spirit3
This device has a flash size up to 256 Kb with page size equal to 2 Kb

Change-Id: I2e284e9cd1d5be7df491a2fe2c9d11ce99c81d73
Signed-off-by: HAOUES Ahmed <ahmed.haoues@st.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/9354
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2026-01-18 22:29:47 +00:00
HAOUES Ahmed
2389c28ea8 flash/bluenrg-x: implement flash bank deallocation with simple alloc
All drivers which simply allocate one driver_priv memory block
per each bank now use default_flash_free_driver_priv()

Change-Id: Id998013332fe29d6882004a0ff897464dd4dccbc
Signed-off-by: HAOUES Ahmed <ahmed.haoues@st.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/9353
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2026-01-18 22:29:41 +00:00
Samuel Obuch
28eb4c37b9 target/xtensa: fix memory leaks in reg_cache
There are two allocated fields that are never freed,
contiguous_regs_desc and contiguous_regs_list.
Additionally, prevent memory leaks and invalid accesses
when xtregs command is called repeatedly.

Change-Id: Id6ab4a2565ddb19e1e9d3f1c3b822182b3a6fb9d
Signed-off-by: Samuel Obuch <samuel.obuch@espressif.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/9113
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
Reviewed-by: Ian Thompson <ianst+cdns@cadence.com>
2026-01-18 22:29:06 +00:00
Michal Lenc
587c783103 doc/opencocd.texi: mention support of PIC32CZ CA70
PIC32CZ CA70 family from Microchip is both binary and pin to pin
compatible with Atmel's SAM series, therefore the same driver
can be used.

Tested on PIC32CZ CA70 Curiosity evaluation kit with ST-Link interface.

Change-Id: I89a760c776a7c043c133bad058a9f5850a878676
Signed-off-by: Michal Lenc <michallenc@seznam.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/9109
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
2026-01-15 10:42:25 +00:00
Igor Cudnik
74d0cff2fe flash: nor: stm32f2x: add NULL check for stm32x_info
This commit prevents NULL dereference during malloc
failure on stm32x bank command.

Change-Id: Ib348a1863aee5f8ed9d1699d203cdc4c83557628
Signed-off-by: Igor Cudnik <igor@its.rel.pl>
Reviewed-on: https://review.openocd.org/c/openocd/+/9379
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
2026-01-13 08:27:15 +00:00
Tomas Vanek
8bd25e0329 flash/nor: do not report error as unknown
The command "flash erase_check" reported any error code from
flash driver erase_check method as "unknown" despite the error
is usually described in a log message from the flash driver layer.
E.g.:

Error: Target not halted
unknown error when checking erase state of flash bank #0 at 0x00000000

Reword the message not to mislead user.

Change-Id: Ica768fa2924c107fa36d0f654d2c3149aa608dc4
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/9331
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2026-01-11 18:20:18 +00:00
Lucien Dufour
daaf48b96f target/armv4_5: drop goto and label
Drop the jumps to the label and the label.

Change-Id: I4e20684b06af09dcd749ae520e299c79ce67b467
Signed-off-by: Lucien Dufour <lucien.buchmann@dufour.aero>
Reviewed-on: https://review.openocd.org/c/openocd/+/9292
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2026-01-11 18:18:53 +00:00
Antonio Borneo
58eb7e31a6 helper: log: document the last user of hack in alloc_vprintf()
Apparently the last user of the hack in alloc_vprintf() is the
code in log_vprintf_lf().

Document it for future rework.

Change-Id: I6b69f8b7f3feb93e5daa9649c4122ec12e22d84f
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/9317
Tested-by: jenkins
2026-01-11 18:15:28 +00:00
Antonio Borneo
cb6b803947 helper: command: assert on command_print() with no command_invocation
Commit 7f260f5009 ("helper/command: Handle Tcl return values
consistently") allows calling command_print with the first
parameter set to NULL.
This should not be allowed.
I cannot identify any part of OpenOCD that calls a command that in
turn calls command_print() with NULL command_invocation.
Adding
	__attribute__((nonnull (1, 2)))
to the prototype of the functions does not trigger any positive
with GCC and scan-build.

Add an assert to detect such corner cases.
This change is kept small and self contained to allow reverting it
easily if a real use case is identified.

Change-Id: I8aa6e5c0c341e818c0327eaa0d2bd5b6304c93b8
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/9091
Tested-by: jenkins
2026-01-11 18:15:20 +00:00
Antonio Borneo
1dedd6918b helper: command: rewrite common command_print()
Avoid code duplication by merging command_print() and
command_print_sameline().

Detect the allocation error, keep track of it and let the command
return error.

Add a FIXME as the functions should always have 'cmd' properly
set. Should this be an assert()?

Change-Id: Iff704c42969a7ca9ea884520942adecd40bebbd6
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/9090
Tested-by: jenkins
2026-01-11 18:14:54 +00:00
Antonio Borneo
6420e83aff helper: command: rewrite command_print() dropping jimtcl strings
Rewrite the function command_print() without using any specific
API from jimtcl for string manipulation.

Change-Id: I1adddd493b43e30ead26e96da09a4ee8c0a41307
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/9076
Reviewed-by: Evgeniy Naydanov <eugnay@gmail.com>
Tested-by: jenkins
2026-01-11 18:14:06 +00:00
Antonio Borneo
e39ae004b0 target: cortex_a: support read and write watchpoints
The current code for cortex_a watchpoint sets the field DBGWCR:LSC
to '3', that corresponds to 'access' watchpoint.
Thus, any 'r' or 'w' watchpoint is considered to 'a'.

Convert the enum watchpoint_rw to the corresponding values for the
field DBGWCR:LSC.

Change-Id: Iccfddb3e34f3f26927983f3b00d9d5f81b06eb21
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/9291
Tested-by: jenkins
2026-01-11 18:13:54 +00:00
Tomas Vanek
0eecf4d21d target/aarch64: fix last_run_control_op on SMP
aarch64_resume() set the last_run_control_op on the current core
only and left last_run_control_op as is on the rest of the SMP group.
It caused semihosting call on other cores to stop because
last_run_control_op sticked on ARMV8_RUNCONTROL_STEP

Set last_run_control_op to ARMV8_RUNCONTROL_RESUME on all cores
in the SMP group.

Change-Id: I55a97bb1f7ea25bfc5937c3cc846532cdf390064
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/9247
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2026-01-11 18:09:10 +00:00
Tomas Vanek
c2fdc38d32 target/aarch64: fix semihosting on SMP
Semihosting worked only on the first/gdb assigned core of a SMP group.
If a semihosting call was issued on another core, aarch64_update_halt_gdb()
emitted 'halted' event on core0 before semihosting decoding started.

Use target's smp_halt_event_postponed flag to keep events from emitting
until semihosting is decoded. If a semihosting call is confirmed,
clear flags and do not send 'halted' event for any core of SMP group.

Change-Id: Ie7eff7e493c2a4df3039f49fce1744d996050a59
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/9246
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2026-01-11 18:09:00 +00:00
Tomas Vanek
1ca34e23c0 target/aarch64: improve handling recursion in SMP halt
update_halt_gdb() called aarch64_poll() recursively with temporary
switching target's smp flag off to prevent deeper recursion.
This was not possible for gdb assigned target or hwthread failed
with "SMP node change, disconnect GDB from core/thread".
Therefore the aarch64_poll(gdb_target) resulted in the useless
recursion back to update_halt_gdb().

Introduce aarch64_poll_smp() with smp parameter to avoid
update_halt_gdb() recursion properly and without fiddling
with target's smp flags.

While on it, add 'aarch64_' prefix to update_halt_gdb() function.

Change-Id: I645166f50c106f4a6d4d35dc70ad49041d2442aa
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/9245
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2026-01-11 18:08:48 +00:00
Tomas Vanek
5dad8a59d8 target/cortex_m: fix segfault on setting HW BP on not examined target
Check cortex_m->fp_comparator_list and if NULL log and return error.

Change-Id: Icf53f1bbc60de3486a285ef1f16bb98a5596913b
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/9182
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2026-01-11 16:35:39 +00:00
Tomas Vanek
7f8eec108b target/cortex_m, hla_target: implement memory_ready() test
Allow memory access as soon as debug_ap is initiated.
This resolves chicken - egg problem in cortex_m_examine():
examined flag had to be set at the start of examination
to allow memory access during examination.

hla_target has memory ready to access as soon as the adapter
is initialized so we can simply return true.

Change-Id: I30b8bcb8c43775ebbd8e677da09189781bebb4ab
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/9179
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2026-01-11 16:35:19 +00:00
Tomas Vanek
ba12fb9b95 target: introduce target_memory_ready() test
Use the new test in target memory access functions
instead of target_was_examined()

Drop the test from target_read/write_u8/16/32/64() helpers
as they directly call a memory access function which does
the test again.

Change-Id: Ic1753e461d2a4b91ce3a3e1bf3e86eb2be743d46
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/9178
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2026-01-11 16:35:06 +00:00
Tomas Vanek
7025e3fe3d target/armv8: do not mark ELx banked regs as save-restore
GDB uses this mark when creating a dummy frame for
manual call of a function by GDB command.

With the original setting of all registers as caller_save = true
GDB inferior call fails in EL2H mode with the message
Could not fetch register "ELR_EL3"; remote failure reply '0E'

It also fails similarly in EL0 and EL1 modes.

A standard function should not change EL banked registers anyway.
Avoid marking ELx banked registers as save-restore.

Treat pauth_dmask and pauth_cmask registers similarly.
They are not typically changed in a function.

Change-Id: Ibaf32210f3fcfa9dfb15e924b888243460e85fb4
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/9243
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2026-01-06 08:00:10 +00:00
Samuel Obuch
ad0ed194f5 target/riscv: fix riscv exec_progbuf for SMP targets
Currently, 'riscv exec_progbuf' command does not select active target.
So with multiple harts with a common debug module, program buffer may
be executed on an incorrect target.

Change-Id: Ic345b09b039c2b1e37e5b99a8534833ac2723277
Signed-off-by: Samuel Obuch <samuel.obuch@espressif.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/9312
Tested-by: jenkins
Reviewed-by: Evgeniy Naydanov <eugnay@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2026-01-06 07:59:34 +00:00
HAOUES Ahmed
67153cf3d5 flash/stm32l4x: Fix permanent write protection on STM32WBA5
STM32WBA5 has an UNLOCK bit in FLASH_WRPAR and FLASH_WRPBR registers

Change-Id: I4b8fe4aaa9cd336f07aaf5bad0c44834ead70499
Signed-off-by: HAOUES Ahmed <ahmed.haoues@st.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/9358
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2026-01-02 14:35:54 +00:00
Tomas Vanek
4593222e85 target: rework target_checksum_memory()
Commit d7142a5727 ("target/target: Check checksum_memory
before call") added the error return if target's checksum_memory()
method is not implemented however the slow path with read buffer and
image_calculate_checksum() should be used instead.

Also the code fragment commented as /* convert to target endianness */
is a pure nonsense - it does not convert anything. Drop the conversion
loop.

Change-Id: I804605d31310698445b3ffb5e3fcad1fc43a5579
Suggested-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/9242
Reviewed-by: Evgeniy Naydanov <eugnay@gmail.com>
Tested-by: jenkins
2025-12-29 11:55:17 +00:00