aboutsummaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
2022-01-29flash/nor/atsame5: add LAN9255 devicesHans-Erik Floryd1-0/+3
Support Microchip LAN9255 devices with embedded SAME53J MCU. Signed-off-by: Hans-Erik Floryd <hans-erik.floryd@rt-labs.com> Change-Id: Ia811c593bf7cf73e588d32873c68eb67c6fafad7 Reviewed-on: https://review.openocd.org/c/openocd/+/6811 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2022-01-22jtag: Add an option to ignore the bypass bitAdrien Grassein4-1/+12
Some CPU wrongly indicate the bypas bit in the codeid. It's the case of the NanoXplore NG-ULTRA chip that export a configurable (and potentially invalid) ID for one of its component. Add an option to ignore it. Signed-off-by: Adrien Grassein <adrien.grassein@gmail.com> Change-Id: Ic59743f23bfc4d4e23da0e8535fec8ca9e87ff1a Reviewed-on: https://review.openocd.org/c/openocd/+/6802 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
2022-01-22target: use target_event_name()Antonio Borneo1-5/+5
We have the API target_event_name(). Use it to improve code readability. Change-Id: Ic48d2227bdefe9af05aff99a871a45e0612e5254 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6790 Tested-by: jenkins
2022-01-22log: fix memory leak when log to file is enabledAntonio Borneo3-0/+12
When log to file is enabled, the file is not closed by OpenOCD at exit. This is reported by Valgrind as a memory leak that is still reachable, as the internal buffers of 'FILE *log_output' are freed by the automatic fclose() at exit. Close the log file before exit. Change-Id: Id472c0d04462035254a9b49ecb0a4037263c6f6f Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6789 Tested-by: jenkins
2022-01-22aarch64: dump a message when CTI is missingAntonio Borneo1-1/+3
If the CTI is not specified OpenOCD fails target's examination without indicating the reason. Drop an error message about the missing CTI. Change-Id: I344537fb21cf38785796ba938e71890e04135509 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6788 Tested-by: jenkins
2022-01-05flash/nor/efr32: fixed lockbits and user dataDoug Brunner1-83/+221
Changed flash driver to support writing to the user data page, as well as to any portion of the lockbits page above 512 bytes (the amount used for the actual page lock words). The top part of the lockbits page is used on at least the EFR32xG1 chips for the SiLabs bootloader encryption keys. As presented to the user, the lockbits page is the same size as the other pages, but any attempt to write to its low 512 bytes is an error. To enforce this, efr32x_write is renamed to efm32x_priv_write and a wrapper function is provided in its place. If the user erases the lockbits page, the driver rewrites the cached lock words after the erase. When the driver erases the lockbits page in order to update the lock words, it first takes a copy of anything stored in the top part of the page, and re-programs it after the erase operation. There are now multiple instances of flash_bank for each target, and the flash_bank instances must share their cached lock words to operate as intended. Therefore, when a bank is created, the global flash bank list is used to find any other banks that share the same target. Since some banks in the global list are invalid at the time free_driver_priv is called, reference counting is used to decide when to free driver_priv. To avoid the need to find the lockbits flash_bank from another flash_bank, efm32x_priv_write and efm32x_erase_page now take an absolute address. There didn't seem to be any reason to prohibit unprotecting individual flash pages, so that limitation is removed from efm32x_protect(). This addresses ticket #185. Valgrind-clean, except for 2x 4kiB not freed/still reachable blocks that were allocated by libudev. No new Clang analyzer warnings, no new sanitizer warnings. Signed-off-by: Doug Brunner <doug.a.brunner@gmail.com> Change-Id: Ifb22e6149939d893f386706e99b928691ec1d41b Reviewed-on: https://review.openocd.org/c/openocd/+/6665 Tested-by: jenkins Reviewed-by: Fredrik Hederstierna <fredrik.hederstierna@gmail.com> Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2021-12-24target/riscv: calloc() memory per register.Tim Newsome2-8/+5
This replaces a static array with 8 bytes per register. When there are vector registers larger than 8 bytes, they would end up clobbering each other's values. I can't believe I didn't catch this earlier. See https://github.com/riscv/riscv-openocd/pull/658 Change-Id: I9df4eaf05617a2c8df3140fff9fe53f61ab2b261 Signed-off-by: Tim Newsome <tim@sifive.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6775 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2021-12-24semihosting: use macro COMMAND_HANDLERAntonio Borneo1-4/+4
We have the macro #define COMMAND_HANDLER(name) \ static __COMMAND_HANDLER(name) Use it! Change-Id: I0e5385cb54197c743348f0d2ce215c93b8e396a4 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6786 Tested-by: jenkins
2021-12-18gdb_server: fix a comment in gdb_new_connection()Antonio Borneo1-4/+7
On 2008-03-05, before git's age, commit 6d9501467441 adds a comment about unobserved ACK supposedly sent by GDB at connection. The ACK is sent since GDB 3.95 (1999-05-04), but a bug introduced in GDB 6.5 (2006-06-21) and fixed in GDB 7.0 (2009-10-06) makes GDB sending the query for "supported packets" before sending the ACK. Due to the bug, the author of the commit failed to see the ACK. Change-Id: I574a8013e7d159d1c71087af83b7c2ce92be86bd Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6769 Tested-by: jenkins
2021-12-18openocd: add keep_alive during command sleepAntonio Borneo1-0/+1
The command sleep holds the host CPU until it completes. Send keep_alive to GDB, so it will not timeout. Change-Id: I92e9c5fc871b4e6a7695cdc449ca9fb3c1f1d9ec Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6770 Tested-by: jenkins Reviewed-by: Jan Matyas <matyas@codasip.com>
2021-12-18target/cortex_m: minor refactoring in cortex_m_store_core_reg_u32()Tomas Vanek1-3/+1
Unlike cortex_m_load_core_reg_u32() storing core register uses the same code pattern around DHCSR read as offered by the convenience helper cortex_m_read_dhcsr_atomic_sticky(). Use the helper. Change-Id: Ia947204944a8b549f3c2be7fb2f717aad18970c4 SeeAlso: 65d762918328 (cortex_m: poll S_REGRDY on register r/w) SeeAlso: 0dcf95c7171b (target/cortex_m: cumulate DHCSR sticky bits) Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/6767 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2021-12-18jtag/drivers/vsllink: fix memory leakTomas Vanek1-0/+1
Close libusb context in vsllink_quit() Change-Id: I85da8d7228b1b2b033a32b2f9ae9ed0726546b55 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/6766 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2021-12-11flash/nor/spi: add micron MT25QU01GJaehoon Park1-0/+1
1Gbit SPI flash on VCU118 Rev. 2.0 Contributed to riscv-openocd in https://github.com/riscv/riscv-openocd/pull/487 Signed-off-by: Tim Newsome <tim@sifive.com> Change-Id: I93447dd970d9901a671567fe8ab9e407432f8db9 Reviewed-on: https://review.openocd.org/c/openocd/+/6764 Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins
2021-12-11target/arm_jtag.h: fix wrong comparison in arm_jtag_set_instrBohdan Tymkiv1-1/+2
Change [1] introduced a regression that results in comparison in arm_jtag_set_instr() to be always true if the length of the IR register is not 8 bit. The value on the left side of the != operator contains only tap->ir_length number of bits while value on the right is full 8-bit instruction code. This forces OpenOCD to update the JTAG IR register on each transaction even if the instruction in the JTAG IR register is correct. This causes noticeable performance degradation, especially with slow JTAG adapters. [1] https://review.openocd.org/c/openocd/+/6285 time ./src/openocd -s tcl/ -f interface/cmsis-dap.cfg \ -c "transport select jtag" -f target/psoc6.cfg \ -c "init; load_image data.bin 0x08000000; exit" Without this change: real 0m4,863s user 0m0,074s sys 0m0,128s With this change: real 0m3,083s user 0m0,038s sys 0m0,098s Signed-off-by: Bohdan Tymkiv <bohdan200@gmail.com> Change-Id: Iaded83a04ecc7e65f18256afae582267ccc1fc59 Reviewed-on: https://review.openocd.org/c/openocd/+/6762 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2021-12-11linuxgpiod: Allow using multiple GPIO chips.Laszlo Sitzer1-90/+175
Allow passing optional gpiochip number before gpio number. If no optional chip number is passed, the one from the 'gpiochip' configuration directive is used. Change-Id: I16933d81581d9af4d1600c5f9fdbc832ef3fda94 Signed-off-by: Laszlo Sitzer <dlsitzer@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6742 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2021-12-11target/target: Check checksum_memory before callYasushi SHOJI1-0/+4
Make sure checksum_memory is present. Otherwise it'll segfault. Change-Id: If31123323bd8a03282da43505c9604fde735ad0e Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6758 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2021-12-11adi_v5_swd: add jtag-to-swd through dormantAntonio Borneo2-2/+18
ARM IHI 0031A does not support SWJ-DP, so no switch between JTAG and SWD is considered. ARM IHI 0031B is not publicly available and it's reported as "Confidential Beta" in the history list in following doc versions. From ARM IHI 0031C the direct switch between JTAG and SWD is already deprecated in favor of passing through dormant mode. With no access to IHI 0031B we haven't info if any device strictly requires the direct switch. OpenOCD implements only the deprecated direct switch, so changing it could cause regression on devices that do not implement dormant mode. Plus, not all the adapters support dormant mode. Nevertheless there are already target devices that only allow entering in SWD by passing through dormant. Let the code try both method, alternating one tentative with the deprecated legacy direct switch, then another tentative passing through dormant, and repeat till timeout. This would work on any device that don't support dormant, on new devices that require switch through dormant and will work with adapters that don't support dormant. Change-Id: Ib8619635277d497872079a33fa4e38be9beb84a0 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6695 Tested-by: jenkins
2021-12-11cortex_m: remove last references to debugport_init()Antonio Borneo1-1/+0
The function debugport_init() has never existed in OpenOCD code, but few comments erroneously references it in place of the existing function ahbap_debugport_init(). Commit 00dbc185ee56 ("arm_adi_v5: Split ahbap_debugport_init") splits the function ahbap_debugport_init() in dap_dp_init() and mem_ap_init(), but did not removed all the incorrect comments about debugport_init(). Few of such comments has been removed in later patches. Remove the last comment that references debugport_init(). Change-Id: Ibd1f125475386e5653340fedf706903a0ee15897 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6694 Tested-by: jenkins
2021-12-03gdb_server: added and improved several debug printsJan Matyas1-3/+8
Added and improved several prints related to the GDB connection and various error states that may occur in relation to this connection. Change-Id: I233246190b613cc925b783561cfa3aa5267360fd Signed-off-by: Jan Matyas <matyas@codasip.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6288 Reviewed-by: Tim Newsome <tim@sifive.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins
2021-12-03target,flash: allow target_free_working_area on NULL area pointerTomas Vanek10-35/+35
Standard C library free() allows NULL pointer as a parameter. Change target_free_working_area() to conform this convention. Remove NULL pointer tests before target_free_working_area() calls. While on it add missing setting pointer to NULL after target_free_working_area(). Change-Id: I7c692ab04a9933398ba5bc614723ad0bdecb87b3 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/6712 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2021-12-03flash/nor/fespi: algorithm, large address, errorsTim Newsome1-327/+148
* Move more smarts into the target algorithm code, and rewrite that in C so it's easier to understand/maintain. * Support >24-bit addresses. * Check for errors. Change-Id: I3b1a143589fe6defafb8f95820aa682acc9646e7 Signed-off-by: Tim Newsome <tim@sifive.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6679 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2021-12-03flash/nor/at91samd: remove 'at91samd info' commandTomas Vanek1-13/+0
The command is a stub only, does nothing. Change-Id: Ib3b8c2122a9f6f2e179bee34ac56d0adf367bfcc Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/6730 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2021-12-03flash/nor/kinetis_ke: remove 'kinetis mdm test_securing' cmdTomas Vanek1-40/+0
The command might be a leftover from development of the driver. There is no documentation what it does. Change-Id: Iaa5aa1ac51638bd6acce172a5dd03846a165dc27 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/6728 Tested-by: jenkins Reviewed-by: Ivan-Artekit <ivan@artekit.eu>
2021-12-03flash/nor/kinetis_ke: add .help fields for tcl commandsTomas Vanek1-4/+4
Add help texts from similar driver kinetis.c While on it fix one existing help: the flash is obviously not NAND Change-Id: Ibd295105586b008aaabf2fb4e4a75bf551266e38 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/6727 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2021-11-29flash/nor/efm32: fixed BG1x identificationDoug Brunner1-3/+3
The EFM32 flash driver misidentifies the EFR32BG1B on my board as EFR32MG1B. Looks like this was caused by a copy-paste error, fixed. Signed-off-by: Doug Brunner <doug.a.brunner@gmail.com> Change-Id: I3067f7ba132c2562487da8c2371f63a4843230c1 Reviewed-on: https://review.openocd.org/c/openocd/+/6666 Tested-by: jenkins Reviewed-by: Fredrik Hederstierna <fredrik.hederstierna@gmail.com> Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2021-11-28drivers: call adapter_get_required_serial() in jtag_libusb_open()Antonio Borneo14-22/+17
Now that adapter serial is handled independently from the adapter drivers, move inside jtag_libusb_open() the call to adapter_get_required_serial(), so every adapter that uses libusb will automagically get USB serial support. Extend the documentation to list the adapters involved. Change-Id: I75b3482d38f8ed3418329f3106c5e8b689fd460b Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6663 Tested-by: jenkins
2021-11-28jtag/hla, jtag/stlink: switch to command 'adapter serial'Antonio Borneo6-67/+32
The driver hla defines the command 'hla_serial' to specify the serial string of the adapter. The driver st-link defines the command 'st-link serial' to specify the serial string of the adapter. Remove and deprecate the driver commands and use 'adapter serial'. Change-Id: I9505c398a77125b1ebf4ba71da7baf4d663b75be Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6657 Tested-by: jenkins
2021-11-28jtag/jlink: switch to command 'adapter serial'Antonio Borneo2-34/+23
The driver jlink defines the command 'jlink serial' to specify the serial string of the adapter. Remove and deprecate the driver command, and use 'adapter serial'. Note: in former code the commands 'jlink serial' and 'jlink usb' were mutually exclusive; running one of them would invalidate the effect of a previous execution of the other. The new code gives priority to 'adapter serial', even if executed before 'jlink usb'. Change-Id: I920b0c136716f459b6fd6f7da8a01a7fa1ed389f Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6656 Reviewed-by: zapb <dev@zapb.de> Tested-by: jenkins
2021-11-28jtag/xds110: switch to command 'adapter serial'Antonio Borneo2-47/+13
The driver xds110 defines the command 'xds110 serial' to specify the serial string of the adapter. Remove and deprecate the driver command, and use 'adapter serial'. Note: the original command 'xds110 serial' used a complex and undocumented conversion of the serial number through multibyte string, wide-character string and C cast. The XDS110 I can access and the lsusb dumps available through Google don't show any exotic USB serial that require such conversion. The original developer doesn't remember any constraint that mandates such conversion (see comments in https://review.openocd.org/4322/). The conversion is removed by this patch. Change-Id: I38909918079b2c1797ad85ebec2fea1b33743606 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6655 Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Tested-by: jenkins
2021-11-28jtag/vsllink: switch to command 'adapter serial'Antonio Borneo4-29/+10
The driver vsllink defines the command 'vsllink usb_serial' to specify the serial string of the adapter. Remove and deprecate the driver command, and use 'adapter serial'. Change-Id: Iadcc018b8aa8974ccd7156915b84e58270fad29d Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6654 Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Tested-by: jenkins
2021-11-28jtag/presto: switch to command 'adapter serial'Antonio Borneo2-42/+11
The driver presto defines the command 'presto serial' to specify the serial string of the adapter. Remove and deprecate the driver command, and use 'adapter serial'. Change-Id: I1a69acce7d4910082d2029d5941ae84f9424314c Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6653 Tested-by: jenkins
2021-11-28jtag/kitprog: switch to command 'adapter serial'Antonio Borneo2-26/+8
The driver kitprog defines the command 'kitprog_serial' to specify the serial string of the adapter. Remove and deprecate the driver command, and use 'adapter serial'. Change-Id: I844cb815af01137392b6d12e1b5972fc77ac092d Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6652 Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Tested-by: jenkins
2021-11-28jtag/ftdi: switch to command 'adapter serial'Antonio Borneo2-24/+9
The driver ftdi defines the command 'ftdi serial' to specify the serial string of the adapter. Remove and deprecate the driver command, and use 'adapter serial'. Change-Id: Ia5b1f325b9fab8f58b5ea70f8b807e50b148b939 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6651 Tested-by: jenkins
2021-11-28jtag/ft232r: switch to command 'adapter serial'Antonio Borneo2-20/+10
The driver ft232r defines the command 'ft232r serial_desc' to specify the serial string of the adapter. Remove and deprecate the driver command, and use 'adapter serial'. Change-Id: I0bd909923a668420604fed3c9f6a260716b044c7 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6650 Tested-by: jenkins
2021-11-28jtag/cmsis_dap: switch to command 'adapter serial'Antonio Borneo5-25/+11
The driver cmsis_dap defines the command 'cmsis_dap_serial' to specify the serial string of the adapter. Remove and deprecate the driver command, and use 'adapter serial'. Change-Id: I88e2d4de360a6c6f23529bb18494962a267250df Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6649 Tested-by: jenkins
2021-11-28jtag/aice: switch to command 'adapter serial'Antonio Borneo3-22/+8
The driver aice defines the command 'aice serial' to specify the serial string of the adapter, but actually does not use this value in the code. Remove and deprecate the driver command, and use 'adapter serial'. Change-Id: I892e0a4e1b41a7a87adf54a5736abf7419f32979 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6648 Tested-by: jenkins
2021-11-28jtag/adapter: add command 'adapter serial'Antonio Borneo2-0/+27
Several adapter define their own command to specify the USB serial number or serial string to be used during USB search. Define a general command 'adapter serial' to be proposed as replacement of the driver specific ones. No driver is changed so far to use it. Change-Id: I7631687a4163ccc63a9bdf3ad1fcb300fc483d3a Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6647 Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Tested-by: jenkins
2021-11-25target/hla_target: set cortex_m->common_magicTomas Vanek3-1/+16
hla_target uses the same struct cortex_m_common as the standard cortex_m target. Unlike the cortex_m target hla missed setting of common_magic. Set commont_magic to help pointer verification. Add convenience tests is_cortex_m_or_hla() and is_cortex_m_with_dap_access() Use proper test in cortex_m_verify_pointer() - this code relied on unset common_magic on hla target before the change. Change-Id: I4dae79f056c3d73adf524e26aa8ef2d3a57b471e Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/6741 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2021-11-23flash/psoc6: initialize usage fieldAntonio Borneo1-1/+1
The missing initialization triggers a run-time error message: Error: BUG: command 'psoc6 reset_halt' does not have the '.usage' field filled out Change-Id: I975e4ba99bd939aa924a9d62b1ab76b2ab5bf193 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6720 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2021-11-23flash/rp2040: don't initialize to NULL fields in structAntonio Borneo1-1/+0
When a struct is initialized, missing fields are already filled with zero or NULL. This change simplifies scripts to compare documentation and registered commands. Change-Id: I96fbdfa98bbb1f2b5e2a9532faf5a15cb5bc28dd Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6719 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2021-11-23openocd: declare struct command_registration in a single lineAntonio Borneo2-6/+3
To simplify scripts to compare documentation and registered commands. Change-Id: I3bed5ba80ea8be1fd615697e80d66b42d7b45fd1 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6718 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2021-11-23openocd: use unique name for struct command_registrationAntonio Borneo5-17/+17
Just to avoid name clash when comparing documentation with registered commands through scripts. Change-Id: I8832545d8d9236ea5dabe6e73732f51e5246caff Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6717 Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Tested-by: jenkins
2021-11-23openocd: use single line for register_commands*()Antonio Borneo7-16/+8
Do not split in multiple lines the calls to register_commands*(). No change in code behaviour, just make it easy to grep in the code and identify the commands that can be registered. This would help detecting undocumented commands. Change-Id: Id654e107cdabf7ee31fc3d227c1d2a59acc5669e Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6716 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2021-11-20target/arm_dap: check SWD DAP configurationTomas Vanek1-0/+52
Raise error if * more than one plain SWD DAPs are defined * plain and multidrop DAPs are mixed * two multidrop DAPs have the same TARGETSEL value Inspired by Graham Sanderson's http://review.openocd.org/4935 Change-Id: I7279744464f5cc6477e50695c596be9c5e5507bf Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/6142 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2021-11-20target/adi_v5_swd: add support for SWD multidropTomas Vanek2-35/+228
Based on Graham Sanderson's http://review.openocd.org/4935 Unlike Graham Sanderson's version this patch does not add any multidrop specific queuing. Multidrop SWD is handled mostly by the same code as single SWD, just a selection sequence is prepended to a SWD operation as needed. This is a minimal working implementation without checking for configuration errors (mixing multidrop and non multidrop DPs, multiple use of the same selection id etc...). Multidrop switching likely demands changes in the adapter code. Change-Id: I99a5742c209b49c0483e800f6105cb5e59a897d9 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/6141 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2021-11-20target/arm_adi_v5,arm_dap: introduce multidrop_targetsel and its configurationTomas Vanek2-1/+65
Add multidrop_targetsel to struct adiv5_dap. Add option -dp-id and -instance-id to dap create command. Add convenience function dap_is_multidrop() Change-Id: Ibb93abb5f50b3665c320a10c1497421035762134 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/6140 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2021-11-20target/arm_dap: clean up dap_configure codeTomas Vanek1-18/+22
dap_configure() contained first time init related tasks, as the call to dap_init_instance() and the check for configured tap. Move all first time init related stuff to dap_create() to make dap_configure() usable in eventual stand-alone 'dap configure' command. Change-Id: Ia86eadb4e960ce54e8581630d01af75720d2318d Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/6702 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
2021-11-20target/adi_v5_swd: introduce swd_queue_dp_read/write_inner()Tomas Vanek1-74/+92
This is a preparatory change for swd multidrop, mostly refactoring. Split swd_queue_dp_read/write() to inner and outer parts. Use the inner parts in swd_queue_dp_bankselect(), swd_connect() they do not need to check reconnect. Use the outer parts exclusively in swd_dap_ops. Rearrange the code to reduce forward declarations. Change-Id: I47b7f0cb037e0032a267463f06ba02123ba96fe7 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/6139 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins
2021-11-20drivers/bitbang: add support for SWD multidropTomas Vanek1-42/+33
Ignore ack received after DP_TARGETSEL write to prevent false error. This change also fixes a bug: Received ACK FAULT or JUNK value were incorrectly stored to queued_retval and later used as bitbang_swd_run_queue() error return. Use LOG_ERROR for parity mismatch. Change-Id: I5ff1f658f221af78d8bbec8416a7a0fc64ba2550 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/6700 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2021-11-20drivers/ftdi: add support for SWD multidropTomas Vanek1-3/+7
Ignore ack received after DP_TARGETSEL write to prevent false error. Inspired by Graham Sanderson's http://review.openocd.org/4935 Change-Id: I04fd77cde3244de250743d8c8bfb93ed26379385 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/6698 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>