aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2022-05-14arm_adi_v5: separate ROM table parsing from command output [1/3]Antonio Borneo1-6/+44
In OpenOCD arm_adi_v5 we have already two implementations of code for parsing the ADIv5 ROM table: - in the commands "dap info" and "$dap_name info"; - in the function dap_lookup_cs_component(). Adding support for ADIv6 requires extending both implementations. Moreover, current code does not handle few aspects of the ROM parsing, e.g. the "Power Domain IDs". To add such extensions both implementations should be touched. I plan to add a command to parses (again) the ROM table and dump a simple prototype of a configuration script for the target, useful while analysing a new target. Keeping aligned all these implementation would be too complex. With focus to "dap info" command, decouple the part of code to walk-through the ROM table from the code that creates the command output. The idea is to keep a single implementation for the walk-through code, while parametrizing the output code to handle the generation of a configuration script or the result of the function dap_lookup_cs_component(). This change only targets the output of MEM-AP header Further changes will target other parts of the code. While there, add a message if MEM-AP is not accessible. Change-Id: I112f637edfdb8688afb4e631297f6536da9604f1 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6819 Tested-by: jenkins
2022-05-14arm_adi_v5: handle faulting entry in ROM tableAntonio Borneo1-2/+5
ARM IHI0031F "Arm Debug Interface Architecture Specification" chapter C2.6.1 "BASE, Debug Base Address register" reports: A debugger must handle the following situations as non-fatal errors: - ... - An entry in the ROM Table points to a faulting location. - ... Typically, a debugger issues a warning if it encounters one of these situations. However, Arm recommends that it continues operating. An example of an implementation that might cause errors of this type is a system with static base address or ROM Table entries that enable entire subsystems to be disabled, for example by a tie-off input, packaging choice, fuse, or similar. Don't halt ROM table parsing if one entry causes an error; log the error condition and continue to next entry. Not sure if we have to send an ABORT before continuing. Change-Id: I94fdb5b175bfb07dde378149421582b7e7cd5b09 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6818 Tested-by: jenkins Reviewed-by: Daniel Goehring <dgoehrin@os.amperecomputing.com>
2022-05-14arm_adi_v5: report sysmem on class 0x9 ROM tablesAntonio Borneo1-1/+10
As Class 0x1 ROM table, also Class 0x9 ROM tables encodes a flag for system memory access. Detect the flag in rtp_cs_component() and dump the same message for both type of ROM tables. Extend rtp_read_cs_regs() to read ARM_CS_C9_DEVID. Change-Id: Ic85d1ea068ed706ceedfd65076ff4c96d04e9792 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6817 Tested-by: jenkins Reviewed-by: Daniel Goehring <dgoehrin@os.amperecomputing.com>
2022-05-14arm_adi_v5: split ROM table loop from generic coresightAntonio Borneo1-36/+66
During ROM table parsing, each ROM table entry points to a CoreSight component that can, in turn, be another ROM table. Split the specific code for ROM table handling from the generic CoreSight code. Log an error if a ROM table entry cannot be read. Change-Id: I5ad106a99b9c21ddb48b5b162ae87101e4f49878 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6816 Tested-by: jenkins
2022-05-14arm_adi_v5: rework dap_read_part_id()Antonio Borneo1-69/+80
Rework dap_read_part_id() while preparing for reorganizing the 'ROM Table Parsing' (RTP): - rename it with 'rtp' prefix; - extends it to read other CoreSight registers, thus improving the overall speed by queuing more reads; - reduce the list of arguments by using a struct; - reorder the reads by increasing offset, potentially gaining speed using MEM_AP_REG_BDx and/or auto-increment; - log a debug message in case of read error. Change-Id: I6544ac7740b808a6c0fbacf97ac00b97f5bd3832 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6815 Tested-by: jenkins
2022-05-14arm_adi_v5: add support for display Class 0x9 ROM tablesFlorian Fainelli1-22/+47
ADI v5.1 and v6.0 permit the definition of CoreSight components (class 9 ROM entries). dap_rom_display() is refactored a bit such that we always end up with attempting to parse the ROM contents using the appropriate upper limit for class 1 and 9 ROM types. Change-Id: I4ba497b3807f1f11f06186eb6e61959ea3540c59 Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6359 Tested-by: jenkins
2022-05-14arm_adi_v5: describe Class 0x9 Device Architecture registerAntonio Borneo1-0/+49
Use the list of values from ARM IHI0029E to decode and print the Device Architecture register. Add attribute 'unused' to the function, not used yet. Change-Id: I7b1dd204bd1db671578c588372b667e23611876c Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6463 Tested-by: jenkins Reviewed-by: Daniel Goehring <dgoehrin@os.amperecomputing.com>
2022-05-14adi_v5_jtag: reduce verbosity on persistent WAITAntonio Borneo1-2/+2
In case of AP not responding, e.g. not clocked, the first WAIT reply is logged as: DAP transaction stalled (WAIT) - slowing down then OpenOCD retries the transaction few times, until it timeouts. At each retry it prints the message: DAP transaction stalled during replay (WAIT) - resending Depending on JTAG speed and transport latency, the amount of log messages can be quite annoying and not relevant. The last printed line is at timeout: Timeout during WAIT recovery Reduce the verbosity. Change-Id: I5a7a337527c98b2450de59066b13713511c2894f Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6814 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-by: Daniel Goehring <dgoehrin@os.amperecomputing.com>
2022-05-14arm_coresight: define ARM_CS_CIDR_CLASS()Antonio Borneo2-2/+2
Right now it has a single use but it will soon be used more. Change-Id: I9a819c65df467fc859e4b5251035a17ed33daa35 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6813 Tested-by: jenkins Reviewed-by: Daniel Goehring <dgoehrin@os.amperecomputing.com>
2022-05-07cross-build.sh: fix build with capstoneTarek BOCHKATI1-1/+1
since commit 12d1ad0c7529 : update capstone include path ... the generated capstone.pc is not working so fix the includedir in capstone.pc to get github action working Change-Id: I7767e181a74c73a7514eeb6293cd556a794dbfe9 Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6969 Tested-by: jenkins Reviewed-by: Tim Newsome <tim@sifive.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-05-07doc: fix typo s/Not/Note/Piotr Kasprzyk1-1/+1
Append lacking e to word Note Signed-off-by: Piotr Kasprzyk <ciri@ciri.pl> Change-Id: Ibd40a2f93d11cf1945361f0c46329b88963d6826 Reviewed-on: https://review.openocd.org/c/openocd/+/6963 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-05-07target: document possibly unreachable target in deinit_target()Tomas Vanek1-0/+11
Change-Id: I95ff3d200bb2c8f5bc43a34c92726d9c47f8c172 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/6953 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-05-07target: fix build with jimtcl 0.79Antonio Borneo1-0/+8
In jimtcl 0.80 the prototype of Jim_DictPairs() has changed. The only code in OpenOCD that uses Jim_DictPairs() has been merged recently and it only uses the current jimtcl syntax. To allow compiling OpenOCD master branch with older versions of jimtcl, detect the version of jimtcl and use the appropriate syntax. Change-Id: I6fc78303b6a4db064a97f326c46119f4568e88f3 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reported-by: dullfire@yahoo.com Reviewed-on: https://review.openocd.org/c/openocd/+/6948 Tested-by: jenkins
2022-05-07bluenrg: add support for bluenrg-lps device and boardSalvatore Giorgio PECORINO4-6/+27
Added bluenrg-lps support Added file for the board steval-idb012v1 Fixed size_info information using a mask Changed the if condition in bluenrg-x.cfg to be valid only for bluenrg-1 and bluenrg-2 Signed-off-by: Salvatore Giorgio PECORINO <salvatore-giorgio.pecorino@st.com> Change-Id: Ic0777ec0811ee6fac7d5e1d065c4629e47d84a1f Reviewed-on: https://review.openocd.org/c/openocd/+/6928 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-05-07server/gdb: fix gdb remote monitor cmd on multi-targetAntonio Borneo1-4/+16
Commit 5ebb1bdea1df ("server/gdb: fix return of gdb remote monitor command") replaces the call to command_run_line() with call to Jim_EvalObj() but does not properly set the "context". In multi-target environment, his can cause the erroneously execution of the command on the wrong target. Copy from the code in command_run_line() the proper setup before executing Jim_EvalObj(). Change-Id: I56738c80779082ca146a06c01bc30e28bc835fd3 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reported-by: Bohdan Tymkiv <bohdan200@gmail.com> Fixes: 5ebb1bdea1df ("server/gdb: fix return of gdb remote monitor command") Reviewed-on: https://review.openocd.org/c/openocd/+/6966 Tested-by: jenkins Reviewed-by: Bohdan Tymkiv <bohdan200@gmail.com> Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-by: Tim Newsome <tim@sifive.com>
2022-05-07smp: deprecate legacy SMP core switching supportAntonio Borneo4-51/+11
The deprecation was already in the documentation since v0.11.0 through commit 85ba2dc4c6ab ("rtos/hwthread: add hardware-thread pseudo rtos") but OpenOCD was not informing the user printing a runtime message. Remove the deprecated method from the documentation and print a deprecated message at runtime. There is no reliable way to print the same message in GDB console, so we have to rely on user noticing it in the OpenOCD log. Target is to remove the functionality after v0.12.0. Change-Id: Idd2d9e3b6eccc92dcf0432c3c7de2f8a0fcabe9f Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6862 Tested-by: jenkins
2022-05-01drivers/cmsis-dap: Correct the DAP protocol parameter parsing errorjihongbin1-7/+7
Fixes: 01030fb89354 (drivers/cmsis-dap: tidy up buffer access) Change-Id: Id192d3930a89980d641058b6444d12caec19ce6f Signed-off-by: Hongbin Ji <longma@orbbec.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6954 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-by: jihongbin <jhb_ee@163.com>
2022-04-30target/disassembler: update capstone include path to <capstone.h>fatalc2-2/+2
on macos (homebrew base) `pkg-config --cflags capstone` output with `-I/opt/homebrew/Cellar/capstone/4.0.2/include/capstone` gcc not find headers on parent "include" path, causes build error `fatal error: 'capstone/capstone.h' file not found` it's ok to change to <capstone.h> for all platforms. Signed-off-by: fatalc <cnfatal@gmail.com> Change-Id: Ia2e2058024d4fc1a57a8b4ea847c664d74f67efb Reviewed-on: https://review.openocd.org/c/openocd/+/6946 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-04-30target/arm_cti: Fix error handling in 'cti create'Marc Schink1-1/+6
Handle JIM_CONTINUE return value of adiv5_jim_mem_ap_spot_configure(), otherwise OpenOCD silently quits when an unknown option is provided. Change-Id: I9b1351c0911e74999d8dd1260ede9760088510d7 Signed-off-by: Marc Schink <dev@zapb.de> Reviewed-on: https://review.openocd.org/c/openocd/+/6944 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-04-30bcm2835gpio: Make buffer an output before the GPIO connected to itSteve Marple1-6/+7
The correct ordering is required to prevent two outputs connected together. Change-Id: I634a9ca7e0ccf337d1723011b8aee1f2d81efbcf Signed-off-by: Steve Marple <stevemarple@googlemail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6937 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-04-30linuxgpiod: add SWDIO bufferSteve Marple1-0/+47
The SWDIO buffer requires a direction pin to select input or output direction. Output is selected by a high logic level (matches bcm2835gpio driver). Change-Id: I240cb99a5dfea08121bb33d4b5e2108ce7597468 Signed-off-by: Steve Marple <stevemarple@googlemail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6936 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-04-24flash/nor/stm32f1x: add can_load_options flag for GD32F1x0, F3x0 and E23xTomas Vanek1-0/+3
According to GigaDevice user manuals the devices have OBRLD bit in FMC_CTL register which is functionally compatible with OBL_LAUNCH @ FLASH_CR of STM32 counterparts. Change-Id: I84d231b38815fcb6452fd73b9153b269cce3b737 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/6759 Tested-by: jenkins Reviewed-by: Andrzej Sierżęga <asier70@gmail.com>
2022-04-24tcl/target/gd32vf103: add flash bankTomas Vanek1-1/+15
The flash is compatible with stm32f1x, reuse the driver. Extend the size of work area to RAM size of the smallest device. Stop watchdogs before flash programming. Change-Id: I67a7654a6e196f9d4b2409edaa7990c53334437e Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/6711 Tested-by: jenkins Reviewed-by: Tim Newsome <tim@sifive.com>
2022-04-24flash/stm32f1x: add support for RISC-V GigaDevice GD32VF103Tomas Vanek5-44/+227
The device has compatible flash macro with STM32F1 family, reuse stm32f1x driver code. Detect non-ARM target - for simplicy test target type name 'riscv' and the address has 32 bits. In case of RISC-V CPU use simple chunked write algo - async algo cannot be used as the core implemented in this device doesn't allow memory access while running. Change-Id: Ie3886fbd8573652691f91a02335812a7300689f7 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/6704 Tested-by: jenkins Reviewed-by: Tim Newsome <tim@sifive.com>
2022-04-23rtos: zephyr: do not use deprecated symbols nameJulien Massot1-3/+3
Zephyr plan to remove openocd specific symbols in favour of more generic one. These generic symbols has been introduced in Zephyr 2.6. Signed-off-by: Julien Massot <julien.massot@iot.bzh> Change-Id: I89418c9c378fb8b8baa29763fc6f1b6e652dc7ef Reviewed-on: https://review.openocd.org/c/openocd/+/6844 Tested-by: jenkins Reviewed-by: Stephanos Ioannidis <root@stephanos.io> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-04-23target/image: fix - p_flags field in ELF64 segment headers is 64 bits wideJan Matyas2-4/+4
Fixed the reading of p_flags in ELF64 segment headers - that field is 64 bits wide. Change-Id: I053ca57d36efb54b7c638484acd6c7a2fbcbd05a Signed-off-by: Jan Matyas <matyas@codasip.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6927 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-04-23server/gdb: fix return of gdb remote monitor commandAntonio Borneo1-1/+42
Current implementation for gdb remote monitor command uses the command_run_line() to execute the command. While command_run_line() has several advantages, it unfortunately hides the error codes and outputs the result of the command through LOG_USER(), which is not what gdb requires. See 'qRcmd' in https://sourceware.org/gdb/onlinedocs/gdb/General-Query-Packets.html Replace command_run_line() with Jim_EvalObj() and parse the output to provide the proper result to gdb. Can be tested by defining in OpenOCD: proc a {} {return hello} proc b {} {return -code 4} proc c {} {return -code 4 "This is an error!"} then by executing in gdb console: monitor a monitor b monitor c monitor foo Change-Id: I1b85554d59221560e97861a499e16764e70c1172 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reported-by: Torbjorn Svensson <torbjorn.svensson@st.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6886 Tested-by: jenkins
2022-04-23tcl/target/stm32l4x: align format/order/comments with stm32f4xMarkus Reiter1-11/+14
Change-Id: Ie97bb2f56b582bc735c238af5f160fcb28a61eb0 Signed-off-by: Markus Reiter <me@reitermark.us> Reviewed-on: https://review.openocd.org/c/openocd/+/6933 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-04-23tcl/target/stm32l4x: switch to new TPIU/SWO supportMarkus Reiter1-7/+33
Change-Id: I3362fa7292eae7a3ba119cf6183f8bc4cbd5cbd4 Signed-off-by: Markus Reiter <me@reitermark.us> Reviewed-on: https://review.openocd.org/c/openocd/+/6932 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-04-23tcl/target/stm32l4x: set default WORKAREASIZE to smallest deviceMarkus Reiter1-2/+2
Change-Id: Ia8bfb664ff28bd0579492032ce513b010e71c593 Signed-off-by: Markus Reiter <me@reitermark.us> Reviewed-on: https://review.openocd.org/c/openocd/+/6931 Tested-by: jenkins Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2022-04-23tcl/target/stm32f4x: fix nameMarkus Reiter1-1/+1
Change-Id: I9baa79d8cf402991e6638c255a91728b8a77020c Signed-off-by: Markus Reiter <me@reitermark.us> Reviewed-on: https://review.openocd.org/c/openocd/+/6930 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-04-23nds32: deprecate it, together with aice adapter driverAntonio Borneo2-5/+11
The target nds32 and its companion adapter aice have not received any real improvement since 2013. It has been hard to keep them aligned during the evolution of OpenOCD code, with no way for maintainers to really check if they are still working. No real documentation is present for them in OpenOCD. The arch nds32 has been dropped from Linux kernel v5.18-rc1. Deprecate both nds32 target and aice adapter with the target of dropping them for v0.13.0. Remove automatic build of aice, forcing user to select it. Change-Id: Ib465d676246fa3b4e95c3d399ba9a5cf1f8b3baf Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6887 Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Tested-by: jenkins
2022-04-13flash/nor/stm32f1x: lock flash in case of errorTomas Vanek1-39/+46
The current code locks the flash controller in case of error during flash write only. An error in other flash operations may cause the flash is left unlocked. Implement locking also after error in erase, mass erase, options write and erase. Change-Id: I26c2ed7914e7847122306f29b777b9eefd1dc580 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/6710 Tested-by: jenkins Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
2022-04-13flash/nor/stm32f1x: unify flash error reportingTomas Vanek1-17/+15
stm32x_wait_status_busy() has two side effects in case of flash programming error: - reports error - clears error bit in status register Use stm32x_wait_status_busy() to report also flash error during target algo flash write. While on it use more descriptive error codes in stm32x_wait_status_busy(). Change-Id: I6e1cffc2aa5411b918a23ed62d5194910888a9d1 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/6709 Tested-by: jenkins Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
2022-04-13flash/nor/stm32f1x: tidy up async algo supporting codeTomas Vanek1-21/+26
Use target_get_working_area_avail() instead of try-fail iteration. Call destroy_reg_param() in a for cycle. Change-Id: I1891d1ffdea99010c6ab66b9578400b9d7922e20 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/6708 Tested-by: jenkins Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
2022-04-13flash/nor/stm32f1x: remove write alignment codeTomas Vanek1-23/+14
Use flash infrastructure to ensure writes are halfword aligned. Change-Id: Iddca3a256ace3486a23e1a9cb6a31c7a91ee58bf Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/6707 Tested-by: jenkins Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
2022-04-13flash/nor/stm32f1x: allow write fallback for flash optionsTomas Vanek1-34/+50
Mostly refactoring. Rename original stm32x_write_block() to stm32x_write_block_async() as it uses target async algo. Introduce new stm32x_write_block() and move slow, host controlled fallback flash write there. The change allows stm32x_write_options() to use slow flash write fallback. While on it rename variables where halfword count is stored. Change-Id: I386ae15cf052b1490461ed8f7eea5b4403d466f7 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/6706 Tested-by: jenkins Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
2022-04-03tcl/board: Add NXP FRDM-K64FMarc Schink1-0/+15
Change-Id: I4b8fbfb2948c4295c2a34d641dd59a73c512d9fa Signed-off-by: Marc Schink <dev@zapb.de> Reviewed-on: https://review.openocd.org/c/openocd/+/6884 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2022-04-03drivers/cmsis-dap: Remove stray whitespaceMarc Schink1-1/+1
Change-Id: I7b60f9e87af2f582864ce94198d0343acf7d45f2 Signed-off-by: Marc Schink <dev@zapb.de> Reviewed-on: https://review.openocd.org/c/openocd/+/6883 Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Tested-by: jenkins
2022-04-03libusb_helper.h: Increase USB timeoutGabor Csapo7-36/+46
When we debug a target that works as a USB device, halting the target causes the USB communication with the USB host to become unresponsive. The host will try to reconnect/reset/setup the unresponsive device during which communication with other devices on the same USB bus can get stalled for several seconds. If the JTAG adapter is on the same bus, we need to make sure openOCD will wait for packets at least as long as the host USB stack. Otherwise the USB stack might deliver a valid packet, but openOCD would ignore it due to the timeout. The xHCI spec uses 5 sec timeouts, so let's use that in openOCD with some margin. Use this value in all libusb calls. HID API might have a libusb backend and would probably be victim to the same bug, so it should use this timeout, too. Ticket: https://sourceforge.net/p/openocd/tickets/343/ Signed-off-by: Gabor Csapo <gaborcsapo@google.com> Change-Id: Ia3dc1356e676fe550f57a4c72f7a24ba296b6af2 Reviewed-on: https://review.openocd.org/c/openocd/+/6882 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-04-03gdb_server: Improve logging of GDB-remote packetsJan Matyas1-14/+31
- Print also the target name, not just the packet contents. This is important when there are more GDB servers (more debug-able targets) active in one OpenOCD session. - Log also the received Ctrl-C requests coming from GDB (one byte 0x3), ACKs ("+") and NACKs ("-"). - Do not print zero-length incoming packets (this occurred when Ctrl-C packets were received). - Removed a stray apostrophe "'" that got printed in gdb_log_outgoing_packet() Signed-off-by: Jan Matyas <matyas@codasip.com> Change-Id: If68fe0a8aa635165d0bbe6fa0e48a4645a02da67 Reviewed-on: https://review.openocd.org/c/openocd/+/6879 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-03-26helper/bits: add BIT_ULL and GENMASK macrosAntonio Borneo2-1/+5
To support 64 bits bit and masks Replace local definition of BIT in rtos/chromium-ec Change-Id: I1f268d6e8790f1b07bf798680b797878ce81064b Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6857 Tested-by: jenkins
2022-03-26openocd: include config.h in every file .cAntonio Borneo6-0/+24
Including config.h as first is required for every C file. Add it to the C files that still miss it. Change-Id: I1a210e7d3a854958a85a290b086ad8a9f5176425 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6856 Tested-by: jenkins
2022-03-26arm_tpiu_swo: fix autodetection of SWO pin frequencyAntonio Borneo1-4/+13
While the documentation reports that SWO pin frequency can be omitted to let the adapter autodetect the value, the code wrongly drops an error when pin frequency is not specified. Don't require the pin frequency to be set at "enable", but verify that the adapter has properly changes it to a valid value. Change-Id: I3dfbe3256e8887ef4f03512769b06381cdc9db0d Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reported-by: Karl Palsson <karlp@tweak.net.au> Fixes: 184724d14e12 ("arm_tpiu_swo: add support for independent TPIU and SWO") Reviewed-on: https://review.openocd.org/c/openocd/+/6310 Tested-by: jenkins Reviewed-by: zapb <dev@zapb.de>
2022-03-26tcl/tools: Add function to measure the speed of ARM Cortex-M devicesMarc Schink1-0/+50
Tested on an EFM32PG12 Starter Kit. Change-Id: I2cbc36fe0d2ad2089bf8c1e7d2260daaae4ddbb4 Signed-off-by: Marc Schink <dev@zapb.de> Reviewed-on: https://review.openocd.org/c/openocd/+/5353 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-03-26semihosting: fix mode flags for local host open()Antonio Borneo1-3/+18
Commit dbbac5f11d66 ("semihosting: use open mode flags from GDB, not from sys/stat.h") fixes the conversion of the mode flags from ARM semihosting encoding for SEMIHOSTING_SYS_OPEN to GDB mapping for open(). Doing this, it breaks the conversion to local host's OS mapping for open(). Split the conversion array to one for GDB and one for local host. The local host conversion array is taken directly from the old code. Change-Id: I385321ddd32c3ac5cf6da3f1ce9eff76b05dd527 Fixes: dbbac5f11d66 ("semihosting: use open mode flags from GDB, not from sys/stat.h") Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reported-by: Erhan Kurubas <erhan.kurubas@espressif.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6870 Tested-by: jenkins
2022-03-19breakpoints: fix build on -fno-inlineAntonio Borneo1-2/+2
Some configuration of GCC could default to -fno-inline, causing the build to fail after commit fb43f1ff4e2f ("target: Rework 'set' variable of break-/watchpoints"). Switch the new inline functions to 'static inline', as it's widely used in the rest of the code. Change-Id: I8bf31045a137bd34ed825f4b2a9338eb3c70046d Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Fixes: fb43f1ff4e2f ("target: Rework 'set' variable of break-/watchpoints") Reviewed-on: https://review.openocd.org/c/openocd/+/6881 Tested-by: jenkins
2022-03-19target: Rework 'set' variable of break-/watchpointsMarc Schink21-242/+258
The 'set' variable name suggests a boolean data type which determines whether a breakpoint (or watchpoint) is active. However, it is also used to store the number of the breakpoint. This encoding leads to inconsistent value assignments: boolean and integer values are mixed. Also, associated hardware comparator numbers, which are usually numbered from 0, cannot be used directly. An additional offset is required to store the comparator numbers. In order to make the code more readable and the value assignment more consistent, change the variable name to 'is_set', its data type to 'bool' and introduce a dedicated variable for the break-/watchpoint number. In order to make the review easier, the data types of various related variables (e.g. number of breakpoints) are not changed. While at it, fix a few coding style issues. Change-Id: I2193f5639247cce6b80580d4c1c6afee916aeb82 Signed-off-by: Marc Schink <dev@zapb.de> Reviewed-on: https://review.openocd.org/c/openocd/+/6319 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-03-19flash/stm32l4x: fix auto-probe when RDP is promoted from 0 to 0.5Tarek BOCHKATI1-2/+13
Considering this use case: (using STM32 L5 or U5) 1- first probe : TZEN enabled, RDP level 0 flash_regs_base |= STM32L5_REGS_SEC_OFFSET => 0x50022000 2- the user promotes the RDP to level 0.5 3- the second probe, fails to read OPTR using secure flags_regs_base: used OPTR address is 0x50022040 Step 3 fails because when RDP is level 0.5, we should use Non-Secure flash registers. To fix this, always use NS flash regs to read OPTR in probe functions. Fixes: 80d323c6e82b (flash/stm32l4x: introduce auto-probe when OPTR is changed) Change-Id: I296aa633972b0c410b927488c999584a07b912d3 Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6864 Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Tested-by: jenkins
2022-03-19tcl/stm32u5x: fix clock config used at 'reset init'Tarek BOCHKATI1-9/+12
Change-Id: If004a04b93be47439809ea3fa336b14de7a12277 Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6597 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Tested-by: jenkins