Commit Graph

8759 Commits

Author SHA1 Message Date
HAOUES Ahmed
e4e0faeba6 flash/stm32h7x: Refactor STM32H7 flash register definitions to use enum
Replace individual #define constants for STM32H7 flash registers with an
enum to improve code readability and maintainability.

While there, replace a magic number with the macro
MASS_ERASE_TIMEOUT.

while there, remove the unneeded inline attribute

Change-Id: Ib35cbdace5c2f4d12aa91c370d6ec0ce348b397f
Signed-off-by: HAOUES Ahmed <ahmed.haoues@st.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8888
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2025-11-06 08:08:29 +00:00
Lucien Dufour
22afaae7fa Use C99 style for loop var
Use ARRAY_SIZE() to ensure ranges are correct.
Also, the C99 style is hopefully more readable.

Change-Id: I3d6bfbdc8e723791ba14d5a32e311c61bc2dfd77
Signed-off-by: Lucien Dufour <lucien.buchmann@dufour.aero>
Reviewed-on: https://review.openocd.org/c/openocd/+/9097
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
Reviewed-by: zapb <dev@zapb.de>
2025-11-02 13:50:21 +00:00
kryvosheiaivan
1ee0499cd8 armv8m: Add support for msplim/psplim for targets with no secext
When armv8m does not have security extension, it still has
msplim/psplim regs implemented, which is described in Cortex-M33
Devices Generic User Guide.
Document ID: 100235_0100_06_en, or at the link:
https://developer.arm.com/documentation/100235/latest/
Tested on cyw20829 along with gdb v14.2.1

Change-Id: I4f060e4df742c6773e79ce0481697361202d544c
Signed-off-by: kryvosheiaivan <Ivan.Kryvosheia@infineon.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8887
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2025-11-02 13:46:35 +00:00
Jonathan Steinert
914b855780 xmc4xxx: Correct some flash sector layouts
I think this may have been a typo/thinko from first implementation, but
for the 4200 the layout is 8 16KB chunks and then 1 128KB chunk. We were
previously only writing 240KB

Signed-off-by: Jonathan Steinert <hachi@kuiki.net>
Change-Id: Ic3cff75ba21f6bc6ac440dfb30e24c328c7cd47c
Reviewed-on: https://review.openocd.org/c/openocd/+/9172
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Karl Palsson <karlp@tweak.au>
Tested-by: jenkins
2025-11-02 13:39:56 +00:00
Marc Schink
165e578d2b adapter/cmsis-dap: Add driver for TCP backend
The cmsis-dap driver is not added to the list of drivers if none of the
USB backends is available.

Add cmsis-dap driver also if TCP backend is available.

Change-Id: I877fac528e7102af74ee54dfcca77c5aded6a7ce
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/9162
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2025-11-02 13:39:04 +00:00
Antonio Borneo
88b9bd396d target: cortex-m: fix support for armv8m caches
Scan-build is unable to correctly follow the deferred loading of
queued read, finalized by the atomic write, thus it incorrectly
claims that the arrays d_u_ccsidr[] and i_ccsidr[] could carry
not initialized values:

	armv7m_cache.c:154:31: warning: 1st function call argument
	is an uninitialized value [core.CallAndMessage]
	   cache->arch[cl].d_u_size = decode_ccsidr(d_u_ccsidr[cl]);

	armv7m_cache.c:172:29: warning: 1st function call argument
	is an uninitialized value [core.CallAndMessage]
	   cache->arch[cl].i_size = decode_ccsidr(i_ccsidr[cl]);

Initialize the arrays to zero to hide these false positive.

Change-Id: I6d1e88093cb8807848643139647a571c1b566aa8
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Fixes: 04da6e2c62 ("target: cortex-m: add support for armv8m caches")
Reviewed-on: https://review.openocd.org/c/openocd/+/9167
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2025-10-18 08:59:44 +00:00
Antonio Borneo
85542c1c5c helper/log: mark 'fmt' argument of alloc_*printf() as not NULL
Even after commit e12ceddd5e ("helper/log: mark `fmt` argument
of `alloc_vprintf()` as format string"), the GCC compiler still
reports that alloc_vprintf() could call vsnprintf() with a NULL
format parameter.

Inform the compiler that alloc_vprintf() cannot accept NULL as
format string.
Add an assert() in alloc_vprintf() so even compilers that do not
use the function attribute 'nonnull' will play safe.
While there, extend the same fixes to alloc_printf() too.

Change-Id: Idfa4fe9c6dfb2acfbf434c392237937ae03f0e8a
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reported-by: Parshintsev Anatoly <anatoly.parshintsev@syntacore.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/9166
Tested-by: jenkins
Reviewed-by: Anatoly P <anatoly.parshintsev@syntacore.com>
2025-10-18 08:58:55 +00:00
Antonio Borneo
557a2082b1 openocd: don't test 'debug_level' directly
Use the macro 'LOG_LEVEL_IS()' to test 'debug_level'.

While there, use the macro 'LOG_LVL_*' in place of the numeric
value.

Skip all riscv code, as it is going to be updated soon from the
external fork.

Change-Id: Icad7e879e040d3b9cf1cc004c433f28725017493
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/9070
Tested-by: jenkins
2025-10-18 08:37:13 +00:00
Marc Schink
3fd9759415 adapters/cmsis-dap: Fix build without libusb
The cmsis-dap core driver depends on libusb-related code which breaks
the build when libusb is not available.

Remove libusb dependency of the core driver to fix the build issue. For
now, use an own timeout #define with the value of LIBUSB_TIMEOUT_MS but
timeout handling should be better moved to the backends. However, this
should be addressed in a dedicated patch.

Change-Id: Ic5da392f8ab26b47466be199432432cdc08712ab
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/9161
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: <niklaus.leuenb@gmail.com>
Tested-by: jenkins
2025-10-13 07:56:35 +00:00
Marc Schink
910e6ba2f0 adapter/parport: Add device file support
Allow to specify the parallel port by its device file. Deprecate port
number support but keep it for backward compatibility.

This is one necessary step to remove direct I/O support for the parallel
port driver.

While at it, consistently return ERROR_JTAG_INIT_FAILED in case of a
failure in parport_init().

Change-Id: Ie68087f05ece4b32ccab9d9bdfbf7e1a779e9031
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/9152
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2025-10-11 16:15:10 +00:00
Marc Schink
39ed0b0bba adapter/parport: Deprecate direct I/O support
We deprecate direct I/O support in favor of ppdev for the following
reasons:

  - Linux supports ppdev since ~2.4 (released ~24 years ago) and it is
    enabled by default on major distros (Ubuntu, Fedora). So it is
    effectively ubiquitous
  - FreeBSD provides no direct I/O support, so ppdev (ppi) is the only
    viable option
  - Direct I/O requires root/elevated privileges which is inadvisable
  - Removing direct I/O reduces build and driver complexity and yields
    a smaller, easier-to-maintain codebase
  - Supporting only ppdev allows us to simplify the codebase by using
    device files (e.g., /dev/parport0) instead of numeric identifiers

Windows is the only rationale to keep direct I/O, but the user base
appears minimal to nonexistent and no active contributors can test the
Windows driver.

Change-Id: Ia6d5ed6e8c5faa2a9b4919ca97c5cf9033372a64
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/9151
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2025-10-11 16:14:07 +00:00
EasyDevKits
5fa74d4ee8 jtag/ch347: Refine driver and configs for EasyDevKits adapters
This commit improves support for CH347-based JTAG adapters:

- configure.ac: removed "Mode3" restriction (CH347F does not require mode).
- configs: added board config for ESP32-WROVER-E WCH JTAG DevKit and
  ESP32-WROVER-E FTDI JTAG DevKit
- ch347 driver: removed `ch347 activity_led` command; activity LED
  is now controlled via the generic `adapter gpio led` command.
- doc/openocd.texi: updated documentation accordingly.

Change-Id: I5524290297adcc004e00af919181868d2b6303af
Signed-off-by: EasyDevKits <info@easydevkits.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/9015
Reviewed-by: zapb <dev@zapb.de>
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2025-10-11 16:02:18 +00:00
Antonio Borneo
8b43a967e5 target: cortex_m: add comment for breakpoint of length 3
Add a comment in the breakpoint code to clarify the check for the
odd breakpoint length of 3 bytes, introduced by [1].

[1]: commit 0a5e03c12a ("cortex_m.c: Use two byte breakpoint for
     32bit Thumb-2 request").

Change-Id: I024863d10078b5d9062c876aa59ccf70a81bf641
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/9139
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
2025-10-11 15:57:06 +00:00
Antonio Borneo
04da6e2c62 target: cortex-m: add support for armv8m caches
Cores like Cortex-M7, Cortex-M55 and Cortex-M85 can have either
D-Cache and/or I-Cache.
Using SW breakpoints in RAM requires handling these caches.

Detect the presence of cache at examine.
Detect cache state (enable/disable) at debug entry.
Take care of caches synchronization through the PoC (usually the
SRAM) while setting and removing SW breakpoints.
Add command 'cache_info' to check cache presence and size.

Change-Id: Ice637c215fe3042c8fff57edefbab1b86515ef4b
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/9077
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
2025-10-11 15:56:41 +00:00
Marc Schink
2abf8daa80 target/cortex_m: Remove echo of 'reset_config' command
Do not echo the selected reset config. This is one of many changes to
make the behavior of Tcl commands more consistent.

This also avoids stray and confusing messages in the output of OpenOCD.
For example, the "reset_config" line here:

  Open On-Chip Debugger 0.12.0+dev-00802-gb7f0145fc-dirty
  Licensed under GNU GPL v2
  For bug reports, read
  	http://openocd.org/doc/doxygen/bugs.html
  cortex_m reset_config sysresetreq
  Info : Listening on port 6666 for tcl connections
  Info : Listening on port 4444 for telnet connections

While at it, fix some coding style and command handling issues.

Change-Id: I3b3d8687af1d23a2dc1764f29b52dc607b80cb59
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8638
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2025-10-11 15:51:37 +00:00
Samuel Obuch
e5888bda38 target/breakpoints: drop duplicate breakpoint/watchpoint "clear_target" functions
We need to cleanup watchpoints on all targets in SMP group when GDB
connects. Otherwise, the targets will not be consistent.
Once thats fixed, both *_clear_target functions clearly duplicate
the corresponding *_remove_all functions.

Change-Id: I8e85dbc66fd3e596990d631ed2aed22959a8ca60
Signed-off-by: Samuel Obuch <samuel.obuch@espressif.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/9086
Reviewed-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2025-09-30 07:22:37 +00:00
Brian Kuschak
896738264e jtag/drivers/cmsis_dap_tcp: fix socket handling for Windows
Windows does not support socket recv() with a combination of MSG_PEEK
and MSG_WAITALL flags. Work around this limitation in a way that works
for both Windows and other platforms.

Change-Id: Ib77e2cc872e5fe3d1fc41034010b86390131fff3
Fixes: https://sourceforge.net/p/openocd/tickets/457/
Signed-off-by: Brian Kuschak <bkuschak@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/9136
Reviewed-by: IRON ALEKS <8ironaleks8@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
2025-09-27 15:22:27 +00:00
Tomas Vanek
32afb0ab04 jtag: linuxgpiod: log memory allocation errors
Log error in case of NULL calloc() return.

Change-Id: I40c5cba5b92cd39e9a8f7e6d420e11afc8747b3e
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/9119
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2025-09-27 14:56:40 +00:00
Michael Heimpold
9e2a11c2f2 jtag: linuxgpiod: finalize emulation of libgpiod v2 API for older versions
This finalizes the work that has begun to emulate v2 API
for older libgpiod versions.

It also add the required autotools/pkg-config stuff to
detect the available libgpiod version.

Change-Id: I2c3a60ce607ed9601b01d22d5d9b8af953944941
Signed-off-by: Michael Heimpold <mhei@heimpold.de>
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/8226
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2025-09-27 14:56:26 +00:00
Antonio Borneo
c92cc6b570 jtag: linuxgpiod: use libgpiod v2 API for gpiod_line_request()
Work in progress. Target is to replace v1 gpiod_line_request()

Define and use dummy functions from v2 for v1:
- gpiod_line_config_new(),
- gpiod_line_config_free(),

Not yet used:
- gpiod_line_config_add_line_settings(),
- gpiod_chip_request_lines().

Change-Id: I9e2d3013845c5d12942f5e07c9721fcd151d6840
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8207
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
2025-09-27 14:56:16 +00:00
Antonio Borneo
f64421d07e jtag: linuxgpiod: use libgpiod v2 API to set gpio active_low
Define and use dummy functions from v2 for v1:
- gpiod_line_settings_set_active_low().

Change-Id: I2c00e1a71950215c47dc07d71af4f319434a266a
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8206
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2025-09-27 14:56:03 +00:00
Antonio Borneo
4b311d3b8f jtag: linuxgpiod: use libgpiod v2 API to set gpio bias
Define and use dummy functions from v2 for v1:
- gpiod_line_settings_set_bias().

Change-Id: I96d32b6200d3bb6ca7c16e7a18e3860f367b5008
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8205
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
2025-09-27 14:55:54 +00:00
Antonio Borneo
78ea8c7fb4 jtag: linuxgpiod: use libgpiod v2 API to set gpio drive
Define and use dummy functions from v2 for v1:
- gpiod_line_settings_set_drive().

Change-Id: Ic058e85c441c9f8db63919be5166172be5b72221
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8204
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2025-09-27 14:55:40 +00:00
Antonio Borneo
981ae530fc jtag: linuxgpiod: use libgpiod v2 to set gpio state
Define and use dummy functions from v2 for v1:
- gpiod_line_settings_new(),
- gpiod_line_settings_free(),
- gpiod_line_settings_set_direction(),
- gpiod_line_settings_set_output_value().

Change-Id: I7d147fa49daf1d008744fab5bf0001c570ea43d6
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8203
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2025-09-27 14:55:30 +00:00
Antonio Borneo
fcbdab78c9 jtag: linuxgpiod: wrap gpiod_request_config from libgpiod v2
Reorganize the code of helper_get_line() for label err_out.
Define and use dummy functions from v2 for v1:
- gpiod_request_config_new(),
- gpiod_request_config_free(),
- gpiod_request_config_set_consumer().

Change-Id: Ide7cd8459941a5a863c425a2b5abf1fb4a075874
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8202
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2025-09-27 14:55:17 +00:00
Antonio Borneo
601d478015 jtag: linuxgpiod: replace gpiod_chip_open_by_number()
Preparing for libgpiod v2, replace v1 specific function
gpiod_chip_open_by_number() with the common v1 & v2 function
gpiod_chip_open().

Change-Id: I5f0f9bef739f4097fb74f78b5b6e2fe823c1ab87
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8201
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2025-09-27 14:53:54 +00:00
Antonio Borneo
27ab12dd82 target: extend registers match on 'get_reg' and 'set_reg'
Some target, like aarch64, has more than one bank of registers.

Let the commands 'get_reg' and 'set_reg' to search the register
name in all banks, as is already done in command 'reg'.

Change-Id: Iae350a52f993790c5546925a2f7f81fbdb3f49b8
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Fixes: e8e62c5aca ("target/tcl: Add get_reg function")
Fixes: da73280101 ("target/tcl: Add set_reg function")
Reviewed-on: https://review.openocd.org/c/openocd/+/9122
Tested-by: jenkins
Reviewed-by: zapb <dev@zapb.de>
2025-09-27 14:53:26 +00:00
Ryan QIAN
e10fb1e2a4 gdb_server: Fix buffer size calculation for snprintf null terminator
The buffer size check was using len + 4 but snprintf requires additional
space for the null terminator. The snprintf call formats '#%02x' which
needs 4 bytes total (1 for '#', 2 for checksum, 1 for null terminator).

The original check of len + 4 was insufficient and could cause snprintf
to truncate the checksum and replace the last character with '\0',
leading to malformed GDB packets.

Fix by changing the buffer size check from len + 4 to len + 5 (1 for '$',
1 for '#', 2 for checksum, 1 for null terminator) to provide adequate space
for snprintf's null terminator.

Change-Id: Ibf8b3c3f5e4d5ac5be795b8e688e055453798afe
Signed-off-by: Ryan QIAN <jianghao.qian@hpmicro.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/9117
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2025-09-12 16:41:31 +00:00
Samuel Obuch
a6752a1671 jtag/drivers/cmsis_dap: fix build with cmsis_dap_tcp backend
For some hosts build fails after the recent cmsis_dap_tcp addition
(see commit fcff4b712c ("jtag/drivers/cmsis_dap: add new backend
cmsis_dap_tcp") or https://review.openocd.org/c/openocd/+/8973)

- Header 'hidapi.h' may not be available and should not be needed here.

- Global pointer variable is not guaranteed to be treated as a constant
  expression even with const modifier. Use global array instead, to avoid
  'error: initializer element is not constant', as address of a global
  array is a constant expression.

Change-Id: I0c72ff52340f546a5f635663a8fde28c99176d1b
Signed-off-by: Samuel Obuch <samuel.obuch@espressif.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/9115
Tested-by: jenkins
Reviewed-by: Brian Kuschak <bkuschak@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2025-09-12 16:39:52 +00:00
Marc Schink
9279a489d4 target/stm8: Remove useless parentheses
Parentheses are not necessary here, remove them.

Change-Id: I793639fbef38688045104d351fb4e5320f1eba2a
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/9058
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2025-09-06 11:41:51 +00:00
Antonio Borneo
ddef9cf73b target: align switch and case statements
The coding style requires the 'case' to be at the same indentation
level of its 'switch' statement.

Align the code accordingly.

While there:
- add space around the operators;
- drop useless empty line.

Skip all riscv code, as it is going to be updated soon from the
external fork.

No changes are reported by
	git log -p -w --ignore-blank-lines --patience

Change-Id: I2691dfdd2b6734143e14160b46183623e9773539
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/9051
Tested-by: jenkins
2025-09-06 11:41:33 +00:00
Antonio Borneo
0cd8b6a9d9 jtag: drivers: ulink: special align switch and case statements
The coding style requires the 'case' to be at the same indentation
level of its 'switch' statement.

Checkpatch is not able to detect numbers in exponential format,
like 6E-5, and complains about missing space around the operator
minus.

To complete the alignment of switch and case statements in this
file, use a separate commit with the special checkpatch ignore tag
in the commit message.

Align the code accordingly.

No changes are reported by
	git log -p -w --ignore-blank-lines --patience

Checkpatch-ignore: SPACING
Change-Id: Ibe70c4a4d3f0bb44c03007103910b778944bb90e
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/9056
Tested-by: jenkins
Reviewed-by: zapb <dev@zapb.de>
2025-09-06 08:35:54 +00:00
Antonio Borneo
867611d3e1 jtag: drivers: align switch and case statements
The coding style requires the 'case' to be at the same indentation
level of its 'switch' statement.

Align the code accordingly.

Skip the driver angie that is going to be updated soon with a new
commit and skip the folder OpenULINK that contains a firmware for
the dongle.

No changes are reported by
	git log -p -w --ignore-blank-lines --patience

Change-Id: I960a89a45bc9956f98676a019f0d1a652601155f
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/9055
Tested-by: jenkins
Reviewed-by: zapb <dev@zapb.de>
2025-09-06 08:35:33 +00:00
Antonio Borneo
8b751e0d45 jtag: drivers: prepare for aligning switch and case statements
To prepare for aligning switch and case statements, fix in advance
some checkpatch error due to existing code:
- remove 'else' after return and break;
- use '__func__' in place of hardcoded function name;
- remove useless parenthesis;
- don't end line with an open parenthesis.

Change-Id: I6a9905e5a30c90456de562e727dd2dfe2fda10c4
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/9054
Reviewed-by: zapb <dev@zapb.de>
Tested-by: jenkins
2025-09-06 08:35:19 +00:00
Antonio Borneo
8a504640d2 jtag: align switch and case statements
The coding style requires the 'case' to be at the same indentation
level of its 'switch' statement.

Align the code accordingly.

No changes are reported by
	git log -p -w --ignore-blank-lines --patience

Change-Id: Iaf368b0bdd7c797b0e4cfb91e838696d706fdcce
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/9053
Tested-by: jenkins
Reviewed-by: zapb <dev@zapb.de>
2025-09-06 08:35:02 +00:00
Antonio Borneo
9bc4873a71 jtag: prepare for aligning switch and case statements
To prepare for aligning switch and case statements, fix in advance
some checkpatch error due to existing code:
- use '__func__' in place of hardcoded function name.

Change-Id: Ib90811c7fffa15702fb710345c5ca3c7331d5ad6
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/9052
Reviewed-by: zapb <dev@zapb.de>
Tested-by: jenkins
2025-09-06 08:34:33 +00:00
Antonio Borneo
e9561c4af5 target: prepare for aligning switch and case statements
To prepare for aligning switch and case statements, fix in advance
some checkpatch error due to existing code:
- remove useless parenthesis;
- remove useless 'break';
- join spit lines;
- add space around operators;
- remove 'else' after exit() and return.

Change-Id: I8a87a0ea104205d087dcb8cbf4c67ff13a47742f
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/9050
Tested-by: jenkins
Reviewed-by: zapb <dev@zapb.de>
2025-09-06 08:33:52 +00:00
Antonio Borneo
6b7cc918f0 target: cortex_a: add break in switch/case
The code falls-through in the default case, making it not easy to
read.

Add the explicit break to improve the readability.

Change-Id: I4784b883e0e82258de17018dfdfb59b4042ac743
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/9049
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2025-09-06 08:33:38 +00:00
Antonio Borneo
cb526f0659 xsvf: align switch and case statements
The coding style requires the 'case' to be at the same indentation
level of its 'switch' statement.

Align the code accordingly.

No changes are reported by
	git log -p -w --ignore-blank-lines --patience

Change-Id: I24762505cdac22058e0a2a1f4e9235c9006e543d
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/9048
Tested-by: jenkins
Reviewed-by: zapb <dev@zapb.de>
2025-09-06 08:33:22 +00:00
Antonio Borneo
ce3fa4ac08 xsvf: prepare for aligning switch and case statements
To prepare for aligning switch and case statements, fix in advance
some checkpatch error due to existing code:
- uniform braces around if/else statements.

While there:
- drop useless break.

Change-Id: Ic0ce0a9877dbf17c625cf80009a52922176a162d
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/9047
Reviewed-by: zapb <dev@zapb.de>
Tested-by: jenkins
2025-09-06 08:33:04 +00:00
Antonio Borneo
08ede91a1f svf: align switch and case statements
The coding style requires the 'case' to be at the same indentation
level of its 'switch' statement.

Align the code accordingly.

No changes are reported by
	git log -p -w --ignore-blank-lines --patience

Change-Id: I1369294af64c2830cc7fcc2814eac073c2413ff5
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/9044
Tested-by: jenkins
2025-09-06 08:32:18 +00:00
Antonio Borneo
3e11574c8f svf: rework the tests in svf_xxr_common()
Check the variable value against the constant.

Change-Id: I353bbada2180d6df789cc225ddb15f22c7deb00d
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/9043
Tested-by: jenkins
2025-09-06 08:32:01 +00:00
Antonio Borneo
880f234915 svf: rework svf_parse_cmd_string()
Rework the function to drop the goto in the switch statement.
While there, change some variable to boolean.

Change-Id: I37cbc8aafaeb8aef7f083ee6f5afa9eae71e0cd9
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/9042
Tested-by: jenkins
Reviewed-by: zapb <dev@zapb.de>
2025-09-06 08:31:46 +00:00
Antonio Borneo
c22e1eb3ce svf: drop goto and label in switch statement
Drop the jumps to the label thanks to the factorized code.
Drop the now unused label.

Change-Id: I7e61ecee5a883a6ed6b77bfbff54a615d1b4d61c
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/9041
Tested-by: jenkins
2025-09-06 08:31:30 +00:00
Antonio Borneo
1c668a0a6b svf: factorize big switch case
Factorize function svf_run_command() by moving out of the 'case'
the common code related to the label 'xxr_common'.

The target is to drop later on the ugly label 'xxr_common' inside
the switch.

Apart for:
- the function and local variables declaration,
- the added function call in place of original code,
- the reduced indentation in the new function,
this change is a dummy copy/paste with no code modification.

Change-Id: I8149cf25f460326ba6666a9287c5c309e5d99488
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/9040
Tested-by: jenkins
2025-09-06 08:31:11 +00:00
Antonio Borneo
ad8d96230d svf: prepare for aligning switch and case statements
To prepare for aligning switch and case statements, fix in advance
some checkpatch error due to existing code:
- remove unnecessary parenthesis;
- uniform braces around if/else statements.

Change-Id: I851032e1b126462a325f73bdf236fd2dbc938ff3
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/9039
Tested-by: jenkins
2025-09-06 08:30:55 +00:00
Antonio Borneo
15fb738850 rtos: linux: align switch and case statements
The coding style requires the 'case' to be at the same indentation
level of its 'switch' statement.

Align the code accordingly.

No changes are reported by
	git log -p -w --ignore-blank-lines --patience

Change-Id: Ic4070571d322776b638a15a40af85cd31fdae7ce
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/9038
Tested-by: jenkins
2025-09-06 08:30:40 +00:00
Antonio Borneo
d34ff22429 rtos: linux: prepare for aligning switch and case statements
To prepare for aligning switch and case statements, fix in advance
some checkpatch error due to existing code:
- fix useless 'else' after 'break', by moving the 'break'
  statement.

While there:
- modify the checks on strncmp().

Change-Id: I123f3c0e3999669440845c946e4839d7288e8d91
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/9037
Tested-by: jenkins
2025-09-06 08:30:23 +00:00
Antonio Borneo
c5806c0ae1 rtos: linux: drop useless code
Since the initial code merged in 2012, the last case of the switch
has a useless test on 'retval' that is not assigned in the case.
Since 'retval' is initialized to ERROR_OK, the condition is always
false.

Drop the check on 'retval'.
While there, drop the useless parenthesis around the 'case' and
add the 'break' statement.

Change-Id: I3f673b5e10f6b28a4a74881b8a06a71b58afb422
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/9036
Tested-by: jenkins
2025-09-06 08:30:08 +00:00
Antonio Borneo
44b8d0f186 flash: nor: jtagspi: invert the operands in check
Check the variable against the constant.
No functional change.

Change-Id: Ie3138e516f4b81bf544780981863e856f8ffc528
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/9035
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2025-09-06 08:29:54 +00:00