aboutsummaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
2023-08-26stlink: increase stlink v2 max speed to 2.25 MbpsMarcin Niestroj1-1/+1
stlink v2 on Nucleo-64 board (e.g. NUCLEO-L476RG) has target SWO signal connected to STM32F103CB'S PA10, which is UART1_RX. UART1 within this MCU in theory can be configured to 4.5 Mbps baudrate, which means this is the upper limit supported by HW. As a confirmation BMP (Black Magic Probe) project also states in documentation that UART1 can be used with up to 4.5 Mbps baudrate. Tests have shown that configuring 4.5 Mbps baudrate on stlink v2 available on NUCLEO-L476RG board results in receiving corrupted data. Using 2.25 Mbps however allows to successfully receive all data from SWO. This makes sense in terms of STM32F103CB capabilities, since 2.25 Mbps is the next supported baudrate due to division by 2. Increase supported stlink v2 SWO speed from 2 to 2.25 Mbps. Tested with NUCLEO-L476RG: $ stm32l4x.tpiu configure -protocol uart \ -traceclk 80000000 -pin-freq 2250000 \ -output /dev/stdout $ stm32l4x.tpiu enable 2.25 Mbps speed confirmed with logic analyzer. Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev> Change-Id: Icbec04585664aba8b217e8f9a75458e577f7617f Reviewed-on: https://review.openocd.org/c/openocd/+/7848 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-08-26jtag/drivers: dmem: Add Emulated AP modeJason Peck1-6/+286
This emulation mode supports software translation of an AP request into an address mapped transaction that does not rely on physical AP hardware. This is necessary in some hardware such as K3 SoCs since the hardware architecture anticipates a potential race condition between AP doing direct memory access generating transactions back to system bus and firewalls that data path out. This emulation mode allows direct memory driver to emulate CoreSight Access Port (AP) and reuse the SoC configuration meant for JTAG debuggers. Since the address ranges are flat in nature, the requisite memory base and size will need to be provided a-priori to the driver for mapping. The other design alternative would be to map requested memory map for every register operation, but, that would defeat our intent of getting max debug performance. Signed-off-by: Nishanth Menon <nm@ti.com> Signed-off-by: Jason Peck <jpeck@ti.com> Change-Id: I2d3c5f7833f1973e90b4f6b247827f62fc2905d0 Reviewed-on: https://review.openocd.org/c/openocd/+/7089 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-08-26jtag/drivers: Add dmem driverNishanth Menon4-0/+349
Direct memory driver support for CoreSight Access Port(AP). Even though we emulate SWD (serial wire debug), we aren't actually using swd. Instead, we are using a direct memory access to get to the register set. This is similar in approach to other fast access native drivers such as am335xgpio drivers. Example operation on Texas Instrument's AM62x K3 SoC: +-----------+ | OpenOCD | SoC mem map | on |--------------+ | Cortex-A53| | +-----------+ | | +-----------+ +-----v-----+ |Cortex-M4F |<───────| | +-----------+ | | | DebugSS | +-----------+ | | |Cortex-M4F |<───────| | +-----------+ +-----------+ Signed-off-by: Nishanth Menon <nm@ti.com> Signed-off-by: Jason Peck <jpeck@ti.com> Change-Id: I8470cb15348863dd844b2c0e3f63a9063cb032c6 Reviewed-on: https://review.openocd.org/c/openocd/+/7088 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-08-26rtos/zephyr: arm: fetch arm exc return offsetBruno Mendes1-0/+1
Since zephyrproject-rtos/zephyr@c3eeae8, Zephyr OS exposes offset of mode_exc_return in the arch struct for ARM. Accounting for this allows for consistency and enables logic with further offsets that may be added after this. Signed-off-by: Bruno Mendes <bd_mendes@outlook.com> Change-Id: Id53ebd80c5d98a7d94eb6b00ad638ce51e719822 Reviewed-on: https://review.openocd.org/c/openocd/+/7851 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins
2023-08-26target/cortex_m: Add Realtek Real-M200 and M300Karl Palsson3-0/+14
These cores are advertised as M23 and M33 compatible, but are identified by the Realtek implementor id. These cores are found on the RTL872xD family, at least. Raw CPUIDs: Real-M200 (KM0): 721cd200 Real-M300 (KM4): 721fd220 Change-Id: I4106ccb7e8c562f98072a71e9e818f57999d664e Signed-off-by: Karl Palsson <karlp@tweak.au> Reviewed-on: https://review.openocd.org/c/openocd/+/7846 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-08-26target/cortex_m: check core implementor fieldKarl Palsson7-38/+52
Presently, we only look at the Part Number field of the CPUID, and completely ignore the Implmentor field, simply assuming it to be ARM. Parts have since been found, with different implementors, that use overlapping part numbers, causing detection to fail. Expand the "part number" field to be a full implementor+part number, excluding the revision/patch fields, to make checking more reliable. Change-Id: Id81774f829104f57a0c105320d0d2e479fa01522 Signed-off-by: Karl Palsson <karlp@tweak.au> Reviewed-on: https://review.openocd.org/c/openocd/+/7845 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2023-08-26efm32: drop unnecessary and incomplete checksKarl Palsson1-12/+0
There's really no reason to try and add an extra layer of cpu verification here. Change-Id: If8c4aa03754607be6c089f514ae300b09b067ffa Signed-off-by: Karl Palsson <karlp@tweak.au> Reviewed-on: https://review.openocd.org/c/openocd/+/7844 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-08-12flash/nor/spi: Improve erase performance on zd25q16Nikolay Dimitrov1-1/+1
Use blocks (64 KiB) instead of sectors (4 KiB) when erasing the zd25Q16 SPI flash memory (thanks to Tomas Vanek!) Change-Id: I969a69ad35f51b84eb3e11b93f0d79db3e98613a Signed-off-by: Nikolay Dimitrov <nikolay.dimitrov@retrohub.org> Reviewed-on: https://review.openocd.org/c/openocd/+/7850 Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Tested-by: jenkins
2023-08-12flash/nor/spi: add zetta zd25q16Nikolay Dimitrov1-0/+1
* Zetta 16 Mbit (2 MiB) SPI flash * Tested on Olimex RP2040-PICO30 and Neo6502 boards Change-Id: I02224dd7a72a9b72f01b31edbd958daa23f28956 Signed-off-by: Nikolay Dimitrov <nikolay.dimitrov@retrohub.org> Reviewed-on: https://review.openocd.org/c/openocd/+/7849 Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Tested-by: jenkins
2023-08-12pld: allow calling of configuration functions before 'init'Daniel Anselmi2-3/+3
Change-Id: I7c475fbbf8c13ae227e3393f01528eb180e9de51 Signed-off-by: Daniel Anselmi <danselmi@gmx.ch> Reviewed-on: https://review.openocd.org/c/openocd/+/7835 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-08-12pld: fix sparser warningsDaniel Anselmi2-2/+2
Change-Id: I31c5b19cd93ac41b026f824337488c9aa9b12439 Signed-off-by: Daniel Anselmi <danselmi@gmx.ch> Reviewed-on: https://review.openocd.org/c/openocd/+/7828 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-08-12target/aarch64: add missing aarch64_poll() callsDaniel Goehring1-0/+9
Add missing aarch64_poll() calls to ensure the event TARGET_EVENT_HALTED is called when necessary. This is needed with the poller update introduced in commit 95603fae18f8 ("openocd: revert workarounds for 'expr' syntax change") Signed-off-by: Daniel Goehring <dgoehrin@os.amperecomputing.com> Change-Id: I6e91f1b6bc1f0d16e6f0eb76fc67d20111e3afd2 Reviewed-on: https://review.openocd.org/c/openocd/+/7737 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-08-12jtag/drivers: Add new driver for ANGIE USB-JTAG AdapterAhmed BOUDJELIDA8-0/+2467
This is the driver code for NanoXplore's ANGIE USB-JTAG Adapter. The driver is based on the openULINK project. This driver communicate with ANGIE's firmware in order to establish JTAG protocol to debug the target chip. Since the ANGIE Adapter has a Spartan-6 FPGA in addition to the FX2 microcontroller, the driver adds two functions, one to download the firmware (embedded C) to the FX2, and the second to program the FPGA with its bitstream. Add ANGIE's configuration file to tcl/interface/ Add the device VID/PID to 60-openocd.rules file. Add ANGIE to OpenOCD's documentation Change-Id: Id17111c74073da01450d43d466e11b0cc086691f Signed-off-by: Ahmed BOUDJELIDA <aboudjelida@nanoxplore.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7702 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins
2023-08-12libusb_helper: split error and returned valueAntonio Borneo8-62/+85
The USB control transfer can be executed without any data. The libusb API libusb_control_transfer() can thus be called with zero 'size', thus returning zero byte transferred when succeed. The OpenOCD API jtag_libusb_control_transfer() returns zero either in case of transfer error and in case of libusb_control_transfer() returning zero, making impossible discriminating the two cases. Extend jtag_libusb_control_transfer() with separate return value for error code and explicit parameter's pointer for transferred bytes. Make the transferred pointer optional, as many callers do not properly handle the returned value. Use 'int' type pointer for transferred, instead of the 'uint16_t' that would have matched the type of 'size'. This can simplify the caller's code by using a single 'int transferred' variable shared with other jtag_libusb_bulk_read|write, while keeping possible the comparison int vs uint16_t without cast. This change is inspired from commit d612baacaa3f ("jtag_libusb_bulk_read|write: return error code instead of size") Change-Id: I14d9bff3e845675be03465c307a136e69eebc317 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7756 Tested-by: jenkins Reviewed-by: ahmed BOUDJELIDA <aboudjelida@nanoxplore.com>
2023-08-08breakpoints: use 64-bit type for watchpoint mask and valueParshintsev Anatoly10-34/+36
This patch changes data types of watchpoint value and mask to allow for 64-bit values match that some architectures (like RISCV) allow. In addition this patch fixes the behavior of watchpoint command to zero-out mask if only data value is provided. Change-Id: I3c7ec1630f03ea9534ec34c0ebe99e08ea56e7f0 Signed-off-by: Parshintsev Anatoly <anatoly.parshintsev@syntacore.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7840 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-by: Marek Vrbka <marek.vrbka@codasip.com> Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2023-08-05pld/virtex2: allow calling set_instr_codes and set_user_codes before 'init'Daniel Anselmi1-2/+2
Change-Id: Ib21366b2fdbf33ee06a958e52b725989114751f4 Signed-off-by: Daniel Anselmi <danselmi@gmx.ch> Reviewed-on: https://review.openocd.org/c/openocd/+/7821 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-08-03register: refactor register_cache_invalidate()Marek Vrbka1-3/+2
register_cache_invalidate() is written a way which uses pointer arithmetic, which makes it harder to read. This patch replaces it with more readable way to iterate over array of structs. Change-Id: Ia420f70a3bb6998c690c8c600c71301dca9f9dbf Signed-off-by: Marek Vrbka <marek.vrbka@codasip.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7735 Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Tested-by: jenkins Reviewed-by: Jan Matyas <jan.matyas@codasip.com>
2023-07-29target: fix messages and return values of failed op because not haltedTomas Vanek29-131/+145
Lot of messages was logged as LOG_WARNING, but the operation failed immediately. Sometimes no error message was logged at all. Add missing messages, change warnings to errors. Sometimes ERROR_TARGET_INVALID was returned. Some command handlers returned ERROR_OK! Always return ERROR_TARGET_NOT_HALTED. While on it use LOG_TARGET_ERROR() whenever possible. Prefix command_print() message with 'Error:' to get closer to LOG_TARGET_ERROR() variant. Error message was not added to get() and set() methods of struct xxx_reg_type - the return value is properly checked and a message is logged by the caller in case of ERROR_TARGET_NOT_HALTED. Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Change-Id: I2fe4187c6025f0038956ab387edbf3f461c69398 Reviewed-on: https://review.openocd.org/c/openocd/+/7819 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-07-24jtag/drivers/xds110: Fix compiler warning.Tim Newsome1-10/+1
Compiler would complain that `written` was used without being initialized. Simplify the code a little. The number of bytes written is already checked in usb_write(). Signed-off-by: Tim Newsome <tim@sifive.com> Change-Id: Ibada85dcccfca6f1269c584cdbc4f2e3b93bb8f3 Reviewed-on: https://review.openocd.org/c/openocd/+/7813 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-by: Jan Matyas <jan.matyas@codasip.com>
2023-07-22target/riscv: Add null pointer check before right shift for bscan tunneling.eolson1-2/+4
Change-Id: I5d4764c777f33d48705b3e5273eb840c13cfbfb7 Signed-off-by: eolson <erin.olson@seagate.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7814 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins Reviewed-by: Jan Matyas <jan.matyas@codasip.com>
2023-07-22target/arc: fix off-by-one error in arc_save_context()Artemiy Volkov1-14/+10
While not affecting the function's main purpose, an error has crept into arc_save_context() that results in logging wrong register values when the debug level is 3 or more. For instance, when debugging a trivial program and halting at entry to main, the following values are printed to the log: Debug: 2915 2020 arc.c:894 arc_save_context(): Get core register regnum=0, name=r0, value=0x0000000 ... Debug: 2947 2020 arc.c:894 arc_save_context(): Get core register regnum=60, name=lp_count, value=0x900002d8 Debug: 2948 2020 arc.c:894 arc_save_context(): Get core register regnum=63, name=pcl, value=0xffffffff Debug: 2949 2020 arc.c:909 arc_save_context(): Get aux register regnum=64, name=pc, value=0x900000b4 Debug: 2950 2020 arc.c:909 arc_save_context(): Get aux register regnum=65, name=lp_start, value=0x900000bc Debug: 2951 2020 arc.c:909 arc_save_context(): Get aux register regnum=66, name=lp_end, value=0x00080801 Debug: 2952 2020 arc.c:909 arc_save_context(): Get aux register regnum=67, name=status32, value=0xffffffff After the change, the register contents make much more sense: Debug: 2923 3934 arc.c:889 arc_save_context(): Get core register regnum=0, name=r0, value=0x00000000 ... Debug: 2955 3934 arc.c:889 arc_save_context(): Get core register regnum=60, name=lp_count, value=0x00000000 Debug: 2956 3934 arc.c:889 arc_save_context(): Get core register regnum=63, name=pcl, value=0x900002d8 Debug: 2957 3934 arc.c:903 arc_save_context(): Get aux register regnum=64, name=pc, value=0x900002da Debug: 2958 3934 arc.c:903 arc_save_context(): Get aux register regnum=65, name=lp_start, value=0x900000b4 Debug: 2959 3934 arc.c:903 arc_save_context(): Get aux register regnum=66, name=lp_end, value=0x900000bc Debug: 2960 3934 arc.c:903 arc_save_context(): Get aux register regnum=67, name=status32, value=0x00080801 While at it, simplify a couple of expressions. Change-Id: I8f2d79404707fbac4503af45b393ea73f91e6beb Signed-off-by: Artemiy Volkov <artemiy@synopsys.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7765 Tested-by: jenkins Reviewed-by: Evgeniy Didin <didin@synopsys.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-07-14target/espressif: cleanup unused macro definitionsErhan Kurubas3-43/+0
Memory region addresses are not in use for now. Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com> Change-Id: I9a2189e956ae59b56245ec914ab16719df857b2d Reviewed-on: https://review.openocd.org/c/openocd/+/7762 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-07-14target/espressif: read entry addresses of pre-defined stub functionsErhan Kurubas6-21/+300
Debug stubs functionality provided by ESP IDF allows executing target function in any address. e.g; esp32_cmd_gcov() Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com> Change-Id: I56d844e5a862c9bf33fdb991b01abb7a76047ca7 Reviewed-on: https://review.openocd.org/c/openocd/+/7758 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-07-14target/esp_xtensa: add xtensa on_halt handlerErhan Kurubas7-3/+35
Right after target halt, some activities needs to be done such as printing exception reason, disable wdts and reading debug stubs information. Missing activities will be submitted in the next patches. Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com> Change-Id: I27aad5614d903f4bd7c8d6dba6bfb0bdb93ed8dc Reviewed-on: https://review.openocd.org/c/openocd/+/7757 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins
2023-07-14ipdbg: fix 'double free' in case of failed startDaniel Anselmi1-3/+1
Change-Id: Id241d9dd0793095106fea000422617fbef462669 Signed-off-by: Daniel Anselmi <danselmi@gmx.ch> Reviewed-on: https://review.openocd.org/c/openocd/+/7770 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins
2023-07-14flash/nor/stm32l4x: Add revision 'V' for STM32L4R/S devicesMarc Schink1-0/+1
See section 57.6.1 in RM0432. Change-Id: Ic4977aee74d1838f420c1d9ff19925d09f8f6e2b Signed-off-by: Marc Schink <dev@zapb.de> Reviewed-on: https://review.openocd.org/c/openocd/+/7763 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-07-13target/espressif: fix build issue with older gcc versionsErhan Kurubas1-1/+1
Compilation on old gcc 4.8.4 fails: error: missing braces around initializer [-Werror=missing-braces] Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com> Change-Id: Ie8b5747f9e23ba5a82bd7f666846e7286284a338 Reviewed-on: https://review.openocd.org/c/openocd/+/7815 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2023-07-08jtag/stlink: add STLINK-V3PWR supportLaurent LEMELE1-3/+42
STLINK-V3PWR is both a standalone debugger probe compatible with STLINK-V3 and a source measurement unit (SMU). Link: http://www.st.com/stlink-v3pwr This code adds support for the debugger probe functionality. Change-Id: Ib056e55722528f922c5574bb6fbf77e2f2b2b0c1 Signed-off-by: Laurent LEMELE <laurent.lemele@st.com> Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7755 Tested-by: jenkins
2023-07-08ipdbg/pld: ipdbg can get tap and hub/ir from pld driver.Daniel Anselmi7-2/+217
To start a ipdbg server one needs to know the tap and the instruction code to reach the IPDBG-Hub. This instruction is vendor/family specific. Knowledge which can be provided by the pld driver. Change-Id: I13eeb9fee895d65cd48544da4704fcc9b528b869 Signed-off-by: Daniel Anselmi <danselmi@gmx.ch> Reviewed-on: https://review.openocd.org/c/openocd/+/7369 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-07-08pld/virtex2: add program/refresh commandDaniel Anselmi1-0/+51
Change-Id: If6d237a6f27c4232849f73d08e7ca74276e6d464 Signed-off-by: Daniel Anselmi <danselmi@gmx.ch> Reviewed-on: https://review.openocd.org/c/openocd/+/7714 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins
2023-07-08pld/xilinx: make instruction codes configurableDaniel Anselmi2-12/+108
Change-Id: I4d2c1fbd4d6007ba8d5c8c687a7c13e25fb6a474 Signed-off-by: Daniel Anselmi <danselmi@gmx.ch> Reviewed-on: https://review.openocd.org/c/openocd/+/7713 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-07-08pld: give devices a name for referencing in scriptsDaniel Anselmi9-189/+234
Change-Id: I05e8596ffacdb6cd8da4dd8a40bb460183f4930a Signed-off-by: Daniel Anselmi <danselmi@gmx.ch> Reviewed-on: https://review.openocd.org/c/openocd/+/7728 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-07-01semihosting: fix handling of errnoMarek Vrbka1-32/+47
This patch fixes the handling of errno by setting the sys_errn only if error has actually occurred during the semihosting call. It also fixes few issues where error was not set in the first place. Change-Id: I2fbe562f3ec5e6220b800de04cd33aa1f409c7a0 Signed-off-by: Marek Vrbka <marek.vrbka@codasip.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7730 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-by: Jan Matyas <jan.matyas@codasip.com>
2023-07-01semihosting: improve semihosting opcode debug messagesMarek Vrbka2-4/+75
This patch introduces function semihosting_opcode_to_str() which converts semihosting opcodes to strings. This function is then used in debug messages to improve log analysis and troubleshooting. Change-Id: Iffea49dae13d6a626ae0db40d379cba3c9ea5bd3 Signed-off-by: Marek Vrbka <marek.vrbka@codasip.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7726 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-by: Jan Matyas <jan.matyas@codasip.com>
2023-06-16riscv/semihosting: Fix ebreak skip on fileio modeMarek Vrbka1-5/+5
This patch fixes skipping the semihosting sequence if the fileio mode is enabled on riscv. This change was tested by me and is in the riscv-openocd fork for a year now. Original merge request: https://github.com/riscv/riscv-openocd/pull/699 Original author: Wu Zhigang zhigang.wu@starfivetech.com https://github.com/wzgpeter Change-Id: Iadaa0a48d1f82d3a7ca168f8a6b656ff6ab78e03 Signed-off-by: Marek Vrbka <marek.vrbka@codasip.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7729 Tested-by: jenkins Reviewed-by: Tim Newsome <tim@sifive.com>
2023-06-10jep106: update to revision JEP106BG May 2023Antonio Borneo1-3/+58
The original document from Jedec does not report the entry for "21 NXP (Philips)", replaced by "c". It's clearly a typo. Keep the line from JEP106BF.01 for "NXP (Philips)". Change-Id: I30215c4ff08d5f112305cde6ab7a3176cdcef948 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7727 Tested-by: jenkins
2023-06-10semihosting: fix non-zero value on Windows isatty()Marek Vrbka1-1/+2
On Windows, isatty() can return any non-zero value if it's an interactive device. Which diverges from the ARM semihosting specification. This patch introduces a fix to make the SYS_ISTTY operation conform to spec. Change-Id: I9bc4f3cb82370812825d52419851910b3e3f35cc Signed-off-by: Marek Vrbka <marek.vrbka@codasip.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7725 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins Reviewed-by: Jan Matyas <jan.matyas@codasip.com>
2023-06-10gdb_server: refactor and unify function gdb_get_char_innerMarek Vrbka1-31/+12
The old implementation of gdb socket error handling in the gdb_get_char_inner() differs between Windows and *nix platforms. This patch simplifies it by using an existing function log_socket_error() which handles most of the platform specific things. It also provides better error messages. Change-Id: Iec871c4965b116dc7cfb03c3565bab66c8b41958 Signed-off-by: Marek Vrbka <marek.vrbka@codasip.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7724 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-06-10gdb_server: add debug signal reason printsMarek Vrbka3-2/+35
Added debug prints to show what is the target debug reason. Also added debug print for Ctrl-C response. This is useful for troubleshooting and log analysis. Change-Id: I055936257d989efe7255656198a8d73a367fcd15 Signed-off-by: Marek Vrbka <marek.vrbka@codasip.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7720 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins
2023-06-10flash/nor: add support for NXP QN908xiosabi4-0/+1200
This patch adds support for the NXP QN908x family of Bluetooth microcontrollers, such as the QN9080. This chip features a Cortex-M4F with 512 KiB of flash on all the available versions, although the documentation suggests that there might be 256 kB versions as well. The initial support allows to read, erase and write the whole user flash area. Three new sub-commands under the new "qn908x" command are added in this patch as well: disable_wdog to disabled the watchdog, mass_erase to perform a mass erase and allow_brick to allow programming images that disable the SWD interface. Disabling the watchdog is required after a "reset halt" in order to run the CRC algorithm from RAM when verifying the chip. However, this is not done automatically on probing or other initialization since disabling the watchdog might interfere with debugging real applications. The "mass_erase" command allows to erase the whole flash without probing it, since in some scenarios the chip can be locked such that no flash or ram can be accessed from the SWD interface, allowing only to run a mass_erase to be able to flash the program. The flashing process allows to compute a checksum, similar to the lpc2000 driver "calc_checksum" but done over a different region of the memory. This checksum is required to be present for the QN908x bootloader ROM to boot, and otherwise is useless. As with the lpc2000 design, verification when using "calc_checksum" is expected to fail if the checksum was not valid in the image being verified. This was manually tested on a QN9080, including the scan-view, AddressSanitizer/UBSan and test coverage configurations. Change-Id: Ibd6d8f3608654294795085fcaaffb448b77cc58b Co-developed-by: Marian Buschsieweke <marian.buschsieweke@ovgu.de> Signed-off-by: Marian Buschsieweke <marian.buschsieweke@ovgu.de> Signed-off-by: iosabi <iosabi@protonmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/5584 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2023-06-02jtag/vdebug: using tap_stateJacek Wuwer1-5/+5
This change implements the predefined type tap_state instead of generic uint8_t in the driver Change-Id: I3478e8d7b40b961f3ba77711179016cdcc35cd32 Signed-off-by: Jacek Wuwer <jacekmw8@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7722 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins
2023-06-02jtag/vdebug: fix endianness supportJacek Wuwer1-2/+2
This change fixes endianness support in the driver. Change-Id: Ida360bb58e988cea0a66fdc79e1610b528846fc4 Signed-off-by: Jacek Wuwer <jacekmw8@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7721 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-06-02target/espressif: fix clang scan-build warningErhan Kurubas1-1/+1
Clang reports that 3rd function call argument is an uninitialized value file esp32_apptrace.c line:1270 Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com> Change-Id: I73e254d4eb0c6b3152229717d8827d334784ab92 Reviewed-on: https://review.openocd.org/c/openocd/+/7719 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins
2023-06-02flash: jtagspi: fix clang build warningAntonio Borneo1-30/+22
Clang is unable to fully track the content of the array write_buffer[] and incorrectly complains that it could contain some uninitialized value. To help clang to track the execution flow, rewrite the handling of the buffer by using simpler indexing and by moving away cmd_byte from the first buffer's element to the variable cmd_byte. While there: - fix the error codes returned while parsing the command line and - use directly command_print_sameline() instead of passing through intermediate buffers. Change-Id: I1969e896887ea3a4abebee057cc04c03005fa57c Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7718 Tested-by: jenkins
2023-06-02flash: psoc4: fix clang errorAntonio Borneo1-1/+1
Clang 15.0.7 complains about snprintf output truncation due to output between 13 and 22 bytes into a destination of size 20. Increase the size of the buffer. Change-Id: I0369255ca1bc02a0cf494f765e91a608c960a0d6 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7717 Tested-by: jenkins
2023-06-02cortex_m: fix reading of DCB_DSCSR registerBohdan Tymkiv1-5/+2
Value in the 'dscsr' variable is garbage until the DAP queue is run. Postpone evaluation of the 'secure_state' variable. Reading the core registers in between will execute the DAP queue. Change-Id: I44959e882dbafb1b9779e813c3d13f3b3dbcd47f Signed-off-by: Bohdan Tymkiv <bohdan200@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7693 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2023-06-02target: armv8: fix support of pointer authenticationAntonio Borneo1-1/+1
The registers pauth_dmask and pauth_cmask are not accessible in AARCH32 mode. Tagging them as 'hidden' is not enough and triggers error: Failed to read pauth_dmask register while halting the core. Tag the pauth registers as not existing, unless required by user. Note: for non existing registers there should be no need to allocate their register cache. Let's keep this for a further improvement. Change-Id: Iaa0d006a3d8ee611ee93333ed49a8615a6c94276 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Fixes: d0436b0cdabb ("armv8: Add support of pointer authentication") Reviewed-on: https://review.openocd.org/c/openocd/+/7712 Tested-by: jenkins Reviewed-by: Koudai Iwahori <koudai@google.com>
2023-05-27flash/jtagspi: sending command and setting parameters without probing.Daniel Anselmi3-12/+34
Change-Id: I6b9d90265ca5112b9ab2aae97bb4c6cf3ebc4112 Signed-off-by: Daniel Anselmi <danselmi@gmx.ch> Reviewed-on: https://review.openocd.org/c/openocd/+/7432 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Tested-by: jenkins
2023-05-27target/xtensa: add file-IO supportIan Thompson5-3/+247
- Manual integration of File-IO support from xt0.2 release - Verified with applications linked using gdbio LSP - No new clang static analysis warnings Signed-off-by: Ian Thompson <ianst@cadence.com> Change-Id: Iedc5f885b2548097ef4f11ae1a675b5944f5fdf0 Reviewed-on: https://review.openocd.org/c/openocd/+/7550 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-05-27jtag/adapter: Removed unused include of strings.hJan Matyas1-4/+0
Removed an unused include from src/jtag/adapter.c. Signed-off-by: Jan Matyas <jan.matyas@codasip.com> Change-Id: Ia5ea0acdfa1c011d7c88decd0f63e8032aafd699 Reviewed-on: https://review.openocd.org/c/openocd/+/7687 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>