The STLink API that supports dap-direct is available from STLink
firmware v2j24, published in early 2015.
We can reasonably expect that any old STLink still in use today
has got at least one firmware update during the last 10 years.
Most of the board files in upstream OpenOCD still use the STLink
in HLA mode. This limits the test coverage of the dap-direct code,
which was introduced in OpenOCD v0.11.0.
- Rename interface/stlink.cfg as interface/stlink-hla.cfg to still
provide support for HLA, adding a deprecated message.
- Rename interface/stlink-dap.cfg as interface/stlink.cfg to make
dap-direct the default trasport.
- Add a redirect file interface/stlink-dap.cfg for users that have
out-of-tree custom board files.
- Update all the board files to the new setup.
- Remove STLink HLA mentions from the documentation, while adding
a reference to interface/stlink-hla.cfg
Checkpatch-ignore: LONG_LINE
Change-Id: I99366bb03cd3b83f8f408514e657f30e59813063
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8523
Tested-by: jenkins
Reviewed-by: Andrzej Sierżęga <asier70@gmail.com>
In multi-target SoC not all the targets are running simultaneously
and some target could be powered off or kept under reset.
Commit 4892e32294 ("target/cortex_m: allow poll quickly get out
of TARGET_RESET state") does not considers the case of a target
that is kept in reset and expects the target to change state from
TARGET_RESET immediately.
This causes OpenOCD to log continuously:
Info : [stm32mp15x.cm4] external reset detected
Info : [stm32mp15x.cm4] external reset detected
Info : [stm32mp15x.cm4] external reset detected
Read again dhcsr to detect the 'stable' reset status and quit,
waiting for next poll to re-check the target's status.
Change-Id: Ic66029b988404a1599bb99bc66d4a8845b8b02c6
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Fixes: 4892e32294 ("target/cortex_m: allow poll quickly get out of TARGET_RESET state")
Reviewed-on: https://review.openocd.org/c/openocd/+/8399
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
Adapter Xilinx XVC/PCIe was not appearing in the configuration summary
because of the wrong variable name: build_xlnx_pcie_xvc
instead of enable_xlnx_pcie_xvc.
Also build this adapter automatically on Linux.
Change-Id: I69ea92f550052b9ce55ce32597ac446a15a87388
Signed-off-by: R. Diez <rdiezmail-openocd@yahoo.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8312
Tested-by: jenkins
Reviewed-by: R. Diez <rdiez-2006@rd10.de>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
On several packet-handling functions, add "const" to arguments
that represent read-only packet buffers.
For instance on GCC 13.2.0, this code:
const char *some_packet = "...";
gdb_put_packet(conn, some_packet, strlen(some_packet));
would prior to the fix produce warning:
passing argument 2 of ‘gdb_put_packet’ discards ‘const’
qualifier from pointer target type [-Wdiscarded-qualifiers]
Change-Id: Idb62f57d37ed323c39de38982e57afdd3882e280
Signed-off-by: Jan Matyas <jan.matyas@codasip.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8517
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
To help the developers who use Visual Studio Code IDE,
ignore the ".vscode" folder in Git. This folder contains
local configuration of the VSCode workspace.
Change-Id: I1d54d8ce2bd0680f2fa1fb773bb33c786bdcc608
Signed-off-by: Jan Matyas <jan.matyas@codasip.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8518
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
Change the prototype of riscv_batch_get_dmi_read_op().
Now that 'target->smp' is unsigned, drop the cast.
Change-Id: I2a54268ed1e4bf0ea884b62cceb73f5c7451da78
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8484
Tested-by: jenkins
Conversion done with
checkpatch --fix-inplace -types UNSPECIFIED_INT
Ignore the cast as they could be better addressed.
Fix only minor additional checkpatch issue (spacing and line
length).
Change-Id: I11f10eddadc21e051c96eb3d4d4c0554a2cddd15
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8483
Tested-by: jenkins
The firmware in contrib folder use Makefile for the build.
Force checkpatch to check these Makefile for the SPDX.
Change-Id: I815bf6df636c96a15f82c3d8a9de0c4f219303d2
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8520
Tested-by: jenkins
Zero is not a power of two.
All functions that use IS_PWR_OF_2 were checked and the edge case
of IS_PWR_OF_2(0) does not occur anywhere at the moment. Therefore
the fix is safe.
Change-Id: I84d9f9c64c9a7df452ca6e99c2ee4169ccb2b0be
Signed-off-by: Jan Matyas <jan.matyas@codasip.com>
Fixes: 9544cd653d ("helper: add align.h")
Reviewed-on: https://review.openocd.org/c/openocd/+/8511
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
New version tagged on 2024-08-28.
Change-Id: Id0cf82a692469ccf794c9680c5d5ac09ea26e6da
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8513
Tested-by: jenkins
In jimtcl 0.82, the include file jim.h included in turn stdio.h
This made redundant to include the former in openocd source files.
Since jimtcl 0.83, jim.h drops the include of stdio.h, causing
openocd build to fail.
Include stdio.h in the files that need it.
Change-Id: Ic81c9b273d7520f4d2d8c32bc3e0a6bcfffb67ed
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8512
Reviewed-by: Jonathan McDowell <noodles-openocd@earth.li>
Tested-by: jenkins
Cross compiling OpenOCD for Windows forces the maximum number of
open files (including sockets) to 64. See in include file
psdk_inc/_fd_types.h:
#ifndef FD_SETSIZE
#define FD_SETSIZE 64
#endif
This limit is far lower than the default value 1024 used by Linux.
In pull request #644 [1] in risc-v fork it's reported that:
- each socket server of OpenOCD (GDB, telnet, ...) uses one FD;
- each active connection to a socket server uses another FD;
- multi-core devices with 32 or more cores, each having a GDB
connection, already saturates the 64 available FD at the 26th
GDB connection.
The patch [2] proposed and merged in risc-v fork adds the compile
flag
-DFD_SETSIZE=128
to all the host types. While this looks fine for Windows, it
reduces the default value for Linux and other OS.
Add the compile flag FD_SETSIZE only to cross compile for Windows.
Link: [1] https://github.com/riscv-collab/riscv-openocd/pull/644
Link: [2] https://github.com/riscv-collab/riscv-openocd/pull/644/commits/1bab4cfbc4f4
Change-Id: Ie43a792ac11a5e63e0407b68e3f270efea0c87be
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8503
Tested-by: jenkins
The macros trigger few errors with checkpatch:
ERROR:MACRO_ARG_REUSE: Macro argument reuse 'g' - possible
side-effects?
ERROR:TRAILING_STATEMENTS: trailing statements should be
on next line
ERROR:SPACING: spaces preferred around (several cases)
ERROR:SINGLE_STATEMENT_DO_WHILE_MACRO: Single statement
macros should not use a do {} while (0) loop
plus an empty line triggers
ERROR:BRACES: Blank lines aren't necessary before a close
brace '}'
Fix them!
Change-Id: I0690b68b511ed7f45a7e0909a0addd2822ba9fe8
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8499
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
The function dpm->finish() returns a value that is almost always
ignored.
Drop the commented-out cast
/* (void) */
Change-Id: I7ff210a2693dd1877b7c7591705cdcd96a2c6125
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8498
Tested-by: jenkins
Reviewed-by: zapb <dev@zapb.de>
Fix checkpatch errors:
ERROR:BOOL_COMPARISON: Using comparison to true/false is
error prone
While there,
- drop useless parenthesis,
- drop unnecessary else after a return.
Change-Id: I1234737b3e65bd10df5e938d1c36f9abaf02d348
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8496
Reviewed-by: zapb <dev@zapb.de>
Tested-by: jenkins
Fix checkpatch error:
ERROR:COMPARISON_TO_NULL: Comparison to NULL could be
written "cmd_ctx"
Change-Id: I3615fc427f8b160d44b6edbf7a066a086cab99bb
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8495
Tested-by: jenkins
Reviewed-by: zapb <dev@zapb.de>
Fix checkpatch error:
ERROR:COMPARISON_TO_NULL: Comparison to NULL could be
written "handle"
Change-Id: I0ac12ccfc5fce4dd41266f83eb4b973a4e6a314d
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8494
Reviewed-by: zapb <dev@zapb.de>
Tested-by: jenkins
Checkpatch triggers the error
ERROR:RETURN_VOID: void function return statements are not
generally useful
Fix it!
Change-Id: I72d9fb8242d6a91c0aa481d5d023f0359c76a5ec
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8492
Tested-by: jenkins
Reviewed-by: zapb <dev@zapb.de>
Checkpatch triggers the error
ERROR:OPEN_BRACE: open brace '{' following function
definitions go on the next line
Fix it!
Change-Id: I0ce4585a6507eca094b82cdabdecf6fdbe7923b1
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8491
Tested-by: jenkins
Reviewed-by: zapb <dev@zapb.de>
Conversion done with
checkpatch --fix-inplace -types UNSPECIFIED_INT
Ignore the cast as they could be better addressed.
Fix only minor additional checkpatch issue (spacing and line
length).
Change-Id: I4f936ffc4cedb153afa331cd293b08f4c913dc93
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8482
Tested-by: jenkins
Conversion done with
checkpatch --fix-inplace -types UNSPECIFIED_INT
Ignore the cast as they could be better addressed.
Fix only minor additional checkpatch issue (spacing and line
length).
Change-Id: I2c1ef03bbc828112cc5bea89463cff9fc0c1e94f
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8481
Reviewed-by: zapb <dev@zapb.de>
Tested-by: jenkins
Conversion done with
checkpatch --fix-inplace -types UNSPECIFIED_INT
Ignore the cast as they could be better addressed.
Fix only minor additional checkpatch issue (spacing and line
length).
Use Checkpatch-ignore below for the function pointers in the file
'armv7a_cache_l2x.h' that do not assign the identifier names to
the function arguments.
Most of these struct are unused and should be fixed or dropped.
Checkpatch-ignore: FUNCTION_ARGUMENTS
Change-Id: I8f27e68eb3502e431c1ba801b362358105f9f2dc
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8480
Tested-by: jenkins
Reviewed-by: zapb <dev@zapb.de>
Conversion done with
checkpatch --fix-inplace -types UNSPECIFIED_INT
Ignore the cast as they could be better addressed.
Fix only minor additional checkpatch issue (spacing and line
length).
Change-Id: Id808747855a02052f3738e2d232bff4dd99b27f1
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8479
Tested-by: jenkins
Reviewed-by: zapb <dev@zapb.de>
Change the type to 'struct target::smp' and to the initialization
variable 'smp_group'.
Change-Id: I5f5a30a796aaf4e0014a38e81abdf4fb4afbdf48
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8478
Reviewed-by: zapb <dev@zapb.de>
Tested-by: jenkins
Detected while converting 'unsigned' to 'unsigned int'.
Use the correct conversion string for stdint values.
Change-Id: I99f3dff4c64dfd7acf2bddb130b56e9ebe1e6c60
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8477
Tested-by: jenkins
Change order of dsp register name array and removed hi0 and lo0
to comply with gdb definition of dsp in mips-dsp.xml, the regs
name array is now mapping corresponding dsp accumulator names
onto `mips32_regs` and `core_regs` instead of mapping to instr
arrays in dsp functions.
feature now requires a place to store cached dsp registers.
Add dsp registers to reg_list for gdb to access them.
Add dsp module enable detection to avoid DSP Disabled exception
while reading dsp accumulators.
Add dsp register reading procedure in `mips32_pracc_read_regs`
and writing procedure in `mips32_pracc_write_regs`.
Change-Id: Iacc335da030ab85989922c81aac7925b3dc17459
Signed-off-by: Walter Ji <walter.ji@oss.cipunited.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8476
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
Due to checkpatch internal state machine, the field 'Checkpatch-ignore:'
must be in the commit message before the 'Signed-off-by:' line.
Report it in the documentation and add that multiple 'Checkpatch-ignore:'
lines are allowed.
Change-Id: I770cdc4cb5b33bcf63c860c154ab3cbd4785ad20
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7572
Tested-by: jenkins
The field 'struct chibios_chdebug::ch_version' is 16 bits wide, so
using le_to_h_u32() and be_to_h_u32() overflows in the following
fields of the struct.
Restrict the endianness conversion to 16 bits and use the target
endianness dependent target_buffer_get_u16().
Convert the 'struct chibios_chdebug::ch_version' to an array of
uint8_t.
Change-Id: Iaa80e9cb1a65c27512919398b8ffbf14e5c240cd
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8473
Tested-by: jenkins
These devices are essentially the same as the E54 series with the
exception of immutable boot (SG41, SG61) and HSM (SG60, SG61), and some
bug fixes found only in E54 revision F. When the security features are
not enabled, they behave identically except for the different DIDs.
Signed-off-by: Matt Trescott <mtc@melexis.com>
Change-Id: Ic93313f3e20af0ed4a5768880d17b335a7b7bb04
Reviewed-on: https://review.openocd.org/c/openocd/+/8355
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Use a command group 'telnet' with subcommands instead of individual
commands with 'telnet_' prefix. Even though there is only one subcommand
at the moment, make this change to ensure consistency with other commands.
The old command is still available to ensure backwards compatibility,
but are marked as deprecated.
Change-Id: I5e88632fa0d0ce5a8129e9fcf5ae743fc5b093cb
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8378
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
The current semantics are a bit confusing, as the return value looks
like memcmp (0/false being equal) but the bool return type means one
likely expects true to mean equal. Make this clearer by switching them
out for buf_eq* functions that do that instead.
Checkpatch-ignore: UNSPECIFIED_INT
Change-Id: Iee0c5af794316aab5327cb9c168051fabd3bc1cb
Signed-off-by: Jessica Clarke <jrtc27@jrtc27.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8490
Tested-by: jenkins
Reviewed-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Backtraces performed by GDB on any thread other than the current
thread would fail if hardware 8 byte ISR stack alignment
was enabled on cortex_m targets. Stack reads now adjust
the stored SP to account for a potential offset introduced by hardware.
Fixed incorrect register offsets for cortex_m Nuttx frames by reading
the TCB info symbols to determine correct offsets.
Fixed offsets can no longer be used since the offsets have changed
multiple times for different Nuttx versions.
Tested on nuttx-12.1.0.
Tested using custom stm32h7 board and custom s32k148 board variants.
Built with CONFIG_ARCH_FPU enabled and disabled to
test FPU and non FPU frame logic.
Change-Id: Ifcbeefb0ddcfbcb528daa9d1d95732ca9584c9ef
Signed-off-by: daniellizewski <daniellizewski@geotab.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8180
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
When a target is reset we must invalidate register caches in order
to avoid showing stale register values or writing them back to
registers. Use EDPRSR.SR to detect a previous reset, and EDPRSR.R to
detect a current reset state.
Change-Id: Ia1e97d7154cf7789d392274eee475733086a835b
Signed-off-by: Peter Collingbourne <pcc@google.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8425
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
This is the fast path for when there is a mismatch in the leading whole
bytes, which means we should return true to indicate not equal like all
the other cases here and in the surrounding functions. Otherwise we'll
incorrectly report _buf1 == _buf2 if and only if there are mismatches in
the leading whole bytes.
This was introduced during the refactor and optimisation referenced
below.
The only in-tree caller of this is jtag_check_value_inner, which will
just fail to catch some errors. However, downstream in riscv-openocd it
gets used in the riscv target to determine whether an IR scan is needed
to select the debug module, and with an IRLEN >= 8 this breaks resetting
if the encoding for the DMI isn't all-ones in its leading whole bytes
(to match BYPASS), since it will believe they are the same and not do an
IR scan, failing (with "At least one TAP shouldn't be in BYPASS mode")
in the subsequent DR scan due to the TAP still being recorded as having
bypass set (and really having an instruction of either BYPASS or
IDCODE).
Fixes: e4ee891759 ("improve buf_cmp and buf_cmp_mask helpers")
Change-Id: Ic4f7ed094429abc4c06a775eb847a8b3ddf2e2d6
Signed-off-by: Jessica Clarke <jrtc27@jrtc27.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8489
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
The README file contains a mixture of Markdown and non-Markdown syntax.
Refurbish the document and use only Markdown syntax according to the
specification in [1].
[1] https://www.markdownguide.org/
Change-Id: If58f4e2971dc798a03a78841226804ab1f2d33c8
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8387
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
- Xtensa LX8 is fully supported in addition to prior LX and NX cores.
Change-Id: I2f3f0a21ce1518b3ced6d241f0ab84c65af64423
Signed-off-by: Ian Thompson <ianst@cadence.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8362
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
Current script does not enforces the check for the SPDX tag in the
linker scripts.
Add the extension '.ld' in the OpenOCD specific part.
Change-Id: I1cb6bc52e9dd86d99a26393085c7e2c9e8bac11f
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8475
Tested-by: jenkins
Two different sizes uint8_t and uint32_t was used for this value
without a good reason.
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Change-Id: I4bb60cc5397ffd0d37e7034e3930e62793140c8d
Reviewed-on: https://review.openocd.org/c/openocd/+/8439
Reviewed-by: Andreas Bolsch <hyphen0break@gmail.com>
Tested-by: jenkins
Could be handy for dummy transfer size detection.
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Change-Id: Ibb485218f6c2ff9066910bb58be0fc614b77add3
Reviewed-on: https://review.openocd.org/c/openocd/+/8438
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
Reviewed-by: Andreas Bolsch <hyphen0break@gmail.com>
Use the TRAX interface DEBUGPC if available.
Otherwise use default stop-and-go profiling.
ESP32-S3, before this patch:
Internal: 8 samples/second
FT2232H: 12 samples/second
After this patch:
Internal: 18ksamples/second
FT2232H: 100ksamples/second
Change-Id: I681f0bccf4263c1e24f38be511e3b3aec8bf4d60
Signed-off-by: Richard Allen <rsaxvc@rsaxvc.net>
Reviewed-on: https://review.openocd.org/c/openocd/+/8431
Reviewed-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Ian Thompson <ianst@cadence.com>
Reviewed-by: Yurii Shutkin <yurii.shutkin@gmail.com>
Simplify the code using the target endianness independent API.
Change-Id: I39f720d0db9cf24eb41d7f359e4321bbc2045658
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8474
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>