]> git.sur5r.net Git - openocd/log
openocd
6 years agotcl/board: Add Renesas R-Car R8A7790 H2 Stout board
Marek Vasut [Mon, 16 Apr 2018 19:22:04 +0000 (21:22 +0200)]
tcl/board: Add Renesas R-Car R8A7790 H2 Stout board

Add configuration for the Renesas R-Car R8A7790 H2
based Stout ADAS board.

Change-Id: Ib880b5d2e1fab5c8c0bc0dbcedcdce8055463fe2
Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Reviewed-on: http://openocd.zylin.com/4497
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
6 years agotcl/target: Add Renesas R-Car R8A7794 E2 target
Marek Vasut [Sat, 21 Apr 2018 13:59:17 +0000 (15:59 +0200)]
tcl/target: Add Renesas R-Car R8A7794 E2 target

Add configuration for the Renesas R-Car R8A7794 E2 target.
This is an SoC with two Cortex A7 ARMv7a cores, both A7
cores are supported.

Change-Id: Ic1c81840e3bfcef8ee1de5acedffae5c83612a5e
Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Reviewed-on: http://openocd.zylin.com/4531
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
6 years agotarget/arm_adi_v5: keep CSW and TAR cache updated
Antonio Borneo [Fri, 15 Jun 2018 14:37:18 +0000 (16:37 +0200)]
target/arm_adi_v5: keep CSW and TAR cache updated

The call to dap_queue_ap_write() can fail and the value in CSW and
TAR becomes unknown.

Invalidate the OpenOCD cache if dap_queue_ap_write() fails.

Change-Id: Id6ec370b4c5ad07e454464780c1a1c8ae34ac870
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/4564
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
6 years agotarget/arm_adi_v5: sync CSW and TAR cache on apreg write
Antonio Borneo [Fri, 15 Jun 2018 14:30:41 +0000 (16:30 +0200)]
target/arm_adi_v5: sync CSW and TAR cache on apreg write

When using apreg to change AP registers CSW or TAR we get internal
cached value not valid anymore.

Reuse the setup functions for CSW and TAR to write them.
Invalidate the cached value before the call to force the write, thus
keeping original apreg behaviour.

Change-Id: Ib14fafd5e584345de94f2e983de55406c588ac1c
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/4565
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
6 years agomips_m4k.c: Fix build with --disable-target64
Liviu Ionescu [Wed, 20 Jun 2018 09:30:33 +0000 (12:30 +0300)]
mips_m4k.c: Fix build with --disable-target64

Replace PRIx64 with TARGET_PRIxADDR to avoid build problems
when --disable-target64 is used during configure.

Change-Id: I054a27a491e86c42c9386a0488194320b808ba96
Signed-off-by: Liviu Ionescu <ilg@livius.net>
Reviewed-on: http://openocd.zylin.com/4566
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Tim Newsome <tim@sifive.com>
6 years agotarget/arm: Add PLD command to ARM disassembler.
James Marshall [Wed, 17 Jan 2018 02:08:16 +0000 (21:08 -0500)]
target/arm: Add PLD command to ARM disassembler.

Updates the ARM disassembler to handle PLD (PreLoad Data) commands.
Previously handled by printing a TODO message. There are three forms of
the command: literal, register, and immediate. Simply decode based off
of the A1 encoding for the instructions in the ARM ARM. Also fixes mask
to handle PLDW commands.

Change-Id: I63bf97f16af254e838462c7cfac80f6c4681c556
Signed-off-by: James Marshall <jcmarsh@gwmail.gwu.edu>
Reviewed-on: http://openocd.zylin.com/4348
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
6 years agoflash/nor/psoc5lp: fix compile issue on GCC 8.1.0
Antonio Borneo [Mon, 11 Jun 2018 08:29:52 +0000 (10:29 +0200)]
flash/nor/psoc5lp: fix compile issue on GCC 8.1.0

Issue already identified by Alex https://sourceforge.net/u/alexbour/
in ticket #191 https://sourceforge.net/p/openocd/tickets/191/

src/flash/nor/psoc5lp.c:237:2: error: ‘strncpy’ output
truncated before terminating nul copying 2 bytes from a
string of the same length [-Werror=stringop-truncation]

Fix it by assigning the value to the array elements.

Change-Id: I22468e5700efa64ea48ae8cdec930c48b4a7d8fb
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/4563
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
6 years agotcl/target/stm32f7x: configure faster system clock in reset-init
Tomas Vanek [Mon, 12 Mar 2018 22:42:23 +0000 (23:42 +0100)]
tcl/target/stm32f7x: configure faster system clock in reset-init

STM32F7xx devices need faster clock for flash programming
over JTAG transport. Using reset default 16 MHz clock
resulted in lot of DAP WAITs and substantial decrease
of flashing performance.

Adapted to the restructured dap support
(see 2231da8ec4e7d7ae9b652f3dd1a7104f5a110f3f).

Change-Id: Ida6915331dd924c9c0d08822fd94c04ad408cdc5
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/4464
Tested-by: jenkins
Reviewed-by: Christopher Head <chead@zaber.com>
6 years agosrc/flash/tms470: remove testing of sectors[].is_erased state
Tomas Vanek [Fri, 9 Feb 2018 16:51:27 +0000 (17:51 +0100)]
src/flash/tms470: remove testing of sectors[].is_erased state

The erase check routine checked sectors only if is_erased != 1

Check sector unconditionally.

While on it fix clang static analyzer warnings.

Change-Id: I9988615fd8530c55a9b0c54b1900f89b550345e9
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/4401
Tested-by: jenkins
6 years agoflash/nor/nrf5: remove is_erased setting and autoerase before write
Tomas Vanek [Fri, 9 Feb 2018 16:24:05 +0000 (17:24 +0100)]
flash/nor/nrf5: remove is_erased setting and autoerase before write

Cached flash erase state in sectors[].is_erased is not reliable as running
target can change the flash.

Autoerase was issued before flash write on condition is_erased != 1
Remove autoerase completely as it is a quite non-standard feature.

Change-Id: I19bef459e6afdc4c5fcaa2ccd194cf05be8a42b6
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/4400
Tested-by: jenkins
6 years agoflash/nor: Add support for TI CC26xx/CC13xx flash
Edward Fewell [Fri, 19 Jan 2018 02:48:11 +0000 (20:48 -0600)]
flash/nor: Add support for TI CC26xx/CC13xx flash

Added cc26xx flash driver to support the TI CC26xx and CC13xx
microcontrollers. Driver is capable of determining which MCU
is connected and configures itself accordingly. Added config
files for four specific variants: CC26x0, CC13x0, CC26x2, and
CC13x2.

Note that the flash loader code is based on the sources used
to support flash in Code Composer Studio and Uniflash from TI.

Removed cc26xx.cfg file made obsolete by this patch.

Change-Id: Ie2b0f74f8af7517a9184704b839677d1c9787862
Signed-off-by: Edward Fewell <efewell@ti.com>
Reviewed-on: http://openocd.zylin.com/4358
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Fredrik Hederstierna <fredrik@hederstierna.com>
6 years agopsoc5lp: Add NV Latch flash driver
Andreas Färber [Tue, 3 May 2016 21:47:54 +0000 (23:47 +0200)]
psoc5lp: Add NV Latch flash driver

Erasing is not supported by the hardware, it can be written directly.

Tested on CY8CKIT-059, except modifying-write.

Change-Id: I6e920ed930dcd5c7f0b10c5b1b4791a828d9080a
Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/3434
Tested-by: jenkins
6 years agoflash/nor/psoc5lp: fix bad commit 2d5f2ede55150235352773a976166c3ab68297bc
Tomas Vanek [Wed, 6 Jun 2018 15:53:32 +0000 (17:53 +0200)]
flash/nor/psoc5lp: fix bad commit 2d5f2ede55150235352773a976166c3ab68297bc

Change #3432 was merged into git master without adapting it
to #4297 "prepare infrastructure for multi-block blank check".
This is a fast fix of PSoC5LP specific blank check.
Not tested on real PSoC5LP device.

Change-Id: I7dc13ee7bd1f07b2bfe5a93a5030c0c482d30f00
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/4557
Tested-by: jenkins
6 years agodrivers: xds110: Remove unnecessary and deprecated libusb function.
Edward Fewell [Tue, 5 Jun 2018 16:17:40 +0000 (11:17 -0500)]
drivers: xds110: Remove unnecessary and deprecated libusb function.

libusb-1.0.22 has deprecated the libusb_set_debug function. This
function was present in the XDS110 driver as an artifact left over
from early debugging. It isn't required because logging is disabled
by default. Removing it to simplify the code and no longer need to
have libusb version specific #if's in the code.

Change-Id: I9c3f16c039da3f3fad9c4a1169978b0d85a1b45c
Signed-off-by: Edward Fewell <efewell@ti.com>
Reviewed-on: http://openocd.zylin.com/4553
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
6 years agopsoc5lp: Add EEPROM flash driver
Andreas Färber [Mon, 2 May 2016 23:47:54 +0000 (01:47 +0200)]
psoc5lp: Add EEPROM flash driver

Tested on CY8CKIT-059.

Change-Id: Ib02262e8eebf0df3d29492b8a7daa65b262da580
Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/3433
Tested-by: jenkins
6 years agoflash/nor: Add PSoC 5LP flash driver
Andreas Färber [Sat, 30 Apr 2016 13:10:05 +0000 (15:10 +0200)]
flash/nor: Add PSoC 5LP flash driver

Always probe for ECC mode and display ECC sectors if disabled.
Non-ECC write is implemented as zeroing the ECC/config bytes.
Erasing ECC sectors is ignored, erase-checking takes them into account.

Tested with CY8CKIT-059 (CY8C5888), except ECC mode.

Change-Id: If63b9ffca7ad8de038be3c086c49712b629ec554
Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Signed-off-by: Forest Crossman <cyrozap@gmail.com>
Reviewed-on: http://openocd.zylin.com/3432
Tested-by: jenkins
6 years agoflash/nor: Add support for TI CC3220SF internal flash
Edward Fewell [Thu, 28 Dec 2017 23:38:21 +0000 (17:38 -0600)]
flash/nor: Add support for TI CC3220SF internal flash

Added cc3220sf flash driver to support the TI CC3220SF
microcontrollers. Implemented flash driver to support the
internal flash of the CC3220SF. The implementation does not
support the serial flash of the CC32xx family that requires
connection over UART, and not via JTAG/SWD debug. Added config
files for both CC32xx devices (no flash) and CC3220SF (with
flash).

Updated to implement comments from code review.
Additional updates to handle remaining comments from review.
Additional updates per review.

Added code to only request aligned writes and full 32-bit
words down to flash helper algorithm. Updated for recent
changes in OpenOCD flash code.

Removed cc32xx.cfg file made obsolete by this patch.
Change-Id: I58fc1478d07238d39c7ef02339f1097a91668c47
Signed-off-by: Edward Fewell <efewell@ti.com>
Reviewed-on: http://openocd.zylin.com/4319
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
6 years agoFix Semihosting FileIO for targets using vcont packet
Omair Javaid [Thu, 31 May 2018 00:36:53 +0000 (05:36 +0500)]
Fix Semihosting FileIO for targets using vcont packet

This patch fixes a bug where target fails to resume after completing GDB FileIO.
We need to update target last run control information to decide resumption. This
was not being done for vcont packets.

Change-Id: I44bea31720f8b877dba97d77a202303d546ea5bd
Signed-off-by: Omair Javaid <omair.javaid@linaro.org>
Reviewed-on: http://openocd.zylin.com/4539
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
6 years agotarget/target.c: free semihosting member
Liviu Ionescu [Tue, 5 Jun 2018 14:34:47 +0000 (17:34 +0300)]
target/target.c: free semihosting member

When destroying the target, if the semihosting
pointer is set, free it.

Change-Id: I07d34918bb3fddab1eee11219dd66f4842708ec1
Signed-off-by: Liviu Ionescu <ilg@livius.net>
Reviewed-on: http://openocd.zylin.com/4552
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
6 years agoFix libusb-1.0.22 deprecated libusb_set_debug with libusb_set_option
Khem Raj [Fri, 1 Jun 2018 04:06:46 +0000 (21:06 -0700)]
Fix libusb-1.0.22 deprecated libusb_set_debug with libusb_set_option

libusb_set_debug is deprecated in libusb >= 1.0.22 therefore replace
with equivalent libusb_set_option()  API

Change-Id: Ic0287a1bc0ccc90afe8e4c688085f0b25a7fb004
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Reviewed-on: http://openocd.zylin.com/4540
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
6 years agotarget/cortex_m: constify some variables
Christopher Head [Fri, 27 Apr 2018 01:09:36 +0000 (18:09 -0700)]
target/cortex_m: constify some variables

Change-Id: I1f3fddd89597333fc1bb9535c0cd76ca3e008324
Signed-off-by: Christopher Head <chead@zaber.com>
Reviewed-on: http://openocd.zylin.com/4503
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
6 years agoflash/nor/virtual: copy missing fields from master flash_bank structure
Bohdan Tymkiv [Fri, 27 Apr 2018 13:09:51 +0000 (16:09 +0300)]
flash/nor/virtual: copy missing fields from master flash_bank structure

Change-Id: I4ac71ad4b46ed613192310d85eb385b727649a11
Signed-off-by: Bohdan Tymkiv <bhdt@cypress.com>
Reviewed-on: http://openocd.zylin.com/4505
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
6 years agoflash/nor/core: fix double-free crash with 'virtual' flash banks
Bohdan Tymkiv [Fri, 27 Apr 2018 12:37:28 +0000 (15:37 +0300)]
flash/nor/core: fix double-free crash with 'virtual' flash banks

flash_bank structure of 'virtual' flash driver is a full copy of
the master flash_bank structure including bank->sectors and
bank->prot_blocks pointers. These pointers point to memory
locations allocated by the master driver and thus master driver
is responsible for deallocating them.
Do not free bank->sectors and bank->prot_blocks of 'virtual'
driver since they were already released by master flash driver.

Change-Id: I01f373d4adb3fc79e2724964926b9276442c5c52
Signed-off-by: Bohdan Tymkiv <bhdt@cypress.com>
Reviewed-on: http://openocd.zylin.com/4504
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
6 years agobreakpoints: simplify the test to find a breakpoint
Antonio Borneo [Thu, 22 Jan 2015 15:22:07 +0000 (23:22 +0800)]
breakpoints: simplify the test to find a breakpoint

The test is overly complicated and unreadable.
Simplify it while keeping the exact same behaviour.

Change-Id: I6b22291ca454e1eddeeab4024d3983dc4c603d3a
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/4512
Tested-by: jenkins
Reviewed-by: Christopher Head <chead@zaber.com>
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
6 years agotarget: fix syntax in help message
Antonio Borneo [Sun, 27 May 2018 15:37:38 +0000 (17:37 +0200)]
target: fix syntax in help message

The name of the command is already printed before the string
in ->usage, thus it appears twice.
E.g.
> help examine
  stm32f4x.cpu arp_examine arp_examine ['allow-defer']
        used internally for reset processing
  stm32f4x.cpu examine_deferred examine_deferred
        used internally for reset processing
  stm32f4x.cpu was_examined was_examined
        used internally for reset processing

Remove the command name from the string in ->usage.

Change-Id: If3b1368ffff8a94eb629ae3679e2e5f2f11ae92e
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/4536
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
6 years agotarget: aarch64: Adding mcr, mrc 32-bit coprocesor read/write support
Kamal Dasu [Fri, 23 Feb 2018 18:01:53 +0000 (13:01 -0500)]
target: aarch64: Adding mcr, mrc 32-bit coprocesor read/write support

Adding mrc and mcr support for 32-bit boot mode on aarch64 target.

Change-Id: I3879908253ccdf79509dcad752871f422526ec64
Signed-off-by: Kamal Dasu <kdasu.kdev@gmail.com>
Reviewed-on: http://openocd.zylin.com/4483
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
6 years agoRework/update ARM semihosting
Liviu Ionescu [Sun, 13 May 2018 15:39:06 +0000 (18:39 +0300)]
Rework/update ARM semihosting

In 2016, ARM released the second edition of the semihosting specs
("Semihosting for AArch32 and AArch64"), adding support for 64-bits.

To ease the reuse of the semihosting logic for other platforms
(like RISC-V), the semihosting code was isolated from the ARM
target and updated to the latest specs.

The new code is already in use since January (in GNU MCU Eclipse
OpenOCD) and no problems were reported, neither for ARM nor for
RISC-V targets, after more than 7K downloads.

The 2 new files were formatted with uncrustify.

Change-Id: Ie84dbd86a547323bb8a5d24eab68fc7dad013d96
Signed-off-by: Liviu Ionescu <ilg@livius.net>
Reviewed-on: http://openocd.zylin.com/4518
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
6 years agojtag: drivers: sysfsgpio: lift upper gpio number limit
Paul Fertser [Thu, 26 Apr 2018 16:21:30 +0000 (19:21 +0300)]
jtag: drivers: sysfsgpio: lift upper gpio number limit

Recent Linux maps GPIOs from 1023 downwards so do not limit the number
to 1000.

This should fix #183.

Change-Id: I6d4f493b670be9ed9b82759f0fb686a9faddbbf5
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/4502
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
6 years agojtag/drivers: Add support for TI XDS110 debug probe
Edward Fewell [Tue, 2 Jan 2018 21:27:51 +0000 (15:27 -0600)]
jtag/drivers: Add support for TI XDS110 debug probe

Add support for the XDS110 debug probe using the APIs in the
probe's firmware. Includes support for older versions of the
firmware (with reduced performance) and support for a newer
version that includes OpenOCD specific APIs. Tested on various
TI LauchPads including MSP432P4, MSP432E4, CC2650, CC2652, and
CC3220SF.

Updated to add better support for swd switch. Removed issues found with
clang static analysis.

Updated to add rules entry for the XDS110 probe and Tiva DFU mode (which
affects both XDS110 and ICDI probes).

Change-Id: Ib274143111a68e67e80003797c6a68e3e80976b2
Signed-off-by: Edward Fewell <efewell@ti.com>
Reviewed-on: http://openocd.zylin.com/4322
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
6 years agoFix warnings exposed by GCC8
Paul Fertser [Tue, 22 May 2018 09:04:31 +0000 (12:04 +0300)]
Fix warnings exposed by GCC8

gcc (GCC) 8.1.0 generates new warnings and thus fails the build.

The ARM disassembler warnings actually exposed a bug in SMALW, SMULW and
SMUL instructions decoding.

Reported by Eimers on IRC.

Change-Id: I200c70f75a9e07a1f13a592addc1c5fb37714440
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/4526
Tested-by: jenkins
Reviewed-by: Jiri Kastner <cz172638@gmail.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
6 years agoconfigure.ac: Fix required libjaylink version
Marc Schink [Tue, 16 Jan 2018 08:24:27 +0000 (09:24 +0100)]
configure.ac: Fix required libjaylink version

Change-Id: I9ede86eeef8991db52ffa188ff293c14bd50a1f4
Signed-off-by: Marc Schink <openocd-dev@marcschink.de>
Reviewed-on: http://openocd.zylin.com/4450
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
6 years agodoc: fix several typos within manual documents
Antonio Borneo [Sat, 10 Feb 2018 22:56:30 +0000 (23:56 +0100)]
doc: fix several typos within manual documents

Mostly trivial fixes spotted by spell checker

Change-Id: I3af693faf5506c866e2abe253a0e37aea3c4d284
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/4510
Tested-by: jenkins
Reviewed-by: Christopher Head <chead@zaber.com>
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
6 years agoarm_dpm: flush both scratch registers (R0 and R1)
Philipp Tomsich [Fri, 27 Apr 2018 17:59:56 +0000 (19:59 +0200)]
arm_dpm: flush both scratch registers (R0 and R1)

Neither the initial loop to clear dirty registers (which visits all
registers starting at R2 and counting upwards) nor the final explicit
flushes ensure a write-back in arm_dpm_write_dirty_registers.

This change makes sure that both our scratch registers (i.e. R0 and
R1) are written back to the target.

Change-Id: If65be4f371cd40af9a0cfa97f3730b070b92e981
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-on: http://openocd.zylin.com/4506
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
6 years agodoc: fix several typos in openocd.texi
Antonio Borneo [Sat, 10 Feb 2018 14:08:26 +0000 (15:08 +0100)]
doc: fix several typos in openocd.texi

Mostly trivial fixes spotted by spell checker
One fix s/are/is/
No changes in the content of the document

Change-Id: Ic2d8696860c540e901e8c5190f8f1e7dce80545f
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/4402
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
6 years agoChibiOS thread states: Update thread state to label mapping
Faisal Shah [Tue, 10 Apr 2018 03:46:45 +0000 (22:46 -0500)]
ChibiOS thread states: Update thread state to label mapping

Fixed style issue.
Removed #define with list of strings, and just put the
strings in the array initialization directly.
Removed empty space at the start of line.

Change-Id: I76580be203d7d69b8c5b5440f820156543e0d5cc
Signed-off-by: Faisal Shah <faisal.shah@gmail.com>
Reviewed-on: http://openocd.zylin.com/4488
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
6 years agopsoc6: Run flash algorithm asynchronously to improve performance
Bohdan Tymkiv [Wed, 21 Mar 2018 14:13:28 +0000 (16:13 +0200)]
psoc6: Run flash algorithm asynchronously to improve performance

Existing psoc6 driver starts flash algorithm for each Flash row. This is
suboptimal from performance point of view, starting/stopping flash
algorithm for each row adds significant overhead. This change starts
flash algorithm and leaves it running asynchronously while driver
performs flash operations.

Performance gain is 170...250% depending on probe:

flash write_image img_256k.bin    | w/o this change | with this change |
----------------------------------|-----------------|------------------|
KitProg2/CMSIS-DAP, SWD @ 1 MHz   |     4 KiB/s     |     10 KiB/s     |
J-Link Ultra, SWD @ 1 MHz         |    17 KiB/s     |     31 KiB/s     |
J-Link Ultra, SWD @ 4 MHz         |    33 KiB/s     |     57 KiB/s     |

Change-Id: I5bd582584b35af67600c4d197829eb7aeeec7e3f
Signed-off-by: Bohdan Tymkiv <bhdt@cypress.com>
Reviewed-on: http://openocd.zylin.com/4472
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
6 years agoflash/nor, contrib/loaders: add stm32 loaders Makefile and generated .inc
Tomas Vanek [Thu, 1 Mar 2018 21:57:08 +0000 (22:57 +0100)]
flash/nor, contrib/loaders: add stm32 loaders Makefile and generated .inc

Flash loaders refactored to the new style - use generated .inc
instead of hexadecimal machine code in the flash driver source.

Change-Id: If65a2099589e210f9450819b467d67819fd841fc
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/4439
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
6 years agoboard: add configuration for stm32f103c8 "Blue Pill"
Matthias Welwarsky [Thu, 19 Apr 2018 07:56:14 +0000 (09:56 +0200)]
board: add configuration for stm32f103c8 "Blue Pill"

The "Blue Pill" is a popular development board with an STM32F103C8
micro controller. According to sources, it has a 128kB Flash on board
even though the option bytes only report 64kB. This patch therefore also
modifies target/stm32f1x.cfg to take an optional FLASH_SIZE variable into
account which the board file sets to 0x20000.

Change-Id: I8a78ccd2b5faf637c539ee3cf8136789ee15c95d
Signed-off-by: Matthias Welwarsky <matthias.welwarsky@sysgo.com>
Reviewed-on: http://openocd.zylin.com/4495
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
6 years agotcl/target: Add Renesas R-Car R8A7790 H2 target
Marek Vasut [Wed, 11 Apr 2018 15:15:01 +0000 (17:15 +0200)]
tcl/target: Add Renesas R-Car R8A7790 H2 target

Add configuration for the Renesas R-Car R8A7790 H2 target.
This is an SoC with four Cortex A15 and four Cortex A7
ARMv7a cores, only the four A15 cores are supported.

Change-Id: I6099b257cc0f04e6858ed5f5f8c8d8ad82ef7650
Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Reviewed-on: http://openocd.zylin.com/4490
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
6 years agojtag: adapter: fix indentation in handle_interface_command
Antonio Borneo [Sat, 14 Apr 2018 22:43:46 +0000 (00:43 +0200)]
jtag: adapter: fix indentation in handle_interface_command

Minor fix, no code change, just align it to the block it belongs to.

Change-Id: I4c3b0d0bd00a55d5109d3723e5c4bfb2fc72e366
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/4492
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
6 years agotarget: add Cortex-M4 target to VF6xx target
Matthias Welwarsky [Mon, 9 Apr 2018 19:41:31 +0000 (21:41 +0200)]
target: add Cortex-M4 target to VF6xx target

The Vybrid VF6xx SoCs contain an additional Cortex-M4
core connected to AP number 3 of the main DAP.

Change-Id: I59c020fdfc53e909b1f0dac1a8627a62cdaa74f2
Signed-off-by: Matthias Welwarsky <matthias.welwarsky@sysgo.com>
Reviewed-on: http://openocd.zylin.com/3640
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
6 years agotarget/cortex_m: allow setting the type of a breakpoint
Tomas Vanek [Thu, 22 Feb 2018 23:12:50 +0000 (00:12 +0100)]
target/cortex_m: allow setting the type of a breakpoint

Cortex-M target used 'auto_bp_type' mode. The requested type
of breakpoint was ignored and hard (FPB) breakpoints were set in
'code memory area' 0x00000000-0x1fffffff, soft breakpoints were set above
0x20000000.

The code memory area of Cortex-M does not mean the memory is flash and
vice versa. External flash (parallel or QSPI) is usually mapped above
code memory area. Cortex-M7 ITCM RAM is mapped at 0. Kinetis
has a RAM block under 0x20000000 boundary.

Remove 'auto_bp_type' mode, set breakpoints to requested type.

Change 'cortex_m maskisr auto' handling to use a hard temporary
breakpoint everywhere: it can also workaround not working soft breakpoints
on Cortex-M7 with ICache enabled.

Change-Id: I7a9f9464c5e10bfd7f17cba1037ed07a064fa2e8
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/4429
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
6 years agoarmv8: valgrind memleak fixes
Matthias Welwarsky [Mon, 26 Mar 2018 07:45:46 +0000 (09:45 +0200)]
armv8: valgrind memleak fixes

Various fixes for memory leaks, adds a target cleanup for aarch64
and ARM CTI objects.

Change-Id: I2267f0894df655fdf73d70c11ed03df0b8f8d07d
Signed-off-by: Matthias Welwarsky <matthias.welwarsky@sysgo.com>
Reviewed-on: http://openocd.zylin.com/4478
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
6 years agotarget: add configuration for NXP MC-IMX8M-EVK
Matthias Welwarsky [Thu, 14 Dec 2017 08:38:46 +0000 (09:38 +0100)]
target: add configuration for NXP MC-IMX8M-EVK

includes target configuration for i.MX8M SoC family,
board file needs to set up CHIPNAME and CHIPCORES
to match the actual hardware configuration

Change-Id: Ieb6d89cab2477a58f85d0ef9cd242710950191c0
Signed-off-by: Matthias Welwarsky <matthias.welwarsky@sysgo.com>
Reviewed-on: http://openocd.zylin.com/4434
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
6 years agotcl/board: add board configuration for NXP IMX7SABRE
Matthias Welwarsky [Wed, 20 Sep 2017 12:09:28 +0000 (14:09 +0200)]
tcl/board: add board configuration for NXP IMX7SABRE

configuration also contains a reset-init procedure that disables the
watchdog and initilizes the boards DDR memory so that you can upload
baremetal (e.g. boot loader) code into DDR and start it from there.

Change-Id: I4d2311b3708a5fcb5174a3447f34ae3904de7243
Signed-off-by: Matthias Welwarsky <matthias.welwarsky@sysgo.com>
Reviewed-on: http://openocd.zylin.com/4227
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
6 years agoflash/nor/at91sam: implement flash bank deallocation for SAM series
Tomas Vanek [Thu, 15 Feb 2018 09:18:37 +0000 (10:18 +0100)]
flash/nor/at91sam: implement flash bank deallocation for SAM series

Microchip (former Atmel) SAM drivers allocate a struct per chip.

at91sam3, at91sam34:
Deallocate all chip structs from the list at once, on the first bank
deallocation.

at91samd and at91sam4l drivers do not handle more than one bank.
Convert them to simple driver_priv allocation and use
default_flash_free_driver_priv().

Change-Id: I49d7200f38a4568c7e12f306c27d1b1b72646736
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/4416
Tested-by: jenkins
6 years agoflash/nor/kinetis: implement flash bank deallocation
Tomas Vanek [Thu, 15 Feb 2018 01:33:07 +0000 (02:33 +0100)]
flash/nor/kinetis: implement flash bank deallocation

Change-Id: I8ef80eae646d3b3eb7f6dd42067f8516adc5abef
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/4415
Tested-by: jenkins
6 years agoflash/nor: handle flash write alignment/padding in the infrastructure
Tomas Vanek [Sat, 10 Feb 2018 12:07:56 +0000 (13:07 +0100)]
flash/nor: handle flash write alignment/padding in the infrastructure

Most of flash drivers have to ensure proper flash write block alignment
and padding. As there was no support for it in the flash infrastructure,
each driver does it its own way. Sometimes this part of code is not properly
tested and contains bugs.

flash_write(_unlock) joins all image sections targeted to one flash bank
using padded areas as a glue. This solves alignment problems on section
boundaries but imposes other problems.

Introduce new flash bank parameters write_start_alignment,
write_end_alignment and minimal_write_gap.
New flash drivers can just properly set these values instead of handling
alignment by its own.

Adapt infrastructure (namely flash_write_unlock(), handle_flash_fill_command()
and handle_flash_write_bank_command()) to prepare write data padded
to an alignment required by the flash bank.

Rework flash_write_unlock() to discontinue write block when the gap
between sections is bigger than minimum specified in minimal_write_gap.
minimal_write_gap is set to one sector by default.

Change-Id: I4368dd402dfaf51c193bcbf1332cffff092b239b
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/4399
Tested-by: jenkins
Reviewed-by: Andreas Bolsch <hyphen0break@gmail.com>
6 years agotarget armv7m: multi-block erase check
Tomas Vanek [Thu, 23 Nov 2017 10:17:53 +0000 (11:17 +0100)]
target armv7m: multi-block erase check

Tested on PSoC6 (Cortex-M0+ core), onboard KitProg2 in CMSIS-DAP mode,
adapter_khz=1000.
Plain read:
flash read_bank 0 /dev/null
takes 48 seconds.

erase_check without this change:
flash erase_check 0
takes horrible 149 seconds!!

And the same command with the change applied takes 1.8 seconds.
Quite a difference.

Remove the erase-value=0 version of algorithm as the new one can check
for any value.

If the target is an insane slow clocked CPU (under 1MHz) algo
timeouts. Blocks checked so far are returned and the next call
uses increased timeout.

Change-Id: Ic0899011256d2114112e67c0b51fab4f6230d9cd
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/4298
Tested-by: jenkins
Reviewed-by: Jonas Norling <jonas.norling@cyanconnode.com>
Reviewed-by: Andreas Bolsch <hyphen0break@gmail.com>
6 years agotarget, flash: prepare infrastructure for multi-block blank check
Tomas Vanek [Thu, 23 Nov 2017 08:18:24 +0000 (09:18 +0100)]
target, flash: prepare infrastructure for multi-block blank check

'flash erase_check' command runs a check algorithm on a target
if possible. The algorithm is run repeatedly for each flash sector.
Unfortunately every start and stop of the algorithm impose not negligible
overhead.
In practice it means checking is faster than plain read only for
sectors of size approx 4 kByte or bigger. And checking sectors
as short as 512 bytes runs approx 4 times slower than plain read.

The patch changes API call target_blank_check_memory() and related
to take an array of sectors (or arbitrary memory blocks).

Changes in target-specific checking routines are kept minimal.
They use only the first block from the array and process it by
the unchanged algorithm.

default_flash_blank_check() routine repeats target_blank_check_memory()
until all blocks are checked, so it works with both multi-block
and single-block based checkers.

Change-Id: I0e6c60f2d71364c9c07c09416b04de9268807f5e
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/4297
Tested-by: jenkins
Reviewed-by: Andreas Bolsch <hyphen0break@gmail.com>
6 years agotcl/target: Add Renesas R-Car R8A7791 M2W target
Niklas Söderlund [Sat, 7 Apr 2018 19:39:45 +0000 (21:39 +0200)]
tcl/target: Add Renesas R-Car R8A7791 M2W target

Add configuration for the Renesas R-Car R8A7791 M2W target.
This is an SoC with two Cortex A15 ARMv7a cores, both cores
are supported.

This patch is based on initial submission by Adam Bass and
improvements by Niklas Söderlund.

Change-Id: I297da62b9ce71ad222a401d98e6bcb8502427673
Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Cc: Adam Bass <adam.bass@renesas.com>
Cc: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-on: http://openocd.zylin.com/4485
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
6 years agoHACKING: document practices to improve code quality
Paul Fertser [Tue, 16 Jan 2018 12:11:18 +0000 (15:11 +0300)]
HACKING: document practices to improve code quality

Change-Id: I58a7d978b7d5bca3037c4535f06746b9f4411950
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/4343
Tested-by: jenkins
6 years agoconfigure: disable all drivers when zy1000 is enabled
Paul Fertser [Wed, 21 Mar 2018 15:40:36 +0000 (18:40 +0300)]
configure: disable all drivers when zy1000 is enabled

This also fixes the transport_is_hla FIXME.

Change-Id: I33960f373f11e3e203f9aed9c6d02bf7ca48ac97
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/4473
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
6 years agogdb_server: gdb_memory_map() rework
Tomas Vanek [Tue, 27 Feb 2018 08:44:07 +0000 (09:44 +0100)]
gdb_server: gdb_memory_map() rework

Use sector sizes instead of bank size.

Detect a gap between sectors and emit xml blocks accordingly.

Detect sector overflow over the bank size.

Change-Id: If0e0e44b0c3b93067b4d717c9c7b07c08582e57b
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/4436
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
6 years agortos: Fix XPSR_OFFSET for cortex_m4f stacking
Armin van der Togt [Thu, 2 Mar 2017 09:39:26 +0000 (10:39 +0100)]
rtos: Fix XPSR_OFFSET for cortex_m4f stacking

Structures rtos_standard_Cortex_M4F_stacking and
rtos_standard_Cortex_M4F_FPU_stacking in rtos_standard_stackings.c
where using rtos_standard_Cortex_M3_stack_align for the stack-align
function. This function calls rtos_Cortex_M_stack_align with
XPSR_OFFSET = 0x3c. This offset is correct for cortex-M3 but not for
cortex-M4F and cortex-M4F with fpu. This patch adds stack_align
functions for M4F an M4F_FPU

Change-Id: If6a90b1898fccbb85619a10f3aef5277dd88ce47
Signed-off-by: Armin van der Togt <armin@otheruse.nl>
Reviewed-on: http://openocd.zylin.com/4037
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
6 years agotarget: free target SMP list on shutdown
Matthias Welwarsky [Fri, 6 Apr 2018 10:38:12 +0000 (12:38 +0200)]
target: free target SMP list on shutdown

On SMP targets, the "target smp" command creates a list of targets
that belong to the SMP cluster. Free this list when a target gets
destroyed on shutdown. For simplicity, the complete list is free'd as
soon as the first target of the SMP cluster is destroyed instead of
individually removing targets from the list.

Change-Id: Ie217ae1efb2e819c288ff3b1155aeaf0a19b06be
Signed-off-by: Matthias Welwarsky <matthias.welwarsky@sysgo.com>
Reviewed-on: http://openocd.zylin.com/4481
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
6 years agotarget/arm_adi_v5: extend apcsw command to accept arbitrary bits
Tomas Vanek [Thu, 22 Feb 2018 23:03:20 +0000 (00:03 +0100)]
target/arm_adi_v5: extend apcsw command to accept arbitrary bits

apcsw command was limited to SPROT bit only.

Now user can manipulate any bit except size and addrinc fields.
Can be used e.g. to set bus signal 'cacheable' on Cortex-M7

Change-Id: Ia1c22b208e46d1653136f6faa5a7aaab036de7aa
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/4431
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
6 years agoAdd gdb_report_register_access_error command
Tim Newsome [Tue, 6 Mar 2018 22:10:04 +0000 (14:10 -0800)]
Add gdb_report_register_access_error command

With this option enabled (it's disabled by default) errors accessing
registers are returned to gdb. Otherwise they are ignored and success is
reported to gdb. (This is the current behavior.)

We want this for RISC-V, but there's still some cleanup that needs to be
done before that can be upstreamed.

Signed-off-by: Tim Newsome <tim@sifive.com>
Change-Id: I7e56109ea52d18b780c14a07fb35f9e6e8979da4
Reviewed-on: http://openocd.zylin.com/4452
Reviewed-by: Steven Stallion <sstallion@gmail.com>
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
Tested-by: jenkins
6 years agoarm_adi_v5: Add ability to ignore the CSYSPWRUPACK bit
Matthias Welwarsky [Tue, 3 Apr 2018 17:13:40 +0000 (19:13 +0200)]
arm_adi_v5: Add ability to ignore the CSYSPWRUPACK bit

The CTRL/STAT register in the ARM DAP DP has a debug power up
ack bit and a system power up ack bit. Some devices do not set
the system power up ack bit until sometime later. To avoid having
the initial target examination fail due to this or to have a
sticky bit error report claim power failure due to this a user
can now specify that this bit should be ignored.

Change-Id: I2451234bbe904984e29562ef6f616cc6d6f60732
Signed-off-by: Eric Katzfey <eric.katzfey@mentalbee.com>
Signed-off-by: Matthias Welwarsky <matthias.welwarsky@sysgo.com>
Reviewed-on: http://openocd.zylin.com/3710
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
6 years agoflash/nor/at91samd: Add "nvmuserrow" command.
Stefan Arnold [Tue, 17 Oct 2017 08:50:13 +0000 (10:50 +0200)]
flash/nor/at91samd: Add "nvmuserrow" command.

Add option "nvmuserrow" to "at91samd" for changing and reading the register at 0x804000 which represents various fuses.

Change-Id: I6382cc4ac15e6b9681e2f30b0ae60397a6289c3b
Signed-off-by: Stefan Arnold <sarnold@sh-sw.de>
Reviewed-on: http://openocd.zylin.com/4260
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
6 years agonrf51: Add HWID 0x008F again
Tomas Vanek [Tue, 27 Feb 2018 16:51:49 +0000 (17:51 +0100)]
nrf51: Add HWID 0x008F again

HWID originally added in commit 7829f31a6dd61297e97d8e94fe98a1658eac833e
was accidentally omited during refactoring in commit
52885d2b538dcd4184aae14cf2706fb97acccbd9

While on it move old ingeneering sample of 51822 to block of 51822 rev 1

Change-Id: Ie9f15563792a27a72e71df6edbcc6b04490370ed
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/4437
Tested-by: jenkins
6 years agodrivers/kitprog: workaround KitProg firmware bug of missing ZLP
Tomas Vanek [Wed, 21 Feb 2018 21:19:58 +0000 (22:19 +0100)]
drivers/kitprog: workaround KitProg firmware bug of missing ZLP

KitProg firmware does not send a zero length packet at the end of the bulk-in
transmission of a length divisible by a bulk packet size. This is inconsistent
with the USB specification and results in jtag_libusb_bulk_read()
waits forever when a transmission of specific size is received.

Limit bulk read size to expected number of bytes for problematic tranfer sizes.
Use 1 second timeout as the last resort.

Change-Id: Ice80306424afd76e9fbc6851911ffd5109c84501
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/4426
Tested-by: jenkins
Reviewed-by: Bohdan Tymkiv <bhdt@cypress.com>
6 years agotarget/cortex_m: avoid dwt comparator overflow
Cody P Schafer [Wed, 7 Mar 2018 16:31:35 +0000 (11:31 -0500)]
target/cortex_m: avoid dwt comparator overflow

Avoid ever overflowing the DWT_COMPARATOR array by allocating space for
16 comparators (the field is masked by 0xf).

On a stm32f767zi chip (on a nucleo-767zi board) I've been seeing crashes
with address sanitizer enabled due to its (apparent) 10 present
comparators. This appears to be due to
https://sourceforge.net/p/openocd/tickets/178/.

In non-address sanitizer builds, this would likely cause some random
memory to be written to in some cases. (see above bug for observations).

Change-Id: I2b7d599eb326236dbc93f74b350c442c9a502c4b
Signed-off-by: Cody P Schafer <openocd@codyps.com>
Reviewed-on: http://openocd.zylin.com/4458
Tested-by: jenkins
Reviewed-by: Christopher Head <chead@zaber.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
6 years agoFix for warnings detected by clang static analyzer
Michele Sardo [Thu, 22 Mar 2018 11:02:19 +0000 (12:02 +0100)]
Fix for warnings detected by clang static analyzer

Fix for potential memory leakage and for unused/unreported return error code

Change-Id: Ifb2c95b60637c3a241ad4bf41d1a328c92ccea4b
Signed-off-by: Michele Sardo <msmttchr@gmail.com>
Reviewed-on: http://openocd.zylin.com/4476
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
6 years agoflash/nor: implement flash bank deallocation in drivers with simple alloc
Tomas Vanek [Thu, 15 Feb 2018 09:25:50 +0000 (10:25 +0100)]
flash/nor: implement flash bank deallocation in drivers with simple alloc

All drivers which simply allocate one driver_priv memory block
per each bank now use default_flash_free_driver_priv()

Change-Id: I425bf4213c3632f02dbe11ab819c31eda9b2db62
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/4417
Tested-by: jenkins
Reviewed-by: Liviu Dudau <liviu@dudau.co.uk>
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
6 years agoxilinx-dna.cfg: generic tools for reading Xilinx Device DNA
Robert Jordens [Mon, 5 Feb 2018 11:54:29 +0000 (11:54 +0000)]
xilinx-dna.cfg: generic tools for reading Xilinx Device DNA

Most Xilinx FPGA devices contain an embedded, unique device identifier.
The identifier is nonvolatile, permanently programmed into the FPGA, and is
unchangeable providing a great serial / tracking number.

This commit adds generic support for reading the Xilinx Spartan 6 and 7
Series (Kintex, Artix, Ultrascale) Device DNA. The code is similar to
the function in fpga/xilinx-xc6s.cfg for Spartan 6 but the register
addresses are different and the logic has been simplified.

The code was not placed in xilinx-xc7.cfg. The approach of defining taps
in the same file as library code to use them is fundamentally broken on
boards that have more than one FPGA or other chips. This commit (like
the addition of support for Xilinx XADC) starts to remedy that by
splitting library code from board-specific fixed definitions.

The support code is sourced in the Kasli and KC705 board support files
as it was tested on these boards.

Change-Id: Iba559c7c1b7e93e1270535fd9e6650007f3794da
Signed-off-by: Robert Jordens <jordens@gmail.com>
Reviewed-on: http://openocd.zylin.com/4396
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
6 years agotcl/fpga/xilinx-xadc.cfg: add support for XADC
Robert Jordens [Mon, 29 Jan 2018 20:12:37 +0000 (21:12 +0100)]
tcl/fpga/xilinx-xadc.cfg: add support for XADC

The 7 Series FPGAs contain an on-chip 12 bit ADC that can probe die
temperature, internal power supply rail voltages as well as external
voltages. The XADC is available both from fabric as well as through the
JTAG TAP.

This code implements access throught the JTAG TAP.

https://www.xilinx.com/support/documentation/user_guides/ug480_7Series_XADC.pdf

Change-Id: I6cef4d0244add71749fa28b58a736302151cc4dd
Signed-off-by: Robert Jordens <jordens@gmail.com>
Reviewed-on: http://openocd.zylin.com/4395
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
6 years agojtag/core, target: unregister JTAG events
Tomas Vanek [Wed, 21 Mar 2018 23:20:15 +0000 (00:20 +0100)]
jtag/core, target: unregister JTAG events

Also call adapter_exit() before command_exit() as the latter releases
Jim interpreter so JTAG events should be released before.

Fixes memory leak reported by valgrind

Change-Id: I493f3fcba34ea2b4234148e79a4e329c866e0f05
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/4474
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
6 years agotarget: fix display halt message logic
Tomas Vanek [Thu, 22 Mar 2018 10:53:40 +0000 (11:53 +0100)]
target: fix display halt message logic

If a target is run from gdb and then stopped from OpenOCD telnet interface,
halt does not show message with status and PC registers.

While on it rename 'display' to 'verbose_halt_msg' and use bool type
instead of int.

Change-Id: Ibe6589015b302e0be97258b06938c297745436a5
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/4475
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
6 years agoflash/nor: implement flash bank deallocation on OpenOCD exit
Tomas Vanek [Thu, 15 Feb 2018 01:29:56 +0000 (02:29 +0100)]
flash/nor: implement flash bank deallocation on OpenOCD exit

Change-Id: I8fcf09b2a85b3b68743f5fd68a31edea933b9b17
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/4414
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
6 years agotcl/board: add support for Kasli
Robert Jordens [Mon, 15 Jan 2018 10:53:48 +0000 (10:53 +0000)]
tcl/board: add support for Kasli

Kasli is an open hardware FPGA board. It is part of the Sinara family of
devices designed to control quantum physics experiments (see Sayma_AMC
for other boards already suppported by openocd).

Kasli was developed as part of the opticlock project. It features a
Xilinx Artix 7 100T FPGA, DDR3 RAM, a clock reconstruction and
distribution network, four 6 Gb/s transceiver links (three SFP and
one SATA) as well as interfaces to up to 12 Eurocard Extension Modules
(EEMs).

https://github.com/m-labs/sinara/wiki/Kasli
http://www.opticlock.de/en/

Change-Id: I88b5e9f16b79e1e731056c45da6b5e1448d2c0e7
Signed-off-by: Robert Jordens <jordens@gmail.com>
Reviewed-on: http://openocd.zylin.com/4341
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
6 years agosayma_amc: add Sayma AMC board definition
Robert Jordens [Thu, 28 Sep 2017 12:40:47 +0000 (14:40 +0200)]
sayma_amc: add Sayma AMC board definition

Change-Id: I4a3dc5fe2d81b6906099af8cc1a360b3cf4a6b80
Signed-off-by: Robert Jordens <jordens@gmail.com>
Reviewed-on: http://openocd.zylin.com/4237
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
6 years agokcu105: add support for Xilinx KCU105
Robert Jordens [Thu, 3 Aug 2017 20:55:59 +0000 (22:55 +0200)]
kcu105: add support for Xilinx KCU105

* Development board with Kintex Ultrascale XCKU040
* Dual SPI 256 MBit flash, supported through xilinx_bscan_spi

Change-Id: I478ec7481beedd270bfba8af56a93301b0ee3028
Signed-off-by: Robert Jordens <jordens@gmail.com>
Reviewed-on: http://openocd.zylin.com/4189
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
6 years agoxilinx-xcu: add Xilinx Ultrascale tap data
Robert Jordens [Thu, 3 Aug 2017 10:25:07 +0000 (12:25 +0200)]
xilinx-xcu: add Xilinx Ultrascale tap data

The Ultrascale series is a bit more complicated to handle since with the
stacked and interconnected dies the IR gets longer. This adds support
for all currently known chips from the Ultrascale family.

Change-Id: Ibac325dd6fadc76f73cc682b1c62c1a5f39f0786
Signed-off-by: Robert Jordens <jordens@gmail.com>
Reviewed-on: http://openocd.zylin.com/4188
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
6 years agotarget: restructure dap support
Matthias Welwarsky [Fri, 23 Mar 2018 20:17:29 +0000 (21:17 +0100)]
target: restructure dap support

- add 'dap create' command to create dap instances
- move all dap subcmmand into the dap instance commands
- keep 'dap info' for convenience
- change all armv7 and armv8 targets to take a dap
  instance instead of a jtag chain position
- restructure tap/dap/target relations, jtag tap no
  longer references the dap, daps are now independently
  created and initialized.
- clean up swd connect
- re-initialize DAP also on JTAG errors (e.g. after reset,
  power cycle)
- update documentation
- update target files

Change-Id: I322cf3969b5407c25d1d3962f9d9b9bc1df067d9
Signed-off-by: Matthias Welwarsky <matthias.welwarsky@sysgo.com>
Reviewed-on: http://openocd.zylin.com/4468
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
6 years agotcl/board: add configuration for the avnet ultrazed-eg starter kit
Matthias Welwarsky [Tue, 13 Mar 2018 16:03:38 +0000 (17:03 +0100)]
tcl/board: add configuration for the avnet ultrazed-eg starter kit

also contains target configuration for the Xilinx UltraScale+
platform

Change-Id: I6300cbc85c1ed71df71d8aaca59500bbf18f0093
Signed-off-by: Matthias Welwarsky <matthias.welwarsky@sysgo.com>
Reviewed-on: http://openocd.zylin.com/4467
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
6 years agoarm_cti: add cti command group
Matthias Welwarsky [Mon, 10 Apr 2017 20:53:27 +0000 (22:53 +0200)]
arm_cti: add cti command group

Extend the CTI abstraction to be accessible from TCL and
change the 'target' command to accept a cti 'object' instead of a
base address. This also allows accessing CTI instances that are not
related to a configured target.

Change-Id: Iac9ed0edca6f1be00fe93783a35c26077f6bc80a
Signed-off-by: Matthias Welwarsky <matthias.welwarsky@sysgo.com>
Reviewed-on: http://openocd.zylin.com/4031
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
6 years agoaarch64: add cpsr bitfields to target description
Matthias Welwarsky [Wed, 7 Mar 2018 20:14:24 +0000 (21:14 +0100)]
aarch64: add cpsr bitfields to target description

provide meta information for the cpsr so gdb can display the status
flags and not only a hexadecimal number

Change-Id: I9d3fb29153780adbea389d7e4175d5e19bddc256
Signed-off-by: Matthias Welwarsky <matthias.welwarsky@sysgo.com>
Reviewed-on: http://openocd.zylin.com/4460
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
6 years agotdesc: bitfields may carry a type
Matthias Welwarsky [Thu, 8 Mar 2018 13:40:10 +0000 (14:40 +0100)]
tdesc: bitfields may carry a type

a bitfield may carry a type (bool or int), add support for that.

Change-Id: Ic831a9b8eac8579e8fdd7d0f01b7f1c9259e6739
Signed-off-by: Matthias Welwarsky <matthias.welwarsky@sysgo.com>
Reviewed-on: http://openocd.zylin.com/4459
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
6 years agotransport: add transport_is_hla()
Tomas Vanek [Thu, 15 Mar 2018 19:02:10 +0000 (20:02 +0100)]
transport: add transport_is_hla()

and move declaration of all transport_is_xxx() functions to transport.h

Change-Id: Ib229115b5017507b49655bc43b517ab6fb32f7a6
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/4469
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
6 years agoserver: bind to IPv4 localhost by default
Paul Fertser [Sat, 13 Jan 2018 13:22:10 +0000 (16:22 +0300)]
server: bind to IPv4 localhost by default

Since OpenOCD basically allows to perform arbitrary actions on behalf of
the running user, it makes sense to restrict the exposure by default.

If you need network connectivity and your environment is safe enough,
use "bindto 0.0.0.0" to switch to the old behaviour.

Change-Id: I4a4044b90d0ecb30118cea96fc92a7bcff0924e0
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/4331
Reviewed-by: Jonathan McDowell <noodles-openocd@earth.li>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
6 years agoaarch64: fix debug entry from EL0
Matthias Welwarsky [Mon, 12 Mar 2018 15:56:05 +0000 (16:56 +0100)]
aarch64: fix debug entry from EL0

If we enter debug state from EL0, some registers are not accessible.
Temporarily move to EL1H and back to gain access. Also, fix
armv8_dpm_modeswitch() to not immediately restore the previous state
on elevating the privilege level.

Change-Id: Ic2a92109230ff4eb6834c00ef544397a5b7ad56a
Signed-off-by: Matthias Welwarsky <matthias.welwarsky@sysgo.com>
Reviewed-on: http://openocd.zylin.com/4461
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
6 years agogdb_server: fake step if thread is not current rtos thread
Matthias Welwarsky [Mon, 5 Mar 2018 13:50:51 +0000 (14:50 +0100)]
gdb_server: fake step if thread is not current rtos thread

gdb assumes that a rtos can make any thread active at will in response
to a 'Hg' packet. It further assumes that it needs to step-over after
setting a breakpoint on frame #0 of any non-current thread. Both
assumptions are not valid for an actual rtos. We fake the step-over to
not trigger an internal error in gdb. See
https://sourceware.org/bugzilla/show_bug.cgi?id=22925 for details.

Change-Id: Ida60cd134033c1d58ada77b87fe664a58f61e2c0
Signed-off-by: Matthias Welwarsky <matthias.welwarsky@sysgo.com>
Reviewed-on: http://openocd.zylin.com/4448
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
6 years agogdb_server: fix ignored interrupt request from gdb during stepping
Matthias Welwarsky [Sun, 4 Mar 2018 17:52:14 +0000 (18:52 +0100)]
gdb_server: fix ignored interrupt request from gdb during stepping

Normally, when a ctrl-c is received from gdb, a SIGINT is reported back
unconditionally to tell gdb that the target has stopped in response.
However when a rtos support was configured, the rtos awareness overwrote
the signal with an actual thread state, which gdb then ignored and got
stuck without the user able to interrupt.

Change-Id: I40fd62333e020a8c4d9df0079270e84df9c77f88
Signed-off-by: Matthias Welwarsky <matthias.welwarsky@sysgo.com>
Reviewed-on: http://openocd.zylin.com/4445
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
6 years agogdb_server: prevent false positive valgrind report
Tomas Vanek [Fri, 16 Feb 2018 10:58:10 +0000 (11:58 +0100)]
gdb_server: prevent false positive valgrind report

Change-Id: Ia59fdf8a23043889840122859b0c5bdb5f757703
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/4420
Tested-by: jenkins
6 years agodrivers/ftdi: free allocated memory
Tomas Vanek [Fri, 16 Feb 2018 08:13:36 +0000 (09:13 +0100)]
drivers/ftdi: free allocated memory

Also uses calloc() for mpsse_ctx->write_buffer to prevent a false
positive valgrind report
"Syscall param ioctl(USBDEVFS_SUBMITURB).buffer points to uninitialised bytes(s)"

Change-Id: I91963371d15c21ea0fee4c40c1da86174db44520
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/4418
Tested-by: jenkins
6 years agosrc/jtag/hla: free allocated memory in hl_interface_quit()
Tomas Vanek [Thu, 15 Feb 2018 09:24:15 +0000 (10:24 +0100)]
src/jtag/hla: free allocated memory in hl_interface_quit()

Change-Id: If6ead00e47021c88e4c106b4aeaf038db87ff50b
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/4413
Tested-by: jenkins
6 years agotarget/target: free what leaked in target_destroy()
Tomas Vanek [Thu, 15 Feb 2018 00:24:50 +0000 (01:24 +0100)]
target/target: free what leaked in target_destroy()

Free event_action, fileio_info and working area.

Change-Id: Iac81230423e92304b8e2c971d0ec71a96b693fc4
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/4412
Tested-by: jenkins
6 years agojtag/core: free all taps and daps in adapter_quit()
Tomas Vanek [Wed, 14 Feb 2018 23:56:44 +0000 (00:56 +0100)]
jtag/core: free all taps and daps in adapter_quit()

Change-Id: I74496f6ddfb0a72b2933e8d682a73a694b8d107b
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/4411
Tested-by: jenkins
6 years agoserver: free strduped port numbers
Tomas Vanek [Wed, 14 Feb 2018 23:22:42 +0000 (00:22 +0100)]
server: free strduped port numbers

Although the leak is negligible, the clean heap on exit will ease
valgrind testing.

Change-Id: I3a7a9c8e8dc7557aa51d0b9caa244537e5e7007d
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/4410
Tested-by: jenkins
6 years agoopenocd.c: call server_quit() for cmd line with -c shutdown
Tomas Vanek [Wed, 14 Feb 2018 21:53:14 +0000 (22:53 +0100)]
openocd.c: call server_quit() for cmd line with -c shutdown

If OpenOCD command line contains -c shutdown, server_quit() is not called.
Though if -c init is also on command line, gdb_server is already initialized.

Call server_quit() on both successful and failure exit from command line.

Change-Id: I6df41c5df045b61d84a5515d1abaa5dc96bc30ac
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/4409
Tested-by: jenkins
6 years agotcl/target: warn if a Kinetis MCU is connected to a high level adapter
Tomas Vanek [Sat, 10 Feb 2018 17:51:40 +0000 (18:51 +0100)]
tcl/target: warn if a Kinetis MCU is connected to a high level adapter

Make sure the user is aware he can lock the device though unlock is not
possible without access to MDM-AP.

Change-Id: I92676530e95d19489c6739748a99c2895849f90f
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/4403
Tested-by: jenkins
6 years agodoc: fix xref texinfo warning
Paul Fertser [Tue, 13 Mar 2018 10:48:25 +0000 (13:48 +0300)]
doc: fix xref texinfo warning

Change-Id: Iff1ba5836e3a4f352903c3a5ae73c7d992306d42
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/4466
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
6 years agodoc: make gdb-attach description understandable
Tomas Vanek [Tue, 13 Mar 2018 09:30:59 +0000 (10:30 +0100)]
doc: make gdb-attach description understandable

Change-Id: I31babf4e3bbe7c94f26818d938699562a4a26d48
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/4465
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
6 years agojtag: drivers: add support for FT232R sync bitbang JTAG interfaces
Matej Kogovsek [Sun, 3 Sep 2017 10:19:41 +0000 (12:19 +0200)]
jtag: drivers: add support for FT232R sync bitbang JTAG interfaces

Change-Id: Ib88a9e270f5c2a50902a137bcc97fdefd5aad1c6
Signed-off-by: Matej Kogovsek <matej@hamradio.si>
Reviewed-on: http://openocd.zylin.com/4215
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
6 years agotarget: hla: check return value of hl_dcc_read
Paul Fertser [Sat, 13 Jan 2018 14:15:29 +0000 (17:15 +0300)]
target: hla: check return value of hl_dcc_read

This should fix "Assigned value is garbage or undefined" warning
reported by clang:
http://build.openocd.org/job/openocd-clang/doclinks/1/report-391318.html

Change-Id: Ib9488fadca871814328501e415f88822291e0c96
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/4332
Tested-by: jenkins
6 years agotarget: arm: disassembler: fix Thumb2 BLX decoding address
Paul Fertser [Sun, 28 Jan 2018 12:48:46 +0000 (15:48 +0300)]
target: arm: disassembler: fix Thumb2 BLX decoding address

Since BLX in Thumb2 always switches mode to ARM, the PC needs to be
4-bytes aligned.

Change-Id: I4f4c194fe21093cecfd9872e1d30588f4adc7257
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/4382
Reviewed-by: Philipp Guehring <pg@futureware.at>
Tested-by: jenkins
Reviewed-by: Paul Sokolovsky <pfalcon@users.sourceforge.net>
6 years agotcl: interface: usb blaster I: specify driver explicitly
Paul Fertser [Sat, 27 Jan 2018 17:23:24 +0000 (20:23 +0300)]
tcl: interface: usb blaster I: specify driver explicitly

When a user asks for blaster I, he or she should either get it, or get
an error, not blaster II driver.

Change-Id: Ibc7683676ce42773e2b14ea5ccb3d119d1e6acea
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/4381
Tested-by: jenkins
6 years agosvf: improve robustness when processing invalid SVF files
Paul Fertser [Thu, 18 Jan 2018 08:59:10 +0000 (11:59 +0300)]
svf: improve robustness when processing invalid SVF files

Uninitialized argument value warnings reported by clang static
analizer.

Change-Id: I30af4900f517ffc0a7282689b58c7a224cdc080a
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/4356
Tested-by: jenkins
6 years agoHACKING: clarify linking identities procedure
Paul Fertser [Thu, 18 Jan 2018 08:39:52 +0000 (11:39 +0300)]
HACKING: clarify linking identities procedure

Change-Id: I89e93002181926eec5fc5a339765b773559a8ff1
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/4354
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>