Commit Graph

12175 Commits

Author SHA1 Message Date
Evgeniy Naydanov 4924f63926
Merge pull request #1029 from MrAlexei/add_decode_wp_rvc
Add functions to decode RVC load and store instructions for watchpoints
2024-05-17 16:39:12 +03:00
Evgeniy Naydanov 418fcf1cea target/riscv: only `dmactive` can be written if `dmactive` is low
There was an error introduced by
8319eee9e1.

According to RISC-V Debug Spec 1.0.0-rc1 [3.14.2. Debug Module Contro]:
> 0 (inactive): The module’s state, including authentication mechanism,
takes its reset values (the dmactive bit is the only bit which can be
written to something other than its reset value).

`dmactive` was written together with `hartsel` and `hasel` in
8319eee9e1.

Change-Id: I11fba35cb87f8261c0a4a45e28b2813a5a086078
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
2024-05-15 18:58:47 +03:00
Ian Thompson 2c8376b79d target/xtensa: avoid IHI for writes to non-executable memory
For MPU configs, determine memory access rights
by probing protection TLB.  Issuing IHI without execute
permissions can trigger an exception.

No new clang static analyzer warnings.

Change-Id: Iea8eab5c2113df3f954285c3b9a79e96d41aa941
Signed-off-by: Ian Thompson <ianst@cadence.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8080
Reviewed-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-05-11 11:55:55 +00:00
Parshintsev Anatoly 22ddf62d75 gdb_server: enable keep-alive packets for qCRC packet
Change-Id: Ia384179bb83ad6b70bf385cc9d575e9ec58f76c7
Signed-off-by: Parshintsev Anatoly <anatoly.parshintsev@syntacore.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8227
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-05-11 11:55:17 +00:00
Antonio Borneo 126d8a0972 cortex_a: drop cortex_a_dap_write_memap_register_u32()
Historically, the function cortex_a_dap_write_memap_register_u32()
was used to discriminate the register write in APB-AP CPU debug
against the complex memory access in AHB-AP memory bus.

It has no sense to keep the function and its comment.
Plus, by forcing atomic write it impacts the debug performance.

Drop it!
A further rework to enqueue sequence of atomic writes is needed.

Change-Id: I2f5e9015f0e27fa5a6d8337a1ae25e753e2e1d26
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8231
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
Tested-by: jenkins
2024-05-11 11:54:51 +00:00
Antonio Borneo caabdd4a66 cortex_a: drop the command 'cache auto'
The command 'cache auto' was introduced with commit cd440bd32a
("add armv7a_cache handlers") in 2015 to allow disabling the cache
handling done automatically by OpenOCD.
This was probably a way to test the cache handling when there were
still the two independent accesses for APB-AP CPU debug and for
AHB-AP memory bus.

The handling of cache for cortex_a is robust and there is no more
reason to disable it.
The command 'cache auto' is not used in any upstream script.
On target aarch64 this command has never been introduced as the
cache is always handled automatically by OpenOCD.

Drop the command 'cache auto' and add it in the deprecated list.
Drop the flag 'auto_cache_enabled' by considering it as true.
Rename the function 'armv7a_cache_auto_flush_all_data()' as
'armv7a_cache_flush_all_data()' and, while there, fix the error
propagation in SMP case.

Change-Id: I0399f1081b08c4929e0795b76f4a686630f41d56
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8230
Tested-by: jenkins
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
2024-05-11 11:54:40 +00:00
Antonio Borneo dbef02789f cortex_a: drop useless cache invalidate on mem write
The initial OpenOCD code for Cortex-A (ARMv7a) [1] was merged in
2009 but, due to lack of public documentation for ARMv7a, it was
almost a simple copy/paste from the existing code for Cortex-M
(ARMv7m).

On Cortex-M the same AP provides access to both CPU debug and CPU
memory. This feature is not present on ARMv7a.
To still keep some communality with ARMv7m code, the change [2]
splits the CPU debug access from the CPU memory access by using
two independent AP; this is copied from the system architecture of
TI OMAP3530 which provides to DAP a direct AHB-AP memory bus on
AP#0, separated from AP#1 for the APB-AP CPU debug.
But the direct memory access through the system bus breaks the
coherency between memory and CPU caches, so change [3] added some
cache invalidation to avoid issues.

The code to allow ARMv7a CPU to really read/write in CPU memory
was added by change [4] in 2011. Such still not optimized
implementation was very slow, so it did not replace the access
through the system bus. A selection through DAP's 'apsel" command
was used to select between the two modes.

Only in 2015, with change [5], the speed of CPU read/write was
improved using the DCC_FAST_MODE. But the direct access to the
memory through the system bus remained.

Finally, with change [6] in 2018 the system bus access was dropped
for good, as the new virtual target "mem_ap" could implement such
access in a more clean way.
Only memory access through CPU remained for ARMv7a.
Nevertheless, a useless cache invalidation remained in the code,
decreasing the speed of the write access.

Drop the useless cache invalidate on CPU memory write and the
associated comment, not anymore valid.
Drop the now unused function armv7a_cache_auto_flush_on_write().

This provides a speedup of between 4 and 8, depending on adapter
and JTAG/SWD speed.

Link: [1] 7a93100c2d ("Add minimalist Cortex A8 file")
Link: [2] 1d0b276c9f ("The rest of the Cortex-A8 support from Magnus: ...")
Link: [3] d4e4d65d28 ("Cache invalidation when writing to memory")
Link: [4] 05ab8bdb81 ("cortex_a9: implement read/write memory through APB-AP")
Link: [5] 0228f8e827 ("Cortex A: fix extra memory read and non-word sizes")
Link: [6] fac9be64d9 ("target/cortex_a: remove buggy memory AP accesses")

Change-Id: Ifa3c7ddf2698b2c87037fb48f783844034a7140e
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8229
Tested-by: jenkins
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
2024-05-11 11:54:11 +00:00
Evgeniy Naydanov ae7ffa424e
Merge pull request #1064 from en-sc/en-sc/from_upstream
Merge up to 04154af5d6 from upstream
2024-05-07 10:54:01 +03:00
Daniel Anselmi bc9ca5f4a8 ipdbg: fix double free of virtual-ir data
Fix possible double free and possible
memory leak while creating an ipdbg hub.

Change-Id: I6254663c27c4f38d46008c4dbff11aa27b84f399
Signed-off-by: Daniel Anselmi <danselmi@gmx.ch>
Reviewed-on: https://review.openocd.org/c/openocd/+/8085
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-05-04 08:36:50 +00:00
Sean Anderson a84d1b5f5e tcl/target: Add helpers for booting Xilinx ZynqMP from JTAG
Add some helpers for booting ZynqMPs over JTAG. Normally, the CSU ROM
will load boot.bin from the boot medium. However, when booting from JTAG
we have to do this ourselves. There are generally two parts to this.
First, we need to load the PMU firmware. Xilinx's tools do this by
attaching to the PMU (a Microblaze CPU) over JTAG. However, the TAP is
undocumented and we don't have any microblaze support in-tree. So
instead we do it the same way FSBL does it:

- We ask the PMU to halt
- We load the firmware into the PMU RAM
- We ask the PMU to resume

The second thing we need to do is start one of the APU cores. When an
APU is released from reset, it starts executing at the value of its
RVBARADDR. While we could load the APU firmware over the AXI target,
it is faster to load it over the APU target. To do this, we put the APU
into an infinite loop before halting it. As an aside, I chose to use the
"APU" terminology as opposed to "core" to make it clear that these
commands operate on the A53 cores and not the R5F cores.

Typical usage of these commands could look something like

	targets uscale.axi
	boot_pmu /path/to/pmu-firmware.bin
	boot_apu /path/to/u-boot-spl.bin

But of course there is always the option to call lower-level commands
individually if your boot process is more unusual.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Change-Id: I816940c2022ccca0fabb489aa75d682edd0f6138
Reviewed-on: https://review.openocd.org/c/openocd/+/8133
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-05-04 08:36:23 +00:00
Antonio Borneo 3eba7b53bf smp: fix SIGSEGV for "smp off" during target examine
The gdb subsystem is initialized after the first target examine,
so the field struct target::gdb_service is NULL during examine.

A command "smp off" in the examine event handler causes a SIGSEGV
during OpenOCD startup.

Check for pointer not NULL before dereferencing it.

Change-Id: Id115e28be23a957fef1b97ab66d7273f0ea0dce4
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8216
Tested-by: jenkins
2024-05-04 08:35:27 +00:00
Antonio Borneo c72afedce7 target: cortex_a: fix regs invalidation when -defer-examine
The code for cortex_a allocates the register cache during the very
first examine of the target.
To prevent a segmentation fault in assert_reset(), the call to
register_cache_invalidate() is guarded by target_was_examined().

But for targets with -defer-examine, the target is set as not
examined in handle_target_reset() just before entering in
assert_reset().

This causes registers to not be invalidated while reset a target
examined but with -defer-examine.

Change the condition and invalidate the register cache if it has
been already allocated.

Change-Id: I81ae782ddce07431d5f2c1bea3e2f19dfcd6d1ce
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8215
Tested-by: jenkins
2024-05-04 08:35:00 +00:00
Antonio Borneo 42e31d75b4 target: aarch64: fix regs invalidation when -defer-examine
The code for aarch64 allocates the register cache during the very
first examine of the target.
To prevent a segmentation fault in assert_reset(), the call to
register_cache_invalidate() is guarded by target_was_examined().

But for targets with -defer-examine, the target is set as not
examined in handle_target_reset() just before entering in
assert_reset().

This causes registers to not be invalidated while reset a target
examined but with -defer-examine.

Change the condition and invalidate the register cache if it has
been already allocated.

Change-Id: Ie13abb0ae2cc28fc3295d678c4ad1691024eb7b8
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8214
Tested-by: jenkins
2024-05-04 08:34:37 +00:00
Antonio Borneo 89d881c19a cortex_m: don't try to halt not-examined targets
Prevent a segmentation fault by preventing to try to halt a target
that has not been examined yet.

Change-Id: I5d344e7fbdb5422f7c5e2c39bdd48cbc6c2a3e58
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8213
Tested-by: jenkins
2024-05-04 08:33:54 +00:00
Marc Schink 8667a72653 target/target: Add 'debug_reason' to current target
Change-Id: Ie35b13b3e06411b4866ffeada47b3262493dbf2e
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8021
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-05-04 08:31:14 +00:00
Antonio Borneo ac6b00c3ca target: cortex_m: fix display of DWT registers
Commit 16b4b8cf54 ("Cortex-M3: expose most DWT registers") added
the DWT registers to the list of CPU registers.
The commit message from 2009 reports the reason behind this odd
mixing of CPU and DWT registers.
This feature got broken in 2017 with the introduction of the field
struct reg::exist and its further use in the code. As result, the
command 'reg' on a target Cortex-M reports only the core registers
and then the header line
	===== Cortex-M DWT registers
not anymore followed by the DWT registers.

Fix it by tagging each DWT registers as existing.

Change-Id: Iab026e7da8d6b8ba052514c3fd3b5cdfe301f330
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Fixes: b5964191f0 ("register: support non-existent registers")
Reviewed-on: https://review.openocd.org/c/openocd/+/8198
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
2024-05-04 08:24:27 +00:00
Antonio Borneo a9e8ca55a6 jtag: linuxgpiod: minor alignment to coding style
Avoid double TAB in 'then' block by increasing indentation of the
multi-line condition.

Change-Id: I7f5a4437fe4f74228f1b0d98e5c5921af4fd36b8
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8200
Tested-by: jenkins
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
2024-05-04 08:22:11 +00:00
Antonio Borneo 495311d206 doc: style: report indentation of multi-line condition
To help readability and discriminate the 'then' block from the
multi-line condition, suggest to increase the indentation of the
condition.

Change-Id: I02e3834be3001e7ecf24349ad3cefe94b27b79c8
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8199
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
2024-05-04 08:21:33 +00:00
Evgeniy Naydanov 6a72b323da
Merge pull request #1028 from en-sc/en-sc/busy-reset-batch
target/riscv: reset delays during batch scans
2024-05-02 10:55:16 +03:00
Aleksey Lotosh 69cf9babfb Add functions to decode RVC load and store instructions
For GDB to fully support hardware watchpoints, OpenOCD needs to tell GDB
which data address has been hit. OpenOCD relies on a target-specific
hit_watchpoint function to do this. If GDB is not given the address, it
will not print the hit variable name or its old and new value.

There does not seem to be a way for the hardware to tell us which
trigger
was hit (0.13 introduced the 'hit bit' but this is optional).
Alternatively,
we can decode the instruction at dpc and find out which memory address
it accesses.

This commit adds support for RVC (compressed) load and store
instructions.

Related to:
https://github.com/riscv-collab/riscv-openocd/issues/688
https://github.com/riscv-collab/riscv-openocd/pull/291
2024-04-30 10:50:51 +03:00
Evgeniy Naydanov 687f00c060
Merge pull request #1031 from aap-sc/aap-sc/hart_status_info_fixup
fix confusing status messages during resume
2024-04-27 16:44:09 +03:00
Evgeniy Naydanov 9563cd67e6
Merge pull request #1055 from aap-sc/aap-sc/bp_unitialized
target/riscv: use breakpoint_hw_set/watchpoint_set to properly initialize bp/wp descriptor
2024-04-27 16:42:29 +03:00
Evgeniy Naydanov c0791b1c9e Merge up to 04154af5d6 from upstream
Change-Id: I84c1566472e5416bc2a71afa5adaf63c6c7a4a75
2024-04-27 15:16:16 +03:00
Evgeniy Naydanov 68fcd1c5b7 target/riscv: reset delays during batch scans
This commit is related to testing how OpenOCD responds to `dmi.busy`.

Consider testing on Spike (e.g. `riscv-tests/debug` testsuite). Spike
returns `dmi.busy` if there were less then a given number of RTI cycles
(`required_rti_cycles`) between DR_UPDATE and DR_CAPTURE:
https://github.com/riscv-software-src/riscv-isa-sim/blob/master/riscv/jtag_dtm.cc#L145
https://github.com/riscv-software-src/riscv-isa-sim/blob/master/riscv/jtag_dtm.cc#L202
`required_rti_cycles` gets it's value from `--dmi-rti` CLI argument and
is constant throughout the run.

OpenOCD learns this required number of RTI cycles by starting with zero
and increasing it if `dmi.busy` is encountered. So the required number
of RTI cycles is learned during the first DMI access in the `examine()`.

To induce `dmi.busy` on demand `riscv reset_delays <x>` command is
provided. This command initializes `riscv_info::reset_delays_wait`
counter to the provided `<x>` value. The counter is decreased before a
DMI access and when it reaches zero the learned value of RTI cycles
required is reset, so the DMI access results in `dmi.busy`.

Now consider running a batch of accesses.  Before the change all the
accesses in the batch had the same number of RIT cycles in between them.
So either:
* Number of accesses in the batch was greater then the value of
  `riscv_info::reset_delays_wait` counter and there was no `dmi.busy`
throughout the batch.
* Number of accesses in the batch was less or equal then the value of
  `riscv_info::reset_delays_wait` counter and the first access of the
batch resulted in `dmi.busy`.

Therefore it was impossible to encounter `dmi.busy` on any scan of the
batch except the first one.

Change-Id: Ib0714ecaf7d2e11878140d16d9aa6152ff20f1e9
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
2024-04-26 21:24:54 +03:00
Evgeniy Naydanov e51f8695ed
Merge pull request #1025 from en-sc/en-sc/dump-field
target/riscv: decode DMI scans in batch access
2024-04-26 20:49:35 +03:00
Evgeniy Naydanov de03da8c2c
Merge pull request #1046 from en-sc/en-sc/reg-rv011-segfault-propper
target/riscv/riscv-011.c: fix access to non-existent register
2024-04-26 20:49:11 +03:00
Evgeniy Naydanov 5aac841f4a
Merge pull request #1054 from en-sc/en-sc/rv011-pc-dpc
target/riscv/riscv-011: pc and dpc should be cached at the same location
2024-04-26 20:48:47 +03:00
Evgeniy Naydanov 16db1b77ff
Merge pull request #1050 from TommyMurphyTM1234/update-github-actions
Bump GitHub actions to latest versions
2024-04-25 08:56:11 +03:00
Parshintsev Anatoly 665fbf605b fix confusing status messages during resume
Recently, (after b503fdef02) OpenOCD started to notify user about hart
state updates. This causes confusion in some cases since some internal
updates to the hart state should not be visible to the user as these are
implementation details. For example situation like this:

```
> reset halt
JTAG tap: riscv.tap tap/device found: 0xdeadbeef ...
> resume
[riscv.cpu0] Found 4 triggers
riscv.cpu0 halted due to single-step.
[riscv.cpu1] Found 4 triggers
riscv.cpu1 halted due to single-step.
[riscv.cpu2] Found 4 triggers
riscv.cpu2 halted due to single-step.
[riscv.cpu3] Found 4 triggers
riscv.cpu3 halted due to single-step.
```
likely confuse people.

There is no issue with the resume functionality. It`s just that
resume internally causes single-step that causes hart state
to change.

This commit disable calling of user-specified (and default)
callbacks during the "hidden" step operation disabling these
confusing messages

Change-Id: I3412a089e2abdcd315d86cec7ee732fdd18c1601
Signed-off-by: Parshintsev Anatoly <anatoly.parshintsev@syntacore.com>
2024-04-24 02:34:48 +03:00
Parshintsev Anatoly 88f7650a6d target/riscv: use breakpoint_hw_set/watchpoint_set to properly initialize bp/wp descriptor
Signed-off-by: Parshintsev Anatoly <anatoly.parshintsev@syntacore.com>
2024-04-24 02:07:16 +03:00
Evgeniy Naydanov 98ece6bac9 target/riscv/riscv-011: pc and dpc should be cached at the same location
Prior to the commit, pc was cached at `info->dpc`, but dpc at register
cache.

Change-Id: I369788441dbe21bcf8fc360d2e97e98096b25e3a
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
2024-04-23 16:42:55 +03:00
Tommy Murphy 5c80ac8c57 Bump GitHub actions to latest versions - https://github.com/riscv-collab/riscv-openocd/issues/1048 2024-04-22 09:21:05 +01:00
Evgeniy Naydanov 967510cb1d target/riscv/riscv-011.c: fix access to non-existent register
`reg` is a number in register cache, as evident by the following call to
`reg_cache_set()`. `CSR_DCSR` is `GDB_REGNO_DCSR - 65`. This results in
setting cache value for another register, which does not exist, and
causes a segfault if all non-existent registers are not allocated a
value (`reg->value == NULL`).

Change-Id: Iab68a4bb55ce6d4730804e9709e40ab2af8a07c6
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
2024-04-20 00:11:51 +03:00
Evgeniy Naydanov e1e6cdfec6 target/riscv: decode DMI scans in batch access
This allows to merge the implementation in `batch.c` with the one in
`riscv-013.c`.

Change-Id: Ic3821a9ce2d75a7c6e618074679595ddefb14cfc
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
2024-04-19 13:21:19 +03:00
Evgeniy Naydanov 3991492cc1
Merge pull request #1040 from rivos-eblot/dev/ebl/read_mem_dmibase
target/riscv: Add missing DM base offset to read_memory_bus_v1()
2024-04-14 17:00:24 +03:00
Evgeniy Naydanov 740cdc78f3
Merge pull request #1023 from en-sc/en-sc/check-ac-busy
target/riscv: check `abstractcs.busy`
2024-04-14 16:59:04 +03:00
Evgeniy Naydanov 93f6260621
Merge pull request #1039 from en-sc/en-sc/running-cache
target/riscv: read registers are not valid on a running target
2024-04-14 16:58:10 +03:00
Evgeniy Naydanov 27fbc2767a
Merge pull request #1036 from en-sc/en-sc/from_upstream
Merge up to a35e254c53 from upstream
2024-04-14 16:57:29 +03:00
Evgeniy Naydanov 34d6fe3676 target/riscv: check `abstractcs.busy`
According to the RISC-V Debug Spec (1.0.0-rc1)[3.7 Abstract Commands]:
> While an abstract command is executing (busy in abstractcs is high), a
debugger must not change hartsel, and must not write 1 to haltreq,
resumereq, ackhavereset, setresethaltreq, or clrresethaltreq.

The patch ensures the rule is followed.

Change-Id: Id7d363d9fdeb365181b7058e0ceb0be0df39654f
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
2024-04-11 12:30:15 +03:00
Evgeniy Naydanov 8319eee9e1 target/riscv: introduce `examine_dm()` function
This allows to examine each DM ones (e.g. enumerating harts assigned to
the DM). Additionaly, it is guaranteed that the DM is reset before the
examination.

Change-Id: I2333d06ff1152bf51c647d59baa55cb402054cb9
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
2024-04-11 12:30:09 +03:00
Evgeniy Naydanov 67b2a5a955 target/riscv: cache `abstractcs.busy` in `dm013_info_t`
According to the RISC-V Debug Spec (1.0.0-rc1)[3.7 Abstract Commands]:
> While an abstract command is executing (busy in abstractcs is high), a
debugger must not change hartsel, and must not write 1 to haltreq,
resumereq, ackhavereset, setresethaltreq, or clrresethaltreq.

Tracking `abstractcs.busy` allows to enforce this rule.

Change-Id: If5975b48cf9fd379033268145c79103c36fb8134
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
2024-04-10 13:10:19 +03:00
Antonio Borneo 04154af5d6 jtag: linuxgpiod: drop extra parenthesis
Checkpatch complains for extra parenthesis not required.

Drop them.

Change-Id: I311409f5732acf10a4910de5dcf0fb05f43e21b5
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8187
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
2024-04-07 20:09:42 +00:00
Walter Ji 47d983a77a target/mips32: fix clang sbuild check fail
Initialized `value` variables that could only be set in a branch.

Change-Id: Iec7413ade9d053c93352a58ff954ad49a6545923
Signed-off-by: Walter Ji <walter.ji@oss.cipunited.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8179
Tested-by: jenkins
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-04-07 19:36:49 +00:00
J. Neuschäfer 79b51fedab remote_bitbang: Change sleep commands to Zz to avoid conflict with SWD
It was noticed that the remote_bitbang protocol has a design issue:
SWD and sleep commands cannot be implemented at the same time, because
they overlap:

 - SWD uses d,e,f,g for setting pin state
 - sleep uses d,D for microsecond and millisecond sleep, respectively

This has previously been reported by Marek Vrbka, but it wasn't fixed.

This commit does the following to resolve the issue:

 - Change the sleep commands to 'Z' for 1 ms, 'z' for 1 µs
 - Document 'D' and 'd' as deprecated aliases
 - Switch the remote_bitbang driver in OpenOCD to 'Z' and 'z'

Unfortunately that's a breaking change, because existing adapter-side
implementations of the protocol will have to implement the new commands
to keep working with future versions of OpenOCD. Fortunately, the
remote sleep commands haven't been part of an OpenOCD release yet,
which should limit the breakage somewhat.

Reported-by: Marek Vrbka <marek.vrbka@codasip.com>
Link: https://sourceforge.net/p/openocd/mailman/openocd-devel/thread/670d28d2-75a1-45ec-afe5-541415701d7a%40codasip.com/
Fixes: e8e09b1b5 ("remote_bitbang: add use_remote_sleep option to send delays to remote")
Change-Id: I04d2790a33bff9d47eb7f69b3275fd9a271625ae
Signed-off-by: J. Neuschäfer <j.neuschaefer@gmx.net>
Reviewed-on: https://review.openocd.org/c/openocd/+/8191
Reviewed-by: David Ryskalczyk <david.rysk@gmail.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
Reviewed-by: Jeremy Herbert <jeremy.006@gmail.com>
2024-04-07 19:36:29 +00:00
Antonio Borneo e035756b22 jtag: linuxgpiod: fix detection for line request bias
Commit 290eac04b9 ("drivers/linuxgpiod: Migrate to adapter gpio
commands") introduced an incorrect check to determine if the
library libgpiod declares the line request flags:
	GPIOD_LINE_REQUEST_FLAG_BIAS_DISABLE
	GPIOD_LINE_REQUEST_FLAG_BIAS_PULL_UP
	GPIOD_LINE_REQUEST_FLAG_BIAS_PULL_DOWN
The names above are declared by the library inside an enum, thus
cannot be used by the C preprocessor in a #ifdef.

Determine in configure if the version of libgpiod provides the
line request flags for "bias" and define a C macro.
Use the new macro in the driver code.

Change-Id: Iaa452230f4753fce4c6e9daa254299cedb7cab7f
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Fixes: 290eac04b9 ("drivers/linuxgpiod: Migrate to adapter gpio commands")
Reviewed-on: https://review.openocd.org/c/openocd/+/8186
Tested-by: jenkins
Reviewed-by: Michael Heimpold <michaheimpold@gmail.com>
2024-04-07 19:35:41 +00:00
Antonio Borneo 74e7fcb2dd configure: prevent build of linuxgpiod with libgpiod v2
The API in libgpiod v2 have changed, and current driver code for
linuxgpiod does not build anymore.

Prevent building the current driver linuxgpiod with the new
library.

Change-Id: Ie673db786dc50ae18a263d2c0a2b46b106866450
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8185
Reviewed-by: Michael Heimpold <michaheimpold@gmail.com>
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2024-04-07 19:35:02 +00:00
Dominik Wernberger 329e983ee9 zynq_7000.cfg: Fix issue 'Error: can't read "zynq_pl": no such variable'
Change-Id: Ic79ce114b60d0707a6e082a81743b378b164b4e2
Signed-off-by: Dominik Wernberger <dominik.wernberger@gmx.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8190
Reviewed-by: Daniel Anselmi <danselmi@gmx.ch>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
2024-04-07 13:46:13 +00:00
Evgeniy Naydanov 9c45c9f4be target/riscv: read registers are not valid on a running target
Change-Id: I2c5335bb6055b767d3c3ffb3f6910b71b9c2bb35
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
2024-04-05 14:19:33 +03:00
Emmanuel Blot fbd9b3d5f4 target/riscv: Add missing DM base offset to read_memory_bus_v1()
dmi_scan expects the full DMI address.

Signed-off-by: Emmanuel Blot <eblot@rivosinc.com>
2024-04-04 19:41:48 +02:00
Steven Chang dd17582722 flash/nor/eneispif: support ENE KB1200 ispi flash
Change-Id: I03bccceb1956ee121e6a3728b7d647ef1262fa23
Signed-off-by: Steven Chang <steven@ene.com.tw>
Reviewed-on: https://review.openocd.org/c/openocd/+/8136
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2024-04-01 05:51:33 +00:00