aboutsummaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
2022-12-03hwthread: Add register validity check in get_thread_reg_listKoudai Iwahori1-0/+9
When OpenOCD receives 'g' packet (read general registers) from GDB and target is configured as rtos=hwthread, hwthread_get_thread_reg_list is called. However, it does not check if the register valid or not. Due to this issue, OpenOCD returns invalid register values to GDB. This commit adds a validity check to hwthread_get_thread_reg_list. If the register is not valid, it tries to read the register from the target. Signed-off-by: Koudai Iwahori <koudai@google.com> Change-Id: Iad6424b62124271ec411b1dfc044b57dfc460280 Reviewed-on: https://review.openocd.org/c/openocd/+/7357 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-12-03jtag: xds110: fix clang error core.StackAddressEscapeAntonio Borneo1-0/+2
Clang ignores that xds110_swd_write_reg() is always called with bit SWD_CMD_RNW in 'cmd' set to zero. It then complains that the local variable 'value' gets passed by address to xds110_swd_queue_cmd() and in case of 'read request' such stack address get stored for later use: src/jtag/drivers/xds110.c:1363:1: warning: Address of stack memory associated with local variable 'value' is still referred to by the global variable 'xds110' upon returning to the caller. This will be a dangling reference [core.StackAddressEscape] To both xds110_swd_write_reg() and xds110_swd_read_reg(), add an assert() to inform Clang about the state of bit SWD_CMD_RNW. Change-Id: I7687c055ec71424b642e152f478723a930966e3a Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7380 Tested-by: jenkins
2022-12-03flash: lpc2900: fix clang error 'dead assignment'Antonio Borneo1-2/+2
The variable retval is assigned a value that is never used. Scan-build reports: Although the value stored to 'retval' is used in the enclosing expression, the value is never actually read from 'retval'. Drop the dead assignment. Change-Id: I11588dee748a55d52aa7f35bc1967b7df55af7fc Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7379 Tested-by: jenkins
2022-11-28flash/nor/stm32lx: Add revision '1, X' for Cat.2 devicesMarc Schink1-1/+1
Change-Id: I0ff1e2102175ee952b066b325c9acbcb598b3af7 Signed-off-by: Marc Schink <dev@zapb.de> Reviewed-on: https://review.openocd.org/c/openocd/+/7378 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-11-28jtag/drivers/cmsis_dap.c: Fix Length of SWO Baudrate CommandNick Kraus1-1/+1
The command should now send the full 5 byte command length, which includes the command tag (0x19) and the 4-byte baudrate word, instead of only the last 3 bytes of the baudrate. Signed-off-by: Nick Kraus <nick@nckraus.com> Change-Id: Idd6e084efd7492489aa900cdbf08f540944041cb Reviewed-on: https://review.openocd.org/c/openocd/+/7370 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-11-15target/armv7m: fix feature name of ARMv8M security extension regsTomas Vanek1-17/+17
gdb requires this feature to enable stack unwinding of secure/nonsecure interstate calls and exceptions on an ARMv8M target with the security extension. Tested on STM32L5 (Cortex-M33). Change-Id: Ib09780c011afbc095b352074068597559ad14fcd Link: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=ae7e2f45aa4798be449f282bbf75ad41e73f055e Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/7265 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-11-15rtos/ThreadX: added check for NULL-named tasksGiulio Fieramosca1-9/+14
Thread name loading was not correctly handled if a ThreadX task has a NULL name. Signed-off-by: Giulio Fieramosca <giulio@glgprograms.it> Change-Id: I03071930182bc2585b61ce5d8c67491710883dd6 Reviewed-on: https://review.openocd.org/c/openocd/+/7328 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-11-15Fix for segfault and some clang reported problems in stmqspiAndreas Bolsch1-16/+14
Change-Id: Id003adb574085cdd603cc13aeb6f2efec73593f1 Signed-off-by: Andreas Bolsch <hyphen0break@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7345 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-11-15jep106: update to revision JEP106BF.01 Oct 2022Antonio Borneo1-3/+84
Change-Id: Ia1f19dcce48da997c036ccffa65e76e179de2eb9 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7341 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2022-11-15flash/nor/stm32f1x: adjust size of the flash loader bufferSimon Smiganovski1-1/+1
target_run_flash_async_algorithm expects the source_buffer to have at least 2 words reserved for read and write pointers in addition to the FIFO buffer. If the size of the data to be flashed is <= 8 bytes then the flash function will fail with "corrupted fifo read pointer" error. Ensure the allocated buffer is big enough to hold both FIFO buffer and read/write pointers. Change-Id: I09c22eaac517b8cfea8e0b463f5deb6b98afd267 Signed-off-by: Simon Smiganovski <simon.smiganovski@fruitcore.de> Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7342 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-11-15target/armv7m: prevent saving and restoring non existent regsTomas Vanek1-6/+12
armv7m_start_algorithm() saves register values to arch_info->context. armv7m_wait_algorithm() restores register values from arch_info->context. Exclude registers with flag exist = false from both loops. While on it refactor the register restore: introduce 'struct reg' pointer and dereference it instead of numerous accesses by a full path from armv7m pointer. Change-Id: I1600084db84809ee13bcf8e7828b79f8c9ff9077 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/7276 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-11-11rtos: hwthread: fix clang error core.NullDereferenceAntonio Borneo1-4/+4
Clang spots a potential NULL pointer dereferencing that is instead an incorrect use of an array of pointers: src/rtos/hwthread.c:254:32: warning: Dereference of null pointer [core.NullDereference] (*rtos_reg_list)[j].number = (*reg_list)[i].number; ^~~~~~~~~~~~~~~~~~~~~ The error has not been spotted before because: - this function is not called for the first core of the SMP node, - for the other cores on Cortex-A it still returns valid register value for the first 12 ARM registers, then it diverges. Also Valgrind does not spot any issue at runtime. Address the array correctly. While there, use DIV_ROUND_UP() macro for the computation. Change-Id: Ib87e60e0edfd9671091f5dcfa9aedaf1aed800d1 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7337 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2022-11-11Revert "Remove duplicate of a counter in hwthread_update_threads"Tomas Vanek1-3/+7
Commit 0cedf10f8fd6 ("Remove duplicate of a counter in hwthread_update_threads") introduced a code bug. In the second foreach_smp_target() loop, variable "threads_found" gets passed to routine hwthread_fill_thread(). By removing the counting of threads_found from the second loop, the incorrect thread counter value gets passed to hwthread_fill_thread(). Change-Id: Ie89e53ccd28bb72b6838ef2f12106a1fe8d00994 Suggested-by: Daniel Goehring <dgoehrin@os.amperecomputing.com> Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/7307 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-11-11jtag/drivers/cmsis_dap: prevent CDC missdetect as CMSIS-DAP bulkTomas Vanek1-1/+3
The autodetection of CMSIS-DAP v2 bulk interface is tricky as not all adapters conform CMSIS-DAP specs. If an interface has a string descriptor containing CMSIS-DAP, then OpenOCD did not insisted on the correct interface class LIBUSB_CLASS_VENDOR_SPEC. However the relaxed test caused false autodetection of v2 bulk interface on some CMSIS-DAP v1 adapters with an additional serial interface with the string descriptor stupidly containing CMSIS-DAP text. Make the test less relaxed, refuse autodetection of the interfaces with the class number of well known functions including CDC and MSC. Link: https://sourceforge.net/p/openocd/tickets/368/ Change-Id: I917cb257eb42aab93560cc39c61ec35a60ce52e3 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/7279 Tested-by: jenkins Reviewed-by: SilverFox <yyjdelete@126.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-11-11flash: stmqspi: fix clang error 'dead assignment'Antonio Borneo1-1/+0
The variable retval is assigned a value that is never used, as it is reassigned few lines below. Drop the dead assignment. Change-Id: Id4e9134408fab3e04936d36e95724bf8d3ab55aa Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7304 Tested-by: jenkins
2022-11-11dsp5680xx: fix clang error core.UndefinedBinaryOperatorResultAntonio Borneo1-2/+2
Clang get confused by initializing the array uint16_t lock_word[], casting it to (uint8_t *), then accessing the second element of the uint8_t pointer. src/target/dsp5680xx.c:2046:41: warning: The left operand of '<<' is a garbage value [core.UndefinedBinaryOperatorResult] uint16_t tmp = (buffer[0] | (buffer[1] << 8)); ~~~~~~~~~ ^ Fix it by replacing the array with a single uint16_t. The code is still depending on host endianness; no fix for this is proposed. Change-Id: I16dfd60cab117dd145aeecf10d9593574ff233a2 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7302 Tested-by: jenkins
2022-11-11esirisc_jtag: fix clang error core.VLASizeAntonio Borneo1-1/+3
The function esirisc_jtag_recv() can be called with argument num_in_fields = 0, for example as consequence of calling esirisc_jtag_continue(). In this case, num_in_bytes is zero and the allocation of the variable-length array 'r' requires size zero. src/target/esirisc_jtag.c:133:2: warning: Declared variable-length array (VLA) has zero size [core.VLASize] uint8_t r[num_in_bytes * 2]; ^~~~~~~~~ ~~~~~~~~~~~~~~~~ Fix it by forcing size one when num_in_bytes is zero. Change-Id: Id764c7b5ec4f5b3c18c7da650bbff39fc98ed049 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7301 Tested-by: jenkins
2022-11-11openrisc: fix clang error core.CallAndMessageAntonio Borneo1-1/+4
Clang assumes that size could assume a value that is not 1 nor 2 nor 4. In such condition the buffer in t is allocated (size != 1) and not initialized. This triggers an error: src/target/openrisc/or1k_du_adv.c:655:14: warning: 2nd function call argument is an uninitialized value [core.CallAndMessage] crc_calc = adbg_compute_crc(crc_calc, data[i], 8); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Add the default case to cover other values of size. After this fix, clang still complains on the same line, this time misunderstanding the limits of the loop and considering that buf_bswap16() only swaps the first 16 bits, thus passing not initialized value data[2] to adbg_compute_crc() Replace malloc() with calloc() to silent it. Change-Id: I358d7fb2ebefd69255670641bd435b770762a301 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7300 Tested-by: jenkins
2022-11-11helper/types: use unsigned type for all h_u64_to_le() and similarAntonio Borneo1-8/+8
All the converters functions: h_u64_to_le() h_u64_to_be() h_u32_to_le() h_u32_to_be() h_u24_to_le() h_u24_to_be() h_u16_to_le() h_u16_to_be() have signed type in their prototype, while the function name and all the current use cases pass an unsigned value. Change the prototypes to use unsigned types. Change-Id: I76dcfdd7912b81f60902184712b2907eae9843f7 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7299 Tested-by: jenkins
2022-11-04ThreadX: set current_thread for kernel executionBen McMorran1-0/+6
If we just invented thread 1 to represent the current execution, we need to make sure the RTOS object also claims it's the current thread so that threadx_get_thread_reg_list() doesn't attempt to read a thread control block at 0x00000001. Signed-off-by: Ben McMorran <bemcmorr@microsoft.com> Change-Id: I7f71e730d047858898297e4cb31db8e47e0c371c Reviewed-on: https://review.openocd.org/c/openocd/+/7280 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-10-21target/xtensa: remove redundant call for `TARGET_EVENT_HALTED`Erhan Kurubas1-2/+6
`xtensa_do_step` is invoked from `xtensa_prepare_resume` to silently step over BP/WP before resuming. For example; in the case of WPs (DEBUGCAUSE_DB), in the current implementation `xtensa_do_step` will generate one more `TARGET_EVENT_HALTED` after the original one caused by WP itself. This patch moves the halted event cb call after the step is done successfully. Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com> Change-Id: I9048e14fb316dc124847a42cfaefb1f76b5ce53e Reviewed-on: https://review.openocd.org/c/openocd/+/7274 Tested-by: jenkins Reviewed-by: Ian Thompson <ianst@cadence.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-10-21doc: fix riscv commandsAntonio Borneo1-0/+3
- Fix the declaration of riscv command 'set_mem_access'. - Remove non existing riscv command 'set_scratch_ram'. - Add riscv commands 'info', 'reset_delays'; copy the description from the 'help' text. - Don't add riscv commands 'set_prefer_sba' and 'test_sba_config_reg' as they are marked as deprecated. - Ensure that 'test_sba_config_reg' prints a deprecation warning when used. Change-Id: I39dc3aec4e7f13b69ac19685f1b593790acdde83 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Signed-off-by: Jan Matyas <matyas@codasip.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7268 Reviewed-by: Tim Newsome <tim@sifive.com> Tested-by: jenkins
2022-10-21jtag/drivers: bcm2835gpio: implement memory barriers when bitbashingJonathan Bell1-0/+15
This GPIO driver is common to SoCs that have in-order ARM cores (BCM2835) as well as superscalar (BCM2836-7) and speculative out-of-order cores (BCM2711). For BCM2837 and BCM2711, the processor can dual-issue stores and is free to merge writes to peripheral memory for pages mapped MT_NORMAL_NC, which is the default provided by /dev/[gpio]mem. This can cause glitches (or missing edges) on GPIO pins when toggled with no delay, as pipelined writes to the same address can get arbitrarily squelched. To prevent this happening, make sure the preceding write ops are flushed outside the shareable domain by using a memory barrier. Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com> Change-Id: I8805cc0911667bcb9b7f4ca340d7f4f1cb25d096 Reviewed-on: https://review.openocd.org/c/openocd/+/7258 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-10-15target/xtensa: fill register number field in the cacheErhan Kurubas1-0/+6
Currently 'number' field is zero in the register cache and this causes an issue on `rtos get_thread_reg_list` calls. Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com> Change-Id: Iaef11e01f55d012969bbc1933f82847d5e02fec5 Reviewed-on: https://review.openocd.org/c/openocd/+/7246 Tested-by: jenkins Reviewed-by: Ian Thompson <ianst@cadence.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-10-15target/esp32s2: check xtensa_poll return valueErhan Kurubas1-0/+2
Although scan build couldn't catch, return value overwritten without checking. Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com> Change-Id: I02b10002b03640604315047e8a8a639824724c16 Reviewed-on: https://review.openocd.org/c/openocd/+/7247 Tested-by: jenkins Reviewed-by: Ian Thompson <ianst@cadence.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-10-08target: re-examine before arp_waitstate in ocd_process_reset_innerTomas Vanek1-4/+15
arp_waitstate will not work on not-examined state Change-Id: I56c3e1c7e63af108e4ed1dbacebb567f9bf46264 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/7230 Tested-by: jenkins Reviewed-by: Erwan Gouriou Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-10-08target/hla_target: try to re-examine under reset in hl_assert_reset()Tomas Vanek1-0/+7
An application often idling in real sleep mode may make a Cortex-M target hard to access as CPU clock are gated and debug requests are responded by WAIT ack. Try to examine the target under reset as the last resort. Change-Id: I7c3de39fb1e6c23b76e2a0a85ab75f23aac94c4d Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/7229 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-10-08target/cortex_m: try to re-examine under reset in cortex_m_assert_reset()Tomas Vanek1-1/+9
An application often idling in real sleep mode may make a Cortex-M target hard to access as CPU clock are gated and debug requests are responded by WAIT ack. Try to examine the target under reset as the last resort. Change-Id: Ife875a966a838c37dde987bc584ad0a1f4d020d6 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/7228 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-10-08target/cortex_m: make reset robust againTomas Vanek1-17/+27
After merging [1] 'reset halt' does not work on not responding Cortex-M. Relax the examined tests and try to set vector catch VC_CORERESET if debug_ap is available. While on it add an info about examination state to debug logs. Fixes: [1] commit 98d9f1168cbd ("target: reset target examined flag if target::examine() fails") Change-Id: Ie2e018610026180af5997d70231061a275f05c76 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/6745 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-10-08target/adiv5: 64-bit TAR setup bugfixDaniel Goehring1-1/+1
For 64-bit TAR setup, if 'tar_valid == false' perform the upper 32-bit write even if the cached copy matches the upper TAR value to be written. Signed-off-by: Daniel Goehring <dgoehrin@os.amperecomputing.com> Change-Id: I320377dc90a9d1d7b64cbb281b2527e56c7621ee Reviewed-on: https://review.openocd.org/c/openocd/+/7245 Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins
2022-10-08fix leaky file-handle in virtex2 driverDaniel Anselmi1-0/+6
Change-Id: I2784a66c42be71f2982dff7746f9fb2eb1dc8ca6 Signed-off-by: Daniel Anselmi <danselmi@gmx.ch> Reviewed-on: https://review.openocd.org/c/openocd/+/7243 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-10-08don't return ERROR_OK in error casesDaniel Anselmi1-2/+2
Change-Id: I7e046df85838692c9044fe9c9d67e8b2c821eb0f Signed-off-by: Daniel Anselmi <danselmi@gmx.ch> Reviewed-on: https://review.openocd.org/c/openocd/+/7236 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins
2022-10-08fix memory leak in virtex2 driverDaniel Anselmi3-5/+34
Change-Id: Ia08f7aaad25631132885acd5898477c1106f0ec4 Signed-off-by: Daniel Anselmi <danselmi@gmx.ch> Reviewed-on: https://review.openocd.org/c/openocd/+/7235 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-10-08target/xtensa: pass correct buffer on read memory retryErhan Kurubas1-2/+2
Read values must be at albuff so that can be copied to buffer on function exit. Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com> Change-Id: I74a533e8f12f1002ca06a98a7c7cd928552b4cc5 Reviewed-on: https://review.openocd.org/c/openocd/+/7226 Tested-by: jenkins Reviewed-by: Ian Thompson <ianst@cadence.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-10-08target/xtensa: rename pc and ps macro namesErhan Kurubas1-8/+9
Actually they are the base of epc and eps Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com> Change-Id: I4f43b9609a9929399fb5d3fa0203efc8a98e94c9 Reviewed-on: https://review.openocd.org/c/openocd/+/7227 Tested-by: jenkins Reviewed-by: Ian Thompson <ianst@cadence.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-10-08flash/nor/at91samd: Use 32-bit register writes for ST-Link compatKeith Packard1-1/+2
ST-Link v2 dongles can be used with many cortex-m parts, but they have one limitation -- they can only perform 8-bit and 32-bit writes to the target. 16-bit writes are done using a pair of 8-bit writes. While not usually an issue, in the case of the at91samd flash driver, the 16-bit 'command' register must have both halves written in the same operation. Fortunately, this register has two pad bytes above it in the address space, making it safe to always access with 32-bit operations. Change-Id: I44b0db9406982a8db5818c0533d3101618741db2 Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7234 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-10-08Remove duplicate of a counter in hwthread_update_threadsEvgeniy Naydanov1-7/+3
There is no need to count number of examined threads twice. Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com> Change-Id: Id32ead853d1ddcd4e67062d6f795700feb20cb4b Reviewed-on: https://review.openocd.org/c/openocd/+/7223 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2022-10-08jtag/drivers/bitbang: reduce debug verbosityTomas Vanek1-11/+4
The bitbang driver floods the log by many messages with very little informational value. Remove some LOG_DEBUGs, convert some others to LOG_DEBUG_IO. Change-Id: I0c7539467b45543e12932c67dc71e86d58c8c6cd Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/7220 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-by: Jonathan Bell <jonathan@raspberrypi.com> Tested-by: jenkins
2022-10-08jtag/drivers/cmsis_dap: add LOG_DEBUG_IO to cmsis_dap_metacmd_targetselTomas Vanek1-2/+4
Make write to DP_TARGETSEL is logged the similar way as other DP register read/writes. While on it fix checkpatch message 'Concatenated strings should use spaces between elements' Change-Id: I98f724c984e8c4610cc461340f4c4a7cc9627ed9 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/7219 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-by: Jonathan Bell <jonathan@raspberrypi.com> Tested-by: jenkins
2022-10-08target/armv7m: show target name in 'halted' messageTomas Vanek1-1/+2
Change-Id: I13e9a33677632d52122585203252fc4ef0c52a2a Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/7237 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-10-08target/armv7m: prevent storing invalid registerTomas Vanek1-4/+7
armv7m_start_algorithm() stored all non-debug execution registers from register cache without checking validity. Check if the register cache is valid. Try to read from CPU if not valid. Issue a warning if register read fails. Change-Id: I365f86d65243230cf521b13909575e5986a87a50 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/7240 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-by: Jonathan Bell <jonathan@raspberrypi.com>
2022-10-08flash/nor/rp2040: fix setting spTomas Vanek1-5/+8
The num_reg_params parameter of target_run_algorithm() was not updated when setting "sp" was introduced. Therefore "sp" as the last register parameter was not passed to a target algo. Introduce a new helper variable with correct count of register parameters and use it everywhere needed. Change-Id: I934a71380783d98917167f1569145808ef23540f Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/7225 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-by: Jonathan Bell <jonathan@raspberrypi.com>
2022-09-27flash/nor/rp2040: remove new line from error messageTomas Vanek1-1/+1
Change-Id: Idf3bce842b4507c1f12692b5fbcd6730637de9db Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/7216 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-by: Jonathan Bell <jonathan@raspberrypi.com> Tested-by: jenkins
2022-09-27flash/nor/rp2040: use LOG_TARGET_xxx to show core nameTomas Vanek1-2/+1
Change-Id: Ic76e1c6306ece18b3590beaad4d5b224d4449aa0 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/7188 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins
2022-09-27flash/nor/rp2040: check target halted before flash operationTomas Vanek1-1/+19
Flash read_id/erase/write operation on running target failed in target_run_algorithm() anyway. It generated lot of error messages. Check the target state and bail out early if target is running. Change-Id: I903f5f38c8e61016e5002b235e5f07803bd2ec4e Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/7215 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-by: Jonathan Bell <jonathan@raspberrypi.com>
2022-09-27flash/nor/rp2040: fix flash erase timeoutTomas Vanek1-8/+11
SPI flash erase often takes longer than the fixed timeout 3 seconds. Introduce a configurable timeout_ms parameter to rp2040_call_rom_func(). Compute the erase timeout from the number of blocks to be erased. While on it make the timeouts shorter for connect flash, flush cache and enter/exit xip (1 second is enough). Change-Id: I552bfa317ee17064de3a54ec2f0c63e84ba87222 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/7214 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-by: Jonathan Bell <jonathan@raspberrypi.com>
2022-09-27flash/nor/rp2040: fix size of flash write bufferTomas Vanek1-1/+5
The size of the flash write buffer should be rounded down to the multiply of flash page size. Using write chunks of unadjusted size results in write of chunks unaligned to flash pages. Change-Id: If7931362ee193dff4dc2df7ec78f13530658cf08 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/7187 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-09-27flash/nor/rp2040: fix memory leak of target stack workareaTomas Vanek1-25/+57
While on it restore memory-mapped mode also after flash erase (originally was restored after flash write only). Change-Id: I5e153b79ac27a8439f57239ce90ce8a79c0bb8a1 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/7186 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-09-27flash/nor/rp2040: preparatory refactoringTomas Vanek1-29/+40
Prepend stack_grab_and_prep() function name by rp2040_ prefix. Introduce target helper variable in rp2040_stack_grab_and_prep() and use it instead of dereferencing bank->target several times. Move flash ID reading code to the new rp2040_spi_read_flash_id() function. Change-Id: I9d6e51e17e36e6230155a586065499f2f260089a Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/7185 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-09-27target/adi_v5_swd: suppress reconnect in swd_multidrop_select()Tomas Vanek1-0/+2
swd_multidrop_select() uses its own retry loop. If select fails, do_reconnect flag remains set on exit and causes useless reconnect. Clear do_reconnect flag in retry loop. Change-Id: Ie06d6967d7f4a977774c8530bb8d4b3e5ab4f62c Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/7217 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-by: Jonathan Bell <jonathan@raspberrypi.com> Tested-by: jenkins