aboutsummaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
2024-05-31riscv-013: Remove unused typedef slot_tremove-slot_t-from-riscv-013Jan Matyas1-6/+0
Code cleanup: "slot_t" is unused in riscv013 - remove it. Change-Id: I9d5a0cf8446a180b1d13a9ce2c86d904b946cf28 Signed-off-by: Jan Matyas <jan.matyas@codasip.com>
2024-05-28target/riscv: do not emit warnings when a non-existent CSR is hiddenParshintsev Anatoly1-1/+1
hide_csrs should not emit warnings on an attempt to hide non-exitents CSR. hide_csrs funcitonality is intended to be used for scenarios when we don`t want certain groups of registers to be available in GDB. Typically this is needed to simplify integration with various IDE. In such scenarious it may be impractical/unfeseable to figure out which register is present on a target. So reporting a situation when a user wants to hide a non-existent register creates way too much noise. This commit reduces severity of relevant debug message to LOG_TARGET_DEBUG
2024-05-28Merge pull request #1033 from en-sc/en-sc/err-read-abs-argEvgeniy Naydanov3-80/+218
target/riscv: read abstract args using batch
2024-05-23target/riscv: read abstract args using batchEvgeniy Naydanov3-80/+218
This would elliminate the need for an extra nop in-between the two reads in case of a 64-bit register. Change-Id: I2cddc14f7f78181bbda5f931c4e2289cfb7a6674 Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
2024-05-18Merge pull request #1061 from en-sc/en-sc/dm-resetEvgeniy Naydanov1-41/+81
target/riscv: only `dmactive` can be written if `dmactive` is low
2024-05-17Merge pull request #1029 from MrAlexei/add_decode_wp_rvcEvgeniy Naydanov1-30/+467
Add functions to decode RVC load and store instructions for watchpoints
2024-05-15target/riscv: only `dmactive` can be written if `dmactive` is lowEvgeniy Naydanov1-41/+81
There was an error introduced by 8319eee9e1ffc601b94b4223958180b49f8b8188. 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 8319eee9e1ffc601b94b4223958180b49f8b8188. Change-Id: I11fba35cb87f8261c0a4a45e28b2813a5a086078 Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
2024-05-07Merge pull request #1064 from en-sc/en-sc/from_upstreamEvgeniy Naydanov7-9/+445
Merge up to 04154af5d6cd5fe76a2583778379bdacb5aa6fb0 from upstream
2024-05-02Merge pull request #1028 from en-sc/en-sc/busy-reset-batchEvgeniy Naydanov5-29/+45
target/riscv: reset delays during batch scans
2024-04-30Add functions to decode RVC load and store instructionsAleksey Lotosh1-30/+467
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-27Merge pull request #1031 from aap-sc/aap-sc/hart_status_info_fixupEvgeniy Naydanov1-8/+31
fix confusing status messages during resume
2024-04-27Merge pull request #1055 from aap-sc/aap-sc/bp_unitializedEvgeniy Naydanov1-3/+7
target/riscv: use breakpoint_hw_set/watchpoint_set to properly initialize bp/wp descriptor
2024-04-27Merge up to 04154af5d6cd5fe76a2583778379bdacb5aa6fb0 from upstreamEvgeniy Naydanov7-9/+445
Change-Id: I84c1566472e5416bc2a71afa5adaf63c6c7a4a75
2024-04-26target/riscv: reset delays during batch scansEvgeniy Naydanov5-29/+45
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-26Merge pull request #1025 from en-sc/en-sc/dump-fieldEvgeniy Naydanov5-76/+49
target/riscv: decode DMI scans in batch access
2024-04-26Merge pull request #1046 from en-sc/en-sc/reg-rv011-segfault-propperEvgeniy Naydanov1-4/+4
target/riscv/riscv-011.c: fix access to non-existent register
2024-04-24fix confusing status messages during resumeParshintsev Anatoly1-8/+31
Recently, (after b503fdef02f) 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-24target/riscv: use breakpoint_hw_set/watchpoint_set to properly initialize ↵Parshintsev Anatoly1-3/+7
bp/wp descriptor Signed-off-by: Parshintsev Anatoly <anatoly.parshintsev@syntacore.com>
2024-04-23target/riscv/riscv-011: pc and dpc should be cached at the same locationEvgeniy Naydanov1-2/+2
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-20target/riscv/riscv-011.c: fix access to non-existent registerEvgeniy Naydanov1-4/+4
`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-19target/riscv: decode DMI scans in batch accessEvgeniy Naydanov5-76/+49
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-14Merge pull request #1040 from rivos-eblot/dev/ebl/read_mem_dmibaseEvgeniy Naydanov1-1/+5
target/riscv: Add missing DM base offset to read_memory_bus_v1()
2024-04-14Merge pull request #1023 from en-sc/en-sc/check-ac-busyEvgeniy Naydanov1-80/+239
target/riscv: check `abstractcs.busy`
2024-04-14Merge pull request #1039 from en-sc/en-sc/running-cacheEvgeniy Naydanov1-1/+2
target/riscv: read registers are not valid on a running target
2024-04-11target/riscv: check `abstractcs.busy`Evgeniy Naydanov1-6/+73
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-11target/riscv: introduce `examine_dm()` functionEvgeniy Naydanov1-73/+131
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-10target/riscv: cache `abstractcs.busy` in `dm013_info_t`Evgeniy Naydanov1-2/+36
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-07jtag: linuxgpiod: drop extra parenthesisAntonio Borneo1-2/+2
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-07target/mips32: fix clang sbuild check failWalter Ji1-2/+2
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-07remote_bitbang: Change sleep commands to Zz to avoid conflict with SWDJ. Neuschäfer1-2/+2
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-07jtag: linuxgpiod: fix detection for line request biasAntonio Borneo1-3/+3
Commit 290eac04b93c ("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: 290eac04b93c ("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-05target/riscv: read registers are not valid on a running targetEvgeniy Naydanov1-1/+2
Change-Id: I2c5335bb6055b767d3c3ffb3f6910b71b9c2bb35 Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
2024-04-04target/riscv: Add missing DM base offset to read_memory_bus_v1()Emmanuel Blot1-1/+5
dmi_scan expects the full DMI address. Signed-off-by: Emmanuel Blot <eblot@rivosinc.com>
2024-04-01flash/nor/eneispif: support ENE KB1200 ispi flashSteven Chang4-0/+436
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-03-28Merge up to a35e254c5383008cdacf7838a777f7f17af5eeb1 from upstreamEvgeniy Naydanov25-1206/+1641
Checkpatch-ignore: MACRO_ARG_REUSE, MACRO_ARG_PRECEDENCE Change-Id: Icd10f44d162054f8f32019a579ccbdda2cee7a91
2024-03-24target/adi_v5_swd: move setting of do_reconnect one level upTomas Vanek1-12/+10
Move setting of do_reconnect flag from swd_run_inner() to swd_run(). Reconnect is not used at the inner level and the flag had to be cleared after swd_run_inner() to prevent recursion. Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Change-Id: Ib1de80bbdf10d1cbfb1dd351c6a5658e50d12af2 Reviewed-on: https://review.openocd.org/c/openocd/+/8155 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins
2024-03-24helper/list: include the correct header fileAntonio Borneo3-2/+4
The file 'list.h', copied from FreeBSD, does not depend from any OpenOCD specific include file, but only needs 'stddef.h' for the type 'size_t'. Let 'list.h' to include the correct header file, then fix the now broken dependencies in the other files that were incorrectly relying on 'list.h' to include 'helper/types.h' Change-Id: Idd31b5bf607e226cac44ef41b2aa335ae4dbf519 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/8173 Tested-by: jenkins
2024-03-24helper/list: Replace Linux code with FreeBSD oneAntonio Borneo1-709/+225
The file list.h was originally taken from the Linux kernel code, thus under license GPL-2.0-only. This locks OpenOCD to follow the same license, even if the majority of OpenOCD files are licensed as GPL-2.0-or-later. A similar file is also present in FreeBSD code base under the more permissive license BSD-2-Clause. Drop the code from Linux kernel and replace it with the code from FreeBSD 13.3.0. Adapt the code to OpenOCD coding style by fixing the majority of issues identified by checkpatch. Add the OpenOCD specific macros and comments. Unfortunately this causes the lost of all the doxygen comments. Checkpatch-ignore: MACRO_ARG_REUSE, MACRO_ARG_PRECEDENCE Change-Id: I6d86752c50158f3174c4e8c4add81e9998d01e0e Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/8172 Tested-by: jenkins
2024-03-24gdb_server: drop useless check in gdb_keep_client_alive()Antonio Borneo1-5/+2
OpenOCD can send it's log to gdb, and gdb replies with 'OK'. Calls to LOG_XXX() are also present in the code that communicates with gdb. This can cause infinite nested calls. OpenOCD uses the flag 'gdb_con->busy' to protect the communication with gdb and prevent nested calls. There is no reason to check for 'gdb_con->busy' in the code for keep-alive, as keep_alive() is never called in this gdb server; the flag would eventually be set if the current keep_alive() will send something to gdb. Drop the flag 'gdb_con->busy' in gdb_keep_client_alive(). While there, document the use of 'gdb_con->busy'. Change-Id: I1ea20bf96abb5d2f1fcdba1e3861df257c396bb6 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/8166 Tested-by: jenkins
2024-03-24gdb_server: add async-notif keep-alive during memory read/writeAntonio Borneo1-6/+46
To avoid gdb to timeout, OpenOCD implements a keep-alive mechanism that consists in sending periodically to gdb empty strings embedded in the "O" remote reply packet. The main purpose of "O" packets is to forward in the gdb console the output of the remote execution; the gdb-remote puts in the "O" packet the string that gdb will print. It's use is restricted to few "running/execution" contexts listed in http://sourceware.org/gdb/onlinedocs/gdb/Stop-Reply-Packets.html and this currently limits the keep-alive capabilities of OpenOCD. Long data transfer (memory R/W) can also cause gdb to timeout if the interface is too slow. In this case the usual keep-alive based on "O" packet cannot be used and, if used, would trigger a protocol error that causes the transfer to be dropped. The slow transfer rate can be simulated by adding some delay in the main loop of mem_ap_write() and mem_ap_read(), then using the gdb commands "dump" and "restore". In the wait loop during a memory R/W, gdb drops any extra character received from the gdb-remote that is not recognized as a valid reply to the memory command. Every dropped character re-initializes the timeout counter and could be used as keep-alive. From gdb 7.0 (released 2009-10-06), an asynchronous notification can also be received from gdb-remote during a memory R/W and has the effect to reset the timeout counter, thus can be used as keep-alive. The notification would be treated as "junk" extra characters by any gdb older than 7.0, being still valid as keep-alive. Check putpkt_binary() and getpkt_sane() in gdb commit 74531fed1f2d662debc2c209b8b3faddceb55960 Currently, only one notification packet ("Stop") is recognized by gdb, and gdb documentation reports that notification packets that are not recognized should be silently dropped. Use 'set debug remote 1' in gdb to dump the received notifications and the junk extra characters. Add a new level in enum gdb_output_flag for using the asynchronous notifications. Activate this new level during memory transfers. Send a custom "oocd_keepalive" notification packet as keep_alive. While there, drop a useless return in the switch/case, already managed in case of break. After this commit, the proper calls to keep_alive() have to be added in the loops that code the memory transfers. Of course, the keep_alive() should be placed during the wait for JTAG flush, not while locally queuing the JTAG elementary transfers. Change-Id: I9ca8e78630611597d15984bd0e8634c8fc3c32b9 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/8165 Tested-by: jenkins
2024-03-21[NFC] target/riscv: refactor `init_registers()`Evgeniy Naydanov3-379/+529
The logic in `init_registers()` was quite convoluted. Initialization of each `struct reg` field is separated into function `gdb_regno_<field_name>()`. IMHO, this makes it much easier to reason about the code. Change-Id: Id7faa1464ce026cc5025585d0a6a95a01fb39cee Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
2024-03-16target/mips32: add fpu access supportWalter Ji4-12/+245
Add access to fpr and cp1 registers. GDB can now check the FPRs with `info reg f` and change them. Checkpatch-ignore: MACRO_ARG_REUSE Change-Id: I63896ab6f6737054d8108db105a13a58e1446fbc Signed-off-by: Walter Ji <walter.ji@oss.cipunited.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7866 Tested-by: jenkins Reviewed-by: Oleksij Rempel <linux@rempel-privat.de> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-03-16ipdbg: configurable queue size used between JTAG-Host and JTAG-HubDaniel Anselmi1-14/+54
Change-Id: I7941de02a968ccab730bfebd3483b8c3b84d7e53 Signed-off-by: Daniel Anselmi <danselmi@gmx.ch> Reviewed-on: https://review.openocd.org/c/openocd/+/7980 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins
2024-03-16ipdbg: split ipdbg command into multiple commandsDaniel Anselmi4-139/+408
To simplify the ipdbg start/stop command and be able to add additional commands in the future, we introduce the concept of a hub which has to be created before a ipdbg server can be started. The hub was created on the fly in previous versions. Change-Id: I55f317542d01a7324990b2cacd496a41fa5ff875 Signed-off-by: Daniel Anselmi <danselmi@gmx.ch> Reviewed-on: https://review.openocd.org/c/openocd/+/7979 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins
2024-03-16openocd: dump full command line in the debug logAntonio Borneo1-0/+4
When receiving an OpenOCD debug log to investigate about errors or issues, the first question is often about providing the complete command line to better understand the use context. Plus, when OpenOCD is lunched by an IDE, its command line is kept hidden inside the IDE, adding troubles to the user to recover it. Add the full command line directly inside the debug log. It could have been useful to also search and add in the log the full path of the OpenOCD executable, but this is not an immediate task due to portability among OS's. See, for example: https://stackoverflow.com/questions/933850 This part could be handled in a future change, if really needed. Change-Id: Ia6c5b838b9b7208bf1ecac7f95b5efc319aeabf5 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/8170 Tested-by: jenkins Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2024-03-16target: aarch64: add support for 32 bit MON modeAntonio Borneo1-0/+3
Extend the existing code to support Monitor mode in AArch32. Change-Id: Ia43df98d1497baac48aea67b92d81344c24f0635 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/8169 Tested-by: jenkins
2024-03-16target/adi_v5_swd: fix DP registers bankingTomas Vanek1-6/+9
ADIv6 brought more complicated rules for DP reg 0 banking. Neither the original implementation [1] nor the later modification [2] respected that the DP reg 0 is banked for read only, not for write. Enforcing of an useless SELECT write before a write to ABORT register may trigger FAULT (CTRL/STAT bits ORUNDETECT and STICKYORUN are set) or WAIT (DP is stalled by an outstanding previous operation) and therefore make ABORT register virtually unusable on some adapters (bitbang, CMSIS-DAP). There are DP ABORT specific functions swd_queue_ap_abort() and swd_clear_sticky_errors() which worked around the problem using the lowest level swd->write_reg(). Using a specific write procedure for a single DP register was error prone (there are other DP_ABORT writes using swd_queue_dp_write_inner()) and also the Tcl command 'xx.dap dpreg 0 value' suffered from unwanted SELECT write. Other smaller discords in DP banking probably do not influence normal DP operation however they may complicate debugging in corner cases. Adhere strictly to the DP banking rules for both ADI versions. Fixes: [1] commit 72fb88613f02 ("adiv6: add low level swd transport") Fixes: [2] commit ee3fb5a0eacb ("target/arm_adi_v5: fix DP SELECT logic") Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Change-Id: I3328748c1c3e0661c5ecd6eb070ac519b190ace2 Reviewed-on: https://review.openocd.org/c/openocd/+/8154 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-03-16jtag/drivers/bitbang: limit SWD WAIT retries by timeoutTomas Vanek1-2/+16
The bitbang driver kept retrying a SWD command as long as the debugged device had been responding by SWD WAIT. If the DP stalled in WAIT permanently, OpenOCD hanged. Check 0.5 sec timeout in WAIT retry loop. While on it insert a short alive_sleep() if the command is retried 20 or more times. Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Change-Id: I744e56e21a5a2dc2c4494cc0d7bbcb4be14ddb23 Reviewed-on: https://review.openocd.org/c/openocd/+/8153 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins
2024-03-16jtag/drivers/bitbang: use LOG_CUSTOM_LEVEL() macro for SWDTomas Vanek1-23/+33
Log SWD commands with not OK response but WAIT retries at debug level. For commands responded OK and WAIT retries use debug io level not to flood the log. Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Change-Id: Idf658e82ed970061c155945df55d06908ed25e09 Reviewed-on: https://review.openocd.org/c/openocd/+/8152 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-03-16helper/log: add LOG_CUSTOM_LEVEL() macroTomas Vanek2-1/+11
Allow logging at a changeable level. Add an example of usage in ftdi driver. Log SWD commands with not OK response at debug level (3). For commands which responded OK use debug io level (4) not to flood the log. Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Change-Id: I67a472b293f7ed9ee84cadb7c081803e9eeb1ad0 Reviewed-on: https://review.openocd.org/c/openocd/+/8151 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins