aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2020-10-28tcl/interface/ftdi: Add Steppenprobe open hardware interfaceDiego Herranz1-0/+41
https://github.com/diegoherranz/steppenprobe Change-Id: Ief2c3f4a8707fa628650697d93893b2355015898 Signed-off-by: Diego Herranz <diegoherranz@diegoherranz.com> Reviewed-on: http://openocd.zylin.com/5653 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-10-24server/telnet: Handle Ctrl+KBrian Brooks1-1/+11
Handle Ctrl+K shortcut which clears the line from the cursor position to the end of line. Change-Id: I2ecff5284473cef7c11cf9cb7e1c0c97d55f6c1c Signed-off-by: Brian Brooks <brooks.brian@gmail.com> Reviewed-on: http://openocd.zylin.com/5868 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins Reviewed-by: Marc Schink <dev@zapb.de>
2020-10-24target/arc: introduce watchpoints supportEvgeniy Didin1-3/+165
With help of actionpoint mechanism now it is possible to introduce watchpoints support for ARC. Change-Id: I5887335d0ba38c15c377bc1d24a1ef36e138cf65 Signed-off-by: Evgeniy Didin <didin@synopsys.com> Reviewed-on: http://openocd.zylin.com/5867 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-10-24Added comment to ti-icdi.cfgJohn Pham1-0/+5
Added comment to ti-icdi.cfg specifying how to get serial and an example of specifying hla_serial for ti-icdi devices. This has been implemented in revision 2121a8f92969804611412b705af8114697a647dc Change-Id: I648458a4dea176beae6a3f1a4e5641d0206077eb Signed-off-by: John Pham <jhnphm@gmail.com> Reviewed-on: http://openocd.zylin.com/2528 Tested-by: jenkins Reviewed-by: Matthew Trescott <matthewtrescott@gmail.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-10-24Enable hla_serial for TI ICDI devicesJohn Pham1-18/+10
Used jtag_libusb_open from libusb_helper.h instead of libusb_open_device_with_vid_pid to get device handle, as well as managing context, i.e. similar to stlink_usb. Direct calls to libusb1 are left in for the moment. (When this Gerrit revision was originally created, the jtag_libusb_ wrappers did not return error conditions.) Tested w/ a TM4C123GXL board Change-Id: I71e9a366356c125444d4813e58ddd9b6c6498bf0 Signed-off-by: John Pham <jhnphm@gmail.com> Signed-off-by: Matthew Trescott <matthewtrescott@gmail.com> Reviewed-on: http://openocd.zylin.com/2527 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-10-22flash/stm32l4: add support of STM32G4 category 4 devices (G491/G4A1)Tarek BOCHKATI1-1/+18
STM32G4 cat.4 devices are up to 512 KB of flash memory (single bank) organized into pages of 2KB each. Reference: RM0440 rev.4 Change-Id: I0f510e2806c8f824fff8083e2d4f90d68f01046b Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-on: http://openocd.zylin.com/5793 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2020-10-22tcl/target/nrf52: fix nrf52_recoverTomas Vanek1-17/+18
nrf52_recover was merged in pre "Handle Tcl return values consistently" state - remove ocd_ prefixes. Erase and unlock sequence was changed to comply Nordic semiconductor recommendation: https://infocenter.nordicsemi.com/index.jsp?topic=%2Fnwp_027%2FWP%2Fnwp_027%2FnWP_027_erasing.html Change-Id: Ic54236c27cf25ad8091e9e572ba1ef846f0d47c2 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reported-by: Pieter De Gendt <pieter.degendt@gmail.com> Reviewed-on: http://openocd.zylin.com/5845 Tested-by: jenkins Reviewed-by: Pieter De Gendt <pieter.degendt@gmail.com>
2020-10-22cortex_m: support control.FPCASylvain Chouleur3-7/+7
Bit 2 of control register is used if the processor includes the FP extension Change-Id: Ie21bc9de8cae5bad9d841e1908eff3aa0bb29d4b Signed-off-by: Sylvain Chouleur <schouleur@graimatterlabs.ai> Reviewed-on: http://openocd.zylin.com/5853 Reviewed-by: Sylvain Chouleur <sylvain.chouleur@gmail.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2020-10-14riscv: fix compile errorAntonio Borneo1-2/+2
The commit b68674a1da72 ("Upstream tons of RISC-V changes.") was proposed well before commit 3ac010bb9f10 ("Fix debug prints when loading to flash"), but the merge got in different order. After latest merge, the master branch fails to compile. Fix the compile error. Change-Id: Ia3bd21d970d589343a3b9b2d58c89e0c49f30015 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5856 Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Tested-by: jenkins Reviewed-by: Jan Matyas <matyas@codasip.com>
2020-10-14Upstream tons of RISC-V changes.Tim Newsome16-2662/+7273
These are all the changes from https://github.com/riscv/riscv-openocd (approximately 91dc0c0c) made just to src/target/riscv/*. Some of the new code is disabled because it requires some other target-independent changes which I didn't want to include here. Built like this, OpenOCD passes: * All single-RV32 tests against spike. * All single-RV64 tests against spike. * Enough HiFive1 tests. (I suspect the failures are due to the test suite rotting.) * Many dual-RV32 (-rtos hwthread) against spike. * Many dual-RV64 (-rtos hwthread) against spike. I suspect this is an overall improvement compared to what's in mainline right now, and it gets me a lot closer to getting all the riscv-openocd work upstreamed. Change-Id: Ide2f80c9397400780ff6780d78a206bc6a6e2f98 Signed-off-by: Tim Newsome <tim@sifive.com> Reviewed-on: http://openocd.zylin.com/5821 Tested-by: jenkins Reviewed-by: Jan Matyas <matyas@codasip.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-by: Karl Palsson <karlp@tweak.net.au>
2020-10-14flash/nor/at91sam4: ATSAMG55x19 Rev.BBenedikt-Alexander Mokroß1-2/+70
Add support for ATSAMG55x19 Rev.B. Both chips have nearly the same cidr, however, Rev.B has an incremented version. Change-Id: I5939c41fa5d54c4d3bfb850964974b878f709d13 Signed-off-by: Benedikt-Alexander Mokroß <mokross@gessler.de> Reviewed-on: http://openocd.zylin.com/5825 Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Tested-by: jenkins
2020-10-11target/aarch64: fix use of 'target->private_config'Antonio Borneo1-0/+5
The function adiv5_jim_configure() casts the void pointer 'target->private_config' to a struct adiv5_private_config pointer. This is tricky in case of aarch64, where the private data are in a struct aarch64_private_config that has as first element the struct adiv5_private_config. While the current solution is working fine, it's not clean and requires special attention for any further code development. Override 'target->private_config' to the correct pointer while calling adiv5_jim_configure(). Change-Id: Ic2fc047dd1e57013943d96e6d5879a919d1eb7b3 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5847 Tested-by: jenkins Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
2020-10-11target/aarch64: Use apnum settingKevin Yang1-10/+14
Change aarch64 to use ap-num setting if provided. Fall back to original behavior of using first AP when ap-num is invalid. Change-Id: I0d3624f75c86ba5fd5a322ac60856dbbb6e71eaf Signed-off-by: Kevin Yang <kangyang@google.com> Reviewed-on: http://openocd.zylin.com/5831 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-10-03drivers/jlink: fix (again) calculate_swo_prescaler formulaAntonio Borneo1-2/+1
The prescaler computation should round at the nearest integer value, not to the next integer value. Change-Id: I957e0774421211f3c4ba4b312738b1c67b87c4a2 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Fixes: 051e80812b1b ("drivers/jlink: fix calculate_swo_prescaler formula") Reviewed-on: http://openocd.zylin.com/5846 Tested-by: jenkins Reviewed-by: Adrian M Negreanu <adrian.negreanu@nxp.com>
2020-10-03Update user dir config file search pathAndreas Fritiofson2-23/+62
Search in XDG_CONFIG_HOME as per XDG Base Directory Specification in addition to $HOME/.openocd. On Darwin, search in ~/Library/Preferences/org.openocd/ which appears to be one of the conventional locations. Make $OPENOCD_SCRIPTS highest priority on all platforms, previously it was only higher on WIN32. Update the documentation to reflect the search order. Change-Id: Ibaf4b59b51fdf452712d91b47ea2b5312bb5ada9 Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/3890 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-10-03FreeRTOS: strip duplicate line returnsKarl Palsson1-10/+10
Log lines already print a new line, so these superfluous \r\n result in blank lines being printed in the log. Remove per review comment request. Change-Id: I8f5b20776634cf70ce4490fc4f732c916130928a Signed-off-by: Karl Palsson <karlp@etactica.com> Reviewed-on: http://openocd.zylin.com/5843 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins
2020-10-03FreeRTOS: properly read on big endian systems.Karl Palsson1-42/+41
Remember, don't cast your pointers between types of different sizes! While the FreeRTOS handlers attempt to account for different pointer and list widths, the types used are always fixed, so this will _remain_ broken if/when someone targets FreeRTOS on 8/16/64 bit targets. (Note that this patch does not _change_ that, it was fixed to 32bit before as well) In the meantime, this properly handles 32bit reads on a mips BE system (ath79) as well as remaining fully functional on x86_64. Change-Id: I677bb7130e25dccb7c1bee8fabaee27371494d00 Signed-off-by: Karl Palsson <karlp@etactica.com> Reviewed-on: http://openocd.zylin.com/5842 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins
2020-10-03ARM|Driver: Add DPI Driver for emulationKevin Burke6-0/+490
This driver provides support for Cadence JTAG BFM The "jtag_dpi" driver implements a JTAG driver acting as a client for the SystemVerilog Direct Programming Interface (DPI) for JTAG devices. DPI allows OpenOCD to connect to the JTAG interface of a hardware model written in SystemVerilog, for example, on an emulation model of target hardware. Tested on Ampere emulation with Altra and Altra Max models Change-Id: Iaef8ba5cc1398ee2c888f39a606e8cb592484625 Signed-off-by: Kevin Burke <kevinb@os.amperecomputing.com> Signed-off-by: Daniel Goehring <dgoehrin@os.amperecomputing.com> Reviewed-on: http://openocd.zylin.com/5573 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-10-03target/cortex_m.c: vector_catch command checks if a target is examinedDaniel Trnka1-0/+5
If a target is not examined, command vector_catch crashes while accessing the debug_ap NULL pointer. maskisr and reset_config commands don't require this check. Change-Id: I949b6f6e8b983327dd98fbe403735141f8f0b5d6 Signed-off-by: Daniel Trnka <daniel.trnka@gmail.com> Reviewed-on: http://openocd.zylin.com/5813 Tested-by: jenkins Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-10-03target/aarch64: a64 disassemblerMete Balci5-1/+224
Add A64 (AArch64) Disassembler using Capstone framework. Change-Id: Ia92b57001843b11a818af940a468b131e42a03fd Signed-off-by: Mete Balci <metebalci@gmail.com> [Antonio Borneo: Rebased on current HEAD] Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5004 Tested-by: jenkins
2020-10-03tcl: board/dp_busblaster_v4 Busblaster v4.1a by Seed Studio addedUlrich-Lorenz Schlüter1-0/+19
Change-Id: I53141d7f6f022f9dee641858f5fb0e0b70c049f8 Signed-off-by: Paul Fertser <fercerpav@gmail.com> Signed-off-by: Ulrich-Lorenz Schlüter <audiomobster@gmail.com> Reviewed-on: http://openocd.zylin.com/5549 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-10-03tcl/board: Add QuickLogic QuickFeather configurationJan Kowalewski1-0/+9
Add configuration for QuickLogic QuickFeather development kit. Change-Id: I39120714bf0bcafa86e0071c38da84a7d9f12a0d Signed-off-by: Jan Kowalewski <jkowalewski@antmicro.com> Reviewed-on: http://openocd.zylin.com/5803 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins
2020-10-03tcl/target: Add QuickLogic EOS S3 MCU configurationJan Kowalewski1-0/+44
Add configuration for QuickLogic EOS S3 MCU target. Change-Id: I375057ff387a826e632f194843dbd92148b0c5dd Signed-off-by: Jan Kowalewski <jkowalewski@antmicro.com> Reviewed-on: http://openocd.zylin.com/5802 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-09-27drivers/jlink: fix calculate_swo_prescaler formulaAdrian Negreanu1-7/+5
a) TPIU_ACPR is defined as: SWO_baudrate = TRACECLKIN/(TPIU_ACPR +1) b) TPIU_ACPR is set by armv7m_trace_tpiu_config() target_write_u32(target, TPIU_ACPR, Prescaler-1), so TPIU_ACPR = Prescaler-1 Replacing TPIU_ACPR in a), we get: SWO_baudrate = TRACECLKIN/Prescaler, so c) Prescaler = TRACECLKIN/SWO_baudrate The Prescaler calculated by calculate_swo_prescaler() is greater by 1: Prescaler = TRACECLKIN/SWO_baudrate + 1 The second problem is that even in situations when an exact baudrate match is possible, the resulting TRACECLKIN/Prescaler already has a 3% deviation. For example, TRACECLKIN=88000000, SWO_baudrate=500000, calculate_swo_prescaler will return Prescaler=171. The correct value should be Prescaler=176 (TPIU_ACPR=175). Might be related to https://sourceforge.net/p/openocd/tickets/263/ Change-Id: Ib4d6df6e34685a9be4c2995cb500b2411c76e39b Signed-off-by: Adrian Negreanu <adrian.negreanu@nxp.com> Reviewed-on: http://openocd.zylin.com/5807 Tested-by: jenkins Reviewed-by: Marc Schink <dev@zapb.de> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-09-27Add support of STM32H72x/73x 1M (0x483)Tarek BOCHKATI1-2/+23
STM32H72x/73x flash is similar to STM32H74x/75x, except STM32H72x/73x devices have only one single flash bank. Change-Id: I3d3422dc60234f8273172924f426200210f388cc Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-on: http://openocd.zylin.com/5792 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-09-27Use capstone for ARM disassemblerMarc Schink5-1615/+122
Change-Id: I1c9bf3f8178d4a06babe23a918e4411833ebc418 Signed-off-by: Marc Schink <dev@zapb.de> Reviewed-on: http://openocd.zylin.com/4812 Tested-by: jenkins Reviewed-by: Fredrik Hederstierna <fredrik@hederstierna.com> Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-09-20cortex_m: add detection of Cortex M35P and M55Tarek 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>