aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2020-11-04jtag: declare local symbols as staticAntonio Borneo14-119/+119
Functions and variables that are not used outside the file should be declared as static. Change-Id: I58c9f5557d4809db9ccc34d32182c3797f825da1 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5896 Tested-by: jenkins
2020-11-04target: declare local symbols as staticAntonio Borneo19-51/+48
Functions and variables that are not used outside the file should be declared as static. Change-Id: I9f97571a528f0cb3c3c26f873577ab16fdec3cdc Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5895 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2020-11-04rtos: declare local symbols as staticAntonio Borneo4-21/+21
Functions and variables that are not used outside the file should be declared as static. Change-Id: I9731a35496cd1c7421563c8961da5fa0e3cc71c3 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5894 Tested-by: jenkins Reviewed-by: Jonathan McDowell <noodles-openocd@earth.li>
2020-11-04flash: declare local symbols as staticAntonio Borneo9-15/+19
Functions and variables that are not used outside the file should be declared as static. Change-Id: I52d46ed6d4c9b98a7152eb23274c836416f409a3 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5893 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2020-11-04openocd: add support for libftdi 1.5Antonio Borneo5-8/+40
The new libftdi 1.5 (2020-07-07) changes some API, deprecating the old ones. This cause a warning at compile time. Detect in configure the version of libftdi. Use the new API in the driver's code. Add an helper include file 'libftdi_helper.h' that wraps the old API for backward compatibility with old libftdi. Change-Id: I7800fbebe17dd0ce62e55b3598d8c08be8875bb7 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Fixes: https://sourceforge.net/p/openocd/tickets/286/ Reviewed-on: http://openocd.zylin.com/5891 Tested-by: jenkins
2020-11-04configure.ac: stop automake to search for scripts in parent dirsAntonio Borneo1-0/+1
Automake will search for the helper scripts in the folder that contains the current Makefile.am (typically '.'), then some of the scripts will be also searched in '..' and '../..'. If the parent folders '..' or '../..' of OpenOCD source code contain a file named 'install.sh', then automake will use it and will assume that the same folder should contains also 'ltmain.sh'. This situation can either cause the build to fail or automake to use incorrect helper scripts. Force automake to only search for helper scripts in the current directory. Change-Id: I00bbd6bf9057c94cf5007e5ecda3fefd683481f5 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Fixes: https://sourceforge.net/p/openocd/tickets/285/ Reviewed-on: http://openocd.zylin.com/5890 Tested-by: jenkins
2020-11-04target: handle command 'target current' when no target is presentAntonio Borneo1-1/+3
Is it possible to run OpenOCD without any target, for example to only dump the rom-tables of an arm dap, or to perform low level jtag operations. But without any target created, the command 'target current' causes OpenOCD to abruptly exit. Handle in command 'target current' the case of no targets. Change-Id: Ide15cb13bec84b88ccc3e7126523c04a6d70e636 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5881 Tested-by: jenkins
2020-11-04gdb_server: allow multiple GDB connections to selected targetsAntonio Borneo4-5/+40
The default way of working is to have a single GDB attached to one target, so OpenOCD accepts only one connection to the GDB port of each targets and rejects any further connection. There are some barely safe use cases in which it could get useful having a second GDB connection to the same target. One such use case is while using GDB as a 'non-intrusive memory inspector', as explained in the OpenOCD documentation. One GDB can be left running an infinite loop to dump some memory area, or even analysing the content, while keeping a second GDB ready for user interaction or spot memory check. Add a target configure option to specify the maximum number of GDB connections allowed for that target, keeping the default to 1. Change-Id: I4985a602e61588df0b527d2f2aa5b955c93e125e Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5865 Tested-by: jenkins Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
2020-11-04tcl: replace '-ctibase' with '-baseaddr'Antonio Borneo11-17/+17
Replace the deprecated option '-ctibase' with the generic option '-baseaddr'. Change generated with command: sed -i 's/-ctibase/-baseaddr/g' $(find tcl/ -type f) Change-Id: If776934d2ac106532708768bb3a4ec6fcffb0368 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5870 Tested-by: jenkins
2020-11-04target/arm_cti: use adiv5_jim_mem_ap_spot_configure()Antonio Borneo3-102/+48
To avoid code duplication, reorganize the code to replace cti_configure() with adiv5_jim_mem_ap_spot_configure(). Reorganize 'struct arm_cti_object' and its sub-'struct arm_cti' moving DAP and mem-AP info in a 'struct adiv5_mem_ap_spot'. Replace cti_configure() with adiv5_jim_mem_ap_spot_configure(). Deprecate the use of '-ctibase' in favor of '-baseaddr'. Change-Id: I43740a37c80de67c0f5e4dc79c3400b91a12e9e8 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5869 Tested-by: jenkins
2020-11-04target/arm_adi_v5: add helper to get mem_ap spot in configure/cgetAntonio Borneo2-85/+135
This is somehow an extension of existing adiv5_jim_configure(), but includes the 'address' in the mem_ap. Rewrite adiv5_jim_configure() using the new helper. Change-Id: Ia7effeeece044004d459b45126ed4961a98b8568 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5857 Tested-by: jenkins
2020-11-04stm32h7x.cfg: alignment with RM0399 rev3Tarek BOCHKATI1-2/+4
in RM0399 rev2, there was these bits in DBGMCU_CR registers: - DBGSTBY_D3 : bit 7 - DBGSTOP_D3 : bit 8 these bits have been changed to reserved in rev3 Change-Id: I9d10d90e383795dc8e25a117d59fa065dc594610 Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-on: http://openocd.zylin.com/5861 Tested-by: jenkins Reviewed-by: Christopher Head <chead@zaber.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-11-04jtag/tcl: fix memory leak in error returnTomas Vanek1-0/+5
Clang static analyzer reported: Warning: line 196, column 3 Potential leak of memory pointed to by 'fields' Free allocated memory pointed by 'fields' and fields[i].in_value Change-Id: I0b3935d9a235544afc03e39a4648319047e65815 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/5906 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins Reviewed-by: Jonathan McDowell <noodles-openocd@earth.li>
2020-11-04gdb_server: fix clang static analyzer warningTomas Vanek1-1/+1
Warning: line 373, column 15 Assigned value is garbage or undefined Most probably a false warning, building the hex string byte per byte seems too complicated for static analyze. Change malloc to calloc to silence the warning. Change-Id: I746d43fa51abf05582ccf2680ed72dc557798a7a Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/5905 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins Reviewed-by: Jonathan McDowell <noodles-openocd@earth.li>
2020-11-04helper/command: fix clang static analyzer warningTomas Vanek1-28/+18
Warning: line 955, column 3 Argument to free() is the address of a global variable, which is not memory allocated by malloc() It is definitely a false alarm. Simplify concatenation of arguments and allocate a string always to silence the warning. Change-Id: I5ac4cc610fc35224df0b16ef4f7102700363249f Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/5904 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2020-11-04flash/nor/atsamv: fix clang static analyzer warningTomas Vanek1-0/+3
Warning: line 679, column 4 4th function call argument is an uninitialized value Change-Id: If62d96e1595be945c8e17885bb402e820fb1ec7b Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/5903 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-by: Jonathan McDowell <noodles-openocd@earth.li>
2020-10-30tcl/board: fix changed target config filenamesAntonio Borneo2-2/+2
In commit a1ce28b118e7 ("rename some target scripts to be consistent with the rest") the following renames was applied, but the old names are still referenced: tcl/target/{sam7se512.cfg => at91sam7se512.cfg} tcl/target/{sam7x256.cfg => at91sam7x256.cfg} Fix the board files to use to correct target config filename. Change-Id: I7698aa0da7db95c2bd9ba7ab8c260905a975c857 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5888 Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Tested-by: jenkins
2020-10-30tcl/board: drop 'tcl' prefix in 'find' commandAntonio Borneo2-2/+2
When OpenOCD is installed to the host the 'tcl' folder gets usually installed in /usr/share/openocd/, thus having 'tcl' as prefix of the target's file causes 'find' to fail. Remove the 'tcl' folder prefix. Change-Id: I3dc484c8de6af8f5aae4dd1b230522ee47ae2ba6 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5887 Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Tested-by: jenkins
2020-10-30tcl/interface/ti-icdi: remove empty lines at end of fileAntonio Borneo1-1/+0
Change-Id: I031dc52c20b8f213b12df13c9c974d9ac3ef2164 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5603 Tested-by: jenkins
2020-10-30jtag: xlnx-pcie-xvc: Declare function staticMoritz Fischer1-1/+1
The xlnx_pcie_xvc_execute_stableclocks() function can and should be static. Change-Id: I45fb1363caee1f1762b0b1ac2c6bc1bb0153b15b Signed-off-by: Moritz Fischer <moritzf@google.com> Reviewed-on: http://openocd.zylin.com/5889 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-10-30board: drop open-bldcKarl Palsson1-7/+0
This is a) broken and b) doesn't include anything other than the (broken) target alias. Don't see any reason for it to exist. Change-Id: I833635eeac392bf7c0c39f51ff2f76525ba2d406 Signed-off-by: Karl Palsson <karlp@tweak.net.au> Reviewed-on: http://openocd.zylin.com/5884 Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-10-30jtag/drivers/stlink_usb: fix SWO prescalerCliff L. Biffle1-6/+6
The config_trace function has an out-parameter for generating the prescaler for the TPIU. The STLink implementation wasn't always writing it, causing the tpiu command to load uninitialized stack memory (minus one) into the TPIU's prescaler register when 'external' was requested. This change ensures that the out-parameter (and the other one, trace_freq, which hadn't caused any buggy behavior for me) are written every time. Signed-off-by: Cliff L. Biffle <cliff@oxide.computer> Change-Id: I222975869b1aa49cc6b1963c79d5ea0f46522b8c Reviewed-on: http://openocd.zylin.com/5656 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-10-30target: restore last run state after profilingChristopher Head1-1/+13
Now that it’s possible to start profiling from either a running or a halted state, rather than unconditionally halting after profiling finishes, it makes more sense to restore the processor to whatever state (running or halted) it was in before profiling started. Change-Id: If6f6e70a1a365c1ce3b348a306c435c220b8bf12 Signed-off-by: Christopher Head <chead@zaber.com> Reviewed-on: http://openocd.zylin.com/5237 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-10-30target/cortex_m: reduce duplication in profilingChristopher Head3-47/+24
The Cortex-M implementation of profiling contains a bunch of conditionals and checks to handle both chips which have PCSR and chips which do not. However, the net effect of the non-PCSR branches is actually exactly the same as what target_profiling_default does. Rather than duplicating this code, just detect the situation where PCSR isn’t available and delegate to target_profiling_default. Change-Id: I1be57ac77f983816ab6bf644a3cfca77b67d6f70 Signed-off-by: Christopher Head <chead@zaber.com> Reviewed-on: http://openocd.zylin.com/5236 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-10-30target: allow profiling from runningChristopher Head2-4/+6
There are a handful of implementations of profiling. There is the default implementation, which repeatedly halts and resumes the target, sampling PC each time. There is the Cortex-M implementation, which uses PCSR if available, otherwise falling back to halting and resuming and sampling PC. There is the OR1K implementation, which reads NPC repeatedly. Finally, there is the NDS32 implementation which uses some kind of AICE commands with which I am unfamiliar. None of these (with the possible exception of the NDS32 implementation) actually require the target to be halted when starting profiling. The Cortex-M and OR1K actually resume the target as pretty much their first action. The default implementation doesn’t do this, but is written in such a way that the target just flips back and forth between halted and running, and the code will do the right thing from either initial state. The NDS32 implementation I don’t know about. As such, for everything except NDS32, it is not really necessary that the target be halted to start profiling. For the non-PCSR Cortex-M and default implementations, there is no real harm in such a requirement, because profiling is intrusive anyway, but there is no benefit. For the PCSR-based Cortex-M and the OR1K, requiring that the target is halted is annoying because it makes profiling more intrusive. Remove the must-be-halted check from the target_profiling function. Add it to the NDS32 implementation because I am not sure if that will break when invoked with a running target. Do not add it to any of the other implementations because they don’t need it. Change-Id: I479dce999a80eccccfd3be4fa192c904f0a45709 Signed-off-by: Christopher Head <chead@zaber.com> Reviewed-on: http://openocd.zylin.com/5235 Tested-by: jenkins Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-10-28flash/nor/nrf5: unify size of HWIDTomas Vanek1-5/+6
HWID is a part of 32 bit CONFIGID register. hwid member of struct nrf5_info was typed uint32_t to enable direct CONFIGID read and masked afterwards. Change to uint16_t to unify with hwid in struct nrf5_device_spec and RM description. Change-Id: Ib720d3ce23c301aee41d074ea78a6f00a23aed68 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/5589 Tested-by: jenkins
2020-10-28flash/nor/nrf5: improve handling of nRF52 flash errorsTomas Vanek1-2/+2
nRF52 devices indicate a flash error by emitting hard fault exception (unlike nRF51 series). Change error message when NVMC READY read fails. A hard fault from flash erase/write operation is detected here. Check exit point of the flash write algo to ensure a failed write is recognised. Change-Id: I637eda268a6bf45f7f41bcb9dcd82db8f5cb41b4 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/5587 Tested-by: jenkins
2020-10-28flash/nor/nrf5: check protection before flash erase/write on nRF51Tomas Vanek1-48/+98
nRF51 devices have a clumsy flash protection based on UICR CLENR0. A code running in RAM can write to a protected flash region without any hint the protection gets violated. NVMC flash page erase obeys protection setting but fails absolutely silently. Before this change the first problem was not addressed in the code. To justify the second one, protection was loaded during probe, after protection setting and after a mass erase. Move protection updates to the beginning of erase/write operation and limit them to nRF51 series only. Check for protected sectors before write. The change also fixes the problem of 'nrf5 mass_erase' on nRF52833/840 devices. They use ACL flash protection, which is not supported in nrf5 driver. mass_erase then looked like it failed. Change-Id: Ie58cda68eb104d410b02777c3df5b343408e2666 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/5522 Tested-by: jenkins
2020-10-28flash/nor/nrf5: fix protection setting on nRF51Tomas Vanek1-26/+50
Protection setting has not ever worked. UICR CLENR0 register cannot be simply written but has to programmed because it resides in UICR page of the flash. Enable flash programming before writing CLENR0 and set back to r/o afterwards. Inform the user that reset might be required. Change-Id: Ib0f96c74ba3583ac33f4394ddb57d8c8895adf53 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/5586 Tested-by: jenkins
2020-10-28tcl/interface/ftdi: Add Steppenprobe open hardware interfaceDiego Herranz1-0/+41
https://github.com/diegoherranz/steppenprobe Change-Id: Ief2c3f4a8707fa628650697d93893b2355015898 Signed-off-by: Diego Herranz <diegoherranz@diegoherranz.com> Reviewed-on: http://openocd.zylin.com/5653 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-10-24server/telnet: Handle Ctrl+KBrian Brooks1-1/+11
Handle Ctrl+K shortcut which clears the line from the cursor position to the end of line. Change-Id: I2ecff5284473cef7c11cf9cb7e1c0c97d55f6c1c Signed-off-by: Brian Brooks <brooks.brian@gmail.com> Reviewed-on: http://openocd.zylin.com/5868 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins Reviewed-by: Marc Schink <dev@zapb.de>
2020-10-24target/arc: introduce watchpoints supportEvgeniy Didin1-3/+165
With help of actionpoint mechanism now it is possible to introduce watchpoints support for ARC. Change-Id: I5887335d0ba38c15c377bc1d24a1ef36e138cf65 Signed-off-by: Evgeniy Didin <didin@synopsys.com> Reviewed-on: http://openocd.zylin.com/5867 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-10-24Added comment to ti-icdi.cfgJohn Pham1-0/+5
Added comment to ti-icdi.cfg specifying how to get serial and an example of specifying hla_serial for ti-icdi devices. This has been implemented in revision 2121a8f92969804611412b705af8114697a647dc Change-Id: I648458a4dea176beae6a3f1a4e5641d0206077eb Signed-off-by: John Pham <jhnphm@gmail.com> Reviewed-on: http://openocd.zylin.com/2528 Tested-by: jenkins Reviewed-by: Matthew Trescott <matthewtrescott@gmail.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-10-24Enable hla_serial for TI ICDI devicesJohn Pham1-18/+10
Used jtag_libusb_open from libusb_helper.h instead of libusb_open_device_with_vid_pid to get device handle, as well as managing context, i.e. similar to stlink_usb. Direct calls to libusb1 are left in for the moment. (When this Gerrit revision was originally created, the jtag_libusb_ wrappers did not return error conditions.) Tested w/ a TM4C123GXL board Change-Id: I71e9a366356c125444d4813e58ddd9b6c6498bf0 Signed-off-by: John Pham <jhnphm@gmail.com> Signed-off-by: Matthew Trescott <matthewtrescott@gmail.com> Reviewed-on: http://openocd.zylin.com/2527 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-10-22flash/stm32l4: add support of STM32G4 category 4 devices (G491/G4A1)Tarek BOCHKATI1-1/+18
STM32G4 cat.4 devices are up to 512 KB of flash memory (single bank) organized into pages of 2KB each. Reference: RM0440 rev.4 Change-Id: I0f510e2806c8f824fff8083e2d4f90d68f01046b Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-on: http://openocd.zylin.com/5793 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2020-10-22tcl/target/nrf52: fix nrf52_recoverTomas Vanek1-17/+18
nrf52_recover was merged in pre "Handle Tcl return values consistently" state - remove ocd_ prefixes. Erase and unlock sequence was changed to comply Nordic semiconductor recommendation: https://infocenter.nordicsemi.com/index.jsp?topic=%2Fnwp_027%2FWP%2Fnwp_027%2FnWP_027_erasing.html Change-Id: Ic54236c27cf25ad8091e9e572ba1ef846f0d47c2 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reported-by: Pieter De Gendt <pieter.degendt@gmail.com> Reviewed-on: http://openocd.zylin.com/5845 Tested-by: jenkins Reviewed-by: Pieter De Gendt <pieter.degendt@gmail.com>
2020-10-22cortex_m: support control.FPCASylvain Chouleur3-7/+7
Bit 2 of control register is used if the processor includes the FP extension Change-Id: Ie21bc9de8cae5bad9d841e1908eff3aa0bb29d4b Signed-off-by: Sylvain Chouleur <schouleur@graimatterlabs.ai> Reviewed-on: http://openocd.zylin.com/5853 Reviewed-by: Sylvain Chouleur <sylvain.chouleur@gmail.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2020-10-14riscv: fix compile errorAntonio Borneo1-2/+2
The commit b68674a1da72 ("Upstream tons of RISC-V changes.") was proposed well before commit 3ac010bb9f10 ("Fix debug prints when loading to flash"), but the merge got in different order. After latest merge, the master branch fails to compile. Fix the compile error. Change-Id: Ia3bd21d970d589343a3b9b2d58c89e0c49f30015 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5856 Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Tested-by: jenkins Reviewed-by: Jan Matyas <matyas@codasip.com>
2020-10-14Upstream tons of RISC-V changes.Tim Newsome16-2662/+7273
These are all the changes from https://github.com/riscv/riscv-openocd (approximately 91dc0c0c) made just to src/target/riscv/*. Some of the new code is disabled because it requires some other target-independent changes which I didn't want to include here. Built like this, OpenOCD passes: * All single-RV32 tests against spike. * All single-RV64 tests against spike. * Enough HiFive1 tests. (I suspect the failures are due to the test suite rotting.) * Many dual-RV32 (-rtos hwthread) against spike. * Many dual-RV64 (-rtos hwthread) against spike. I suspect this is an overall improvement compared to what's in mainline right now, and it gets me a lot closer to getting all the riscv-openocd work upstreamed. Change-Id: Ide2f80c9397400780ff6780d78a206bc6a6e2f98 Signed-off-by: Tim Newsome <tim@sifive.com> Reviewed-on: http://openocd.zylin.com/5821 Tested-by: jenkins Reviewed-by: Jan Matyas <matyas@codasip.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-by: Karl Palsson <karlp@tweak.net.au>
2020-10-14flash/nor/at91sam4: ATSAMG55x19 Rev.BBenedikt-Alexander Mokroß1-2/+70
Add support for ATSAMG55x19 Rev.B. Both chips have nearly the same cidr, however, Rev.B has an incremented version. Change-Id: I5939c41fa5d54c4d3bfb850964974b878f709d13 Signed-off-by: Benedikt-Alexander Mokroß <mokross@gessler.de> Reviewed-on: http://openocd.zylin.com/5825 Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Tested-by: jenkins
2020-10-11target/aarch64: fix use of 'target->private_config'Antonio Borneo1-0/+5
The function adiv5_jim_configure() casts the void pointer 'target->private_config' to a struct adiv5_private_config pointer. This is tricky in case of aarch64, where the private data are in a struct aarch64_private_config that has as first element the struct adiv5_private_config. While the current solution is working fine, it's not clean and requires special attention for any further code development. Override 'target->private_config' to the correct pointer while calling adiv5_jim_configure(). Change-Id: Ic2fc047dd1e57013943d96e6d5879a919d1eb7b3 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5847 Tested-by: jenkins Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
2020-10-11target/aarch64: Use apnum settingKevin Yang1-10/+14
Change aarch64 to use ap-num setting if provided. Fall back to original behavior of using first AP when ap-num is invalid. Change-Id: I0d3624f75c86ba5fd5a322ac60856dbbb6e71eaf Signed-off-by: Kevin Yang <kangyang@google.com> Reviewed-on: http://openocd.zylin.com/5831 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-10-03drivers/jlink: fix (again) calculate_swo_prescaler formulaAntonio Borneo1-2/+1
The prescaler computation should round at the nearest integer value, not to the next integer value. Change-Id: I957e0774421211f3c4ba4b312738b1c67b87c4a2 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Fixes: 051e80812b1b ("drivers/jlink: fix calculate_swo_prescaler formula") Reviewed-on: http://openocd.zylin.com/5846 Tested-by: jenkins Reviewed-by: Adrian M Negreanu <adrian.negreanu@nxp.com>
2020-10-03Update user dir config file search pathAndreas Fritiofson2-23/+62
Search in XDG_CONFIG_HOME as per XDG Base Directory Specification in addition to $HOME/.openocd. On Darwin, search in ~/Library/Preferences/org.openocd/ which appears to be one of the conventional locations. Make $OPENOCD_SCRIPTS highest priority on all platforms, previously it was only higher on WIN32. Update the documentation to reflect the search order. Change-Id: Ibaf4b59b51fdf452712d91b47ea2b5312bb5ada9 Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/3890 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-10-03FreeRTOS: strip duplicate line returnsKarl Palsson1-10/+10
Log lines already print a new line, so these superfluous \r\n result in blank lines being printed in the log. Remove per review comment request. Change-Id: I8f5b20776634cf70ce4490fc4f732c916130928a Signed-off-by: Karl Palsson <karlp@etactica.com> Reviewed-on: http://openocd.zylin.com/5843 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins
2020-10-03FreeRTOS: properly read on big endian systems.Karl Palsson1-42/+41
Remember, don't cast your pointers between types of different sizes! While the FreeRTOS handlers attempt to account for different pointer and list widths, the types used are always fixed, so this will _remain_ broken if/when someone targets FreeRTOS on 8/16/64 bit targets. (Note that this patch does not _change_ that, it was fixed to 32bit before as well) In the meantime, this properly handles 32bit reads on a mips BE system (ath79) as well as remaining fully functional on x86_64. Change-Id: I677bb7130e25dccb7c1bee8fabaee27371494d00 Signed-off-by: Karl Palsson <karlp@etactica.com> Reviewed-on: http://openocd.zylin.com/5842 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins
2020-10-03ARM|Driver: Add DPI Driver for emulationKevin Burke6-0/+490
This driver provides support for Cadence JTAG BFM The "jtag_dpi" driver implements a JTAG driver acting as a client for the SystemVerilog Direct Programming Interface (DPI) for JTAG devices. DPI allows OpenOCD to connect to the JTAG interface of a hardware model written in SystemVerilog, for example, on an emulation model of target hardware. Tested on Ampere emulation with Altra and Altra Max models Change-Id: Iaef8ba5cc1398ee2c888f39a606e8cb592484625 Signed-off-by: Kevin Burke <kevinb@os.amperecomputing.com> Signed-off-by: Daniel Goehring <dgoehrin@os.amperecomputing.com> Reviewed-on: http://openocd.zylin.com/5573 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-10-03target/cortex_m.c: vector_catch command checks if a target is examinedDaniel Trnka1-0/+5
If a target is not examined, command vector_catch crashes while accessing the debug_ap NULL pointer. maskisr and reset_config commands don't require this check. Change-Id: I949b6f6e8b983327dd98fbe403735141f8f0b5d6 Signed-off-by: Daniel Trnka <daniel.trnka@gmail.com> Reviewed-on: http://openocd.zylin.com/5813 Tested-by: jenkins Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-10-03target/aarch64: a64 disassemblerMete Balci5-1/+224
Add A64 (AArch64) Disassembler using Capstone framework. Change-Id: Ia92b57001843b11a818af940a468b131e42a03fd Signed-off-by: Mete Balci <metebalci@gmail.com> [Antonio Borneo: Rebased on current HEAD] Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5004 Tested-by: jenkins
2020-10-03tcl: board/dp_busblaster_v4 Busblaster v4.1a by Seed Studio addedUlrich-Lorenz Schlüter1-0/+19
Change-Id: I53141d7f6f022f9dee641858f5fb0e0b70c049f8 Signed-off-by: Paul Fertser <fercerpav@gmail.com> Signed-off-by: Ulrich-Lorenz Schlüter <audiomobster@gmail.com> Reviewed-on: http://openocd.zylin.com/5549 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>