aboutsummaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
2024-05-04smp: fix SIGSEGV for "smp off" during target examineAntonio Borneo1-1/+1
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-04target: cortex_a: fix regs invalidation when -defer-examineAntonio Borneo1-1/+1
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-04target: aarch64: fix regs invalidation when -defer-examineAntonio Borneo1-1/+1
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-04cortex_m: don't try to halt not-examined targetsAntonio Borneo1-0/+5
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-04target/target: Add 'debug_reason' to current targetMarc Schink1-0/+7
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-04target: cortex_m: fix display of DWT registersAntonio Borneo1-0/+1
Commit 16b4b8cf5453 ("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: b5964191f0d2 ("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-04jtag: linuxgpiod: minor alignment to coding styleAntonio Borneo1-9/+9
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-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-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-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-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
2024-03-16target/arm_adi_v5: introduce adiv5_jim_configure_ext()Tomas Vanek4-26/+29
Allow direct pointer to struct adiv5_private_config for targets with adiv5_private_config inside of a bigger private config container. Use it instead of the private_config pointer toggling hack in aarch64.c Allow optional use of -dap parameter and use it instead of the static variable hack in xtensa_chip.c Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Change-Id: I7260c79332940adfa49d57b45cae39325cdaf432 Reviewed-on: https://review.openocd.org/c/openocd/+/8138 Tested-by: jenkins Reviewed-by: Ian Thompson <ianst@cadence.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-03-16drivers/cmsis_dap, kitprog: use helper to derive err code from ackTomas Vanek2-2/+2
Unify the error codes returned by adapter drivers in the case of the received SWD ACK field differs from OK. Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Change-Id: I29e478390b4b30408054a090ac6a7fac3415ae71 Reviewed-on: https://review.openocd.org/c/openocd/+/8137 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins
2024-03-10flash/nor/nrf5: drop useless for cycle conditionTomas Vanek1-1/+1
Commit [1] added a break on error to the nrf5_erase() sector loop and the checking of the res value became useless in the for loop condition. Removing nrf5_get_probed_chip_if_halted() later in [2] dropped res initialization and clang static analyser complains "The left operand of '==' is a garbage value" Drop the useless test! Fixes: [1] commit 491636c8b832 ("flash/nor/nrf5: check protection before flash erase/write on nRF51") Fixes: [2] commit 2db325f5395f ("flash/nor/nrf5: drop nrf5_get_probed_chip_if_halted()") Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Change-Id: Ife6071c509719f8d7dc312fe9a780bdcf2575f69 Reviewed-on: https://review.openocd.org/c/openocd/+/8174 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-03-09target/mips32: add dsp access supportWalter Ji2-1/+447
Add access to dsp registers and a command for dsp related operations. Checkpatch-ignore: MACRO_ARG_REUSE Change-Id: I30aec0b9e4984896965edb1663f74216ad41101e Signed-off-by: Walter Ji <walter.ji@oss.cipunited.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7867 Tested-by: jenkins Reviewed-by: Oleksij Rempel <linux@rempel-privat.de> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-03-09gdb_server: fix segfault with GDB command 'flash-erase'Antonio Borneo1-0/+7
Running the GDB command 'flash-erase' triggers sending the remote GDB commands 'vFlashErase' (one per flash bank) followed by one single 'vFlashDone', with no 'vFlashWrite' commands in between. This causes the field 'gdb_connection->vflash_image' to be NULL during the execution of 'vFlashDone', triggering a segmentation fault in OpenOCD. While parsing 'vFlashDone', check if any image to flash has been received. Change-Id: I443021c7a531255b60f2c44c2685e52e3c34b5c8 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/8164 Tested-by: jenkins
2024-03-09mem_ap: fix GDB connectionsAntonio Borneo1-4/+4
After commit d9b2607ca094 ("gdb_server: support sparse register maps"), GDB crashes while requesting the value of 'cpsr' because the fake register is tagged as not existing. Change the logic and set all register as existing, while still limiting the list for the initial GDB request at connect. Change-Id: I1c4e274c06147683db2a59a8920ae5ccd863e15c Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/8163 Tested-by: jenkins
2024-03-09flash/nor/nrf5: use BIT() instead of << operatorTomas Vanek1-4/+5
for features flags. Change-Id: I8bff0f5fac41c50180c847f36c6d2a075eca32ca Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/8109 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins
2024-03-09flash/nor/nrf5: drop nrf5 info commandTomas Vanek1-166/+0
The command substantially complicates support of nRF53/91 series. It was not even properly ported to nRF52. The informative value is disputable. Who wants to see e.g. override trim values for radio or unique device ID? Drop it and simplify the driver. Change-Id: Ia7fb20ce2ebf16065705c5d18deaf934e58db426 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/8108 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-03-09flash/nor/nrf5: drop nrf5_get_probed_chip_if_halted()Tomas Vanek1-44/+53
nrf5_get_probed_chip_if_halted() was somewhat bizarre combination of functions: - test if the target is halted is appropriate for flash erase/write only, certainly not for getting chip info - getting chip pointer takes place more frequently and using one temporary variable for dereference makes no harm - probing chip is useless at all as the flash infrastructure always calls auto_probe() before entering a flash operation Replace the function by ordinary and readable code. Change-Id: Ic31f4e33d8b7b36687be3f40bfd0fe913d17b75f Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/8107 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-03-09flash/nor/nrf5: add missing device typesTomas Vanek1-0/+4
from nRF52 family. Change-Id: I6d2b4586700bb4014c0b77dbf4ea26d1b5dc9715 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/8106 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins
2024-03-09flash/nor/nrf5: add missing package codesTomas Vanek1-4/+9
from Product Specification of nRF52805, 810, 811 820, 833 and 840. While on it, rename the table to make sure the codes are valid for nRF52 series only. Change-Id: Id8f78fd214c5d345d1769378ae546a6be5a183ba Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/8105 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-03-09flash/nor/nrf5, target/nrf51: deprecate nrf51 flash driverTomas Vanek1-0/+3
Use the newer driver name 'nrf5' instead. While on it set the unused parameters of flash bank creation to zero. While on it remove 2 empty comments. Change-Id: I9cf0eadc5b696e6c8b7e6aec0ea3345967523e87 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/8103 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins
2024-03-09flash/nor/nrf5: drop unused part of HWIDs tableTomas Vanek1-32/+16
While on it update table comment and drop not working URLs. Change-Id: I9e21c72aa75a908c644460e43c148d3240c49b2d Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/8102 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins
2024-03-02gdb_server: don't send unrequested ACK at connectionAntonio Borneo1-3/+0
On 2008-03-05, before git's age, commit 6d9501467441 adds sending an ACK ('+' char) at GDB connection, before receiving any GDB remote command that requires to be ACK'ed. Neither the text added in the commit message ("added ACK upon connection (send +)") nor in the associated comment ("send ACK to GDB for debug request") provide an exhaustive explanation for sending this unsolicited ACK. This code has never been touched since its introduction. Analysis of GDB code doesn't show it's required, including old GDB code. Running gdbserver (from GDB package) and attaching it with "nc" shows that gdbserver does not send any ACK to a new connection. Same for lldb-server. Drop it! Change-Id: Id68c352ce44dd85a1ea3d67446e17e2a241ef058 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6768 Tested-by: jenkins Reviewed-by: Jan Matyas <jan.matyas@codasip.com> Reviewed-by: Anatoly P <anatoly.parshintsev@syntacore.com> Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2024-03-02target/esp_xtensa_smp: don't use coreid as an SMP indexErhan Kurubas1-2/+5
For the sake of https://review.openocd.org/c/openocd/+/7957 Instead of "coreid", 'target smp' command call order used as an index Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com> Change-Id: Iab86b81868d37c0bf8663707ee11367c41f6b96d Reviewed-on: https://review.openocd.org/c/openocd/+/8162 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-03-02src/jtag/drivers/mpsse: Add support for new FTDI chip types.Luca Rufer2-0/+24
The new FTDI ICs with USB-C Support have different bcdDevice identifiers. The added bcdDevice identifiers are taken from the chips datasheet, respectively. The patch was tested with a FT4232HP IC. The used bcdDevice IDs can be found in Section 8.1 of the respective Datasheets: https://ftdichip.com/wp-content/uploads/2023/09/DS_FT233HP-v1.4.pdf https://ftdichip.com/wp-content/uploads/2023/09/DS_FT2233HP-v1.4.pdf https://ftdichip.com/wp-content/uploads/2023/09/DS_FT4233HP-v1.5.pdf Change-Id: I701083cb72030e398ce1c74310676e13895a77ff Signed-off-by: Luca Rufer <lucarufer333@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/8134 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-02-24jtag/commands: fixed buffer overflowSydMontague1-1/+1
When performing a command queue allocation larger than the default page size of 1MiB any subsequent allocations will run into an integer under- flow when checking for the remaining memory left in the current page. Causing the function returning a pointer past the end of the buffer and thus creating a buffer overflow. This has been observed to cause some transfers to Efinix FPGAs to fail, because another buffer can get corrupted in the process, causing its respective free() to fail. Change-Id: Ic5a0e1774e2dbd58f1a05127f14816c8251a7d9c Signed-off-by: SydMontague <sydmontague@phoenix-staffel.de> Reviewed-on: https://review.openocd.org/c/openocd/+/8126 Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins
2024-02-24src/target/riscv: Help older compilersSevan Janiyan1-1/+1
find members of a union, nested in struct. Allows file to be compiled with GCC 4.0 Signed-off-by: Sevan Janiyan <venture37@geeklan.co.uk> Change-Id: Ied68668d3b5f811573a20e11e83aceff268963eb Reviewed-on: https://review.openocd.org/c/openocd/+/8120 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-02-18driver: Add additional check for count of BYPASS devicesKirill Radkin1-0/+9
At least one TAP shouldn't be in BYPASS mode Change-Id: Ic882acbfc9b6a9f4b0c3bb4741a49f3981503c8c Signed-off-by: Kirill Radkin <kirill.radkin@syntacore.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7741 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-02-17server/gdb-server: fix type error.wangyanwen1-4/+5
Fix flash operation error when addr-width > 32bit on any 32-bit OS and some 64-bit OS (windows). Change-Id: I199f1cc5128c45bd0bb155e37acb2fb6325dff88 Signed-off-by: wangyanwen <wangyanwen@nucleisys.com> Reviewed-on: https://review.openocd.org/c/openocd/+/8095 Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Tested-by: jenkins
2024-02-15portability fix: Switch binary literals to hexSevan Janiyan3-71/+71
Allows build with legacy toolchains which do not support C23 nor GCC extension for binary literals. Change-Id: I742d3a8a86bf16f81421d11c59d3cb155ee17aed Signed-off-by: Sevan Janiyan <venture37@geeklan.co.uk> Reviewed-on: https://review.openocd.org/c/openocd/+/8123 Tested-by: jenkins Reviewed-by: Jörg Wunsch <openocd@uriah.heep.sax.de> Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2024-02-11jep106: update to revision JEP106BI January 2024Antonio Borneo1-4/+54
The original documents from Jedec since JEP106BG, do not report the entry for "21 NXP (Philips)", replaced by "c". It's clearly a typo. Keep the line from JEP106BF.01 for "NXP (Philips)". Change-Id: I293173c4527c2eabebdc33a94cd23d3a557a4618 Signed-off-by: Antonio Borneo <antonio.borneo@st.com> Reviewed-on: https://review.openocd.org/c/openocd/+/8132 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-02-11jtag interfaces: Reduce usage of global for jtag queueEvan Hunter31-65/+72
Makes driver interface slightly more flexible. Change-Id: I2c7f5cb6d014e94a0e6122cbe2f4002c77fbabb9 Signed-off-by: Evan Hunter <ehunter@broadcom.com> Signed-off-by: David Ryskalczyk <david.rysk@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/945 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins
2024-02-11jtag/drivers: fix reset logic handling in OpenJTAGN S1-7/+11
The OpenJTAG driver behaviour always forces a system reset on jtag_init. The driver was incorrectly assuming that when execute_reset is called with trst set to 1 - perform a software TAP reset, otherwise perform a system reset when trst is 0. The set_state call assumes the that OpenJTAG hardware will perform a software TLR reset if the target state is TAP_RESET. This is not the case: the published VHDL will simply find the shortest path to TLR and not perform a fixed 5 cycle operation with TMS held high. Fix the code to only perform system resets when srst is 1 in execute_reset and to force a software TAP reset operation in set_state when the target state is TAP_RESET. Change-Id: I7e0f76f8491efefff1ccaeb4b1ae16e722d76df4 Signed-off-by: N S <nlshipp@yahoo.com> Reviewed-on: https://review.openocd.org/c/openocd/+/8121 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins