Commit Graph

12391 Commits

Author SHA1 Message Date
Antonio Borneo 89fb9211ec target: riscv: convert 'unsigned' to 'unsigned int'
Conversion done with
	checkpatch --fix-inplace -types UNSPECIFIED_INT

Change-Id: I62fad88dd33716c24154d44c5a23ae2c0f7c4a4c
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-10-12 17:01:36 +02:00
Evgeniy Naydanov a4020f1a02
Merge pull request #1142 from en-sc/en-sc/from_upstream
Merge up to 1173473f66 from upstream
2024-10-08 14:17:57 +03:00
Jan Matyas edf2c82cf6 helper/align.h: Fix macro IS_PWR_OF_2
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
2024-10-05 15:53:43 +00:00
Antonio Borneo 30c3d077f2 jimtcl: update to version 0.83
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
2024-10-05 15:53:02 +00:00
Antonio Borneo 73390332d2 openocd: fix build with jimtcl 0.83
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
2024-10-05 15:52:26 +00:00
Antonio Borneo 116e9553d1 openocd: build: allow more socket connections on Windows
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
2024-10-05 15:51:58 +00:00
Antonio Borneo 595bb965b7 jtag: bcm2835gpio: fix macro definition
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>
2024-10-05 15:50:23 +00:00
Antonio Borneo 8c23e6c175 target: arm: drop casts commented-out
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>
2024-10-05 15:49:49 +00:00
Antonio Borneo 3ccf68cd0a OpenOCD: drop comparison with true/false
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
2024-10-05 15:49:04 +00:00
Antonio Borneo 66006d83b9 target: drop comparison to NULL
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>
2024-10-05 15:48:48 +00:00
Antonio Borneo 39197cdb4e jtag: stlink_usb: drop comparison to NULL
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
2024-10-05 15:48:35 +00:00
Antonio Borneo 4214fca447 OpenOCD: fix code alignment
Fix checkpatch errors:

	ERROR:TABSTOP: Statements should start on a tabstop

Change-Id: Ia771e7b7fa2cc4ef0be7f52b670525175555c8e4
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8493
Reviewed-by: zapb <dev@zapb.de>
Tested-by: jenkins
2024-10-05 15:48:23 +00:00
Antonio Borneo 537793bb24 target: mem_ap: drop return from void function
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>
2024-10-05 15:48:11 +00:00
Antonio Borneo 39f024900e flash: stm32l4x: fix open brace style
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>
2024-10-05 15:47:52 +00:00
Antonio Borneo 436e6f1770 openocd: convert 'unsigned' to 'unsigned int'
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
2024-10-05 15:46:25 +00:00
Antonio Borneo a64dc23bf1 jtag: convert 'unsigned' to 'unsigned int'
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
2024-10-05 15:45:57 +00:00
Antonio Borneo e72733d590 target: convert 'unsigned' to 'unsigned int'
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>
2024-10-05 15:45:34 +00:00
Antonio Borneo 2ad48b78d4 flash: convert 'unsigned' to 'unsigned int'
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>
2024-10-05 15:45:19 +00:00
Antonio Borneo 50586c9a06 target: use 'unsigned int' for smp group
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
2024-10-05 15:45:00 +00:00
Antonio Borneo bf1cf4afbb openocd: fix conversion string for stdint values
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
2024-10-05 15:44:46 +00:00
Antonio Borneo 8750beeb44 tcl: update to new syntax of telnet command
Commit ad21613618 ("server/telnet: Restructure commands")
modifies the syntax.

	sed -i 's/telnet_port/telnet port/'

Change-Id: If1ad34a1ec54824dbc124acd36a894862276a34f
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8502
Reviewed-by: zapb <dev@zapb.de>
Tested-by: jenkins
2024-10-05 15:43:26 +00:00
Walter Ji 00ee9b09d9 target/mips32: add dsp access support for gdb
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>
2024-10-05 15:43:03 +00:00
Antonio Borneo ab31562131 jep106: update to revision JEP106BK Sep 2024
Change-Id: Ica84e22b8d2da152cec39fc569c8333677c19490
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8501
Tested-by: jenkins
2024-10-05 15:42:32 +00:00
Parshintsev Anatoly bd93b83f1b jtag: update constant names to follow code style guidelines
Change-Id: Ib081433c67f3be0e5be0b39469680bcce079e0cc
Signed-off-by: Parshintsev Anatoly <anatoly.parshintsev@syntacore.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8485
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-10-05 15:42:07 +00:00
Antonio Borneo 017e61feb4 HACKING: add info on ignoring check-patch checks
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
2024-10-05 15:41:30 +00:00
Antonio Borneo 8edfdb02ed rtos: chibios: fix version display
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
2024-10-05 15:38:23 +00:00
Evgeniy Naydanov 0a2c146440
Merge pull request #1140 from TommyMurphyTM1234/riscv
Fix `riscv013_invalidate_cached_progbuf()`
2024-10-04 16:39:32 +03:00
Evgeniy Naydanov e4f5489723
Merge pull request #1127 from sunnyzhu-learning/Songhe-develop
target/riscv: Mismatch napot when mcontrol.maskmax is not expected
2024-10-04 11:12:02 +03:00
Evgeniy Naydanov ec00140a10 Merge up to 1173473f66 from upstream
1ae6b07b45 replaced `buf_cmp()` with
`buf_eq()`, so a96a0a4e39 needs to be
adjusted.

Change-Id: I97f6a3518db9421dab2ae4dd2312f443e928b114
2024-10-03 21:48:18 +03:00
Tommy Murphy 16fa57da41 Fix riscv013_invalidate_cached_progbuf() off by one error
See https://github.com/riscv-collab/riscv-openocd/issues/1139
riscv013_invalidate_cached_progbuf() was failing to zeroize the final
buffer array element. Use memset() instead of a manual loop to zeroize
it in order to address this and simplify the code.
2024-10-03 09:37:28 +01:00
Matt Trescott 1173473f66 flash/nor/atsame5: add PIC32CX-SG device IDs
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>
2024-10-01 04:00:05 +00:00
Evgeniy Naydanov 841b61adf3
Merge pull request #1134 from fk-sc/early-exit-support
target/riscv: early exit support for memory access operations
2024-09-30 10:49:35 +03:00
Evgeniy Naydanov 27220e4c85
Merge pull request #1136 from en-sc/en-sc/batch-logging
target/riscv: DMI logging improvements
2024-09-27 17:50:55 +03:00
Farid Khaydari 173086a651 target/riscv: early exit support for memory access operations
(1) Error code and 'skip_reason' string were replaced with memory access
    status. It allows to specify whether OpenOCD should exit the access
    early.
(2) Slightly refactored 'read_memory' and 'write_memory' functions.

Checkpatch-ignore: MACRO_ARG_PRECEDENCE, MULTISTATEMENT_MACRO_USE_DO_WHILE
Checkpatch-ignore: TRAILING_SEMICOLON
Signed-off-by: Farid Khaydari <f.khaydari@syntacore.com>
2024-09-27 12:27:11 +03:00
Evgeniy Naydanov f3302653a7
Merge pull request #1135 from borneoa/riscv
Move FD_SETSIZE to configure.ac
2024-09-26 12:30:19 +03:00
Evgeniy Naydanov 250aa20135 target/riscv: DMI logging improvements
Fixes #1043

There were multiple issuese with DMI logging:
1. Address was assumed to be the same (#1043).
2. Reported IDLE count was not affected by a reset of the delays.
3. VLA were used.

These issues are addressed in the commit.

Change-Id: I82f45505e8a62dfdd7dcb418784975fe10180109
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
2024-09-26 12:25:28 +03:00
zhusonghe 85c836bfb0 target/riscv: Mismatch napot when mcontrol.maskmax is not expected
1.Remove trigger_request_info::tdata1_ignore_mask
2.Adding ignore napot matching condition

Signed-off-by: Songhe Zhu <zhusonghe@eswincomputing.com>
Reviewed-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
Reviewed-by: Jan Matyas <jan.matyas@codasip.com>
2024-09-25 17:34:07 +08:00
Evgeniy Naydanov 7f8c43a77d target/riscv: move `riscv_log_dmi_scan`
Change-Id: Iade30374331e9bde31a411b82056d47207cc39a8
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
2024-09-23 18:28:51 +03:00
Antonio Borneo 54037d7b98 Move FD_SETSIZE to configure.ac
The commit from the pull request #644 sets the macro FD_SETSIZE to
128 for every host OS, while it is needed on Windows only.
Note that this macro has a much higher value on other OS and after
this commit it get reduced to 128 only.

Since in configure.ac is already present a hook to change the
compile defines for Windows, move there also FD_SETSIZE.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-09-23 12:01:59 +02:00
Marc Schink ad21613618 server/telnet: Restructure commands
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>
2024-09-21 09:05:36 +00:00
Evgeniy Naydanov e6ade35305 server/gdb_server: improve error handling for `Z/z` packet
* Report errors for `z` packet.
* Report not supported types as required by GDB Remote Protocol's
  documentation:
  > Implementation notes: A remote target shall return an empty string
    for an unrecognized breakpoint or watchpoint packet type.

  Link: https://sourceware.org/gdb/current/onlinedocs/gdb.html/Packets.html#insert-breakpoint-or-watchpoint-packet

Change-Id: I9130400aca5dbc54fefb413ed74f27d75fe50640
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8488
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-09-21 09:05:02 +00:00
Jessica Clarke 1ae6b07b45 binarybuffer: Invert buf_cmp* return value and rename to buf_eq*
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>
2024-09-21 09:04:06 +00:00
daniellizewski 5159c59915 src/rtos/rtos_nuttx_stackings.c: Fix stack alignment for cortex-m targets
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
2024-09-21 09:02:59 +00:00
Peter Collingbourne b14f63e004 aarch64: Invalidate caches on reset
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
2024-09-21 09:01:16 +00:00
Evgeniy Naydanov 3bed4c8015
Merge pull request #1132 from en-sc/en-sc/from_upstream
Merge up to fd7b66c5eb from upstream
2024-09-19 17:46:25 +03:00
Evgeniy Naydanov 90162b3250
Merge pull request #1130 from en-sc/en-sc/fix-reg-hide-warning
Revert "target/riscv: re-apply patch do stop avoid warnings when a no… …n-existent CSR is hidden"
2024-09-17 12:21:38 +03:00
Evgeniy Naydanov 4c45762d76 target/breakpoints: fix types in `watchpoint_add_internal()`
There was a conflict:
1. commit 2cd8ebf44d ("breakpoints: use 64-bit type for watchpoint mask
   and value")
2. commit 0bf3373e80 ("target/breakpoints: Use 'unsigned int' for
   length")

The second commit was created erlier, but merged later so the types of
`mask` and `value` became `uint32_t` in `watchpoint_add_internal()`.

This created a bug:
`WATCHPOINT_IGNORE_DATA_VALUE_MASK` is defined as `(~(uint64_t)0)`.
Truncation to uint32_t makes it so the comparisons with the constant
don't work.

Change-Id: I19c414c351f52aff72a60330d83c29db7bbca375
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
2024-09-16 18:41:08 +03:00
Evgeniy Naydanov 269c57e376 Merge up to fd7b66c5eb from upstream
Backports the fix for #1131.

Commit 0bf3373 ("target/breakpoints: Use 'unsigned int' for length")
introduces a bug.
Link: https://review.openocd.org/c/openocd/+/7056/comment/3c4d9185_83614e2a/

Change-Id: I9f5f67050698a83c27f84965f6de031e2cad492d
2024-09-16 18:38:05 +03:00
Jessica Clarke fd7b66c5eb binarybuffer: Fix inverted return value in buf_cmp
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
2024-09-15 09:22:44 +00:00
Marc Schink 63ca967032 README: Use proper Markdown syntax
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
2024-09-15 09:20:31 +00:00