aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2020-09-20cortex_m: add detection of Cortex M35P and M55HEADmasterTarek BOCHKATI2-3/+9
Change-Id: I52599b2b09c2dc50c95d64059213c832d380ea31 Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-on: http://openocd.zylin.com/5799 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-09-20cortex_m: read and display core security stateTarek BOCHKATI3-1/+25
Change-Id: I0fce3c66af7e98df2dc2258daf0d6af661e29ae7 Signed-off-by: Laurent LEMELE <laurent.lemele@st.com> Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-on: http://openocd.zylin.com/5798 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-09-20armv8-m: add SecureFault exceptionTarek BOCHKATI3-1/+12
Change-Id: I4e1963631e834b6334bc917e956c2db4464b7b08 Signed-off-by: Laurent LEMELE <laurent.lemele@st.com> Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-on: http://openocd.zylin.com/5797 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-09-20GitHub: add workflow to provide an openocd snapshot binaries for win32Tarek BOCHKATI2-15/+132
This change could be used within OpenOCD GitHub forks. Once workflow actions are enabled in the GitHub project, this workflow will be run automatically on each push into OpenOCD. This workflow will provide a neutral build of openocd for win32, then the package will be available for download in Actions section. Note: the artifact will be deleted after 90 day (actual GitHub rules) If the push is a tag, the generated package will be uploaded to release pane under the corresponding release, and it will resides forever. The built openocd enables libusb1, hidapi and libftdi adapters, and could be extended to cover more adapters and Oses PS: ./contrib/cross-build.sh updated to build libftdi from source like libusb1 and hidapi. Change-Id: I290c8aa14a12548e2dcb6a0eee456430ea44ab9f Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-on: http://openocd.zylin.com/5594 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-09-05target: avoid checking for non NULL pointer to free itAntonio Borneo11-87/+43
The function free() can be called with a NULL pointer as argument, no need to check the argument before. If the pointer is NULL, no operation is performed by free(). Remove the occurrences of pattern: if (ptr) free(ptr); In target/openrisc/jsp_server.c, an error is logged if the ptr was already NULL. This cannot happen since the pointer was already referenced few lines before and openocd would have been already SIGSEGV in that case, so remove the log. Change-Id: I290a32e6d4deab167676af4ddc83523c830ae49e Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5809 Tested-by: jenkins
2020-09-05drivers/buspirate: remove empty lines at end of fileAntonio Borneo1-2/+0
Change split from http://openocd.zylin.com/5172/ to avoid conflicts with other pending changes in gerrit. Change-Id: Id3e21c92b3da7ddce7b00664280da2143c06f172 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5604 Tested-by: jenkins
2020-09-05jtag: avoid checking for non NULL pointer to free itAntonio Borneo23-122/+60
The function free() can be called with a NULL pointer as argument, no need to check the argument before. If the pointer is NULL, no operation is performed by free(). Remove the occurrences of pattern: if (ptr) free(ptr); Change-Id: I2938e333bd1eac5218bd67aefb9d8f373da017a8 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5810 Tested-by: jenkins
2020-09-05openrisc: Fix segv jsp due to free of unallocated dataStafford Horne1-6/+0
The prompt pointer in the jtag serial port is never zero'd or allocated. Completely remove it since there is not much use for it as the target software will provide the actual prompt. Change-Id: Id95d8ccb9f725e53b9d03386b11d91eba1cd6ef4 Signed-off-by: Stafford Horne <shorne@gmail.com> Reviewed-on: http://openocd.zylin.com/4093 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-09-05openocd: fix command's usage stringAntonio Borneo4-7/+7
The usage string should contain only the command parameters. OpenOCD will automatically prepend the command name to the usage string while dumping the usage or help message. Remove the repeated command name from the usage string. Change-Id: If10a0f1c254aee302b9ca08958390b7f21cdb21b Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5824 Tested-by: jenkins
2020-09-05jtag/aice: fix command's usage stringAntonio Borneo1-13/+13
The usage string should contain only the command parameters. OpenOCD will automatically prepend the command name to the usage string while dumping the usage or help message. Remove the repeated command name from the usage string. Change-Id: Idbc301b34fab19e221131d232577c1629568e6ea Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5823 Tested-by: jenkins
2020-09-05target/arc: fix command's usage stringAntonio Borneo1-10/+10
The usage string should contain only the command parameters. OpenOCD will automatically prepend the command name to the usage string while dumping the usage or help message. Remove the repeated command name from the usage string. Change-Id: I691094a6395acb0e4ea3bea2347ff38379002464 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5822 Tested-by: jenkins
2020-09-05openocd: use proper format with uint32_tAntonio Borneo5-14/+14
Modify the format strings to properly handle uint32_t data types. Change-Id: I4de49bf02c9e37b72240224c23fc83abe8a4fa83 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5819 Tested-by: jenkins
2020-09-05target: use proper format with uint32_tAntonio Borneo30-121/+121
Modify the format strings to properly handle uint32_t data types. While there, fix prototype mismatch between header and C file of the function armv7a_l1_d_cache_inval_virt(). Change-Id: I434bd241fa5c38e0c15d22cda2295097050067f5 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5818 Tested-by: jenkins
2020-09-05flash: use proper format with uint32_tAntonio Borneo38-142/+141
Modify the format strings to properly handle uint32_t data types. Change the type of variable retval in 'nor/ambiqmicro.c' to match both the value to carry and the returned type of the function. Fix the prototype mismatch of function lpc2900_address2sector() between the header and the C file. Change-Id: I68ffba9bd83eec8132f83bff3af993861fd09d84 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5816 Tested-by: jenkins
2020-09-05jtag: use proper format with uint32_tAntonio Borneo18-43/+43
Modify the format strings to properly handle uint32_t data types. Change the prototype of detect_swo_freq_and_prescaler() in 'jlink.c' to avoid an implicit cast in the caller function. Change the type of the variable retlen in some functions in 'usb_blaster.c' to properly pass their pointer to the local read and write functions. Use the proper parser COMMAND_PARSE_NUMBER(u32, ...). Change-Id: I5227dbce04ee59881f173724db90790b7b9cc7af Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5815 Tested-by: jenkins
2020-09-05jtag/aice: avoid abusing of int32_t typeAntonio Borneo2-86/+60
In several cases the 'int' status value returned by libusb and by aice internal functions is taken in a variable of type 'int32_t', requiring an implicit (but trivial) cast. This makes compulsory using 'PRId32' in the format strings that print such 'int32_t' result and requires an additional implicit conversion to return the 'int32_t' as 'int'. Replace to type 'int' all the occurrences of 'int32_t result' and fix accordingly the format strings. Plus, all the size of aice commands are stored as int32_t const variables with uppercase name, violating the coding style, and are then passed as 'int' parameter to the read/write functions. Replace the variables with C macros carrying an 'int' value. While there, replace also a 'uint32_t' loop index with 'unsigned' and fix the format string in the loop. Change-Id: Ic57d58770f1af95f003b5a02fbcb7c926ec06fd1 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5814 Tested-by: jenkins
2020-09-05openocd: avoid checking for non NULL pointer to free itAntonio Borneo9-111/+61
The function free() can be called with a NULL pointer as argument, no need to check the argument before. If the pointer is NULL, no operation is performed by free(). Remove the occurrences of pattern: if (ptr) free(ptr); While there replace a sequence malloc(size)+memset(,0,size) with a calloc(1,size). Replace a pointer assignment to '0' with an assignment to NULL. In server/*, an error is logged if the ptr was already NULL. This cannot happen since the pointer was already referenced few lines before and openocd would have been already SIGSEGV in that case, so remove the log. Change-Id: I10822029fe8390b59edff4070575bf7f754e44ac Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5808 Reviewed-by: Adrian M Negreanu <adrian.negreanu@nxp.com> Tested-by: jenkins
2020-09-05flash: avoid checking for non NULL pointer to free itAntonio Borneo30-161/+71
The function free() can be called with a NULL pointer as argument, no need to check the argument before. If the pointer is NULL, no operation is performed by free(). Remove the occurrences of pattern: if (ptr) free(ptr); There are cases where the pointer is set to NULL after free(), but then re-assigned within few lines. Drop the setting to NULL when this is evident. Anyway, the compiler will remove the useless assignment so no reason to be too much aggressive in this change. Change-Id: I55b2ce7cbe201410016398933e34d33a4b66e30b Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5811 Tested-by: jenkins
2020-09-05adi_v5: use macro DP_APSEL_MAX to allocate struct adiv5_apAntonio Borneo1-1/+1
Commit 11019a824d02 ("adi_v5: enforce check on AP number value") introduces the macro DP_APSEL_MAX and use it in place of hardcoded magic numbers for the upper limit of AP selection value. Use the macro also while defining the array of struct adiv5_ap in struct adiv5_dap. Change-Id: I88f53ceb710f92a48a8026a365709fbf2d9e6912 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5806 Tested-by: jenkins
2020-09-05helper: fix minor typosAntonio Borneo7-13/+13
Change-Id: I785e388148c0329e51cb0b39ab30e8ee44f5a7cd Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5801 Tested-by: jenkins
2020-09-05hla_transport: split command registration per transportAntonio Borneo3-35/+47
All the HLA transports (hla_swd and hla_jtag) register the same set of commands. Such commands are mainly aimed at handling JTAG compatibility that is required for the transport hla_jtag only. Split per transport the command registration and limit the commands to only those required by the transport itself. Replace the command "hla newtap" with the transport specific "swd newdap" or "jtag newtap". Deprecate the command "hla". Change-Id: I79c78fa97b707482608516d3824151a4d07644c0 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/4877 Tested-by: jenkins
2020-09-05tcl/target: use command 'jtag newtap' to add a boundary scan TAPAntonio Borneo6-6/+9
A JTAG TAP for boundary scan should be added in the scan chain through the command "jtag newtap". In some TCL target script the boundary scan TAP is added through the command "swj_newdap", command that is inappropriate in this context because specific for arm adi-v5 SWJ-DP. This situation was probably created to bypass the error with HLA framework, caused by missing command "jtag newtap". Add the command "jtag newtap" in HLA, by reusing the existing code for command "hla newtap". Fix the TCL target scripts to use the command "jtag newtap" for the boundary scan TAPs. The TCL script target/psoc6.cfg has no evident reference to HLA, so the reason for using "swj_newdap" is less clear. Nevertheless it uses the wrong command and, once HLA is fixed, there is no reason to avoid fixing it too. Change-Id: Ia92f8221430cf6f3d2c34294e22e5e18963bb88c Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/4873 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2020-09-05tcl/board/st_nucleo_l1.cfg use dualbank configurationAlexandre Bourdiol1-1/+1
st_nucleo_l1.cfg is based on STM32L152RET6 which support dualbank flash. Change-Id: I7ecdb7b7557229465e23eed667f20cd84197dfc7 Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com> Reviewed-on: http://openocd.zylin.com/5829 Tested-by: jenkins Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-09-05Fix debug prints when loading to flashSamuel Obuch7-58/+31
While loading to flash with debug level at least 3, OpenOCD tries to print the whole loaded bitstream. This will be very-very-slow due to implementation of conversion from buffer to string. * fix condition on selected debug level in jtag/core.c * replace slow buf_to_str function from helper/binarybuffer.c with faster but_to_hex_str function Change-Id: I3dc01d5846941ca80736f2ed12e3a54114d2b6dd Signed-off-by: Samuel Obuch <sobuch@codasip.com> Reviewed-on: http://openocd.zylin.com/5800 Tested-by: jenkins Reviewed-by: Jan Matyas <matyas@codasip.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-09-05tcl/interface/ftdi: fix comment in minimodule-swd.cfgJan Kowalewski1-1/+1
Change-Id: I160faca11f231e3e839046ae2045e37e350ca613 Signed-off-by: Jan Kowalewski <jkowalewski@antmicro.com> Reviewed-on: http://openocd.zylin.com/5804 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-08-17Refer to cross-build script in READMEAndreas Fritiofson1-0/+4
Change-Id: Ic983d2505e40891ba0d0eea3468a71a7741f5c3a Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/5711 Tested-by: jenkins Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
2020-08-16log: handle LOG_*() before calling to log_init()Antonio Borneo1-4/+9
There are cases where LOG_*() functions are called before the logs are initialized with log_init(). E.g. in transport_register() that is executed in gcc constructors, thus called even before main(). With debug_level set to LOG_LVL_USER=-1 all the LOG_ERROR() get dropped. Properly initializing debug_level cause segmentation fault due to log_output still not initialized. Initialize debug_level to LOG_LVL_INFO so errors get printed. Handle separately the case of log_output still NULL, meaning that log_init() is not called yet. Change-Id: I2ea32c87a4955fb44e79b38131c456e25dfbc327 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5602 Tested-by: jenkins
2020-08-16server/gdb_server: fix incorrect condition checkChristopher Head1-1/+1
The warning message should be printed if the target is NOT halted, not if it IS halted. Change-Id: I0a38292a8a2e20e4a4a5ada92b475d551d4cbf38 Signed-off-by: Christopher Head <chead@zaber.com> Reviewed-on: http://openocd.zylin.com/5794 Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-08-16tcl: Add support for NDS V5 target and xc7/Corvette-F1Hellosun Wu3-0/+35
The "Corvette-F1" is an Arduino-compatible evaluation platform, which fully supports AndesCore. The board has FTDI FT2232 to connected to FPGA's JTAG interface. The "ADP-XC7KFF676" is a development and prototyping board that provides capacity for evaluation of AndesCore processors. It works with AICE in-circuit debugging tools. This patch also include target/nds32v5.cfg to support AndesCore N22/N25F and AndeShape Platform AE250. Change-Id: I144d5063d5086d00ec44634a5028b5ea5d2eba33 Signed-off-by: Hellosun Wu <wujiheng.tw@gmail.com> Reviewed-on: http://openocd.zylin.com/5338 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-08-09src/flash/nor/virtual: handle null pointersChristopher Head1-13/+5
Either of protect and protect_check driver callbacks can be NULL. In virtual_protect, reuse flash_driver_protect which checks for that case and generates a nice error message and return code. In virtual_protect_check, there is no corresponding flash_driver_* function, so add the NULL check directly. Change-Id: Ia63d85ede640a8382cf5cad0760f5d1ffe4d7cfe Signed-off-by: Christopher Head <chead@zaber.com> Reviewed-on: http://openocd.zylin.com/5782 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2020-08-09flash/nor/stm32f2x: clean up data typesChristopher Head1-18/+17
Change-Id: I677bc4487fc2eff2c32e14ca2db5470fddaa63b5 Signed-off-by: Christopher Head <chead@zaber.com> Reviewed-on: http://openocd.zylin.com/5778 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2020-08-09src/flash/nor/stm32h7x: fix format stringsChristopher Head1-11/+11
* use proper type codes * add 0x in front of hex values * remove some concatenated empty strings Change-Id: I06a8344d0ed62de7a0f3e2dd8fba69b17eeb3626 Signed-off-by: Christopher Head <chead@zaber.com> Reviewed-on: http://openocd.zylin.com/5783 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2020-08-08target: fix memory leaks on target_create() failAntonio Borneo1-14/+55
There are failure cases of target_create() that are not checked. Plus, in case of failure the memory allocated in not properly released before returning error. Check all the possible failure in target_create(). Change current_target only when target is successfully created. Add the new target to all_targets list only when target is successfully created. Release all the allocated memory before quit on failure. Use malloc() instead of calloc() for target->type, because the struct will be fully populated with memcpy(). Change-Id: Ib6f91cbb50c28878e7c73dc070b17b8d7d4e902f Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5776 Tested-by: jenkins
2020-08-08gdb_server: refuse gdb connection if target is not examinedAntonio Borneo1-0/+11
If the target is not examined, many internal data required for the gdb connections are not ready nor allocated. This causes OpenOCD to hit a segmentation fault. After the execution of the gdb-attach event handler, check if target has been examined and eventually return error to refuse the gdb connection. Plus, since OpenOCD does not implements non-stop mode yet, gdb expects the target to be halted by the inferior when the connection is established. Print a warning to inform the user in case the target is not halted, but still accept the gdb connection to permit the non-intrusive memory inspection with gdb, as explained in http://openocd.org/doc/html/GDB-and-OpenOCD.html#gdbmeminspect Change-Id: If727d68f683c3a94e4826e8c62977de41274ceff Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5201 Tested-by: jenkins
2020-08-08target: fix registers reading from non examined targetMikhail Rasputin1-1/+10
If a target is not examined when the debugger tries to connect to it then it can lead to undesired/undefined behavior. In particular it leads to a zero pointer dereference on the aarch64. Change-Id: I67f2b714ab8b2727fd36f3de16d7f9017b4c55fe Signed-off-by: Mikhail Rasputin <mikhail.godlike.rasputin@yandex.ru> Reviewed-on: http://openocd.zylin.com/5727 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-08-08Fix 2 warnings about obsolete Autoconf macros.R. Diez1-2/+2
Those changes were automatically suggested by tool "autoupdate". Change-Id: Id70bdeacc3c80816f3f5c65d1abceabb5cdf3873 Signed-off-by: R. Diez <rdiezmail-openocd@yahoo.de> Reviewed-on: http://openocd.zylin.com/5638 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-08-02tcl/interface: snps_sdp: fix minor typo s/similiar/similar/Antonio Borneo1-1/+1
Change-Id: I4fd6af560278b3e114cc5d8ee1b49b5c4521d8be Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Fixes: b2821b607460 ("Introduce tcl config files for Synopsys HSDK board") Reviewed-on: http://openocd.zylin.com/5788 Tested-by: jenkins Reviewed-by: Evgeniy Didin <didin@synopsys.com>
2020-08-02tcl/target/armada370: remove useless 'init' commandAntonio Borneo1-2/+0
As the comment states, the 'init' command is issued before the command 'dap apsel', otherwise it fails. This dependency has been already fixed in commit e48690cb26e4 ("target/arm_adi_v5: allow commands apsel and apcsw during init phase"), so the command 'dap apsel' can now be issued directly. Remove both the unneeded 'init' command and the comment that documents and justify its presence. Change-Id: I50f0a820fa7ead6f5a3bd9cc5180d521070822c9 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5786 Tested-by: jenkins
2020-08-02target/arm11: fix memory leaks, including register cacheAntonio Borneo3-0/+20
There is no deinit_target method, so few memory allocations leak at openocd exit. Issue identified by tracking all calls to arm_dpm_setup(). Implement the method arm11_dpm_deinit() to free all the memory allocated in arm11_dpm_init() and call it in the new arm11_deinit_target(). NOT TESTED on real HW. Change-Id: Icab86e290fc2db14f70eb84c8286357aadb02a35 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5694 Tested-by: jenkins
2020-08-02target: use one second timeout while halting target at gdb attachAntonio Borneo1-1/+1
By default GDB timeouts after 2 seconds, even if this value can be modified with GDB command "set remotetimeout". On OpenOCD side, the default event for GDB attach is to halt the target and wait it to halt. But here the default timeout of the halt command is 5 seconds! If the target cannot be halted (e.g. it's kept in reset by another core or the debugger doesn't have enough privileges) then GDB will timeout while OpenOCD is still waiting and is unable to communicate with GDB. Decrease the halt timeout to 1 second in the default GDB attach event handler. Change-Id: I231c740816bb6a0d74b0bc679a368a6cbfb34824 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5687 Tested-by: jenkins
2020-08-02nulink: add minimal support for Nu-Link2Antonio Borneo4-12/+91
Implementation largely taken from Nuvoton github https://github.com/OpenNuvoton/OpenOCD-Nuvoton Reset is still not fully compatible with OpenOCD framework. Adapted to hidapi. Change-Id: Ieb1791b1b7f0b444c15c9668f8f2bcf34975d48f Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Signed-off-by: Zale Yu <cyyu@nuvoton.com> Reviewed-on: http://openocd.zylin.com/5720 Tested-by: jenkins Reviewed-by: Saravanan Sekar <saravanan@linumiz.com> Reviewed-by: Marc Schink <dev@zapb.de>
2020-08-02nor/spi.c: add N25Q032A flash chipMichael Betz1-0/+1
this flash is used on the Digilent CMODA7 FPGA board Change-Id: I6749ca3fbebf2e384051a26a3fd253da5d6e25fb Signed-off-by: Michael Betz <michibetz@gmail.com> Reviewed-on: http://openocd.zylin.com/5787 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2020-08-02jtag/drivers: add support for Nu-Link (Nuvoton ICE) over usbZale Yu8-4/+1145
Add support for Nu-Link1 over usb hidapi and config file. The original work is fetched from Nuvoton github. Code cleanup, fix merge conflicts, compile and runtime issues. Switch the code from libusb to hidapi, being the device HID based. Add documentation. Merge fixes for multi-word memory read. Reset is not fully compatible with openocd framework; currently the target is reset and then halt at openocd start. Change-Id: I9738de4e26783ba462ea3e39ec32069fd5bb7d94 Signed-off-by: Zale Yu <cyyu@nuvoton.com> Signed-off-by: Saravanan Sekar <saravanan@linumiz.com> Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5635 Tested-by: jenkins Reviewed-by: Marc Schink <dev@zapb.de>
2020-07-30Make autotools warnings visible.R. Diez1-4/+5
Change-Id: Ibcdac7100faca7a66d9b3440431e74a8a8c5f042 Signed-off-by: R. Diez <rdiezmail-openocd@yahoo.de> Reviewed-on: http://openocd.zylin.com/5639 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2020-07-30cmsis_dap_usb: Support for Microchip's nEDBG CMSIS-DAP interfaceMichal Potrzebicz1-1/+1
This commit fixes support for the nEDBG CMSIS-DAP interface which is used ie. on the Curiosity Nano SAMD21 board. nEDBG, similarily to mEDBG, does not support 512 byte HID packets. This patch adds its USB PID to the exclusion list to make sure that we stick with the default 64 bytes. Change-Id: I9010b0cf77c0b1347269a759b5d16ee5155abb16 Signed-off-by: Michal Potrzebicz <michal@elevendroids.com> Reviewed-on: http://openocd.zylin.com/5756 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2020-07-26target: fix minor typos and duplicated wordsAntonio Borneo47-114/+114
Change-Id: I8deb0017dc66a243e3dd51e285aa086db500decd Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5766 Tested-by: jenkins
2020-07-26drivers/bitbang: blink LED on SWDAntonio Borneo1-0/+10
The blinking was implemented for JTAG only. Extend it to SWD. There is no error check on SWD exchange. Add a FIXME for further fix. Change-Id: I42a6708c54b1eefaf691e0fe09ca58c42b2764fd Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5771 Tested-by: jenkins
2020-07-26drivers/linuxgpiod: add ledAntonio Borneo2-1/+41
Bitbang interface allows having a LED on one of the GPIO. Let also linuxgpiod driver to specify and use the LED connection. Change-Id: Id3d8772ee1808b92354fd073ba3947bacd8253ef Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5770 Tested-by: jenkins
2020-07-26svf: fix minor typosAntonio Borneo1-6/+6
Change-Id: I40ac2d01c1feb2771ce96a26c4a4d05a1e816a61 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5761 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2020-07-26flash: fix minor typo s/fifo's/fifos/Antonio Borneo1-4/+4
Change-Id: I21feee50377b13cd0d48749c19abb12d499fe199 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5769 Tested-by: jenkins
2020-07-26contrib: fix minor typosAntonio Borneo17-25/+25
While there, replace s/return(0)/return 0/ that causes checkpatch to fail. Change-Id: I5ad54cffca629475563c471114a9f77301a9e4f8 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5768 Tested-by: jenkins
2020-07-26jtag: fix minor typosAntonio Borneo31-69/+69
Change-Id: I3a3370db438f8fd045fb22e7c9fff4e83794a3b7 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5767 Tested-by: jenkins
2020-07-26xsvf: fix minor typosAntonio Borneo1-4/+4
Change-Id: Ib36b2178eacf79dd26ebd2e15ba385853825c198 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5765 Tested-by: jenkins
2020-07-26transport: fix minor typosAntonio Borneo1-3/+3
Change-Id: I481d69f9953e04c881124b2da4d092213591e4ae Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5764 Tested-by: jenkins
2020-07-26server: fix minor typosAntonio Borneo2-4/+4
Change-Id: Ibf835dc174a1a160ec0d57000a113c35f2713045 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5760 Tested-by: jenkins
2020-07-26rtos: fix minor typosAntonio Borneo5-5/+5
Change-Id: I9ed4e2150a0a057397538b608d4a72bc48d0d64f Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5759 Tested-by: jenkins
2020-07-26flash: fix typos and duplicated wordsAntonio Borneo42-125/+125
Fix typos and duplicated words in comments and strings. Change-Id: I64282c7018462deefeeb8e5f4d0d81942425b3fc Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5758 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-by: Christopher Head <chead@zaber.com>
2020-07-26target/arm720t: fix memory leak of register cacheAntonio Borneo1-0/+6
There is no method to free the register cache, allocated in arm720t_init_target(). Issue identified by tracking all calls to arm7tdmi_init_target(). Implement the method arm720t_deinit_target() by calling directly arm7tdmi_deinit_target(). NOT TESTED on a real arm720t target. Tested on a arm926ejs (SPEAr320) by hacking the target type and pretending it is a xscale: sed -i s/arm926ejs/arm720t/ tcl/target/spear3xx.cfg Change-Id: I53c1f46c1a355a710e8df01468b19220671569dc Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5697 Tested-by: jenkins
2020-07-26target/arm7tdmi: fix memory leak of register cacheAntonio Borneo2-0/+14
There is no method to free the register cache, allocated in arm7tdmi_init_target(), so we get a memory leak. Issue identified by tracking all calls to arm_build_reg_cache(). Implement the method arm7tdmi_deinit_target() that in turn calls arm7tdmi_free_reg_cache(). NOT TESTED on a real arm7tdmi target. Tested on a arm926ejs (SPEAr320) by hacking the target type and pretending it is a arm7tdmi: sed -i s/arm926ejs/arm7tdmi/ tcl/target/spear3xx.cfg Change-Id: Iad465b708eb4ebb298725d7155fea76357e9045c Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5696 Tested-by: jenkins
2020-07-26target/xscale: fix memory leak of register cacheAntonio Borneo1-0/+24
There is no method to free the register cache, allocated in xscale_build_reg_cache(), so we get a memory leak. Issue identified by tracking all calls to arm_build_reg_cache(). Implement the method xscale_deinit_target() that in turn calls the new xscale_free_reg_cache(). Fix leak of struct xscale. NOT TESTED on a real xscale target. Tested on a arm926ejs (SPEAr320) by hacking the target type and pretending it is a xscale: sed -i s/arm926ejs/xscale/ tcl/target/spear3xx.cfg Change-Id: Ibb2104c42411b76f4bb77c2fa387d1b85a3d2d5d Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5695 Tested-by: jenkins
2020-07-26target: fix memory leaks on targets based on arm9tdmiAntonio Borneo7-0/+62
Similarly to the fix for arm926ejs (also base on arm9tdmi), fix the other targets based on arm9tdmi. The fix for arm926ejs is tested on SPEAr320 target. This fix is proposed separately because is not tested on a correct target device, but tested on SPEAr320 by hacking the target type and pretending it is the correct one, e.g.: sed -i s/arm926ejs/arm920t/ tcl/target/spear3xx.cfg The memory leaks detected and fixed are: - arm register cache; - EmbeddedICE register cache; - arm_jtag_reset_callback internal data; - struct <target_type>_common. Change-Id: I565f9a5bf144a9df78474434d86a64127ef0fbe5 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5699 Tested-by: jenkins
2020-07-26rtos: add support for RIOTDaniel Krebs6-1/+566
Add threads support for RIOT (https://github.com/RIOT-OS/RIOT). Original code is from Daniel Krebs. Change-Id: I83fe3b91dd75949e800b5aea1015d8fa37b09c61 Signed-off-by: Daniel Krebs <github@daniel-krebs.net> Signed-off-by: Vincent Dupont <vincent@otakeys.com> Signed-off-by: Benjamin Valentin <benpicco@googlemail.com> Reviewed-on: http://openocd.zylin.com/4256 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-07-26tcl/target: Add initial GigaDevice GD32VF103 supportMarc Schink1-0/+26
There is no flash bank support at the moment. Change-Id: I52a2bde39425d94d9333cda002e5df0a1ef63c08 Signed-off-by: Marc Schink <dev@zapb.de> Reviewed-on: http://openocd.zylin.com/5755 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-07-26libjaylink: Update to 0.2.0 releaseMarc Schink1-0/+0
Change-Id: Ib53a98d0c715f91bdced1df6f157d2a50326fa8c Signed-off-by: Marc Schink <dev@zapb.de> Reviewed-on: http://openocd.zylin.com/5757 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-07-26tcl/target: add Rockchip RK3308 targetJiri Kastner1-0/+69
Change-Id: Ia8c2cec0761c37623fa8a416bcfc405f2af6a6b3 Signed-off-by: Jiri Kastner <cz172638@gmail.com> Reviewed-on: http://openocd.zylin.com/5774 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins
2020-07-26src/target/arm_adi_v5.c: add Cortex-A35 related entriesJiri Kastner1-0/+4
ROM Table registers: https://developer.arm.com/documentation/100236/0100/debug/rom-table/rom-table-peripheral-identification-registers Debug reisters: https://developer.arm.com/documentation/100236/0100/debug/memory-mapped-debug-registers/external-debug-peripheral-identification-registers PMU registers: https://developer.arm.com/documentation/100236/0100/debug/pmu-registers/performance-monitors-peripheral-identification-registers CTI registers: https://developer.arm.com/documentation/100236/0100/debug/cti-registers/cti-peripheral-identification-registers Change-Id: Ibd57d91fb9b66bc46929f4e93d0bf23c2a32f11a Signed-off-by: Jiri Kastner <cz172638@gmail.com> Reviewed-on: http://openocd.zylin.com/5773 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins
2020-07-26src/target/arm_adi_v5.c: resorted idsJiri Kastner1-4/+4
Change-Id: Ieeccf48254032244a86d6cd35793f8f6076527e9 Signed-off-by: Jiri Kastner <cz172638@gmail.com> Reviewed-on: http://openocd.zylin.com/5772 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-07-26src/flash/nor/stm32f2x: fix format stringsChristopher Head1-20/+20
* use proper type codes * add 0x in front of hex values * remove some concatenated empty strings Change-Id: I77e8dd161887f02ecf8019b43d3e8e7cc122ad0e Signed-off-by: Christopher Head <chead@zaber.com> Reviewed-on: http://openocd.zylin.com/5780 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-07-26doc/target/mips: fix grammarChristopher Head1-4/+4
Change-Id: Ib9012a1cfccbe4f69682d106688536c4d92392dd Signed-off-by: Christopher Head <chead@zaber.com> Reviewed-on: http://openocd.zylin.com/5777 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins
2020-07-26Introduce tcl config files for Synopsys HSDK boardEvgeniy Didin4-0/+180
With this commit we add tcl configure files for ARCv2 HS Development kit(HSDK). HSDK board has Quad-core ARC HS38 CPU with L1 and L2 caches. Change-Id: I372ef45428c7c7ca1421a6da3e5ed08b86f705e0 Signed-off-by: Evgeniy Didin <didin@synopsys.com> Reviewed-on: http://openocd.zylin.com/5784 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-07-26target/arc: Introduce Actionpoints supportEvgeniy Didin4-9/+418
Actionpoint mechanism allows to setup HW breakpoints and watchpoints on Synopsys ARC CPUs. This mechanism is controlled by DEBUG register and by a set of auxilary registers. Each actionpoint is controlled by 3 aux registers: Actionpoint(AP) match mask(AP_AMM), AP match value(AP_AMV) and AP control(AC). Note: some fields of actionpoint_t structure will be used in further support of watchpoints. Change-Id: I4efb24675f247cc19d9122501c9e63c3126fcab4 Signed-off-by: Evgeniy Didin <didin@synopsys.com> Reviewed-on: http://openocd.zylin.com/5763 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-07-21spi: add MX25U1635E flashHellosun Wu1-0/+1
* Macronix 16 MBit SPI flash * https://www.macronix.com/en-us/products/NOR-Flash/Serial-NOR-Flash/Pages/spec.aspx?p=MX25R1635F&m=Serial%20NOR%20Flash&n=PM2161 * used e.g. on Andestech ADP-XC7KFF676 Change-Id: Ida701cf3832e3302aa29b4dded1c390c5ff8c482 Signed-off-by: Hellosun Wu <wujiheng.tw@gmail.com> Reviewed-on: http://openocd.zylin.com/5428 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-07-14cmsis-dap: fix USB interface for NXP LPC-Link2Antonio Borneo1-0/+4
The adapter NXP LPC-Link2 is a USB composite device that provides five interfaces; among three of them that are of HID class, only one is cmsis-dap. Accordingly to ticket 255, OpenOCD code is not opening the right HID interface; then it fails to communicate with the cmsis-dap while checking the adapter's info. Unfortunately, hidapi does not provide any support for reading the string descriptor of the interface, otherwise it would have been trivial to look for the right cmsis-dap interface. In fact the cmsis-dap specification reports: The CMSIS-DAP Firmware can be also part of a USB composite device. If this case, the HID Interface String must contain the sub-string CMSIS-DAP. This requirement is satisfied by the USB device descriptor of the LPC-Link2 reported below, but cannot be used. Add a quirk to let OpenOCD only accept interface number zero on a LPC-Link2 device. Bus 001 Device 050: ID 1fc9:0090 NXP Semiconductors Device Descriptor: bLength 18 bDescriptorType 1 bcdUSB 2.00 bDeviceClass 239 Miscellaneous Device bDeviceSubClass 2 bDeviceProtocol 1 Interface Association bMaxPacketSize0 64 idVendor 0x1fc9 NXP Semiconductors idProduct 0x0090 bcdDevice 1.00 iManufacturer 1 NXP Semiconductors iProduct 2 LPC-LINK2 CMSIS-DAP V5.224 iSerial 3 I3F4AABA bNumConfigurations 1 Configuration Descriptor: bLength 9 bDescriptorType 2 wTotalLength 0x00ab bNumInterfaces 5 bConfigurationValue 1 iConfiguration 0 bmAttributes 0x80 (Bus Powered) MaxPower 500mA Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 0 bAlternateSetting 0 bNumEndpoints 2 bInterfaceClass 3 Human Interface Device bInterfaceSubClass 0 bInterfaceProtocol 0 iInterface 4 LPC-LINK2 CMSIS-DAP V5.224 HID Device Descriptor: bLength 9 bDescriptorType 33 bcdHID 1.00 bCountryCode 0 Not supported bNumDescriptors 1 bDescriptorType 34 Report wDescriptorLength 35 Report Descriptors: ** UNAVAILABLE ** Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x81 EP 1 IN bmAttributes 3 Transfer Type Interrupt Synch Type None Usage Type Data wMaxPacketSize 0x0400 1x 1024 bytes bInterval 4 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x01 EP 1 OUT bmAttributes 3 Transfer Type Interrupt Synch Type None Usage Type Data wMaxPacketSize 0x0400 1x 1024 bytes bInterval 4 Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 4 bAlternateSetting 0 bNumEndpoints 2 bInterfaceClass 3 Human Interface Device bInterfaceSubClass 0 bInterfaceProtocol 0 iInterface 7 LPC-LINK2 DATA PORT HID Device Descriptor: bLength 9 bDescriptorType 33 bcdHID 1.00 bCountryCode 0 Not supported bNumDescriptors 1 bDescriptorType 34 Report wDescriptorLength 35 Report Descriptors: ** UNAVAILABLE ** Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x84 EP 4 IN bmAttributes 3 Transfer Type Interrupt Synch Type None Usage Type Data wMaxPacketSize 0x0400 1x 1024 bytes bInterval 1 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x04 EP 4 OUT bmAttributes 3 Transfer Type Interrupt Synch Type None Usage Type Data wMaxPacketSize 0x0400 1x 1024 bytes bInterval 1 Interface Association: bLength 8 bDescriptorType 11 bFirstInterface 1 bInterfaceCount 2 bFunctionClass 2 Communications bFunctionSubClass 2 Abstract (modem) bFunctionProtocol 0 iFunction 5 VCOM Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 1 bAlternateSetting 0 bNumEndpoints 1 bInterfaceClass 2 Communications bInterfaceSubClass 2 Abstract (modem) bInterfaceProtocol 0 iInterface 5 VCOM CDC Header: bcdCDC 1.10 CDC Call Management: bmCapabilities 0x01 call management bDataInterface 2 CDC ACM: bmCapabilities 0x02 line coding and serial state CDC Union: bMasterInterface 1 bSlaveInterface 2 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x83 EP 3 IN bmAttributes 3 Transfer Type Interrupt Synch Type None Usage Type Data wMaxPacketSize 0x0010 1x 16 bytes bInterval 4 Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 2 bAlternateSetting 0 bNumEndpoints 2 bInterfaceClass 10 CDC Data bInterfaceSubClass 0 bInterfaceProtocol 0 iInterface 5 VCOM Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x02 EP 2 OUT bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0200 1x 512 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 0x0200 1x 512 bytes bInterval 0 Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 3 bAlternateSetting 0 bNumEndpoints 2 bInterfaceClass 3 Human Interface Device bInterfaceSubClass 0 bInterfaceProtocol 0 iInterface 6 LPCSIO HID Device Descriptor: bLength 9 bDescriptorType 33 bcdHID 1.11 bCountryCode 0 Not supported bNumDescriptors 1 bDescriptorType 34 Report wDescriptorLength 33 Report Descriptors: ** UNAVAILABLE ** Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x85 EP 5 IN bmAttributes 3 Transfer Type Interrupt Synch Type None Usage Type Data wMaxPacketSize 0x0040 1x 64 bytes bInterval 2 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x05 EP 5 OUT bmAttributes 3 Transfer Type Interrupt Synch Type None Usage Type Data wMaxPacketSize 0x0040 1x 64 bytes bInterval 2 Device Qualifier (for other device speed): bLength 10 bDescriptorType 6 bcdUSB 2.00 bDeviceClass 0 bDeviceSubClass 0 bDeviceProtocol 0 bMaxPacketSize0 64 bNumConfigurations 1 Device Status: 0x0000 (Bus Powered) Change-Id: Ib3d46f87743a2d35a266842cb356035d898d466e Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Suggested-by: Masatoshi Tateishi <tateishim3@gmail.com> Reported-by: Donald Bailey <donaldb@users.sourceforge.net> Fixes: https://sourceforge.net/p/openocd/tickets/255/ Reviewed-on: http://openocd.zylin.com/5732 Tested-by: jenkins
2020-07-14cmsis-dap: prevent hidapi to search again for the adapterAntonio Borneo1-14/+8
The code in cmsis_dap_usb_open() already searches for the right HID device that corresponds to the adapter. By calling hid_open() it asks hidapi to re-search the adapter again based on the VID:PID and the serial string of the adapter it has just found! Apart from being a run-time overhead, this has an additional drawback; there are USB adapters built as composite USB devices that, beside the cmsis-dap HID interface, have other HID interfaces for other purposes. A typical example is the NXP LPC-Link2, that over the 5 interfaces 0) cmsis-dap (HID) 1) VCOM-CDC 2) VCOM-CDC 3) LPCSIO (HID) 4) LPC-LINK2 DATA PORT (HID) has 3 of them of HID class. The code in cmsis_dap_usb_open() could select the right interface but then cannot propagate this information to hid_open(). Replace the call to hid_open() with hid_open_path(), passing as parameter the "unique" path of the HID device already found. Checking in hidapi source code, the implementation of hid_open() consists in enumerating the HID devices, scan for the first one matching VID:PID and serial number, and opening it by calling hid_open_path(). This analysis highlights that using directly hid_open_path() should not introduce any regression. While applying these changes, move hid_init() before enumerating the HID devices. This has no real consequences because the HID API is marked as optional but, logically, it should be called before any other HID API. Change-Id: I77ec01dca64223ec597f21f188f363366d0049c6 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Suggested-by: Masatoshi Tateishi <tateishim3@gmail.com> Reviewed-on: http://openocd.zylin.com/5731 Tested-by: jenkins
2020-07-14jtag/drivers: replace perror() with LOG_ERROR()Antonio Borneo5-14/+14
The function perror() sends the output to stderr, but OpenOCD cannot intercept such output to send it to the log. Replace all occurrences of perror() with LOG_ERROR(), but keeping the same output format of perror(). The replacement is done automatically through: sed -i 's/perror("\([^":]*\)[: ]*")/LOG_ERROR("\1: %s", strerror(errno))/' src/jtag/drivers/*.c Change-Id: I4c140bdb09235d56cfd8bef75da9b56fbe7c2aec Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5728 Tested-by: jenkins
2020-07-14doc: remove duplicated wordsAntonio Borneo5-11/+11
Remove occurrences of duplicated words in the documentation. Change-Id: Ib6ef1607fc5e6387764be108b2b9c0c93ac10a62 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5754 Tested-by: jenkins Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2020-07-14tcl/interface: add example of linuxgpiod through dln-2Antonio Borneo1-0/+25
The USB adapter DLN-2 provides 32 GPIO (beside I2C, SPI, ...). Use the first 6 GPIO for a SWD/JTAG bitbanging example through linuxgpiod driver. Change-Id: I229c2078142ec648fc6430b5d123539045dcfbda Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5561 Tested-by: jenkins
2020-07-14contrib/60-openocd.rules: add udev rules for Linux gpiodAntonio Borneo1-0/+3
Change-Id: I767776d3659adddefe81a63f351794318463fd50 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5560 Tested-by: jenkins
2020-07-14jtag/drivers: add linuxgpiod driverAntonio Borneo4-0/+626
New adapter driver for GPIO bitbanging over Linux GPIO descriptors through the library libgpiod. On Debian based distribution, the package libgpiod-dev is required for build. Change-Id: I1ce1a4f1ca79096d6d476b01b523c8c10f2cac07 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5559 Tested-by: jenkins
2020-07-14bcm2835gpio: enable only the transport specific gpioAntonio Borneo1-37/+53
Change-Id: Ice6744600079d5994d628bb3b782aa36e71f862e Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5558 Tested-by: jenkins
2020-07-14imx_gpio: enable only the transport specific gpioAntonio Borneo1-21/+25
Change-Id: Idb1fabbc1e9385f8c23b643584bf7863ea91ffbf Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5557 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2020-07-14sysfsgpio: enable only the transport specific gpioAntonio Borneo1-42/+37
If the configuration file specifies both SWD and JTAG gpios, the current code request all of them. In case of overlap a warning is generated when the same gpio is released for the second time. Require and release only the gpio needed by the specified transport. Change-Id: I41a0970980ceeb559afa98ab34cfe93dffed2e1c Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5556 Tested-by: jenkins
2020-07-14bitbang: split jtag and swd operationsAntonio Borneo5-42/+33
The split in OpenOCD between SWD and JTAG has been already fully implemented. The bitbang driver still keeps a single API write() to drive the output lines. Introduce a new SWD specific API swd_write(). Move the existing SWD bitbang drivers to the new API by extracting the available conditional implementation. Cleanup some function prototype. Remove the now unused global swd_mode, handled implicitly. Rename bitbang_exchange() as bitbang_swd_exchange() to track its scope for SWD only. Change-Id: Ie53080b941cb1ac7a34a1f80bad8bee4e304454d Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5555 Tested-by: jenkins
2020-07-13bitbang: remove superfluous switch between jtag and swdAntonio Borneo5-18/+1
The SWD framework already takes care of switching between JTAG and SWD by calling driver's switch_seq() in swd_connect() and in swd_quit(); there is no need for the driver to force the switch again. Remove the extra switch between jtag and swd. Change-Id: I84de4bffb593374b96fce31951c6cc83f92d2578 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5554 Tested-by: jenkins
2020-07-13bitbang: document bitbang callbacksAntonio Borneo1-1/+9
Change-Id: I732c2eeb452f3ba8a2385d0e02fccbe86381812c Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5553 Tested-by: jenkins
2020-07-13flash/nor/kinetis: fix FCF handlingTomas Vanek1-22/+34
Kinetis Flash Configuration Field needs special handling to prevent unwanted locking of the device. Warn user about any difference between generated FCF and FCF data in the programmed file. Inform user that re-programming of already programmed FCF may fail on devices with FTFE flash module. While on it remove useless setting of is_erased flag after erase. Change-Id: I3911f436674547fa12ef3886c7d5e8cd889f9e2b Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Fixes: https://sourceforge.net/p/openocd/tickets/270/ Reported-by: Noel Diviney <vk3avm@users.sourceforge.net> Reviewed-on: http://openocd.zylin.com/5753 Tested-by: jenkins
2020-07-13flash/nor/kinetis: use target_get_working_area_avail()Tomas Vanek1-14/+13
Since e22c6484eaedd56d71 the trial/error allocation shows "not enough working area available(requested 2048)" message on klx.cfg. The message is not clear if it means a problem or not. Replace with new style allocation using target_get_working_area_avail() Change-Id: I87fe1e38248fcac29982b72aaba12217a0552f38 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/5752 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2020-07-08gdb_server: suggest user to prefer GDB extended modeAntonio Borneo2-6/+26
In case of GDB connection not using extended mode, issue a warning message to suggest the user to switch using the extended mode. Issue the message only once at each run of OpenOCD, to avoid too much noise. Update the documentation to suggest using extended mode. Change-Id: I9326e84f748d5d7912d5a48f00f0fb541ca19221 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5311 Tested-by: jenkins Reviewed-by: Karl Palsson <karlp@tweak.net.au>
2020-07-08coding style: add arguments to function prototypesAntonio Borneo6-27/+27
Issue identified by checkpatch script from Linux kernel v5.1 using the command find src/ -type f -exec ./tools/scripts/checkpatch.pl \ -q --types FUNCTION_ARGUMENTS -f {} \; This patch also fixes an incorrect function prototype in zy1000.c. ZY1000 minidriver implementation overrides the function arm11_run_instr_data_to_core_noack_inner(), but the prototype is not the same as in src/target/arm11_dbgtap.c and to avoid compile error it was changed also the prototype of the called function arm11_run_instr_data_to_core_noack_inner_default(). Change-Id: I476cda8cdb0e1e280795b3b43ca95c40d09e4a3d Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5630 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2020-07-08coding style: fix space separationAntonio Borneo17-262/+262
The checkpatch script from Linux kernel v5.1 complains about using space before comma, before semicolon and between function name and open parenthesis. Fix them! Issue identified using the command find src/ -type f -exec ./tools/scripts/checkpatch.pl \ -q --types SPACING -f {} \; The patch only changes amount and position of whitespace, thus the following commands show empty diff git diff -w git log -w -p git log -w --stat Change-Id: I1062051d7f97d59922847f5061c6d6811742d30e Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5627 Tested-by: jenkins
2020-07-08coding style: fix print of hex values as decimalAntonio Borneo2-2/+2
It is an error to prefix with "0x" the print of values in decimal. Replace the incorrect decimal format specifier with PRIx32. Issue identified by checkpatch script from Linux kernel v5.1 using the command find src/ -type f -exec ./tools/scripts/checkpatch.pl \ -q --types PRINTF_0XDECIMAL -f {} \; Change-Id: I2eb867ef654527b2737ba573a405ec8f97c6a739 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5624 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2020-07-08target/arm926ejs: fix memory leaksAntonio Borneo7-0/+44
The memory leaks detected and fixed are: - arm register cache; - EmbeddedICE register cache; - arm_jtag_reset_callback internal data; - struct arm926ejs_common. Issue identified with valgrind. Tested on SPEAr320 based on arm926ejs. Change-Id: If2bed02c516051ce4d0eb29b204a3f3337fe5d6a Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5698 Tested-by: jenkins
2020-07-08configure: split build of hla layoutsAntonio Borneo4-4/+13
Current hla driver supports two "layout": stlink and ti-icdi. The configure script allows to independently enable/disable the the two layout. But in reality by selecting only one of them the whole hla driver is built, including both "layouts". This is currently not a big issue because the dependencies of the two layout are the same (libusb), so we are sure that selecting one of them would permit to build both. This is going to change with the merge of a third "layout" for Nuvoton Nu-Link, because it would be based on hidapi. We need, at least, to decouple the build of libusb and hidapi "layouts". A full decouple of each "layout" is also welcome to match the selection done during configure. Introduce a new automake macro for each of the two "layout" and use them to conditionally build the "layout" files. Use the existing autoconf macros to conditionally compile the code that depends by the "layout". Change-Id: Ia20da7a260002a8d2af883425aa401b8920d3f36 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5719 Tested-by: jenkins
2020-07-08flash/nor/w600: Use 'bool' data typeMarc Schink1-4/+4
Change-Id: Ia71ffba82b23ed1860acc5daf6c66fa574a0d797 Signed-off-by: Marc Schink <dev@zapb.de> Reviewed-on: http://openocd.zylin.com/5751 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-07-08flash/nor/stmsmi: Use 'bool' data typeMarc Schink1-4/+4
Change-Id: I0b9d3eb6fa40cc9fed6491c8f583580fb471bcac Signed-off-by: Marc Schink <dev@zapb.de> Reviewed-on: http://openocd.zylin.com/5750 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-07-08flash/nor/stm32h7x: Use 'bool' data typeMarc Schink1-1/+1
Change-Id: Ib9c567e2287f2a99172bd3bd35a81e3205cea421 Signed-off-by: Marc Schink <dev@zapb.de> Reviewed-on: http://openocd.zylin.com/5749 Tested-by: jenkins Reviewed-by: Christopher Head <chead@zaber.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-07-08flash/nor/sh_qspi: Use 'bool' data typeMarc Schink1-3/+3
Change-Id: Id5567102013648b1565078310abc27bee4446992 Signed-off-by: Marc Schink <dev@zapb.de> Reviewed-on: http://openocd.zylin.com/5748 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-07-08flash/nor/pic32mx: Use 'bool' data typeMarc Schink1-4/+4
Change-Id: I9a0b60bc07781401f26df31303b8c04822b7ddc2 Signed-off-by: Marc Schink <dev@zapb.de> Reviewed-on: http://openocd.zylin.com/5747 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-07-08flash/nor/mrvlqspi: Use 'bool' data typeMarc Schink1-4/+4
Change-Id: Icc64d9ba56841ff6eb96efcbdc9545938ebb7347 Signed-off-by: Marc Schink <dev@zapb.de> Reviewed-on: http://openocd.zylin.com/5746 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-07-08flash/nor/mdr: Use 'bool' data typeMarc Schink1-3/+3
Change-Id: I1eced61e5cb062445078e05507f6ad1a5a594c8d Signed-off-by: Marc Schink <dev@zapb.de> Reviewed-on: http://openocd.zylin.com/5745 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-07-08flash/nor/max32xxx: Use 'bool' data typeMarc Schink1-8/+8
Change-Id: I828cdd6d97a59fd0692eb22ba8fc0a5759029432 Signed-off-by: Marc Schink <dev@zapb.de> Reviewed-on: http://openocd.zylin.com/5744 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-07-08flash/nor/lpcspifi: Use 'bool' data typeMarc Schink1-4/+4
Change-Id: I0485a7885fe154f983c7a7ce84cbedb0ba32ca31 Signed-off-by: Marc Schink <dev@zapb.de> Reviewed-on: http://openocd.zylin.com/5743 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-07-08flash/nor/jtagspi: Use 'bool' data typeMarc Schink1-4/+4
Change-Id: I0e81dd476c6b3ec7fee6c84ab1bfcf9bca90c532 Signed-off-by: Marc Schink <dev@zapb.de> Reviewed-on: http://openocd.zylin.com/5742 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-07-08flash/nor/fm3: Use 'bool' data typeMarc Schink1-4/+4
Change-Id: Ic90ab762488063f6958f5e775c1b2fe5f3f1718f Signed-off-by: Marc Schink <dev@zapb.de> Reviewed-on: http://openocd.zylin.com/5741 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-07-08flash/nor/fespi: Use 'bool' data typeMarc Schink1-4/+4
Change-Id: I4583b4475b2fa2733db0861bfe8f52f0a514c472 Signed-off-by: Marc Schink <dev@zapb.de> Reviewed-on: http://openocd.zylin.com/5740 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-07-08flash/nor/em357: Use 'bool' data typeMarc Schink1-4/+4
Change-Id: I251b62275d204fdc315cd167685799c15d4e7cf4 Signed-off-by: Marc Schink <dev@zapb.de> Reviewed-on: http://openocd.zylin.com/5739 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-07-08flash/nor/cfi: Use 'bool' data typeMarc Schink3-17/+17
Change-Id: I25198223175c26aded9ad667b802da09883e94ee Signed-off-by: Marc Schink <dev@zapb.de> Reviewed-on: http://openocd.zylin.com/5738 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-07-08flash/nor/atsamv: Use 'bool' data typeMarc Schink1-2/+2
Change-Id: Id4ceaf38dc5eba5b0eb62416fc357fdfc7ea21c0 Signed-off-by: Marc Schink <dev@zapb.de> Reviewed-on: http://openocd.zylin.com/5737 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-07-08flash/nor/ath79: Use 'bool' data typeMarc Schink1-3/+3
Change-Id: Iecd29dcfcc1ae983e4e0828025d2d174944c1e9d Signed-off-by: Marc Schink <dev@zapb.de> Reviewed-on: http://openocd.zylin.com/5736 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-07-08flash/nor/at91sam4: Use 'bool' data typeMarc Schink1-132/+132
Change-Id: Iade91ac58a995676c412606a63e62b70337427f1 Signed-off-by: Marc Schink <dev@zapb.de> Reviewed-on: http://openocd.zylin.com/5735 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-07-08flash/nor/at91sam3: Use 'bool' data typeMarc Schink1-88/+88
Change-Id: Ibaf599a4ab88ea36a84b3389e2f704554d465434 Signed-off-by: Marc Schink <dev@zapb.de> Reviewed-on: http://openocd.zylin.com/5734 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-07-08flash/nor/ambiqmicro: Use 'bool' data typeMarc Schink1-9/+9
Change-Id: Ia8492905dc506d518266343d699c3245efbc1ab1 Signed-off-by: Marc Schink <dev@zapb.de> Reviewed-on: http://openocd.zylin.com/5733 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-07-08jtag/tcl: fix a double free of jim objectMikhail Rasputin1-2/+4
The Jim_SetResultFormatted() frees jim object earlier and the Jim_FreeNewObj() does it second time. It breaks the memory heap. To avoid it the Jim_IncrRefCount() + Jim_DecrRefCount() should be used instead of the Jim_FreeNewObj() call. Change-Id: Ifa5f38009b2d617624b5f27e916720888a3dbad9 Signed-off-by: Mikhail Rasputin <mikhail.godlike.rasputin@yandex.ru> Reviewed-on: http://openocd.zylin.com/5724 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-07-07flash/nor: Use proper data types in driver APIMarc Schink70-755/+773
Use 'unsigned int' and 'bool' instead of 'int' where appropriate. While at it, fix some coding style issues. No new Clang analyzer warnings. Change-Id: I700802c9ee81c3c7ae73108f0f8f06b15a4345f8 Signed-off-by: Marc Schink <dev@zapb.de> Reviewed-on: http://openocd.zylin.com/4929 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-07-07flash/nor/atsame5: Fix a timeout when erasingMichael Hope1-6/+16
According to the datasheet, erasing a block can take up to 200 ms. When using a Segger J-Link with a 2 MHz clock the current loop finishes after < 50 ms, ignores the timeout, and then fails when erasing the next block. Switch to a time based check, add an explicit yield, and report an error on timeout. Change-Id: I8255401d1e59f427a08d2cccb8a66143dcdbb324 Signed-off-by: Michael Hope <mlhx@google.com> Reviewed-on: http://openocd.zylin.com/5706 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2020-06-27target: do not print an error on shutdown in target eventsAntonio Borneo1-2/+6
Before commit b3ce5a0ae545 ("target: use LOG_USER to print errors in events") an error in an event handler was silently lost, while now the associated message is printed out. A "shutdown" command in a target event (e.g. in gdb-detach) causes the event to end with error code ERROR_COMMAND_CLOSE_CONNECTION, that triggers the error message: shutdown command invoked Error executing event <event-name> on target <target-name>: The error code returned by the command "shutdown" is required to stop the execution in a script/proc and avoid executing any further command in the script/proc. It is then normal to get an error code from the "shutdown" command and it should not be printed out. Intercept the return code of the event in case of "shutdown", then skip scheduling other target events and return without printing the incorrect error message. Change-Id: Ia3085fb46beacb90a5e4bf0abf7c6e28bb9e6a9b Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reported-by: Laurent Lemele <laurent.lemele@st.com> Reviewed-on: http://openocd.zylin.com/5710 Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Tested-by: jenkins
2020-06-27jtag: drivers: xlnx-pcie-xvc: Add support for SWD mode.Moritz Fischer2-5/+215
Add support for SWD debug to the Xilinx XVC/PCIe driver. This is possible since the device is essentially a shift-register. So doing SWD vs JTAG is a matter of wiring things correctly on the RTL side (use TMS for SWDI, TDO for SWDO). The clang static checker doesn't find any new problems with this change. Change-Id: I3959e21440cd1036769e8e56a55e601d3e4aee9a Signed-off-by: Moritz Fischer <moritzf@google.com> Reviewed-on: http://openocd.zylin.com/5447 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-06-27target/arc: Introduce L1I,L1D,L2 caches supportEvgeniy Didin4-5/+328
With this commit we introduce L1 and L2 cache flush and invalidate operations which are necessary for getting/setting actual data during memory r/w operations. We introduce L2 cache support, which is not presented on currently support EMSK board. But L2 is presented on HSDK board, which soon will be introduced. Change-Id: I2fda505a47ecb8833cc9f5ffe24f6a4e22ab6eb0 Signed-off-by: Evgeniy Didin <didin@synopsys.com> Reviewed-on: http://openocd.zylin.com/5688 Reviewed-by: Oleksij Rempel <linux@rempel-privat.de> Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-06-27aarch64: Add support for debugging in HYP mode on ARMv8-A coresLucas3-2/+12
When debugging an ARMv8-A/AArch32 target running HYP mode, OpenOCD would throw the following error to GDB on most operations (step, set breakpoint): cannot read system control register in this mode The mode in question is 0x1A, a privilege level 2 mode available on cores that have the virtualization extensions (such as the Raspi 3). Note: this mode is only used when running in AArch32 compatibility mode. Signed-off-by: Lucas Jenss <public@x3ro.de> Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Change-Id: Ia8673ff34c5b3eed60e24d8da57c3ca8197a60c2 Reviewed-on: http://openocd.zylin.com/5255 Tested-by: jenkins Reviewed-by: Lucas Jenß <lucas.jenss@gmail.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-06-23libjaylink: Update to latest Git versionMarc Schink1-0/+0
This update is for testing the upcoming 0.2.0 release. Change-Id: I400b09eb3ead4306c83c7980c621124101aaef7e Signed-off-by: Marc Schink <dev@zapb.de> Reviewed-on: http://openocd.zylin.com/5723 Tested-by: jenkins Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2020-06-18target/armv7m_trace: Calculate prescaler for external capture devicesMarc Schink2-7/+26
This fixes a regression introduced in "2dc88e1479f29ef0141b05bfcd907ad9a3e2d54c" Change-Id: I04dc19ed30118a4c499b83732700b2ee0fdb67b6 Signed-off-by: Marc Schink <dev@zapb.de> Reviewed-on: http://openocd.zylin.com/5610 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2020-06-14target/icepick.cfg: Add support for Test TAPs in ICEPick CEdward Fewell1-4/+18
In addition to the debug TAPs, the ICEPick C also supports a bank of Test TAPs (limited functionality intended for non-debuggable targets). Added support for Test TAPs to the icepick_c_tapenable routine. Port numbers of 0 to 15 will continue to be handled as a debug TAP number. Test TAPs will be port numbers of 16 to 31. This functionality will be needed for doing a flash mass erase on CC26xx/CC13xx targets. It is possible for user application to block even adding the Cortex M TAP to the scan chain, so the only way to unbrick the target and erase the flash is using a component on a test TAP of the device's ICEPick router. Change-Id: I0aa52a08d43a00cbd396efdeadd504fc31c98510 Signed-off-by: Edward Fewell <efewell@ti.com> Reviewed-on: http://openocd.zylin.com/5715 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-06-14flash/nor/stm32l4x: Fix check for number of argumentsMarc Schink1-1/+1
The current version erroneously allows any number of arguments >= 1. Change-Id: I64156c11b48d411c72bebbf866954818cd036ff2 Signed-off-by: Marc Schink <dev@zapb.de> Reviewed-on: http://openocd.zylin.com/5716 Tested-by: jenkins Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-06-14stlink: code factorization by introducing stlink_usb_exit_modeTarek BOCHKATI1-43/+24
Change-Id: I4abd6432c4ef969e382bfed96cd19a49d9610000 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-on: http://openocd.zylin.com/5612 Tested-by: jenkins
2020-06-14openocd: fix issue in WIN32 with TCP adaptersTarek BOCHKATI3-2/+22
Issue: server_quit is called before adapter_quit: In WIN32 only in server_quit we do an WSACleanup, which terminates/closes all active sockets. So if the adapter is TCP based, the adapter.quit handler will fail if it will need to send some commands through TCP. Example: close_socket in jtag_vpi_quit will fail in WIN32 because the socket is already closed and the errno is set as "Bad File Descriptor" To fix that we introduced new functions called server_host_os_entry/quit to manage specific OS setup (hence WSA for sockets in WINDOWS) in order to delay WSACleanup after adapter_quit(). Change-Id: Ie4afacafe123857f6ae300e376bdfcf0d8c027ac Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-on: http://openocd.zylin.com/5456 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-06-14board: Add the HiFive1 revB board configurationAlistair Francis1-0/+21
Change-Id: If186afcfd2c87414b9323569a16aed9a6054c883 Signed-off-by: Alistair Francis <alistair.francis@wdc.com> Reviewed-on: http://openocd.zylin.com/5680 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-by: Tim Newsome <tim@sifive.com>
2020-06-14flash: Add the Freedom E310-G002 SPI FlashAlistair Francis1-1/+2
Change-Id: Id9f4a209a6eacf186931b142e70a5b0458517be0 Signed-off-by: Alistair Francis <alistair.francis@wdc.com> Reviewed-on: http://openocd.zylin.com/5679 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-by: Tim Newsome <tim@sifive.com>
2020-06-06coding style: fix multi-line dereferencingAntonio Borneo2-16/+9
Issue identified by checkpatch script from Linux kernel v5.1 using the command find src/ -type f -exec ./tools/scripts/checkpatch.pl \ -q --types MULTILINE_DEREFERENCE -f {} \; Change-Id: Icba05613e22a72ecc3e6a0aad7cb6b479496146f Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5629 Tested-by: jenkins Reviewed-by: Marc Schink <dev@zapb.de>
2020-06-06jtag/tcl: fix memory leak in command 'irscan'Antonio Borneo1-4/+9
If the function parse_u64() fails, we jump to return, thus leaking the memory just allocated in 'v'. Issue identified by clang. Move earlier the call to parse_u64() and the associated test, before memory allocation. While there, fix a possible NULL pointer dereferencing in case the calloc() fails, by testing for allocation failure. Change-Id: I6a77ee17aceb282bbdfefe7cdafeba2e0e7012f1 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5692 Tested-by: jenkins Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
2020-06-06target/cortex_a: fix memory leak of register cacheAntonio Borneo4-0/+25
There is no method to free the register cache, allocated in armv4_5, so we get a memory leak. Issue identified by valgrind. Implement the method arm_free_reg_cache() and call it in cortex_a deinit and to exit for error during arm_dpm_setup(). Tested on dual cortex-A stm32mp15x. This change is inspired from similar fix in commit b01b5fe13a67 ("armv7m: Fix memory leak in register caching."). The same allocation is also used by target types "arm7tdmi", "arm9tdmi", "arm11" and "xscale" but they all lack the deinit method and I do not have relevant HW to test the fix. For such reasons they are not addressed in this patch. Change-Id: I4da1e1f12e36ec245d1f3b11a4eafcbd9a1d2e25 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5693 Tested-by: jenkins
2020-06-06target/mem_ap: fix two memory leaksAntonio Borneo1-0/+10
The target mem_ap misses the method 'deinit_target' and does not free the memory allocated during 'target create' and 'configure'. Add the missing method and free the allocated memory. Issue identified with valgrind. Change-Id: If0d0114a75dd76a8b65c2d46d96c6085fd31a09d Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5700 Tested-by: jenkins
2020-06-06libusb_helper: fix memory leak when no adapter is foundAntonio Borneo1-0/+3
When jtag_libusb_open() fails to find the adapter, it returns error but left libusb initialized causing memory leak of libusb internal data. Issue found with valgrind when no adapter or board is connected to the host, e.g. valgrind openocd -f board/st_nucleo_f4.cfg Close the libusb operations if jtag_libusb_open() has to return error. Change-Id: Ieb2f110be15705dafe80c099e7d83c07056c2a41 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5701 Tested-by: jenkins
2020-06-06target/cortex-m: enable C_DEBUGEN during examineAntonio Borneo1-0/+13
Current code for Cortex M does not set C_DEBUGEN as soon as possible, (which means during target examine), but later-on either: 1) at command 'halt' (e.g. for 'gdb-attach' event); 2) at command 'soft_reset_halt'; 3) at commands 'reset', 'reset halt' or 'reset init'; 4) during polling, but only if the target: = enter in 'double fault', or = exit from a reset, or = halts (not possible if C_DEBUGEN is not set) Plus, if commands in 1) or 2) are executed before the very first poll of the target, the value of 'cortex_m->dcb_dhcsr' is used not initialized while writing it back in DCB_DHCSR. Another side effect of this situation is that it's possible to set a HW breakpoint with the target running, while C_DEBUGEN is not set. Accordingly to [1], C1.3.1 "Debug authentication": When DGBEN is LOW and DHCSR.S_HALT == 0: ... FPB breakpoints do not generate an entry to Debug state and, if no DebugMonitor exception is generated, will escalate to HardFault, Lockup, or be ignored. On STM32MP15x I get HW breakpoint ignored, while on STM32F411 I get HardFault. E.g. following these steps: - power-on a pre-flashed board that starts running the firmware; - connect openocd, without halting or resetting the board; - set a HW breakpoint to some address often executed; - wait, but the board doesn't halt ...; - type the command 'halt'; - if the Cortex-M has HardFault it would be visible and the fault is at the breakpoint address; - if no HardFault then type the command 'resume'; - wait and the board will finally halt at the HW breakpoint. A similar issue has been detected on Cortex-A code and fixed by commit bff87a7f28fb ("target/cortex_a: enable DSCR_HALT_DBG_MODE during examine"). Follow the same approach and set C_DEBUGEN during examine. Also, initialize 'cortex_m->dcb_dhcsr' during examine. [1] ARM DDI 0403E "ARM v7-M Architecture Reference Manual" Change-Id: I5b0b23403634f7dfce38f104bba9f59c33eb3e99 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5702 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-by: Moritz Fischer <moritzf@google.com>
2020-06-06log: fix kept_alive() and report expired timeoutAntonio Borneo1-17/+39
The kept_alive() function is called to inform the keep-alive code that a keep-alive as been just kicked through some other path. But kept_alive() erroneously resets the timeout counter without checking if it has already expired, thus masking a potential timeout. Check if timeout counter has expired during kept_alive(). While there, put the timeout values in macros and explicit the units in the timeout messages. Change-Id: Iaf6368b44e5b5352b1cc4e7efbb2368575dcfa08 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5705 Reviewed-by: <jonatan_zeidler@gmx.de> Tested-by: jenkins
2020-06-06nor/kinetis: add keep-alive during flash writeAntonio Borneo1-0/+4
Flashing Kinetis MCU MK22FX512VLH12 takes longer than one second, thus gdb connection can timeout. Before commit 7f260f5009a7 ("helper/command: Handle Tcl return values consistently") the openocd timeout warning was masked by a bug in gdb_put_packet() that resets the timeout counter if any message is logged out. The commit above removes one log message and the timeout warning is now triggered. While the bug in gdb_put_packet() is still to be fixed, the reason of the timeout is the lack of keep_alive() calls in kinetis flash driver. Add keep_alive() call at every iteration in function kinetis_write_sections(), that is reported as core write function in chunks of 1024 bytes in the log from the reporter. Add also a keep_alive() call at every iteration in function kinetis_write_inner(). This part is not present in the log but, by code analysis, it represents another critical loop. Change-Id: I38e631b36c7eb2f1e21cef68710ce47c03d3edda Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reported-by: Jonatan Hatakeyama Zeidler <jonatan.zeidler@medineering.de> Reviewed-on: http://openocd.zylin.com/5703 Tested-by: jenkins Reviewed-by: <jonatan_zeidler@gmx.de>
2020-06-06arm_adi_v5: dap_ti_be_32_quirks_command minor simplificationTarek BOCHKATI1-18/+2
use handle_command_parse_bool within dap_ti_be_32_quirks_command to make it shorter and simpler. Change-Id: Ice179cc477933b27e27235dc2ade23fe655e233d Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-on: http://openocd.zylin.com/5708 Tested-by: jenkins Reviewed-by: Marc Schink <dev@zapb.de> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-06-06arm_adi_v5: enhance command error reportingTarek BOCHKATI1-17/+32
avoid the usage of ERROR_COMMAND_SYNTAX_ERROR when ERROR_COMMAND_ARGUMENT_INVALID is more adequate. Change-Id: Ic9aaedb93fedd45efee1b39f8ea20185f01af2da Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-on: http://openocd.zylin.com/5654 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-06-06jtag/drivers/bcm2835gpio: bcm2835gpio_init has been updatedtscn921-1/+5
For jtag/drivers/bcm2835gpio dev_mem_fd has been updated within bcm2835gpio_init with the add on of gpio to mem. This permits the access to memory of GPIO without the need for root access. For failed attempt, a fallback to original memory follows. It should be noted that any printed error is relative to original memory ("dev/mem"). Tested on EFM32GG12B390F board Change-Id: I4540bdf62fb3b91a51221e277881adfae138dcc5 Signed-off-by: tscn92 <tscn@kamstrup.com> Reviewed-on: http://openocd.zylin.com/5568 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-06-06tcl/boards: Rename 'ek-tm4c1294xl.cfg' to 'ti_ek-tm4c1294xl.cfg'Marc Schink2-13/+16
The new filename has a proper vendor prefix. Keep the old configuration file for now but show a "deprecated" warning at runtime. Change-Id: If7465a752f47f3292e430c8b311148badfd384cd Signed-off-by: Marc Schink <dev@zapb.de> Reviewed-on: http://openocd.zylin.com/5478 Tested-by: jenkins Reviewed-by: Karl Palsson <karlp@tweak.net.au> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-06-06tcl/boards: Rename 'ek-tm4c123gxl.cfg' to 'ti_ek-tm4c123gxl.cfg'Marc Schink2-12/+15
The new filename has a proper vendor prefix. Keep the old configuration file for now but show a "deprecated" warning at runtime. Change-Id: I13871ec13709055843e23b1b6da90694fd60505e Signed-off-by: Marc Schink <dev@zapb.de> Reviewed-on: http://openocd.zylin.com/5477 Tested-by: jenkins Reviewed-by: Karl Palsson <karlp@tweak.net.au> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-06-06tcl/boards: Rename 'dk-tm4c129.cfg' to 'ti_dk-tm4c129.cfg'Marc Schink2-13/+16
The new filename has a proper vendor prefix. Keep the old configuration file for now but show a "deprecated" warning at runtime. Change-Id: I30fcb8f291d401acaa1fe665db0eeabc250d24b6 Signed-off-by: Marc Schink <dev@zapb.de> Reviewed-on: http://openocd.zylin.com/5476 Tested-by: jenkins Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-06-02Update Autotools Mythbuster link to avoid multiple redirects.Diego Elio Pettenò1-1/+1
While I'm hoping to maintain the chain of redirects for the foreseeable future, it makes sense to point at the final URL now that Autotools Mythuster has had its domain for a long while. Change-Id: I6d912e3be0f81b25bec14746ebfee58f29f144b6 Signed-off-by: Diego Elio Pettenò <flameeyes@flameeyes.com> Reviewed-on: http://openocd.zylin.com/5709 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2020-05-24helper/command: remove unused functions and make static local onesAntonio Borneo2-49/+8
The function command_find_in_parent() is never used in OpenOCD, so remove it. The functions command_name() and [un]register_command() are only used internally in command.c, so make them static. Change-Id: Ide9842659796f4884fb6c1fcf5979b3b71b67abb Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5663 Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Tested-by: jenkins
2020-05-24openocd: properly use jim data typesAntonio Borneo3-4/+5
The jim library exports all the data types through typedef, so there is no need to use the internal struct types. Fix the few remaining inconsistencies in the code. Change-Id: Id4ae0083563ea7a371833374e7b39f17158f66a4 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5662 Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Tested-by: jenkins
2020-05-24helper/command: fix check on value returned by jim APIAntonio Borneo1-2/+2
Either Jim_CreateCommand() and register_command_handler() return the jim error code JIM_OK/JIM_ERR. Fix the check and the initialization of retval. Change-Id: I3073c66764670128706ad979a43bb3edbbeb0ab0 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5661 Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Tested-by: jenkins
2020-05-24helper/command: strip replicated command name in logAntonio Borneo3-11/+8
After commit 0840414f0e57 ("helper/command: do not replace new commands with ocd_ prefix"), the command name is present in argv[0], so there is no need to pass it directly. The current code causes the command name to be logged twice, once explicitly and then from the content of argv[0]: openocd -c 'debug_level 3; echo hello; shutdown' <snip> Debug: 13 3 command.c:142 script_debug(): command - echo echo hello <snip> Debug: 16 4 command.c:142 script_debug(): command - shutdown shutdown Remove the command name from the arguments of the function script_debug(). Change-Id: I57860774f450ff717ee71ef9dc07590549a84319 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5660 Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Tested-by: jenkins
2020-05-24stlink: fix open AP for v2j37 and v3j7Antonio Borneo1-4/+11
The new stlink firmware requires opening the AP before issuing any operation. In the current code we have a 'questionable' check about the core model to set the TAR autoincrement, that is issued without opening the AP, thus causing a STLINK_BAD_AP_ERROR. Modify the AP open API to handle this case and open AP#0 before the memory access to check the core model. Change-Id: I576955b5094bd41d63ff1fbad7b4fd9433253321 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reported-by: Andreas Bolsch <hyphen0break@gmail.com> Reviewed-on: http://openocd.zylin.com/5691 Tested-by: jenkins Reviewed-by: Andreas Bolsch <hyphen0break@gmail.com>
2020-05-24stlink: fix incorrectly returned error on v2j28Antonio Borneo1-1/+14
Firmware v2j28 introduces the API to open and close the AP, but closing AP always returns error 0x1d (STLINK_BAD_AP_ERROR). Ignore the error returned by the bogus firmware on closing AP. Change-Id: I992ddbf7acb10f1d376ed8f781eeb3344605b85d Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5683 Tested-by: jenkins
2020-05-24stlink: default dapdirect to SWD instead of JTAGAntonio Borneo1-1/+1
When the transport is not specified, OpenOCD uses the first listed by the selected adapter driver. The old HLA driver for stlink lists SWD as first. The new driver dapdirect instead lists JTAG, making more difficult a fallback to HLA when dapdirect is not available due to old stlink FW. Plus, in case of JTAG wiring, SWD is still possible, while the opposite is not. Reorder the list of transports to grant the default to SWD. Change-Id: Id9c529e921b148d5b352d4603a9028c2a5f15d83 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Suggested-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-on: http://openocd.zylin.com/5538 Tested-by: jenkins Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
2020-05-24stm8 target: make adapter speed settings workAke Rehnman3-15/+37
Previously the adapter speed settings were hard-coded to connect with low speed then switch over to high speed regardless what was mentioned in the cfg files. Now the stm8 target intercept adapter speed settings and configure the stm8 control registers accordingly. Change-Id: I7419514e5214e4b43b9d51253cf5b7f04a233533 Signed-off-by: Ake Rehnman <ake.rehnman@gmail.com> Reviewed-on: http://openocd.zylin.com/5548 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-05-24tcl/board: add board ST nucleo-8l152r8Antonio Borneo1-0/+10
The transport SWIM is selected twice, in board and in target, thus a warning is generated at run-time. It should be fixed by remove a line in the target file, but does not harm so let's keep it there for the time being. Change-Id: I479004dc16005a330d552c8dbd5def61690f9b9f Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5543 Tested-by: jenkins
2020-05-24Revert "adapter: expose HLA interface in struct adapter_driver"Antonio Borneo2-9/+0
No reason to keep longer this temporary hack. Remove it by reverting the original commit. Change-Id: I5c6dcdb1f4755b7dba4c03a5033913ef8db35e18 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5533 Tested-by: jenkins
2020-05-24stlink: simplify handling of SWIMAntonio Borneo1-17/+8
Now that SWIM is not accessed through HLA anymore, decouple the SWIM code and remove the conditional execution. Fix the inconsistency of the return type for stlink_usb_state() in case of SWIM (returns ERROR_OK while type is enum target_state) introduced by commit 3de6b5f6e52f ("jtag/drivers/stlink_usb : implemented and repaired SWIM support"). The code added by commit above in stlink_usb_state() is an hack to reuse existing HLA API to perform a reconnect. Move the SWIM specific code from stlink_usb_state() to a dedicated stlink_swim_op_reconnect() that provides consistent data type. Change-Id: I3fe175fef00b0735bea6139b057f217a080c9d38 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Fixes: 3de6b5f6e52f ("jtag/drivers/stlink_usb : implemented and repaired SWIM support") Reviewed-on: http://openocd.zylin.com/5532 Tested-by: jenkins
2020-05-24stlink: simplify mem R/W with SWIMAntonio Borneo1-12/+36
Thanks to API separation between SWIM and the other transports, we can easily split the memory read/write for SWIM from the rest of the code. While there, use the macro STLINK_DATA_SIZE as size of data chunks that can be read/write in SWIM. This was not implemented before. Change-Id: I7d913c92539007e4d914480bacc0126a8f0e9705 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5531 Tested-by: jenkins
2020-05-24swim: add new transportAntonio Borneo12-41/+197
Add SWIM and STM8 to documentation and update TODO file. Introduce transport "swim" and command "swim newtap". Switch in swim.c from HLA API to the new SWIM API. Implement in stlink driver the SWIM APIs as wrappers of existing HLA functions. Remove any SWIM related reference from HLA files. Update stm8 config files and stlink-dap interface config file. Change-Id: I2bb9f58d52900f6eb4df05f979f7ef11fd439c24 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5530 Tested-by: jenkins
2020-05-24swim: fix adapter speed handlingAntonio Borneo5-11/+18
SWIM transport only supports two adapter speeds: - "low speed" equal to 363 kHz (8 MHz / 22) - "high speed" equal to 800 kHz (8 MHz / 10) Replace the previous convention that use "0" or "1" for "low" or "high" speed with the effective speed in kHz. Rework the implementation of stlink_speed_swim(). Set low speed in the stm8 config files, because only low speed is permitted at debug connection; the previous code ignores the initial value. Change-Id: I2484c9419a2c554c59eb6b9216339393ab0b54f3 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5529 Tested-by: jenkins
2020-05-24swim: abstract the transport in stm8 targetAntonio Borneo4-53/+134
SWIM is implemented by (ab)using the HLA API. This was acceptable when OpenOCD code did not provided a clear separation between transports and related APIs. Still today SWIM in OpenOCD is only supported by STLink, so the decision to re-use the HLA API was the simpler way to implement it. After commit efd1d642220a ("adapter: switch from struct jtag_interface to adapter_driver") the transports API are better split and SWIM can be implemented as a separate set of API. This would open the possibility to extend OpenOCD for other adapters that provide SWIM, e.g. versaloon, or through SPI emulation [1]. Introduce a new set of files swim.[ch] to handle the SWIM API. Beside the API that almost match the transport low-level data communication (system_reset, read_mem, write_mem), add a further API reconnect. Today, inside HLA STLink code, the reconnect is implemented by hacking the HLA API state(). Please notice that due to this hack the return type is incorrect; stlink_usb_state() returns ERROR_OK in SWIM mode, while its return type is enum target_state. Ignore the type mismatch and still call the HLA API state in the new SWIM API reconnect. Further commit will fix it. [1] http://kuku.eu.org/?projects/stm8spi/stm8spi Change-Id: I52018e1e2200cbd41af8e5031f7b35dc761b61d6 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5528 Tested-by: jenkins
2020-05-24adapter: expose HLA interface in struct adapter_driverAntonio Borneo2-0/+9
The transition of STM8/SWIM out of HLA will require a new struct swim_ops in struct adapter_driver. To simplify the development, make the HLA interface temporarily accessible through the struct adapter_driver. This commit will be reverted after the swim rework. Change-Id: I1e4f370cf64641164d7bcaa22f75ac58c9240052 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5527 Tested-by: jenkins
2020-05-24stlink: reduce use of hla specific enum hl_transportsAntonio Borneo1-50/+52
In the driver's code it's widely used the enum hl_transports for any check concerning the current transport, even for the non-hla transport dapdirect. The driver already provides a stlink specific enum stlink_mode that can be used in place of the hla one. Replace the hla enum with the stlink one allover the code. Introduce a hla specific wrapper stlink_usb_hl_open() to cope with the only API that requires the hla specific enum. The overall behaviour is not changed, with exception for a debug message in stlink_usb_open() than now prints the numeric value of stlink enum in place of the numeric value of the corresponding hla one. This change prepares the road for moving SWIM transport out of hla by removing any reference to the macro HL_TRANSPORT_SWIM from the stlink driver. Change-Id: Ieeea34f312245a94bfc1333087afdb8eb9f77139 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5526 Tested-by: jenkins
2020-05-24flash/nor/sh_qspi: Fix dead assignmentMarc Schink1-1/+1
Change-Id: I6a99076fea30062535e615244895698e51107441 Signed-off-by: Marc Schink <dev@zapb.de> Reviewed-on: http://openocd.zylin.com/5645 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-05-24arm_disassembler: fix typo 'ARM_UNKNOWN_INSTUCTION' to '.._INSTRUCTION'Tarek BOCHKATI2-2/+2
Change-Id: I3a3d566fe96fb1497cf8337389e993e0f728a64b Signed-off-by: Laurent LEMELE <laurent.lemele@st.com> Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-on: http://openocd.zylin.com/5657 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-05-24nor/flash: Add keep_alive() during flash write handlerEdward Fewell1-0/+2
Added keep_alive() call inside main flash write loop. Large files where causing a gdb timeout warning. Change-Id: I525dad2d644e248dd9ecf678e4d8e33c22eefdf2 Signed-off-by: Edward Fewell <efewell@ti.com> Reviewed-on: http://openocd.zylin.com/5682 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2020-05-24flash/nor/jtagspi: propagate error from jtag_execute_queue()Tomas Vanek1-2/+2
Change-Id: Ib985bdf3d60345a1e701f9cc98f89a47ff74d3e2 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/5684 Tested-by: jenkins Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-05-24rtos/ChibiOS: Fix some coding stylesMarc Schink3-62/+62
Change-Id: I2648479df1a2dd95f8a57868c4ed4259e0fbbe11 Signed-off-by: Marc Schink <openocd-dev@marcschink.de> Reviewed-on: http://openocd.zylin.com/4989 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-05-24contrib: Add HiFive1 to udev rulesAlistair Francis1-0/+2
Change-Id: I4ba9219e1c673d650931f8f9426d554de8322abf Signed-off-by: Alistair Francis <alistair.francis@wdc.com> Reviewed-on: http://openocd.zylin.com/5678 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-05-18flash: nor: jtagspi: make read_status report errorsPaul Fertser1-4/+15
This is a follow-up to 3c9bd7c6f30a34e3930e44dd2e8ce5f5a877b4eb. Change-Id: If430f7fcfbba084d9cd74b32344ad43508a96a77 Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/4383 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2020-05-14target/arc: fix build with clangAntonio Borneo1-1/+1
Commit da41bce3aee9 ("target/arc: introduce breakpoint functionality") introduces a mismatch between the format string and one int constant. Change the format string to match the int constant. Change-Id: I0d59552205551b90e165c0a2e3fef247ad0c7701 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Fixes: da41bce3aee9 ("target/arc: introduce breakpoint functionality") Reviewed-on: http://openocd.zylin.com/5655 Tested-by: jenkins Reviewed-by: Evgeniy Didin <didin@synopsys.com> Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
2020-05-12cortex_m: make bit fields in cortex_m unsigned.iosabi2-31/+32
Expression like (0xffff << 16) evaluate to type int, which is not able to hold that value, producing a warning when compiling with -fsanitize=undefined. This patch makes most of the cortex_m constants unsigned using the BIT() macro or appending "ul" when possible to fix the undefined behavior warning. Signed-off-by: iosabi <iosabi@protonmail.com> Change-Id: I7af194305ef612d7a32e74eaf9f11dd85fa87f32 Reviewed-on: http://openocd.zylin.com/5583 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-by: Christopher Head <chead@zaber.com> Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2020-05-12flash/nor/bluenrg-x: Minor code cleanupsMarc Schink1-10/+9
Change-Id: I7844eb30d58b0a23ca5bcc94181066cca6fa0861 Signed-off-by: Marc Schink <dev@zapb.de> Reviewed-on: http://openocd.zylin.com/5462 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2020-05-09coding style: open function's brace at beginning of new lineAntonio Borneo2-21/+11
Issue identified by checkpatch script from Linux kernel v5.1 using the command find src/ -type f -exec ./tools/scripts/checkpatch.pl \ -q --types OPEN_BRACE -f {} \; Change-Id: I6d1356ed11e2699525f384efb7556bc2efdc299f Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5628 Tested-by: jenkins Reviewed-by: Marc Schink <dev@zapb.de>
2020-05-09coding style: wrap lines longer than 120 charsAntonio Borneo2-3/+13
The coding style is quite permissive allowing 120 chars per line, but abuses are still present. Fix them, wrapping the lines. Change-Id: I94d66b651d759a60ec35f7ba115c43933e70ed69 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5626 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2020-05-09coding style: join consecutive string fragmentsAntonio Borneo1-1/+1
The re is no need to split a long string, apart for fitting the predefined line width. Join the consecutive string fragments. Issue identified by checkpatch script from Linux kernel v5.1 using the command find src/ -type f -exec ./tools/scripts/checkpatch.pl \ -q --types STRING_FRAGMENTS -f {} \; Change-Id: I8de52d572b0e3d4788c1d4d2b0cf8f94c7f08409 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5625 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2020-05-09coding style: let "else" follow the close braceAntonio Borneo2-4/+2
The statement "else" should not be on a new line when follows a close brace '}'. Fix it! Issue identified by checkpatch script from Linux kernel v5.1 using the command find src/ -type f -exec ./tools/scripts/checkpatch.pl \ -q --types ELSE_AFTER_BRACE -f {} \; Change-Id: I8af247ec3f75a69713d7cb1e73881254d16c189e Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5623 Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Tested-by: jenkins
2020-05-09coding style: remove useless return statement from void functionsAntonio Borneo3-15/+0
For void functions, a return as last statement is useless. Remove it. Issue identified by checkpatch script from Linux kernel v5.1 using the command find src/ -type f -exec ./tools/scripts/checkpatch.pl \ -q --types RETURN_VOID -f {} \; Change-Id: Ie0616fe98623f30d2d7b04ac9517d669774092de Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5622 Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Tested-by: jenkins
2020-05-09coding style: prototype of functions with no parametersAntonio Borneo6-9/+9
Functions that have no parameters should use "void" as parameter in the function declaration. Issue identified and fixed by script checkpatch from Linux kernel v5.1 using the command find src/ -type f -exec ./tools/scripts/checkpatch.pl \ -q --types FUNCTION_WITHOUT_ARGS --fix-inplace -f {} \; Change-Id: If104ac75b44e939ec86155ff7b5720f2e33c6b39 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5621 Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Tested-by: jenkins
2020-05-09coding style: add missing space when split stringsAntonio Borneo8-17/+17
Long strings are split across few lines; usually split occurs at the white space between two words. Check that the space between the two words is still present. While there, adjust the amount of space between words. Issue identified by checkpatch script from Linux kernel v5.1 using the command find src/ -type f -exec ./tools/scripts/checkpatch.pl \ -q --types MISSING_SPACE -f {} \; Change-Id: I28b9a65564195ba967051add53d1c848c7b8fb30 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5620 Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Tested-by: jenkins
2020-05-09coding style: avoid unnecessary line continuationsAntonio Borneo23-74/+74
Line continuation, adding a backslash as last char of the line, is requested in multi-line macro definition, but is not necessary in the rest of C code. Remove it where present. Identified by checkpatch script from Linux kernel v5.1 using the command find src/ -type f -exec ./tools/scripts/checkpatch.pl \ -q --types LINE_CONTINUATIONS -f {} \; Change-Id: Id0c69e93456731717a7b290b16580e9f8ae741bc Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5619 Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Tested-by: jenkins
2020-05-09coding style: add parenthesis around the argument of sizeofAntonio Borneo15-32/+32
The script checkpatch available in new Linux kernel offers an experimental feature for automatically fix the code in place. While still experimental, the feature works quite well for simple fixes, like parenthesis. This patch has been created automatically with the script under review for inclusion in OpenOCD, using the command: find src/ -type f -exec ./tools/scripts/checkpatch.pl \ -q --types SIZEOF_PARENTHESIS --fix-inplace -f {} \; Change-Id: I8adb325bdb0e13211f8bae8b4770ec1979c176bf Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5618 Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Tested-by: jenkins
2020-05-09coding style: remove useless break after a goto or returnAntonio Borneo18-68/+0
In a switch/case statement, a break placed after a goto or return is never executed. The script checkpatch available in Linux kernel v5.1 issues a warning for such unused break statements. In the process of reviewing the new checkpatch for its inclusion in OpenOCD, let's get rid of these warnings. The script checkpatch is unable to fixup automatically this case. Thanks to having "break" command using a single code line, this patch has been generated using the script below: find src/ -type f -exec ./tools/scripts/checkpatch.pl -q \ --types UNNECESSARY_BREAK -f {} \; \ | sed -n '/^#/{s/^.*FILE: //;s/:$//;s/:/ /;p}' \ | awk 'function P() {print "sed -i '\''"b"'\'' "a}; { if ($1!=a) { if (a) {P()}; a=$1; b=$2"{d}"; } else { b=b";"$2"{d}" } }; END {P()}' Change-Id: I56ca098faa5fe8d1e3f712dc0a029a3f10559d99 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5617 Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Tested-by: jenkins
2020-05-09tcl: remove trailing whitespaceAntonio Borneo29-140/+140
The script checkpatch available in new Linux kernel offers an experimental feature for automatically fix the code in place. While still experimental, the feature works quite well for simple fixes, like spacing. This patch has been created automatically with the script under review for inclusion in OpenOCD, using the command: find tcl/ -type f -exec ./tools/scripts/checkpatch.pl \ -q --types TRAILING_WHITESPACE --fix-inplace -f {} \; The patch only changes amount and position of whitespace, thus the following commands show empty diff git diff -w git log -w -p git log -w --stat Change-Id: Ie7e3a236f4db9c70019e3b3c7e851edbd3a9dd84 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5616 Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Tested-by: jenkins
2020-05-09tcl: fix typo and spellingAntonio Borneo31-37/+37
Identified by checkpatch script from Linux kernel v5.7-rc1 using the command find tcl/ -type f -exec ./tools/scripts/checkpatch.pl \ -q --types TYPO_SPELLING --strict -f {} \; Change-Id: I7b523f0ab5ec047ff167742a44c29984ac672cf4 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5615 Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Tested-by: jenkins
2020-05-09doc: fix typo and spellingAntonio Borneo2-6/+6
Identified by checkpatch script from Linux kernel v5.7-rc1 using the command find doc/ -type f -exec ./tools/scripts/checkpatch.pl \ -q --types TYPO_SPELLING --strict -f {} \; Change-Id: I1269ac966027439e16eb6e63179e43925bec37fa Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5614 Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Tested-by: jenkins
2020-05-09doc: fix texinfo warning on @deffn not at the line beginningAntonio Borneo1-18/+23
Commit 87a4158acf56 ("drivers: xds110: Clean up command syntax and documentation") does not follow the documentation structure that lists the adapters in cpt 2 "Debug Adapter Hardware" then lists the adapter commands in cpt 8.2 "Interface Drivers"; it puts all in cpt 2. While doing that, uses an incorrect texinfo syntax that causes the following warnings at compile time: doc/openocd.texi:543: warning: @deffn should only appear at the beginning of a line doc/openocd.texi:547: warning: @deffn should only appear at the beginning of a line doc/openocd.texi:552: warning: @deffn should only appear at the beginning of a line Move the documentation of xds110 commands in the proper chapter and fix the texinfo syntax. Change-Id: I0b3f0fe0c687f194bb02e2d81aca86fcd4fdd718 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Fixes: 87a4158acf56 ("drivers: xds110: Clean up command syntax and documentation") Reviewed-on: http://openocd.zylin.com/5613 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-by: Edward Fewell <efewell@ti.com>
2020-05-09helper/ioutil: silence gcc-8 on strncpyAntonio Borneo1-1/+1
Starting from version 8, gcc issues a warning if strncpy could be able to truncate a string (so without adding the zero-termination char in destination) by copying exactly "size" char from a source string not shorter than "size". Such truncation from strncpy could actually be the desired code behaviour, but the way to silent gcc only locally (without global disabling with -Wno-stringop-truncation) through pragma has other side effects on portability. In current code, the source string is always "eth0", because has been checked right above. So this is a false positive from gcc, being always strlen("eth0") < 16, the sizeof(ifreq.ifr_name). Silent gcc by decrementing the "size" and remove: error: ‘strncpy’ specified bound 16 equals destination size [-Werror=stringop-truncation] This file is only optionally compiled together with ZY1000 driver with --enable-zy1000 --enable-ioutil. This combination is not checked in jenkins, so the error passed unnoticed. Plus, the configure flags above are both deprecated! Change-Id: I229e66227cfd3513139feeaffa47a6e1ec00767b Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5631 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2020-05-09helper/command: register all commands through register_commands()Antonio Borneo1-3/+15
The commands "ocd_find" and "capture" are registered directly through the jim API, instead of the common way to describe them in a struct command_registration that is then passed to the helper register_commands(). This cause the two commands above to not have either "help" nor "usage" string nor a properly identified "mode". Since the following line registers the commands listed in struct command_builtin_handlers, simply add the two commands above in the same struct. Change-Id: Id6ee11dac3b18364deeed65ee8e18ad80152750a Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5644 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2020-05-09tcl: stm32mp15x: fix "reset halt" on CM4 in engineering bootAntonio Borneo1-1/+1
The state machine of cortex-m have to pass through a set of state before it get in "halted". Add one more "arp_poll" to achieve the proper state during a "reset halt" command in engineering boot. Change-Id: I90828bf20ef75bd4018f8b911f727ae69c4d6e8f Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5649 Tested-by: jenkins Reviewed-by: Richard Braun <rbraun@sceen.net>
2020-05-09flash/nor/efm32: Some small code cleanupsMarc Schink1-14/+9
Change-Id: I547970ce31435f75bae01d6d2cc96ebc9c15588c Signed-off-by: Marc Schink <dev@zapb.de> Reviewed-on: http://openocd.zylin.com/5420 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-05-09server/telnet: Fix history outputMarc Schink1-15/+35
Restore the prompt after the "history" command is invoked. Change-Id: I3d0744abbc58e82b039e06f21675efa180e8e1b0 Signed-off-by: Marc Schink <openocd-dev@marcschink.de> Reviewed-on: http://openocd.zylin.com/3414 Tested-by: jenkins Reviewed-by: Marc Schink <dev@zapb.de> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-05-09hla: remove unused hl_interface_param_s.apiTarek BOCHKATI2-3/+1
Change-Id: I90a23293c7e3a6067d56e56d186f9f452af7c15e Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-on: http://openocd.zylin.com/5611 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins
2020-05-09flash/nor/avrf: Minor code cleanupsMarc Schink1-15/+11
Change-Id: I64aa8e41f336584b524445e0ee7f986a0032852a Signed-off-by: Marc Schink <dev@zapb.de> Reviewed-on: http://openocd.zylin.com/5461 Tested-by: jenkins Reviewed-by: Lars Poeschel <poeschell+openocd@mailbox.org> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-05-09flash/nor/kinetis: Minor code cleanupsMarc Schink1-34/+26
Change-Id: Id74cb6c238b803d1a1566fc615e22ea478f2e15e Signed-off-by: Marc Schink <dev@zapb.de> Reviewed-on: http://openocd.zylin.com/5459 Tested-by: jenkins Reviewed-by: Lars Poeschel <poeschell+openocd@mailbox.org> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-05-08target/arc: introduce breakpoint functionalityEvgeniy Didin2-2/+162
With this patch we introduce set/unset breakpoints routines and add/remove bp handlers. Currently soft breakpoints are only supported. Changes since v1: * Change if-statement in arc_remove_breakpoint * Squash changes from http://openocd.zylin.com/#/c/5641/ in this commit to fix build. Change-Id: Ib10ccdb02fd1606e4f407f012b1bee106a8ffccd Signed-off-by: Evgeniy Didin <didin@synopsys.com> Reviewed-on: http://openocd.zylin.com/5641 Tested-by: jenkins Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
2020-05-08target/arc: introduce arc_read/write_instruction functionsEvgeniy Didin2-0/+79
This commit introduces helper instruction read/write functions for further bp functionality. Change-Id: I619fbe2870ef6365c29ed1618bb83b6f7eb84690 Signed-off-by: Evgeniy Didin <didin@synopsys.com> Reviewed-on: http://openocd.zylin.com/5640 Tested-by: jenkins Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
2020-05-08target/arc: Add initial stepping functionsEvgeniy Didin2-2/+108
Change-Id: I84845f2ec6f1cff975990f0a495165a02de33227 Signed-off-by: Evgeniy Didin <didin@synopsys.com> Reviewed-on: http://openocd.zylin.com/5643 Tested-by: jenkins Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
2020-05-07Add get_thread_reg() and set_reg() for hwthreadTim Newsome1-51/+90
get_thread_reg() allows gdb to request the register value of a specific "thread." set_reg() allows register writes without getting a giant list of registers first. Signed-off-by: Tim Newsome <tim@sifive.com> Change-Id: I87faa1c8793916b9ee476dd696f0695a07ca2b41 Reviewed-on: http://openocd.zylin.com/5324 Tested-by: jenkins
2020-05-03loaders/flash/nrf5: add CPU type to loader sourceTomas Vanek1-0/+1
Change-Id: Ia65ac21bd99d76c8dace4e9ede060e870cad14de Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/5588 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-05-03flash/stm32l4x: always use stm32l4_get_flash_regTarek BOCHKATI1-4/+3
this change is a preparation for STM32L5 support on top of L4 driver STM32L5 flash is quite similar to L4 flash, mainly register names and offsets and some bits are changed. a table with register offset will be introduced, thus correct register addresses will be obtained using this table and the driver internal function 'stm32l4_get_flash_reg' will be responsible of this. Change-Id: I74bf61a83fe53575623640af0328b3253ecc796f Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-on: http://openocd.zylin.com/5508 Tested-by: jenkins Reviewed-by: Andreas Bolsch <hyphen0break@gmail.com> Reviewed-by: Michael Jung <mijung@gmx.net> Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2020-05-03revision id for STM32L4P5/Q5 correctedAndreas Bolsch1-1/+1
According to RM0432 rev. 6, only 0x1001 "Z" rev. applies for STM32L4P5/Q5. Verified on real device. Whether other revisions exist is unclear. Change-Id: I761ae077d089b06925fc0fe1ff2b1e478b8a66fa Signed-off-by: Andreas Bolsch <hyphen0break@gmail.com> Reviewed-on: http://openocd.zylin.com/5521 Tested-by: jenkins Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2020-05-03target/armv7m: cosmetic refactorizationTomas Vanek1-5/+7
Introduce a variable 'size' and reduce the number of dereferencing *reg_list_size by using the variable. Change-Id: I3bdf1485a4ed8e34435e8acb3efd0df8d802508c Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/5326 Tested-by: jenkins Reviewed-by: Christopher Head <chead@zaber.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-05-02jtag: remove unused function adapter_driver_modules_load()Antonio Borneo2-8/+0
Commit c2cecc74b0ac ("Move JTAG interface list to new files.") merged in mid 2009 introduces an unused and empty function that the developer expects to use for loading adapter drivers from shared libraries. This have never happened and the function is still empty and unused. Remove it. Change-Id: I7c88dbf8a9747e96e5ca4e6e7038ac0f232604fd Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5601 Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Tested-by: jenkins