Skip to content

Conversation

@en-sc
Copy link
Collaborator

@en-sc en-sc commented Sep 12, 2025

Conflicts:

  • configure.ac: commit bd5649d ("Support cJTAG JScan3 mode") and commit 7d0e125 ("jtag/drivers: Add support for CH347-based JTAG adapters")
  • src/jtag/drivers/ftdi.c: commit f61098c ("Rename ftdi_oscan1 to ftdi_cjtag") and commit 867611d ("jtag: drivers: align switch and case statements") -- resolved by aligning the statements.
  • src/rtos/freertos.c: commit 50a5971 ("RISC-V Freertos support (RISC-V Freertos support #582)") and commit commit 3954896 ("rtos/FreeRTOS: fix next pointer member offset in FreeRTOS lists") -- dropped the upstream change since the offsets are dynamically computed by freertos_compute_offsets().
  • src/rtos/freertos.c: due to commit b3b790e ("rtos: rework rtos_create()") -- the change is already adopted.
  • src/rtos/hwthread.c: commit 95cb368 ("Merge up to 1f3f635 from upstream") and commit c545b9c ("rtos/hwthread: use printf format specifier") -- resolved in favour of upstream version.
  • src/rtos/rtos.c: commit 737f013 ("Support RV32/RV64 mainline/metal stackings (Support RV32/RV64 mainline/metal stackings #586)") and commit b3b790e ("rtos: rework rtos_create()") -- adjusted the handlers, adopted the error checks.
  • src/server/gdb_server.c: commit 52c9ae0 ("server/gdb_server: Handle events if first target is unavailable") and commit 7f57e72 ("gdb_server: Operate on available targets.") -- resolved in favor of the version from RISC-V OpenOCD, since it is being upstreamed.
    Link: https://review.openocd.org/c/openocd/+/8914
  • src/target/breakpoints.c: commit b1f3a75 ("target/riscv: Don't resume unavailable harts.") and commit ddef9cf ("target: align switch and case statements") -- aligned the statements.
  • src/target/riscv/riscv.c: due to commit 325e6d3 ("target: Use 'bool' data type in mmu()") -- adjusted to use bool instead of int.
  • src/target/target.c: commit 41b5b54 ("Revert "break from long loops on shutdown request"") and commit 9fe3780 ("openocd: drop iteration downsampling for keep_alive()") -- also dropped the downsampling.
  • src/helper/base64.[ch]: due to commit 6a3abda ("helper: add base64 encoding/decoding helpers from FreeBSD") -- resolved in favour of upstream.

en-sc and others added 30 commits May 9, 2025 12:12
`target create` calls can get quite long and an indication what is the
option that caused the error can be helpful.

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

Change-Id: I5ea61437ca9705e790ed8343183883a3fdfebc80
Signed-off-by: Evgeniy Naydanov <[email protected]>
Reviewed-on: https://review.openocd.org/c/openocd/+/8861
Reviewed-by: Tomas Vanek <[email protected]>
Reviewed-by: Antonio Borneo <[email protected]>
Tested-by: jenkins
Introduce basic testing of error-handling in target configuration
related commands.

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

Change-Id: Id0f382046dd70007d8e696d82d2396a7ccab7a33
Signed-off-by: Evgeniy Naydanov <[email protected]>
Reviewed-on: https://review.openocd.org/c/openocd/+/8644
Tested-by: jenkins
Reviewed-by: Antonio Borneo <[email protected]>
The license CC-BY-4.0 is not compatible with GPLv2, but files can
be dual licensed with a GPLv2 compatible license 'OR' CC-BY-4.0.

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

Change-Id: I4313d85a569a5e6423392129a730d1e22ef17c51
Signed-off-by: Antonio Borneo <[email protected]>
Reviewed-on: https://review.openocd.org/c/openocd/+/8894
Reviewed-by: Bernhard Rosenkraenzer <[email protected]>
Tested-by: jenkins
This patch ports FIELD_{GET,PREP,FIT} macros and related macro
from FreeBSD, referenced file:
- `src/tree/sys/compat/linuxkpi/common/include/linux/bitfield.h`

Checkpatch-ignore: MACRO_ARG_REUSE

Change-Id: I6fdf4514d3f95d62fadf7654409a4878d470a600
Signed-off-by: Walter Ji <[email protected]>
Reviewed-on: https://review.openocd.org/c/openocd/+/8171
Tested-by: jenkins
Reviewed-by: Antonio Borneo <[email protected]>
These helpers are needed by the updated RISC-V target files.

Change-Id: I5aa9f4e58eb75e1c7a1e8e0e3961725e2a915ebb
Signed-off-by: Bernhard Rosenkränzer <[email protected]>
Reviewed-on: https://review.openocd.org/c/openocd/+/8895
Tested-by: jenkins
Reviewed-by: Antonio Borneo <[email protected]>
On ARMv7a/r the single-step is implemented through a HW breakpoint
that hits instructions at any address except the address of the
current instruction.

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

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

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

Document the method in the code.

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

Change-Id: I9641a4a3e2f68b83897ccf3a12d3c34e98a7805c
Signed-off-by: Antonio Borneo <[email protected]>
Reviewed-on: https://review.openocd.org/c/openocd/+/8871
Tested-by: jenkins
Rewrite only the command, but still use the old jimtcl specific
code in dap_configure().

Change-Id: I3360884616367aae52f5b32247d9864000c53fdc
Signed-off-by: Antonio Borneo <[email protected]>
Reviewed-on: https://review.openocd.org/c/openocd/+/8897
Tested-by: jenkins
Rewrite only the command, but still use the old jimtcl specific
code in cti_configure().

Change-Id: I29fb952a7c8148416b301cbf78b6e342979af7d3
Signed-off-by: Antonio Borneo <[email protected]>
Reviewed-on: https://review.openocd.org/c/openocd/+/8898
Tested-by: jenkins
Rewrite only the command, but still use the old jimtcl specific
code in arm_tpiu_swo_configure(), shared with commands 'configure'
and 'cget'.

Change-Id: I39c69b1cdc23f7b5f875df3e15be987c715b0bcf
Signed-off-by: Antonio Borneo <[email protected]>
Reviewed-on: https://review.openocd.org/c/openocd/+/8899
Tested-by: jenkins
…ND_HANDLER

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

Change-Id: If2258f048403f54faf229e602d9b395b71894f97
Signed-off-by: Antonio Borneo <[email protected]>
Reviewed-on: https://review.openocd.org/c/openocd/+/8900
Tested-by: jenkins
With all OpenOCD commands converted to COMMAND_HANDLER, we can
drop the management of jim_handler commands.
Drop also from documentation the subsection on Jim Command
Registration.

Change-Id: I4d13abc7e384e64ecb155cb40bbbd52bb79ec672
Signed-off-by: Antonio Borneo <[email protected]>
Reviewed-on: https://review.openocd.org/c/openocd/+/8901
Tested-by: jenkins
With the rewrite of jim_handler commands as COMMAND_HANDLER, some
camelcase symbol from jimtcl are not referenced anymore in OpenOCD
code.

Drop such symbols from the camelcase whitelist.

Change-Id: I723be1820f13fe2cec7e4f0512a5e9da12889199
Signed-off-by: Antonio Borneo <[email protected]>
Reviewed-on: https://review.openocd.org/c/openocd/+/8902
Tested-by: jenkins
The API was introduced in 2008 by commit 8d73c2a ("duan ellis
target tcl work in progress") and never used.

Drop it!

Change-Id: Icbc5789f59696bd28f9d1151bc3e29f4adb74670
Signed-off-by: Antonio Borneo <[email protected]>
Reviewed-on: https://review.openocd.org/c/openocd/+/8903
Tested-by: jenkins
Since the initial commit f444c57 ("arm_cti: add cti command
group") the helper handle_cti_dump() return JIM error codes.

Fix it by returning standard OpenOCD error codes.

Change-Id: Ia36b82083d213aff90fe22fcfe7fbe26172806a3
Signed-off-by: Antonio Borneo <[email protected]>
Reviewed-on: https://review.openocd.org/c/openocd/+/8904
Tested-by: jenkins
Replace it by target_state_name() helper.

Change-Id: I720f2bf121e6fd2c6987a7e8fa9e52593888ee6c
Signed-off-by: Tomas Vanek <[email protected]>
Reviewed-on: https://review.openocd.org/c/openocd/+/8918
Tested-by: jenkins
Reviewed-by: Antonio Borneo <[email protected]>
GDB server debug logging eat Ctrl-C when gdb user issues interrupt
in time of communication between OpenOCD and gdb.
E.g. Ctrl-C after `next` gdb command taking many
gdb remote protocol $vCont;s (steps)

Change-Id: I4a65446a9bb25a28e50566607b3dec116fa7d2cd
Suggested-by: Tim Newsome <[email protected]>
Signed-off-by: Tomas Vanek <[email protected]>
Reviewed-on: https://review.openocd.org/c/openocd/+/8920
Tested-by: jenkins
Reviewed-by: Antonio Borneo <[email protected]>
The numeric value '3' for the ASCII character CTRL-C is not
immediately readable, even if the lines that follow explicitly
mention CTRL-C.

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

Change-Id: Iaf4296b1f0e384f8122d8a4875cad17e8ddaf66a
Signed-off-by: Antonio Borneo <[email protected]>
Reviewed-on: https://review.openocd.org/c/openocd/+/8922
Reviewed-by: Tomas Vanek <[email protected]>
Tested-by: jenkins
This is added for future RISC-V changes. The RISC-V debug interface can
explicitly tell a debugger when a hart is unavailable. This is used for
instance when that hart is powered down (or yet to be powered up out of
reset).

Imported from
riscv-collab#752

Change-Id: I8a062d59eea1e5b3c788281a75159592db024683
Signed-off-by: Tim Newsome <[email protected]>
Reviewed-on: https://review.openocd.org/c/openocd/+/8911
Tested-by: jenkins
Reviewed-by: Antonio Borneo <[email protected]>
Reviewed-by: Bernhard Rosenkränzer <[email protected]>
Imported from
riscv-collab#767

Change-Id: I53c6e2876d9bab70800a0f080e72a2abe0499120
Signed-off-by: Tim Newsome <[email protected]>
Reviewed-on: https://review.openocd.org/c/openocd/+/8919
Tested-by: jenkins
Reviewed-by: Antonio Borneo <[email protected]>
When SMP is enabled, gdb will always use the first target in the SMP
group. That doesn't work when that first target is unavailable, but
others in the SMP group are still available.

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

Imported from
riscv-collab#767

Change-Id: I4bed600da3ac0fdfe4287d8fdd090a58452db501
Signed-off-by: Tim Newsome <[email protected]>
Reviewed-on: https://review.openocd.org/c/openocd/+/8912
Tested-by: jenkins
Reviewed-by: Antonio Borneo <[email protected]>
Fixes: 8911: target: Add TARGET_UNAVAILABLE state | https://review.openocd.org/c/openocd/+/8911
Change-Id: I6d152aea5bb449f79fd0f829252442b8b9f8ed9c
Signed-off-by: Tomas Vanek <[email protected]>
Reviewed-on: https://review.openocd.org/c/openocd/+/8923
Tested-by: jenkins
Reviewed-by: Antonio Borneo <[email protected]>
Imported from
riscv-collab#763

Change-Id: Ia5931a772476a2ae186ed87cd70d7e4be2f196fb
Signed-off-by: Tim Newsome <[email protected]>
Reviewed-on: https://review.openocd.org/c/openocd/+/8917
Reviewed-by: Antonio Borneo <[email protected]>
Tested-by: jenkins
instead of typecast.

Change-Id: I62e3a0faebd915615f6b72a456667c49970a4091
Signed-off-by: Tomas Vanek <[email protected]>
Reviewed-on: https://review.openocd.org/c/openocd/+/8926
Tested-by: jenkins
Reviewed-by: Antonio Borneo <[email protected]>
Fix endianness for cortex_r4 and cortex_r5 when inserting software
breakpoints. Because the cortex_a target is used by the cortex_r
architecture and some chips start in BE by default (e.g. TMS570)

Change-Id: I68b7fe7c4604de67fee2e64fff0fad2691659a58
Signed-off-by: Lucien Dufour <[email protected]>
Reviewed-on: https://review.openocd.org/c/openocd/+/8909
Reviewed-by: Antonio Borneo <[email protected]>
Tested-by: jenkins
Added support for TMS570LS1xxx series parts. This uses the existing
ti_tms570.cfg as parent.

Change-Id: I40567bfb8dc052532807df68ef3d42f8e7a8ecf4
Signed-off-by: Lucien Dufour <[email protected]>
Reviewed-on: https://review.openocd.org/c/openocd/+/8928
Tested-by: jenkins
Reviewed-by: Tomas Vanek <[email protected]>
Reviewed-by: zapb <[email protected]>
The TCL configuration files are going to be dispatched in vendor
specific folders.
Old user configuration files will fail to find the new files to
include, so a set of fallback files reporting the deprecation
should replace the renamed files.

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

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

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

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

Change-Id: If4793fef27dc570d5df4ff4d77a5e36004f394f6
Signed-off-by: Antonio Borneo <[email protected]>
Reviewed-on: https://review.openocd.org/c/openocd/+/8929
Tested-by: jenkins
Move target configuration files into a dedicated vendor directory as
required by the new guideline for configuration files.

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

Change-Id: If3935985769dc543e8c7d72cda590c9d79303abb
Signed-off-by: Marc Schink <[email protected]>
Reviewed-on: https://review.openocd.org/c/openocd/+/8905
Reviewed-by: Antonio Borneo <[email protected]>
Tested-by: jenkins
Keep the old configuration files to ensure backwards compatibility.

Change-Id: Ia1d06b5a8a646d65f2cdc5a9415df3014a93b7d7
Signed-off-by: Marc Schink <[email protected]>
Reviewed-on: https://review.openocd.org/c/openocd/+/8863
Tested-by: jenkins
Reviewed-by: Antonio Borneo <[email protected]>
Use the moved nordic target configuration files.

Change-Id: Ie0e2eb7f9514eedb1ae6678eeee59291856c2674
Signed-off-by: Marc Schink <[email protected]>
Reviewed-on: https://review.openocd.org/c/openocd/+/8906
Tested-by: jenkins
Reviewed-by: Antonio Borneo <[email protected]>
Move board configuration files into a dedicated vendor directory as
required by the new guideline for configuration files.

Change-Id: Icbf368d7a453c82813e685d2935b186eb738c3ea
Signed-off-by: Marc Schink <[email protected]>
Reviewed-on: https://review.openocd.org/c/openocd/+/8864
Tested-by: jenkins
Reviewed-by: Antonio Borneo <[email protected]>
borneoa and others added 22 commits September 27, 2025 14:56
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 <[email protected]>
Reviewed-on: https://review.openocd.org/c/openocd/+/8207
Reviewed-by: Tomas Vanek <[email protected]>
Tested-by: jenkins
…sions

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 <[email protected]>
Signed-off-by: Tomas Vanek <[email protected]>
Reviewed-on: https://review.openocd.org/c/openocd/+/8226
Reviewed-by: Antonio Borneo <[email protected]>
Tested-by: jenkins
Log error in case of NULL calloc() return.

Change-Id: I40c5cba5b92cd39e9a8f7e6d420e11afc8747b3e
Signed-off-by: Tomas Vanek <[email protected]>
Reviewed-on: https://review.openocd.org/c/openocd/+/9119
Reviewed-by: Antonio Borneo <[email protected]>
Tested-by: jenkins
This Windows symbol is camelcase.

Change-Id: I2427de43e070592cf0c36c160c53c2bdfe96e524
Signed-off-by: Brian Kuschak <[email protected]>
Reviewed-on: https://review.openocd.org/c/openocd/+/9137
Tested-by: jenkins
Reviewed-by: Tomas Vanek <[email protected]>
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 <[email protected]>
Reviewed-on: https://review.openocd.org/c/openocd/+/9136
Reviewed-by: IRON ALEKS <[email protected]>
Reviewed-by: Tomas Vanek <[email protected]>
Tested-by: jenkins
…t" 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 <[email protected]>
Reviewed-on: https://review.openocd.org/c/openocd/+/9086
Reviewed-by: Evgeniy Naydanov <[email protected]>
Tested-by: jenkins
Reviewed-by: Tomas Vanek <[email protected]>
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 <[email protected]>
Reviewed-on: https://review.openocd.org/c/openocd/+/8638
Reviewed-by: Antonio Borneo <[email protected]>
Tested-by: jenkins
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 <[email protected]>
Reviewed-on: https://review.openocd.org/c/openocd/+/9077
Reviewed-by: Tomas Vanek <[email protected]>
Tested-by: jenkins
Add a comment in the breakpoint code to clarify the check for the
odd breakpoint length of 3 bytes, introduced by [1].

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

Change-Id: I024863d10078b5d9062c876aa59ccf70a81bf641
Signed-off-by: Antonio Borneo <[email protected]>
Reviewed-on: https://review.openocd.org/c/openocd/+/9139
Reviewed-by: Tomas Vanek <[email protected]>
Tested-by: jenkins
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 <[email protected]>
Reviewed-on: https://review.openocd.org/c/openocd/+/9015
Reviewed-by: zapb <[email protected]>
Tested-by: jenkins
Reviewed-by: Tomas Vanek <[email protected]>
Reviewed-by: Antonio Borneo <[email protected]>
The file INSTALL has been dropped in 2009 with [1] and it has been
replaced by the INSTALL file generated by automake.
The file INSTALL is only present in official releases of OpenOCD
and not in the code cloned from git.

Add a note in README to report this inconsistency.

Change-Id: I881b4282550a80bd5a6c61baff05543714a2e9c5
Reported-by: Mats <[email protected]>
Signed-off-by: Antonio Borneo <[email protected]>
Fixes: https://sourceforge.net/p/openocd/tickets/451/
Link: [1] commit ef733b4 ("Switch automake handling to use
	--gnu mode, not --foreign. Remove INSTALL file; automake
	generates a copy of the latest version.")
Reviewed-on: https://review.openocd.org/c/openocd/+/9121
Tested-by: jenkins
Adds support for BL616 series of chips, BL616 and BL618.
No flash bank support yet.

BL616 in comparison with BL602-series have new architecture,
using T-Head E907 RISC-V cores, instead of SiFive ones.

As BL602-series, the ndmreset bit in RISC-V Debug Module
does not reset the chip as it should, so we need to do it
manually with registers almost the same way as in BL602.

Additionally, JTAG Debug Transport Module in the chip have wrongly
implemented Test-Logic-Reset state, causing automatic chain scan
not working at all after initial JTAG usage. This is because
Test-Logic-State do not set IR instruction to IDCODE,
as it should by JTAG spec. We can fix this by getting state machine
to known state and configure IR instruction manually to IDCODE.
This bug was so far found in T-Head C906 and E907 IP cores.

This patch was tested heavily and works reliably on
BL616, BL618 and QCC74X.

Change-Id: Idc80a702e817d78fc0ca925572c68d4d0c28ce4e
Signed-off-by: Marek Kraus <[email protected]>
Reviewed-on: https://review.openocd.org/c/openocd/+/9145
Tested-by: jenkins
Reviewed-by: Antonio Borneo <[email protected]>
Remove the configuration file, a replacement is already available.

Link the old filename to the new configuration file to ensure backwards
compatibility.

Change-Id: I11361e471bb7ec277a850f956e51cd7d0fab408d
Signed-off-by: Marc Schink <[email protected]>
Reviewed-on: https://review.openocd.org/c/openocd/+/9149
Reviewed-by: Antonio Borneo <[email protected]>
Tested-by: jenkins
Remove the configuration file, a replacement is already available.

Link the old filename to the new configuration file to ensure backwards
compatibility.

Change-Id: I77cbd62d805b1c9b9bb8f56a823c3f6476d1a5a9
Signed-off-by: Marc Schink <[email protected]>
Reviewed-on: https://review.openocd.org/c/openocd/+/9150
Reviewed-by: Antonio Borneo <[email protected]>
Tested-by: jenkins
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 <[email protected]>
Reviewed-on: https://review.openocd.org/c/openocd/+/9151
Reviewed-by: Antonio Borneo <[email protected]>
Tested-by: jenkins
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 <[email protected]>
Reviewed-on: https://review.openocd.org/c/openocd/+/9152
Reviewed-by: Antonio Borneo <[email protected]>
Tested-by: jenkins
The adapter's driver that require the header file sys/mman.h
should check for it and don't compile if it is not present.

Add the check for sys/mman.h in configure.ac and prevent the
build of the adapter's driver that depend on it.

Change-Id: If0a518069e8fef9b41a67b633ec20e2f142a8b14
Signed-off-by: Antonio Borneo <[email protected]>
Reviewed-on: https://review.openocd.org/c/openocd/+/9159
Tested-by: jenkins
Commit ce3bf66 ("configure.ac: rename M4 macro 'adapter' to
prevent accidental conflicts") renames the macro as 'adapterTuple'
but since the macro name is printed in error messages, this
creates cryptic errors like:
	configure: error: header sys/mman.h is required
	for adapterTuple "Bitbanging on EP93xx-based SBCs".

Rename it as 'adapter_driver'. It keeps valid the purpose of the
former renaming, while keeping readable the error message.

Change-Id: Idd68270fbdf879153cd59f4cacf5036aa599b251
Signed-off-by: Antonio Borneo <[email protected]>
Fixes: ce3bf66 ("configure.ac: rename M4 macro 'adapter' to prevent accidental conflicts")
Reviewed-on: https://review.openocd.org/c/openocd/+/9160
Tested-by: jenkins
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 <[email protected]>
Reviewed-on: https://review.openocd.org/c/openocd/+/9161
Reviewed-by: Tomas Vanek <[email protected]>
Reviewed-by: <[email protected]>
Tested-by: jenkins
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 <[email protected]>
Reviewed-on: https://review.openocd.org/c/openocd/+/9070
Tested-by: jenkins
Even after commit e12cedd ("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 <[email protected]>
Reported-by: Parshintsev Anatoly <[email protected]>
Reviewed-on: https://review.openocd.org/c/openocd/+/9166
Tested-by: jenkins
Reviewed-by: Anatoly P <[email protected]>
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 <[email protected]>
Fixes: 04da6e2 ("target: cortex-m: add support for armv8m caches")
Reviewed-on: https://review.openocd.org/c/openocd/+/9167
Tested-by: jenkins
Reviewed-by: Tomas Vanek <[email protected]>
@en-sc en-sc force-pushed the en-sc/from_upstream branch from 4d4373d to 7fb168c Compare October 20, 2025 10:20
@en-sc
Copy link
Collaborator Author

en-sc commented Oct 20, 2025

The build will be broken without https://review.openocd.org/c/openocd/+/9115, I'll update the MR.

@en-sc en-sc force-pushed the en-sc/from_upstream branch from 7fb168c to 350fbf5 Compare October 20, 2025 11:57
@en-sc en-sc changed the title Merge up to c2cfeee471bd4a1b77ab1c30329200bb5fd37af4 from upstream Merge up to 88b9bd396d5a1f83c49fa1b28745fd7feaca2b2e from upstream Oct 20, 2025
Conflicts:

* `configure.ac`: commit bd5649d
  ("Support cJTAG JScan3 mode") and commit
  7d0e125 ("jtag/drivers: Add support
  for CH347-based JTAG adapters")
* `src/jtag/drivers/ftdi.c`: commit
  f61098c ("Rename ftdi_oscan1 to
  ftdi_cjtag") and commit 867611d
  ("jtag: drivers: align switch and case statements") -- resolved by
  aligning the statements.
* `src/rtos/freertos.c`: commit 50a5971
  ("RISC-V Freertos support (riscv-collab#582)") and commit commit
  3954896 ("rtos/FreeRTOS: fix next
  pointer member offset in FreeRTOS lists") -- dropped the upstream
  change since the offsets are dynamically computed by
  `freertos_compute_offsets()`.
* `src/rtos/freertos.c`:  due to commit
  b3b790e ("rtos: rework
  rtos_create()") -- the change is already adopted.
* `src/rtos/hwthread.c`: commit 95cb368
  ("Merge up to 1f3f635 from upstream")
  and commit c545b9c ("rtos/hwthread:
  use printf format specifier") -- resolved in favour of upstream
  version.
* `src/rtos/rtos.c`: commit 737f013
  ("Support RV32/RV64 mainline/metal stackings (riscv-collab#586)") and commit
  b3b790e ("rtos: rework
  rtos_create()") -- adjusted the handlers, adopted the error checks.
* `src/server/gdb_server.c`: commit
  52c9ae0 ("server/gdb_server: Handle
  events if first target is unavailable") and commit
  7f57e72 ("gdb_server: Operate on
  available targets.") -- resolved in favor of the version from RISC-V
  OpenOCD, since it is being upstreamed. Link:
  https://review.openocd.org/c/openocd/+/8914
* `src/target/breakpoints.c`: commit
  b1f3a75 ("target/riscv: Don't resume
  unavailable harts.") and commit
  ddef9cf ("target: align switch and
  case statements") -- aligned the statements.
* `src/target/riscv/riscv.c`: due to commit
  325e6d3 ("target: Use 'bool' data
  type in mmu()") -- adjusted to use `bool` instead of `int`.
* `src/target/target.c`: commit 41b5b54
  ("Revert "break from long loops on shutdown request"") and commit
  9fe3780 ("openocd: drop iteration
  downsampling for keep_alive()") -- also dropped the downsampling.
* `src/helper/base64.[ch]`: due to commit
  6a3abda ("helper: add base64
  encoding/decoding helpers from FreeBSD") -- resolved in favour of
  upstream.

Change-Id: I179c142a0f0c168683d48b6ae0956328ab289a2f
Signed-off-by: Evgeniy Naydanov <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.