aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2021-04-09Add --enable-jlink.jlinkTim Newsome1-1/+1
Hopefully this will let me reproduce #589 in one of the travis builds. Signed-off-by: Tim Newsome <tim@sifive.com> Change-Id: Idf0378bd57144067702cd46531ffdd3cffbf665c
2021-04-08Support RV32/RV64 mainline/metal stackings (#586)Tim Newsome6-141/+481
* Support mainline FreeRTOS instead of metal FreeRTOS I'll have to add an option or something before this can be merged. The stack pointer value for suspended threads is computed, and I didn't check that it's right. Can't be written. Does not support accessing gp/tp in suspended threads. Change-Id: Ibe7f5167b970d5990a296e968df2b4480135d673 Signed-off-by: Tim Newsome <tim@sifive.com> * Add riscv_freertos_stacking command. This lets the user describe how registers are stored on the stack. Change-Id: I052188fa9c6cb4f8670fa4b01a8878272ed6fc4d * Redo how we handle offsets in FreeRTOS. Instead of hard-coding them for each "target," hard code the data types in FreeRTOS list structures, and compute the offsets based on size of pointers and ubase_t types. Doesn't work right now. Change-Id: I444cd1ef47121190e2222f19a67edf3c6155a96a * Correctly get thread list. Works on RV32 and RV64. Change-Id: I27768aef698475bef425d6a7e27ea609c9b9a1b6 * Fix SP calculation and RV64 register stacking. Smoketest now passes on spike with both RV32 and RV64. Change-Id: I94b43e041abe5370a833bd3afb4a2a8591538d7a Signed-off-by: Tim Newsome <tim@sifive.com> * Style fixes. Change-Id: I269b5aac8c233022c41ebc8ac8c5aeb437882719 Signed-off-by: Tim Newsome <tim@sifive.com> * Style fix. Change-Id: I18fbff7dcaad9bd35f0942598c05c2a45bdb9f3b Signed-off-by: Tim Newsome <tim@sifive.com>
2021-04-02Update version check error message from 0.14 to 1.0. (#588)Ernie Edgar1-1/+1
2021-03-17Writing registers in other threads appears to work. (#585)Tim Newsome4-1/+78
Change-Id: Ie2a8bef5e9aa24fc85e9b6c9093021731c58c3e7 Signed-off-by: Tim Newsome <tim@sifive.com>
2021-03-05RISC-V Freertos support (#582)Tim Newsome106-214/+6684
Support reading names/status of all threads, as well as all registers that are stored on the stack. Limited to RV32, no FPU. --- * WIP Change-Id: I09417c2e45748504be449d74c39ae0b6b311e277 * WIP Change-Id: I975fa2cabbf43ccf64f5162337c394f9c8e3017f * Import rbtreehash-list from gnulib. The main change to get this to build was to remove 3 includes from config.h (actual code change in configure.ac) because lib/Makefile.am doesn't contain the correct flags to find the files referenced there. Instead I sprinkled necessary includes throughout the source code. This feels like less of a hack regardless, so hopefully that's OK. I'm not actually using the new library. Just got it to build. Change-Id: I824000d8be0b6f58b6f2036498b37c33f453515a * Actually use linkedhash_map. Moved some files around to get it to link. Also note I'm using a different module than before. This is the one I want (I think right now). Change-Id: I6161bffd4b5f916602c33c1930be6e061cefe982 * Properly track TCB/threadid mappings. Change-Id: I725abb96f880745d78c5634d5faff7385c2773e1 * OpenOCD no longer crashes reading rv32 freertos regs Change-Id: Ia84502dbf007145995d4fba8661153ab7f58f26f * WIP The register values reported for threads that aren't the current thread look believable to me. Change-Id: I94b109565c8cc2029fa77657a7fc10291bcb36e3 * Correctly mark the current thread. Change-Id: Id94ababb55a222292090e6465e47ebf92ca26291 * Try to make the build pass. Change-Id: I0fddd10fe22c013464f9a1e106cd21470fa7afe1 Signed-off-by: Tim Newsome <tim@sifive.com> * Exclude new gnulib files. Change-Id: I8b95615908034124f2236422771b5079f3304e37 Signed-off-by: Tim Newsome <tim@sifive.com> * Style fixes. Change-Id: I4aef0b1d0b0e366893c740ab89756fe8ea033ddb Signed-off-by: Tim Newsome <tim@sifive.com> * Don't include string.h. It breaks the i686-w64-mingw32-gcc build, which complains: error: incompatible implicit declaration of built-in function ‘strndup’ Change-Id: I8d758fe092efa503e015f71f34721f2c44632516 Signed-off-by: Tim Newsome <tim@sifive.com> * Hopefully fix mingw32 build. Change-Id: I8703b834b5679588b3aa6602ae4add7258dbd879 Signed-off-by: Tim Newsome <tim@sifive.com> * Include winsock2 in replacements. Change-Id: I77cfc90736c771a3cdefb39062e6c5b59de52cd5 Signed-off-by: Tim Newsome <tim@sifive.com> * Zero now gets the correct value. Change-Id: Ia7da043439a82081629b8a5991ed8cbc382d5ac8 Signed-off-by: Tim Newsome <tim@sifive.com> * Accommodate non-general regs on the stack. Also refactor FreeRTOS a little to separate out target-specific code from target-indepent code. Change-Id: Icc74d85b24f35d069be091e32e23144573560e9f * All registers now read sane values. It appears that FreeRTOS wastes a space on the stack, where x0 would be saved. Am I missing something? Correctly read mstatus as it is saved on the stack as well. This same mechanism should also work for FPU registers, although there's more work to be done before we get there. Change-Id: Iabacc3af2ab368aa7b9090c1ff719451a087b5ed Signed-off-by: Tim Newsome <tim@sifive.com>
2021-02-11From upstream (#580)Tim Newsome44-425/+473
* configure: do not make Capstone dependency automagic This adds regular ./configure options to control dependency on the Capstone disassembly engine. See [0] for the rationale. [0] https://wiki.gentoo.org/wiki/Project:Quality_Assurance/Automagic_dependencies Change-Id: I3e16dc5255d650aa1949ccf896b26dc96e522a75 Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/5985 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> * configure.ac: fix build with libusb0 and without libusb1 Driver 'openjtag' requires both libftdi and libusb1. The current check is incorrect and the driver is built when libftdi is present with libusb0 and without libusb1, which causes the linker to fail resolving the required libusb1 symbols. Remove the check for libusb0 on driver 'openjtag'. Create a new adapters group LIBFTDI_USB1_ADAPTERS to hold the driver 'openjtag'. Change-Id: I1f5e554b519e51c829d116ede894639cb55a26aa Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5989 Tested-by: jenkins * doc: fix over/underfull hboxes in PDF This adds some cosmetic changes to make the PDF User Manual look proper. Building it now requires Texinfo 5.0 which shouldn't be problematic according to [0]. Commit 79fdeb37f486f74658f1eaf658abac8efb3eba6a is effectively reverted. [0] https://repology.org/project/texinfo/versions Change-Id: I990bc23bdb53d24c302b26d74fd770ea738e4096 Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/5995 Reviewed-by: Jonathan McDowell <noodles-openocd@earth.li> Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> * contrib: rpc_examples: haskell: fix ftbs with current libraries And get rid of some warnings along the way. Change-Id: I8fdbe1fa304276be6b0f25249b902b3576aa3793 Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/5987 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> * Makefile.am: fix override of target 'check-recursive' To prevent executing the Jim Tcl tests, the makefile's target 'check-recursive' has been overridden in commit 56d163ce7951 ("jimtcl: update to 0.77, the current version, enable only specific modules"). This causes a runtime warning during build: Makefile:6332: warning: overriding recipe for target 'check-recursive' Makefile:5098: warning: ignoring old recipe for target 'check-recursive' Instead of override the makefile's target 'check-recursive', prevent the recursion by re-assigning as empty the variable SUBDIRS for this specific target only. Change-Id: I03d1c467eba42316a59aeed4612d6bdbe6211282 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Fixes: 56d163ce7951 ("jimtcl: update to 0.77, the current version, enable only specific modules") Reviewed-on: http://openocd.zylin.com/5986 Tested-by: jenkins * contrib: udev file for Cypress SuperSpeed Explorer kit lsusb output: Bus 003 Device 011: ID 04b4:0007 Cypress Semiconductor Corp. Couldn't open device, some information will be missing Device Descriptor: bLength 18 bDescriptorType 1 bcdUSB 2.00 bDeviceClass 0 (Defined at Interface level) bDeviceSubClass 0 bDeviceProtocol 0 bMaxPacketSize0 8 idVendor 0x04b4 Cypress Semiconductor Corp. idProduct 0x0007 bcdDevice 0.00 iManufacturer 1 iProduct 2 iSerial 0 bNumConfigurations 1 Configuration Descriptor: bLength 9 bDescriptorType 2 wTotalLength 114 bNumInterfaces 4 bConfigurationValue 1 iConfiguration 0 bmAttributes 0xa0 (Bus Powered) Remote Wakeup MaxPower 100mA Interface Association: bLength 8 bDescriptorType 11 bFirstInterface 0 bInterfaceCount 2 bFunctionClass 2 Communications bFunctionSubClass 2 Abstract (modem) bFunctionProtocol 1 AT-commands (v.25ter) iFunction 0 Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 0 bAlternateSetting 0 bNumEndpoints 1 bInterfaceClass 2 Communications bInterfaceSubClass 2 Abstract (modem) bInterfaceProtocol 1 AT-commands (v.25ter) iInterface 0 CDC Header: bcdCDC 1.10 CDC ACM: bmCapabilities 0x02 line coding and serial state CDC Union: bMasterInterface 0 bSlaveInterface 1 CDC Call Management: bmCapabilities 0x00 bDataInterface 1 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x83 EP 3 IN bmAttributes 3 Transfer Type Interrupt Synch Type None Usage Type Data wMaxPacketSize 0x0040 1x 64 bytes bInterval 10 Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 1 bAlternateSetting 0 bNumEndpoints 2 bInterfaceClass 10 CDC Data bInterfaceSubClass 0 Unused bInterfaceProtocol 0 iInterface 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x01 EP 1 OUT bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0040 1x 64 bytes bInterval 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x82 EP 2 IN bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0040 1x 64 bytes bInterval 0 Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 2 bAlternateSetting 0 bNumEndpoints 3 bInterfaceClass 255 Vendor Specific Class bInterfaceSubClass 4 bInterfaceProtocol 0 iInterface 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x04 EP 4 OUT bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0040 1x 64 bytes bInterval 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x85 EP 5 IN bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0040 1x 64 bytes bInterval 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x86 EP 6 IN bmAttributes 3 Transfer Type Interrupt Synch Type None Usage Type Data wMaxPacketSize 0x0040 1x 64 bytes bInterval 10 Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 3 bAlternateSetting 0 bNumEndpoints 0 bInterfaceClass 255 Vendor Specific Class bInterfaceSubClass 5 bInterfaceProtocol 0 iInterface 0 Change-Id: I62f0300199da3551c8774a4a5a4cd106a3ab2904 Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> Signed-off-by: Jiri Kastner <cz172638@gmail.com> Reviewed-on: http://openocd.zylin.com/3611 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> * target: fix memory leak on multiple '-gdb-port' flag In the odd case of multiple flags '-gdb-port' during 'target create' or following 'configure', the new strdup()'ed value will replace the old one without freeing it. Free the old value (if it exists) before replacing it. Change-Id: I1673346613ce7023880046e3a9ba473e75f18b8a Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/6005 Tested-by: jenkins * udev: fix permission for Ambiq Micro EVK's Commit 68e204f1e91a ("udev: Add rules for Ambiq Micro EVK's.") was initially proposed as http://openocd.zylin.com/3429/ then replaced by http://openocd.zylin.com/3980/ The initial proposal was for file '99-openocd.rules', in which MODE="664" was the norm. After merge of http://openocd.zylin.com/2804/ the new udev rules in '60-openocd.rules' switched to MODE="660", but the evolution of the above patch missed this change. Switch udev rules of Ambiq Micro EVK's to MODE="660" and uniform them to the rest of the file. Change-Id: I4b4eea535184ee8569da3264bff4f1fafb5bce4d Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Fixes: 68e204f1e91a ("udev: Add rules for Ambiq Micro EVK's.") Reviewed-on: http://openocd.zylin.com/6004 Tested-by: jenkins * doc/style: fix doxygen error Doxygen complains about non-closed nested comments: doc/manual/style.txt:423: warning: Reached end of file while still inside a (nested) comment. Nesting level 1 (probable line reference: 149) This is caused by the string '/**' that is interpreted as the beginning of a comment. Escape the string to not let doxygen consider it as a comment While there, replace @code/@endcode with @verbatim/@endverbatim to properly render the line. Change-Id: If2a27c4cf659326e317cc4ac8c0b313e97e40432 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5996 Tested-by: jenkins * flash/nor/max32xxx: fix path of include file The relative path should have three times '..'. Issue identified by doxygen: src/flash/nor/max32xxx.c:85: warning: include file ../../contrib/loaders/flash/max32xxx/max32xxx.inc not found, perhaps you forgot to add its directory to INCLUDE_PATH? Change-Id: Ie7b4948c6770b8acb9eff26e08eea32945ebb219 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5997 Tested-by: jenkins * Doxyfile.in: fix build out-of-tree When doxygen is built out-of-tree, it fails to find the generated file startup_tcl.inc: src/openocd.c:59: warning: include file startup_tcl.inc not found, perhaps you forgot to add its directory to INCLUDE_PATH? Add '@builddir@/src' to INCLUDE_PATH. Change-Id: I51f2f6fe7224bba0f8b3db7219f9831de4e67139 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5998 Tested-by: jenkins * doc/manual/primer/jtag.txt: remove duplicated section name The section name 'primerjtag' is used twice, causing doxygen to complain: warning: multiple use of section label 'primerjtag', (first occurrence: doc/manual/primer/jtag.txt, line 107) Rename one of them. Change-Id: Id307915dbc51a7f647fab4fb28ab431e65344d61 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5999 Tested-by: jenkins * Doxyfile.in: exclude libjaylink from doxygen When build using libjaylink as git submodule, doxygen includes the libjaylink files and complains for multiple 'mainpage' comment block, one in OpenOCD and the other in libjaylink: src/jtag/drivers/libjaylink/libjaylink/core.c:37: warning: found more than one \mainpage comment block! (first occurrence: doc/manual/main.txt, line 1), Skipping current block! Exclude libjaylink submodule from doxygen. Change-Id: I5e856817344c9f21f8c26f077a23c00b83cfbcb5 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/6000 Tested-by: jenkins * openocd: fix incorrect doxygen comments Use '@param' in front of function's parameters and '@a' when the parameter is recalled in the description. This fixes doxygen complains: warning: Found unknown command '@buff16' While there, fix a minor typo s/occured/occurred/ in a comment and the typo s/@apram/@param/ in a doxygen comment. Change-Id: I5cd86a80adef552331310a21c55ec5d11354be21 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/6001 Tested-by: jenkins * openocd: fix doxygen parameters of functions Add to doxygen comment the missing parameters. Remove from doxygen comment any non-existing parameter. Fix the parameter names in doxygen comment to match the one in the function prototype. Where the parameter name in the doxygen description seems better than the one in the code, change the code. Escape the character '<' to prevent doxygen to interpret it as an xml tag. Change-Id: I22da723339ac7d7a7a64ac4c1cc4336e2416c2cc Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/6002 Tested-by: jenkins * doc/manual/primer/autotools.txt: fix doxygen warning Commit ab90b8777855 ("configure: remove AM_MAINTAINER_MODE, effectively always enabling all the rules") removes the configure flag '--enable-maintainer-mode' and its documentation, but have left a reference to the removed subsection 'primermaintainermode' and this triggers a warning in doxygen: doc/manual/primer/autotools.txt:21: warning: unable to resolve reference to 'primermaintainermode' for \ref command Remove the obsoleted paragraph. Change-Id: I56e69ef033d546d159745bed1b47c6105827e7ae Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Fixes: ab90b8777855 ("configure: remove AM_MAINTAINER_MODE, effectively always enabling all the rules") Reviewed-on: http://openocd.zylin.com/6003 Tested-by: jenkins * flash/stmqspi: fix build error with -Werror=maybe-uninitialized using gcc 9.3 on ubuntu focal fossa with -Werror=maybe-uninitialized we get this error: /src/flash/nor/stmqspi.c: In function ‘read_flash_id’: /src/flash/nor/stmqspi.c:1948:6: error: ‘retval’ may be used uninitialized Change-Id: Ifd8ae60df847fc61e22ca100c008e3914c9af79b Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@st.com> Reviewed-on: http://openocd.zylin.com/6012 Tested-by: jenkins Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> * target/riscv: fix build error with -Werror=maybe-uninitialized using gcc 9.3 on ubuntu focal fossa with -Werror=maybe-uninitialized we get this error: /src/target/riscv/riscv.c: In function ‘riscv_address_translate’: /src/target/riscv/riscv.c:1536:13: error: ‘pte’ may be used uninitialized Change-Id: I51e180b43f9b6996e4e4058db49c179b9f81bcdc Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@st.com> Reviewed-on: http://openocd.zylin.com/6013 Tested-by: jenkins Reviewed-by: Tim Newsome <tim@sifive.com> Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> * cortex_m: [FIX] ARMv8-M does not support VECTRESET ref: Arm®v8-M Architecture Reference Manual (DDI0553B.m) D1.2.3: AIRCR, Application Interrupt and Reset Control Register Bit [0] is RES0 Change-Id: I6ef451b2c114487e2732852a60e86c292ffa6a50 Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@st.com> Reviewed-on: http://openocd.zylin.com/6014 Tested-by: jenkins Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> * driver/ftdi: skip trst in swd mode When using the adapter olimex arm-jtag-swd (to convert to SWD a JTAG-only FTDI adapter), the pin trst on JTAG side is re-used to control the direction of pin SWDIO on SWD side. There is a single reset API at adapter driver to assert/deassert either srst and/or trst. A request to assert/deassert srst can cause also trst to change value, hanging the SWD communication. In SWD mode, ignore the value passed to trst. Change-Id: I5fe1eed851177d405d77ae6079da9642dc1a08f1 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/6006 Tested-by: jenkins * configure.ac: drop macro 'AC_PROG_CC_C99' from autoconf 2.70 The macro AC_PROG_CC_C99 has been obsoleted by autoconf 2.70 and triggers a set of warnings from both 'aclocal' and 'autoconf'. The test of AC_PROG_CC_C99 is now included in AC_PROG_CC. For autoconf 2.69 and earlier the macro is still required, so cannot be simply dropped. Use a conditional test to avoid the warning on autoconf 2.70 but still use AC_PROG_CC_C99 on older autoconf. Change-Id: I5e8437f5a826fb63be6d07bcb5bb824f94683020 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/6009 Tested-by: jenkins Reviewed-by: Marc Schink <dev@zapb.de> * configure: drop macro 'AC_HEADER_TIME' The macro AC_HEADER_TIME has been obsoleted by autoconf 2.70. Not all systems provide 'sys/time.h', plus some old system didn't allowed to include both 'time.h' and 'sys/time.h' because 'time.h' was included by 'sys/time.h' and was not properly protected to allow multiple inclusion. The macro AC_HEADER_TIME helps to detect such odd case. Nowadays all the systems properly protect 'time.h', so its safe to unconditionally include 'time.h', even if it is also included by 'sys/time.h'. The case of systems without 'sys/time.h' is already covered by configure.ac through the directive AC_CHECK_HEADERS([sys/time.h]) Remove the obsoleted autoconf macro and simplify the code by including 'time.h' unconditionally and check HAVE_SYS_TIME_H to include 'sys/time.h'. Change-Id: Iddb3f3f1d90c22668b97f8e756e1b4f733367a7d Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/6010 Tested-by: jenkins Reviewed-by: Marc Schink <dev@zapb.de> * README.macOS: explain how to install suitable Texinfo Change-Id: Ic5906111f412eebd906a9be3fd0e133484def3eb Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/6026 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> * jlink: fix device discovery when network is off If user specifies a serial number for the jlink device, openocd extends the search to network jlink devices too, without checking if the host has a valid and functional network connection. If the network is not functional, libjaylink returns error. This error invalidates the discovery on USB, even if it was successful. Factor-out parts of the jlink_init into separate jlink_open_device function, use that function to firstly discover and match USB devices and, if matching device was not found on the USB bus and serial number was specified, repeat discovery and matching via TCP. Fixes: https://sourceforge.net/p/openocd/tickets/294/ Change-Id: Iea0de1640d4e5b21ecc7e9c1dd6d36f214d647c2 Signed-off-by: Bohdan Tymkiv <bohdan200@gmail.com> Reviewed-on: http://openocd.zylin.com/6025 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins Reviewed-by: Marc Schink <dev@zapb.de> * README: add missing items for 0.11 JTAG adapters Cadence DPI, Cypress Kitpro, FTDI FT232R, Linux GPIOD, Mellanox rshim, Nuvoton Nu-Link, Nu-Link2, NXP IMX GPIO, Remote Bitbang, TI XDS110, Xilinx XVC/PCIe Debug targets AArch64, Cortex-M (ARMv8-M), ARCv2, MIPS64, RISC-V, ST-STM8 Flash Drivers ATmega128RFA1, Atmel SAM, eSi-RISC, EZR32HG, MAX32, MXC, nRF52, PSoC6, Renesas RPC HF and SH QSPI, SiFive Freedom E, ST BlueNRG, STM32 QUAD/OCTO-SPI for Flash/FRAM/EEPROM, SWM050, TI CC13xx, TI CC26xx, TI CC32xx, TI MSP432, Winner Micro w600, Xilinx XCF Change-Id: I341618ac5d7189e4f98268cecd66c99447b72af8 Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@st.com> Reviewed-on: http://openocd.zylin.com/6027 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-by: Paul Fertser <fercerpav@gmail.com> * The openocd-0.11.0-rc2 release candidate Signed-off-by: Paul Fertser <fercerpav@gmail.com> * Restore +dev suffix Signed-off-by: Paul Fertser <fercerpav@gmail.com> * steppenprobe: fix file permission Commit 895d4a599585 ("tcl/interface/ftdi: Add Steppenprobe open hardware interface") erroneously set the execution permission to the configuration file. Strip the execution permission. Change-Id: I556451d5e6fee4aee385451e8c90216a25b6ef46 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Fixes: http://openocd.zylin.com/5653 Reviewed-on: http://openocd.zylin.com/6038 Reviewed-by: Paul Fertser <fercerpav@gmail.com> Tested-by: Paul Fertser <fercerpav@gmail.com> * github: fix github wokflow while pushing a tag this fix permits to add correctly the generated artifact (windows binaries) into the release section. Change-Id: Ia982370d3a1e08c623ebcabb5ac97e9fb49d00e0 Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-on: http://openocd.zylin.com/6047 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> * doc: Fix type in Hooking up the JTAG Adapter We are talking about adapter connectivity in this chapter. It should be "dongles" instead of "cables". Change-Id: I7bd4307765517375caa2af86dfc929d0ef66c3e6 Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com> Reviewed-on: http://openocd.zylin.com/6040 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins * doc/manual: Fix @subpage handling The subpage "thelist" used to have a title "Pending and Open Tasks" but the commit c41db358a0100ab changed it to "The List". With @subpage, it now renders: "The List of The List enumerates opportunities for" instead of "The List of Pending and Open Tasks enumerates opportunities for" This commit fix it to "The List enumerates opportunities for" Change-Id: Ifee0dcd9b3c9f7e651a8748a7afda99eedea3c5c Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com> Reviewed-on: http://openocd.zylin.com/6041 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> * doc/manual: Fix function name typo We have both the singular form, register_command(), and the plural form register_commands(). Change-Id: I905ea83988b8ac70dd809b02d53b646aa4d66697 Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com> Reviewed-on: http://openocd.zylin.com/6042 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins Co-authored-by: Paul Fertser <fercerpav@gmail.com> Co-authored-by: Antonio Borneo <borneo.antonio@gmail.com> Co-authored-by: Jiri Kastner <cz172638@gmail.com> Co-authored-by: Tarek BOCHKATI <tarek.bouchkati@st.com> Co-authored-by: Bohdan Tymkiv <bohdan200@gmail.com> Co-authored-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Co-authored-by: Yasushi SHOJI <yashi@spacecubics.com>
2021-02-09Minor improvement to `riscv expose_custom` docs. (#579)Tim Newsome1-2/+8
* Minor improvement to `riscv expose_custom` docs. Change-Id: Idba63368a147111af7b0a8b15aab5d9d653b9a6d Signed-off-by: Tim Newsome <tim@sifive.com> * Document name info for `riscv expose_csrs`. Change-Id: I18b542df42255467dd906e32bd9d1214d1db0743 Signed-off-by: Tim Newsome <tim@sifive.com>
2021-02-04Fix in write_memory_bus_v1: Read sbcs properly (#578)Jan Matyas1-16/+38
* Fix in write_memory_bus_v1: Read sbcs properly Fixed an issue with system bus write: sberrors were not properly detected because of an incomplete read of "sbcs". The read was initiated but not completed (value not acquired by a second DMI scan). Added debug prints in case sberror != 0. Added few comments to explain the algorithm. Change-Id: Id5eb07f2f1bf8e9afee2dec04b9ff5c5a57f606b Signed-off-by: Jan Matyas <matyas@codasip.com> * Updated per review discussion at #577. Change-Id: I65c07edcd4e86eaa5327280a81f74db0b9c84f9c Signed-off-by: Jan Matyas <jmatyas@codasip.com> * Empty commit to re-trigger Travis build. Change-Id: I95deeb28584a891203c8904be621e48003f069dc Co-authored-by: Jan Matyas <jmatyas@codasip.com>
2021-01-29Add memory access while running to `riscv info` (#576)Tim Newsome2-0/+25
This way people can write TCL scripts that rely on these more abstract properties instead of having to check for the existence of sbaccess, which is not part of 0.11. (There is a similar feature but things are named differently.) Change-Id: I5c95a29ef43cb40c3a73b904f11fa7ca38d87b21 Signed-off-by: Tim Newsome <tim@sifive.com>
2021-01-29Select current hart before accessing vector regs. (#574)Tim Newsome1-1/+8
I don't know how this worked before. Possibly caused by overzealous removal of `-rtos riscv`. Change-Id: I7259267b861ef45655f469ab39cc463d608fe149 Signed-off-by: Tim Newsome <tim@sifive.com>
2021-01-29Minor cleanups. (#573)Tim Newsome1-7/+7
* Make a few globals const. Looking through globals to see what needs to be removed, but const globals are OK. Change-Id: I4126a3f629daf91b109a3bd7120e4b4f62a9d8ee Signed-off-by: Tim Newsome <tim@sifive.com> * Fix comment typo. Change-Id: I0c20837559411410b6870e0d0e52c0179a3a167e Signed-off-by: Tim Newsome <tim@sifive.com>
2021-01-28Add authdata_read/authdata_write support to 0.11. (#575)Tim Newsome5-22/+118
AFAIK there is no hardware that implements this, but it should be a close-to-done starting point in case it is ever required. Change-Id: I49e3082e8629b1d70b12e8a847c2848e75b04508 Signed-off-by: Tim Newsome <tim@sifive.com>
2021-01-25Document how vector registers are exposed to gdb. (#570)Tim Newsome1-0/+37
Change-Id: Ie7cdef3717e107a9df0b48316cfbc547dea9a7fd Signed-off-by: Tim Newsome <tim@sifive.com>
2021-01-20riscv-013: Fix comment for register_read() (#569)Jan Matyas1-1/+1
Signed-off-by: Jan Matyas <matyas@codasip.com>
2021-01-18Remove `-rtos riscv` (#567)Tim Newsome8-1461/+271
* Remove `-rtos riscv`. `-rtos hwwthread` is target-independent and a cleaner way to achieve the same thing. Change-Id: I863a91f9ad66e37dc36f2fbcbffe403b91355556 * Little more cleanup. Change-Id: I8fda2317368a94760bc734abc7f1de6ee5b82a7c * Clean up some more. Change-Id: I64a1e96aa3bd8c0561d4d19930f99e9bc40eab86 * Get rid of riscv_[sg]et_register_on_hart Change-Id: I5ea9439bad0e74d7ed2099935e7fc7292c4a2b7f * Remove hartid arg from set_register. Change-Id: Ib560e3c63ff32191589c74d3ee06b12295107c6f * Remove more references to hartid. Change-Id: Ie9d932fb8b671c478271c1084dad43cad3b2bfbc * Remove some unused code. Change-Id: I233360c6c420d1fc98b923d067e65a9419d88d7b Signed-off-by: Tim Newsome <tim@sifive.com>
2021-01-15Merge pull request #568 from riscv/zeroTim Newsome1-0/+5
Don't write to zero.
2021-01-14Don't write to zero.Tim Newsome1-0/+5
It doesn't have any effect on real hardware, and by caching the value we pretended it did. Fixes #564 Change-Id: I9f4e2cc8abddee61435bbd8d992cbff971a0c28d Signed-off-by: Tim Newsome <tim@sifive.com>
2021-01-14Merge pull request #566 from craigblackmore/cb-read-progbuf-commentTim Newsome1-2/+2
Fix comment in read_memory_progbuf
2021-01-13riscv: Fix comment in read_memory_progbufCraig Blackmore1-2/+2
The comment should refer to reading rather than writing. Change-Id: I72937bb48053233ab5e48d343c4bd1e394f77bda Signed-off-by: Craig Blackmore <craig.blackmore@embecosm.com>
2021-01-08Merge pull request #562 from riscv/from_upstreamTim Newsome212-1833/+11810
From upstream
2020-12-31Merge branch 'master' into from_upstreamTim Newsome212-1833/+11810
Conflicts: .github/workflows/snapshot.yml .gitmodules src/flash/nor/drivers.c src/helper/jep106.inc src/rtos/hwthread.c src/target/riscv/riscv.c src/target/target.c Change-Id: I62f65e10d15dcda4c405d4042cce1d96f8e1680a
2020-12-26gdb_server: fix HW thread status at gdb attachAntonio Borneo1-9/+9
At gdb attach, the event TARGET_EVENT_GDB_ATTACH is in charge of halting the target. For HW thread, rtos_update_threads() should be called after the event to detect and record the new 'halted' status. Instead it is called immediately before the event, thus reading the status before the halt. Move after the event the call to rtos_update_threads(). Change-Id: Iab3480ea0f5283ed6580f0f6c11200083197d1e9 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5983 Tested-by: jenkins
2020-12-26gdb_server: minor fix for indentationAntonio Borneo1-1/+1
Use a TAB in place of 4 spaces Change-Id: Ic34b7c3ef24078d2c36a193d4dd079bca5a7ef2e Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Fixes: a4cdce0129a6 ("gdb_server: prevent false positive valgrind report") Reviewed-on: http://openocd.zylin.com/5982 Tested-by: jenkins Reviewed-by: Jonathan McDowell <noodles-openocd@earth.li>
2020-12-26rtos/hwthread: fix register list for armv7aAntonio Borneo1-5/+17
The targets armv7a in file cortex_a.c inherit the register list from file armv4_5.c thus, depending on the core status, some register get marked as not existing. For HW threads other than current target, the registers in the list are not checked for existence and are all forwarded to GDB that in turns complains for too many data: Remote 'g' packet reply is too long (expected 68 bytes, got 104 bytes) Check all the attributes of the registers and pass to GDB only the valid registers. To test it, use a SMP cortex-a target (2 cores are enough) and add -rtos hwthread to all the cores. Connect GDB to OpenOCD and issue the GDB command info threads Change-Id: Ie66119fe83a3c8d53e9d18dda39e60fd97769669 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5981 Tested-by: jenkins
2020-12-26tcl/target/rk3308.cfg: add defer-examineJiri Kastner1-1/+2
only core0 is brought up by bootloader Change-Id: I1d6b5e6ba7498beadbf3805f4271f0197e411bd5 Signed-off-by: Jiri Kastner <cz172638@gmail.com> Reviewed-on: http://openocd.zylin.com/5980 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins Reviewed-by: Jonathan McDowell <noodles-openocd@earth.li>
2020-12-26cortex-a: fix reset on dapdirect transportsAntonio Borneo1-2/+2
The target code for assert reset on cortex_a has been patched on commit b0698501b0e7 ("cortex_a: fix cortex_a_assert_reset() if srst_gates_jtag") then in cdba6ba0ad63 ("cortex_a: fix reset for SWD transport") to workaround the mismatch between jtag and swd implementations. See discussion for the second patch at http://openocd.zylin.com/3641/ While all of these mismatches should hopefully be cleaned by the reset framework rework, an extension of the workaround of the second patch is required for dapdirect transports, either dapdirect_swd and dapdirect_jtag. Extend the existing workaround to all non-jtag transports. Change-Id: Ia6a9d43bab524cbb3de4c37ce24c45f25187353d Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5979 Tested-by: jenkins
2020-12-26armv7m_trace: stop getting traces from adapter at exitAntonio Borneo3-0/+21
If OpenOCD is reading trace data from the target, at exit it should stop the adapter to gather data, but should left the target still producing them. Add a helper in armv7m_trace to disable the adapter's trace and call it during OpenOCD teardown. This also provides a workaround for an issue in the firmware of ST-Link V3 till version V3J7. If the SWD connection is closed when trace is active, at following connection the trace does not work anymore. Change-Id: I47ccab61405384938555096c5aca789eaa090d27 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5978 Reviewed-by: Jonathan McDowell <noodles-openocd@earth.li> Tested-by: jenkins
2020-12-26LICENSES: Update GFDL invariant text to match official wordingJonathan McDowell1-3/+3
This was flagged by lintian against the Debian package; the text stating there are no invariant sections deviates from the official GNU wording. Update it to match the text at the bottom of: https://www.gnu.org/licenses/old-licenses/fdl-1.2.en.html Change-Id: Ie222237a8eede24c1b71218b05e1513b74208a47 Signed-off-by: Jonathan McDowell <noodles@earth.li> Reviewed-on: http://openocd.zylin.com/5974 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-12-26Makefile.am: fix non-POSIX warning from automakeAntonio Borneo1-1/+2
Automake issues a warning Makefile.am:46: warning: wildcard $(srcdir: non-POSIX variable name Makefile.am:46: (probably a GNU make extension) because the GNU make function 'wildcard' is not POSIX. Also the GNU make function 'shell' triggers a similar warning. Use the POSIX extension '!=', that executes an arbitrary shell command, to replace the GNU make 'wildcard'. Don't include the file 'NEWS' because automake already includes it by default. Change-Id: Ice560c3789cec4f3f2197a255d6f5af7b1fde634 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5965 Tested-by: jenkins Reviewed-by: Jonathan McDowell <noodles-openocd@earth.li>
2020-12-26Correct warning messageLuca Lindhorst1-2/+2
The warning message regarding wrong verification checksum for LPC2000, claims that the verification will fail, but the checksum written correctly by openocd. Clarify this in the warning message. Change-Id: I929ac767f7f9fdad9bace250c8c04a776462800a Signed-off-by: Luca Lindhorst <l.lindhorst@wut.de> Reviewed-on: http://openocd.zylin.com/5956 Tested-by: jenkins Reviewed-by: Jonathan McDowell <noodles-openocd@earth.li> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-12-14Add `riscv info` command. (#558)Tim Newsome4-92/+57
Add `riscv info` command. Final output is "TCL format" and looks like this: ``` hart.xlen 64 hart.trigger_count 4 dm.abits 6 dm.progbufsize 2 dm.sbversion 0 dm.sbasize 0 dm.sbaccess128 0 dm.sbaccess64 0 dm.sbaccess32 0 dm.sbaccess16 0 dm.sbaccess8 0 ``` * Add `riscv info` command. This command displays some basic information that OpenOCD has detected about the target. The output is displayed in YAML so it can easily be parsed. Example of current output: ``` Hart: XLEN: 32 trigger count: 4 Debug Module: abits: 6 progbufsize: 2 sbversion: 0 sbasize: 0 sbaccess128: 0 sbaccess64: 0 sbaccess32: 0 sbaccess16: 0 sbaccess8: 0 ``` Change-Id: If920c083ff6ec9f482c50f913cd8ceaa62461217 Signed-off-by: Tim Newsome <tim@sifive.com> * Disable workflow inherited from upstream. Change-Id: Ifc5ed1b4f5ec2278b8bcf3279c9fd462e469fefa Signed-off-by: Tim Newsome <tim@sifive.com> * Switch from YAML to TCL "set array" input format. Change-Id: I3833210e5bf6d7cffc9934c04ec5201ae7732ad8 Signed-off-by: Tim Newsome <tim@sifive.com> * Remove indent in `riscv info` output. That was getting a little too cute, and probably more confusing than helpful. Change-Id: Ie51416f53ab4b69294962f0565767d370db82867 Signed-off-by: Tim Newsome <tim@sifive.com>
2020-12-14Fix error handling in read_memory_progbuf_one(). (#560)Tim Newsome1-11/+14
* Fix error handling in read_memory_progbuf_one(). Be sure to restore mstatus/s0 even if there is a failure during the operation. Fixes #559. Change-Id: Ib86ca2c7455bad4a668f34703566060a782116db Signed-off-by: Tim Newsome <tim@sifive.com> * Style fix suggested in review. Change-Id: I444112a9dffea483b7d0e5f96ef7bbdaf58d249f Signed-off-by: Tim Newsome <tim@sifive.com>
2020-12-14Clear sbcs.sbbusyerror without affecting other sbcs bits (#547)Jan Matyas1-3/+3
This is a fix for an issue reported by Joe Stoy at: https://sourceforge.net/p/openocd/mailman/message/37128537/ When clearing sbcs.sbbusyerror, preserve other bits in the sbcs register that are needed for subsequent system bus transactions.
2020-12-10Restore +dev suffixPaul Fertser1-1/+1
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
2020-12-09The openocd-0.11.0-rc1 release candidateAntonio Borneo2-2/+207
Change-Id: I111fec1304482f5c0f9d6ee988be8a2ea3de3981 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-12-09doc: document adapter drivers linuxgpiod and sysfsgpioAntonio Borneo1-0/+23
Change-Id: If894092a7ae04bb95fa1913d2e3c8465c2d0f75c Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5961 Tested-by: jenkins Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
2020-12-09flash/nor/stmsmi: fix compile error with clang 12.0.0Antonio Borneo1-4/+3
The git preliminarily version of clang 12.0.0_r370171 f067bc3c0ad6 reports an error in the expansion of the macro SMI_READ_REG(): error: '(' and '{' tokens introducing statement expression appear in different macro expansion contexts [-Werror,-Wcompound-token-split-by-macro] Remove one intermediate macro expansion to make clang happy. Change-Id: I8ae6d9c18808467ba8044d70cbf0a4f76a18d3e6 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5958 Tested-by: jenkins Reviewed-by: Xiaofan <xiaofanc@gmail.com>
2020-12-09jtag/drivers/ulink: auto-detect OpenULINK USB endpoints numbersŁukasz Misek1-7/+14
This should provide greater compatibility with different OpenULINK targets which might be using various endpoints numbers. Since they're advertised in the USB descriptor anyway it makes sense to autodetect them. Interface is no longer claimed before attempting to load firmware to a freshly booted device, so I have no idea if this will break on windows or other uncommon systems (Paul). Change-Id: Iee10dcb6911dcf46239c430e174d9f98b5bde3c2 Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/2445 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-12-09flash/nor/sfdp|stmqspi: fix build issue with clang on mac OSTarek BOCHKATI2-15/+15
Change-Id: I3b3aa4236125523ad65fd615ada0f5647d26f526 Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@st.com> Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5940 Tested-by: jenkins Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
2020-12-05jimtcl: switch to githubAntonio Borneo1-1/+1
The 'historically' main repository of jimtcl in repo.or.cz has lost sync with the github current main repository since July 2020. The new tag 0.80 is not present in repo.or.cz. The developer of jimtcl has been in contact with the admins of repo.or.cz to fix the not better described sync issues and has now decided to stop any further tentative. A new README has been added on 2020-11-19 in the old repository to inform that it is abandoned in favour of github. The old content in repo.or.cz will remain due to forks that still exists in the same server. Switch OpenOCD git submodules to fetch jimtcl code from the main development repository in github. Change-Id: Ia2d59f1347ccfe374538b38131badfd46054eb91 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5948 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2020-12-05target/register: use an array of uint8_t for register's valueAntonio Borneo7-7/+8
The use of 'void *' makes the pointer arithmetic incompatible with standard C, even if this is allowed by GCC extensions. The use of 'void *' can also hide incorrect pointer assignments. Switch to 'uint8_t *' and add GCC warning flag to track any use of pointer arithmetic extension. Change-Id: Ic4d15a232834cd6b374330f70e2473a359b1607f Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5937 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2020-12-05mips_mips64: fix minor host endianness bugAntonio Borneo1-1/+1
Commit 80f1a92bd798 ("mips64: Add generic mips64 target support") adds a log of the target's program counter in function mips_mips64_debug_entry() by directly casting the little-endian buffer in pc->value. This is going to print an incorrect value on big-endian hosts. Use the function buf_get_u64() to return the register value. Not tested on real HW. Issue identified with GCC compiler flag '-Wcast-align=strict' after change http://openocd.zylin.com/5937/ ("target/register: use an array of uint8_t for register's value"). Change-Id: Icbda2b54a03fdec287c804e623f5db4252f9cd2a Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Fixes: 80f1a92bd798 ("mips64: Add generic mips64 target support") Reviewed-on: http://openocd.zylin.com/5944 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2020-12-05arm7_9_common: fix host endianness bug in arm7_9_full_context()Antonio Borneo1-4/+20
The original code passes to ->read_core_regs() and to ->read_xpsr() the pointer to the little-endian buffer reg.value. This is incorrect because the two functions above require a pointer to uint32_t, since they already run the conversion with arm_le_to_h_u32() in the jtag callback. This causes a mismatch on big-endian host and the registers get read with the incorrect endianness. Use an intermediate buffer to read the registers as uint32_t and to track the destination reg.value pointer, then copy the value in reg.value after the call to jtag_execute_queue(). Tested with qemu-armeb and an OpenOCD built through buildroot configured for cortex-a7 big-endian. Note that if jtag_execute_queue() fails, the openocd register cache is not updated, so the already modified flags 'valid' and 'dirty' are incorrect. This part should be moved after the call to jtag_execute_queue() too. Change-Id: Iba70d964ffbb74bf0860bfd9d299f218e3bc65bf Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5943 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2020-12-05armv4_5: fix output of command 'arm reg'Antonio Borneo1-0/+3
Commit fc2abe63fd3c ("armv7m: use generic arm::core_mode") adds two special modes for ARMv6M and ARMv7M in struct arm_mode_data[]. While these modes do not have any additional register to be dumped by command 'arm reg', the command still prints an header for these modes but not followed by any register. Detect the special modes for ARMv6M and ARMv7M and skip them to avoid printing the useless header. Change-Id: I04145769e5742624f143c910eebf9a6f6d8e3cdc Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Fixes: fc2abe63fd3c ("armv7m: use generic arm::core_mode") Reviewed-on: http://openocd.zylin.com/5942 Tested-by: jenkins
2020-12-05armv4_5: fix segmentation fault in command 'arm reg'Antonio Borneo1-0/+1
Commit fed713104904 ("armv4_5: support weirdo ARMv6 secure monitor mode") introduces the secure mode 28 of ARMv6 as a synonymous of mode 22 (MON), but does not add it in the switch/case in command 'arm reg'. When command 'arm reg' scans the array arm_mode_data[] on targets without secure modes, it does not detect the new secure mode as not supported by the architecture, thus triggers a segmentation fault when it try to read the register's value from unallocated memory. Issue detected with target arm926ejs. Add the new mode in the switch/case and treat it as the mode MON. Change-Id: I2b72cc558e097879a7ee6ea601200bfda6b60270 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Fixes: fed713104904 ("armv4_5: support weirdo ARMv6 secure monitor mode") Reviewed-on: http://openocd.zylin.com/5941 Tested-by: jenkins Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
2020-12-05jep106: Add new IDs from JEDECBoran Car1-243/+503
From JEP106AZ, released on May 24, 2019. Change-Id: I768b7077ec6abcd19ae1530b5715c7ea993add67 Signed-off-by: Boran Car <boran.car@hex-five.com> Reviewed-on: http://openocd.zylin.com/5244 Tested-by: jenkins Reviewed-by: Jonathan McDowell <noodles-openocd@earth.li> Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-by: Jiri Kastner <cz172638@gmail.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-12-02Add initial RTT supportMarc Schink15-4/+1732
Real Time Transfer (RTT) is an interface specified by SEGGER based on basic memory reads and writes to transfer data bidirectionally between target and host. Every target that supports so called "background memory access", which means that the target memory can be accessed by the debugger while the target is running, can be used. RTT is especially of interest for targets which do not support Serial Wire Output (SWO) (e.g. ARM Cortex-M0) or where using semihosting is not possible (e.g. real-time applications) [1]. The data transfer is organized in channels where each channel consists of an up- and/or down-channel. See [2] for more details. Channels are exposed via TCP connections. One or more RTT server can be assigned to each channel to make them accessible to an unlimited number of TCP connections. The current implementation does not respect buffer flags which are used to determine what happens when writing to a full buffer. Note that the implementation is designed in a way that the RTT operations can be directly performed by an adapter (e.g. J-Link). [1] https://devzone.nordicsemi.com/tutorials/6/ [2] https://www.segger.com/jlink-rtt.html Change-Id: I8bc8a1b381fb74e08b8752d5cf53804cc573c1e0 Signed-off-by: Marc Schink <dev@zapb.de> Reviewed-on: http://openocd.zylin.com/4055 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-12-02adi_v5_swd: wait for readable DPIDR, ABORT if stalledTomas Vanek1-13/+56
Reading of DPIDR is the very first operation after JTAG to SWD sequence. Without this change if DPIDR read fails then swd connect fails. Keep trying JTAG to SWD sequence and DPIDR read until success or timeout 0.5 sec. It makes setting of adapter srst delay on SWD transport mostly unnecessary. Also test for ERROR_WAIT (which should not occur according to IHI 0031E B4.3.2 but a quirk is known) and if bus is kept stalled then issue abort to make the next connect possible. Change-Id: Id8fe6618605bbeb4fed5061e987ed55de90a35f2 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/5730 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2020-12-02arm_adi_v5: prevent possibly endless recursion in dap_dp_init()Tomas Vanek3-23/+43
If dap_dp_read_atomic() in 30 trials loop fails, dap->do_reconnect is set. Following dap_dp_read_atomic() calls dap_queue_dp_read() which in case of SWD transport calls swd_queue_dp_read(). It starts with swd_check_reconnect() and it calls swd_connect() because dap->do_reconnect is set. swd_connect() does some initialization, reads DPIDR and calls dap_dp_init() again! Moreover if dap_dp_init() is called from cortex_m_reset_(de)assert() one level of recursion is necessary to reconnect the target. Introduce dap_dp_init_or_reconnect() for use in cortex_m reset and similar. Remove loop of 30 atomic reads of DP_STAT to prevent unwanted recursion. Change-Id: I54052fdefe50bf5f7c7b59fe751fe2063d5710c9 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/5729 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2020-11-19rename and cleanup, add tiny-h-cjtag (#555)Kevin Mills2-3/+25
- rename and cleanup to arm-usb-ocd-h-cjtag file to be consistent - add copy of olimex-arm-jtag-cjtag.cfg as arm-usb-tiny-h-cjtag.cfg - did not remove olimex-arm-jtag-cjtag.cfg (should be deprecated)