]> git.sur5r.net Git - openocd/log
openocd
9 years agortos: fix print format specifiers
Paul Fertser [Mon, 20 Apr 2015 09:02:48 +0000 (12:02 +0300)]
rtos: fix print format specifiers

Exposed by arm-none-eabi build.

Change-Id: I657c642249aa83403f93132d1e28713aee692c30
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2724
Tested-by: jenkins
9 years agoconfigure the SWD frequency when setting adapter speed in SWD mode for versaloon
Simon Qian [Mon, 16 Mar 2015 16:11:09 +0000 (00:11 +0800)]
configure the SWD frequency when setting adapter speed in SWD mode for versaloon

Change-Id: I99cdc11ba1442e4c9efaa0f1de8e7089ec725e14
Signed-off-by: Simon Qian <openocd@versaloon.com>
Reviewed-on: http://openocd.zylin.com/2608
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agoflash: at91samd: add SAML21 support, fix part ID issue
Andrey Yurovsky [Mon, 30 Mar 2015 19:50:13 +0000 (12:50 -0700)]
flash: at91samd: add SAML21 support, fix part ID issue

This adds support for the new Atmel SAML21 family of low-power Cortex
M0+ devices.  Their Flash controller is essentially the SAMDxx one so
the change consists of adding the new part IDs.  Unfortunately the
device ID logic had a couple of mistakes in it that did not affect
anything on SAMD2x devices (due to 0 values expected there) but that is
a problem on L21, it's therefore addressed here and things should now
match the datasheets.

Tested on Amtel SAML21 Xplained Pro development kit against the included
SAML21J18A there.  Also tested for regressions on a SAMD20 and SAMD21
using their dev kits.

Change-Id: I768f75e064b8656c15148730dacaa4c3acfc4101
Signed-off-by: Andrey Yurovsky <yurovsky@gmail.com>
Reviewed-on: http://openocd.zylin.com/2690
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
9 years agostlink_usb.c: Decode some more errors.
Uwe Bonnes [Thu, 9 Apr 2015 13:55:17 +0000 (15:55 +0200)]
stlink_usb.c: Decode some more errors.

Change-Id: I637cb63bd39120554aa184eaa48fd00a4852359f
Signed-off-by: Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de>
Reviewed-on: http://openocd.zylin.com/2706
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agoflash/nor/mdr: add docs, remove memory leak on probe()
Paul Fertser [Sat, 4 Apr 2015 08:08:15 +0000 (11:08 +0300)]
flash/nor/mdr: add docs, remove memory leak on probe()

This adds the mandatory Info documentation for the driver as well as
the usage field.

As a clean up, this also includes freeing of the allocated memory
which results in a memory leak if probe is invoked multiple times.

Valgrind-tested.

Reported by Dmitry Shpak.

Change-Id: I2b1d9b9e8b069c6665b11d880b40ce19a1b26ce6
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2694
Tested-by: jenkins
Reviewed-by: Дмитрий Шпак <disona@yandex.ru>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agoflash: efm32: Add support for EZR32LG and EZR32WG.
Marc Schink [Wed, 8 Apr 2015 08:55:22 +0000 (10:55 +0200)]
flash: efm32: Add support for EZR32LG and EZR32WG.

This patch was tested with an EZR32WG Starter Kit.

Change-Id: I0f7c619e715fe30e88e6da3bead0806dd3bce819
Signed-off-by: Marc Schink <openocd-dev@marcschink.de>
Reviewed-on: http://openocd.zylin.com/2700
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agodocs: update OpenOCD url's to openocd.org domain
Spencer Oliver [Tue, 7 Apr 2015 08:40:53 +0000 (09:40 +0100)]
docs: update OpenOCD url's to openocd.org domain

Change-Id: I8b55c8d12773a1c36f2fd2afeecf20a74e890064
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/2698
Tested-by: jenkins
9 years agocmsis-dap: print vendor and product id on open failure
Spencer Oliver [Fri, 10 Apr 2015 10:46:22 +0000 (11:46 +0100)]
cmsis-dap: print vendor and product id on open failure

Change-Id: Iae7ed8d59a722b805536550a8033f5fb7c85c5fc
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/2708
Tested-by: jenkins
Reviewed-by: Andrey Yurovsky <yurovsky@gmail.com>
9 years agodoc/openocd.texi: fix formatting for mrvlqspi driver documentation
Mahavir Jain [Thu, 9 Apr 2015 13:14:05 +0000 (18:44 +0530)]
doc/openocd.texi: fix formatting for mrvlqspi driver documentation

* also included example for flash usage information

Change-Id: Icf9defc25d38bf24567b1708138b83a8de1e0497
Signed-off-by: Mahavir Jain <mjain@marvell.com>
Reviewed-on: http://openocd.zylin.com/2705
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
9 years agotcl/target/stm32f3: fix reset init for stlink
Paul Fertser [Thu, 9 Apr 2015 12:20:22 +0000 (15:20 +0300)]
tcl/target/stm32f3: fix reset init for stlink

Use mmw to manipulate only selected bits of the word. msb and mwb verify the
memory location and may error on PLLRDY set as a result of PLLON written.

Change-Id: I9a4c1e58f002a1e5e99be1bd34aac27ba65d111d
Reported-by: Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2702
Tested-by: jenkins
9 years agocontrib/itmdump: add a hack to allow direct dumping of specific SWIT, fix timestamp
Paul Fertser [Mon, 9 Feb 2015 13:51:33 +0000 (16:51 +0300)]
contrib/itmdump: add a hack to allow direct dumping of specific SWIT, fix timestamp

Currently itmdump is not a production-quality code hence this hack
seems to be appropriate.

More robust handling is possible with libswo-based swodec tool that's
available from http://git.zapb.de/ .

This adds a new command line option -d N where N is a stimulus number
you want to dump (counting from 1).

The idea here is that if you're interested to live-monitor just a
single stimulus port, you can use this utility directly. If one wants
to demultiplex the TPIU stream, the following is proposed:

1. Use https://gitorious.org/multiplex/multiplex utility that can
accept binary data from a file/pipe/stdin and arbitrary number of TCP
connections. It simply mirrors all the incoming data to all the
accepted connections;

2. Use socat to connect itmdump to the proxy mentioned in 1. and then
either dump the results to separate files or share via their dedicated
TCP ports.

Example script (inspired by http://openocd.zylin.com/#/c/1662/ ,
enables and disables specific itm ports on demand):

for i in `seq 0 31`; do
  while true; do
    socat -U TCP-LISTEN:$((8000+$i)),reuseaddr \
             SYSTEM:"echo itm port $i on | nc -q0 localhost 4444 > /dev/null; nc localhost 7777 | stdbuf -oL itmdump -d$((i+1))"
    echo itm port $i off | nc -q0 localhost 4444 > /dev/null
  done < /dev/null >&0 2>&0 &
done

Change-Id: Iaeb102436eaa5b106002083f2ffe758fb7bd83e5
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2537
Tested-by: jenkins
9 years agoFix several format specifiers errors exposed by arm-none-eabi
Paul Fertser [Sun, 15 Mar 2015 07:18:55 +0000 (10:18 +0300)]
Fix several format specifiers errors exposed by arm-none-eabi

Change-Id: I1fe5c5c0b22cc23deedcf13ad5183c957551a1b7
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2719
Tested-by: jenkins
9 years agoboard: ti_am43xx_evm: remove xds100v2 interface
Felipe Balbi [Wed, 18 Mar 2015 18:12:48 +0000 (13:12 -0500)]
board: ti_am43xx_evm: remove xds100v2 interface

GP and EPOS EVMs do not provide xds100v2 on board,
rather they have a pin header which can be used
to attach any debug pod the user might want.

Change-Id: I61678c50900fbe0fab500ea42f85ecde7a490ded
Reported-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Reviewed-on: http://openocd.zylin.com/2618
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
9 years agortos: add instructions and helper code to make FreeRTOS work again
Andreas Fritiofson [Thu, 16 Apr 2015 11:08:14 +0000 (13:08 +0200)]
rtos: add instructions and helper code to make FreeRTOS work again

Run-time tested with FreeRTOS V8.1.2 (current version).

For the time being I propose this way of dealing with RTOSes that do
not export necessary information on their own.

I also suggest implementing a similar scheme for ChibiOS, exporting
the necessary struct fields' offsets via an OpenOCD-specific helper.

Change-Id: Iacf8b88004d62206215fe80011fd7592438446a3
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/2347
Tested-by: jenkins
9 years agoFreeRTOS: Make optional symbols optional
Andreas Fritiofson [Thu, 16 Apr 2015 08:56:47 +0000 (10:56 +0200)]
FreeRTOS: Make optional symbols optional

xSuspendedTaskList and xTasksWaitingTermination are only available for
some configurations. Missing optional symbols will have their addresses
remaining at zero so the corresponding lists will be skipped when
building the task list.

Change-Id: If330f5038d009298c3a14a4d2756db7105a30bc8
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/2425
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
9 years agoAT91SAM4L: handle reset run/halt in SMAP
Tomas Vanek [Sat, 14 Mar 2015 11:03:47 +0000 (12:03 +0100)]
AT91SAM4L: handle reset run/halt in SMAP

This is a remake of http://openocd.zylin.com/1966
originally written by Angus Gratton <gus@projectgus.com>

ATSAM4L has a "System Manager Access Port" (SMAP) that holds the CPU
in reset if TCK is low when srst (RESET_N) is deasserted.
Without this change any use of sysresetreq or srst locks the chip
in reset state until power is cycled.

A new function smap_reset_deassert is called as reset-deassert-post event handler.
It optionally prepares reset vector catch and SMAP reset is released then.

Change-Id: Iad736357b0f551725befa2b9e00f3bc54504f3d8
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/2604
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
9 years agotarget/arm_adi_v5, cortex_m: retry ahbap_debugport_init few times in case of an error
Paul Fertser [Fri, 13 Mar 2015 14:55:51 +0000 (17:55 +0300)]
target/arm_adi_v5, cortex_m: retry ahbap_debugport_init few times in case of an error

Some targets need arbitrary amount of time (usually not too long)
after reset (both sysresetreq and srst) to do initialisation, and
SWD/JTAG is not available during that. According to PSoC4 docs, the
debugger should try connecting until it succeeds.

Also ahbap_debugport_init might be necessary to perform after using
hardware srst too, so add it there (except for the targets that
support srst_nogate since they are very unlikely to need it).

Change-Id: I3598d5ff7b8e0bf3a5566a57dec4b0b2b243d297
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2601
Tested-by: jenkins
9 years agotarget/cortex_a: emit a clear error message when dbgbase can't be detected
Paul Fertser [Sat, 14 Mar 2015 05:15:12 +0000 (08:15 +0300)]
target/cortex_a: emit a clear error message when dbgbase can't be detected

In some cases (the most obvious are TI's SoCs) ROM table lacks entries
for the cores, so OpenOCD has no way to determine what debug base to
use. Due to an error fixed in ec9ccaa28849 it wasn't handled properly,
and OpenOCD would continue to try using dbgbase = 0, which happened to
work for e.g. AM437x.

This patch adds a clear indication to the user that to access such a
target, dbgbase must be set manually in the config.

Reported by Felipe Balbi on IRC.

Change-Id: Id8533e708f44b76550eb8b659564f5f45717c298
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2603
Tested-by: jenkins
9 years agoflash/nor/lpc2000: free allocated working area when target_write fails
Paul Fertser [Sat, 4 Apr 2015 21:16:59 +0000 (00:16 +0300)]
flash/nor/lpc2000: free allocated working area when target_write fails

In some circumstances (e.g. inappropriate jtag clock)
target_write_memory in lpc2000_iap_working_area_init might fail. The
allocated working area should be freed inside
lpc2000_iap_working_area_init in this error case.

This was leading to a weird segfault due to stack corruption later
when reset was executed.

Reported by quitte (Jonas Meyer).

Change-Id: Ia2ed42a9970a4d771727fd516a6eea88e9b859e2
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2696
Tested-by: jenkins
9 years agojtag/adi_v5_jtag: fix infinite recursion in jtagdp_transaction_endcheck()
Paul Fertser [Mon, 6 Apr 2015 13:04:05 +0000 (16:04 +0300)]
jtag/adi_v5_jtag: fix infinite recursion in jtagdp_transaction_endcheck()

Calling ahbap_debugport_init() is wrong here because the actions
performed by it might lead to jtagdp_transaction_endcheck errors thus
leading to infinite recursion.

The removed code is not needed now because target polling should lead
to reexamination automatically, and both cortex_a and cortex_m call
ahbap_debugport_init() as part of their target examine handler.

This was reported as a real life issue on IRC by Weaselweb with
Cortex-A target. Quitte reports similar results in some circumstances
(adapter_khz too high) with LPC17xx.

Change-Id: I7148022f76a1272b5262d251f2e807ffb1543547
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2697
Tested-by: jenkins
9 years agoflash/nor/lpc2000: properly free working area used in get_lpc2000_part_id()
Paul Fertser [Sat, 4 Apr 2015 17:50:37 +0000 (20:50 +0300)]
flash/nor/lpc2000: properly free working area used in get_lpc2000_part_id()

The IAP working area needs to be freed here, just like in all the
other driver functions since an automatic local variable is used to
store a pointer to it.

This was reported by quitte (Jonas Meyer) on IRC as a strange totally
unrelated segfault after doing certain operations (leading to target
reset) from GDB. He has provided me with remote access to the specific
machine and configuration that exposed the issue, and after some
debugging it became apparent that a auto local variable (holding the
gdb connection pointer) gets overwritten somehow. Placing an
appropriate breakpoint just before the event and using a watchpoint
made the cause apparent: reset lead to freeing of all working areas,
and there was one holding a pointer to a variable that was auto local
in get_lpc2000_part_id().

Change-Id: I7e634d890135ca0f3b4b311e09e8385a03982bd6
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2695
Tested-by: jenkins
9 years agojtag/startup.tcl: fix regression with autoselecting JTAG
Paul Fertser [Fri, 3 Apr 2015 04:55:50 +0000 (07:55 +0300)]
jtag/startup.tcl: fix regression with autoselecting JTAG

This regression was introduced with d90b86d8. "transport select" doesn't
throw an error anymore and autoselects the first available transport on
its own.

Reported by moyix on IRC.

Change-Id: I3f303c0372e915931cca4b28af450694abc1a63e
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2693
Tested-by: jenkins
9 years agoChibiOS: fix crash on auto detection
Richard Braun [Wed, 11 Mar 2015 13:04:15 +0000 (14:04 +0100)]
ChibiOS: fix crash on auto detection

The detection framework assumes rtos->symbols is dynamically allocated,
an assumption that the ChibiOS variant breaks by providing a raw statically
allocated symbol list.

Change-Id: I379bcc2af99006912608ddd3f646ff7085606f47
Signed-off-by: Richard Braun <rbraun@sceen.net>
Reviewed-on: http://openocd.zylin.com/2597
Tested-by: jenkins
Reviewed-by: Stian Skjelstad <stian@nixia.no>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
9 years agoTcl exception codes cleanup, shutdown command amendments
Paul Fertser [Fri, 13 Mar 2015 13:32:53 +0000 (16:32 +0300)]
Tcl exception codes cleanup, shutdown command amendments

This patch might influence openocd Tcl commands behaviour in subtle
ways, please give it a nice testing.

The idea is that if an OpenOCD Tcl command returns an error, an
exception is raised, and then the return code is propogated all the
way up (or to the "catch" if present). This allows to detect
"shutdown" which is not actually an error but has to raise an
exception to stop execution of the commands that follow it in the
script.

openocd_thread special-cases shutdown because it should then terminate
OpenOCD with a success error code, unless shutdown was called with an
optional "error" argument which means terminate with a non-zero exit
code.

Change-Id: I7b6fa8a2e24c947dc45d8def0008b4b007c478b3
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2600
Tested-by: jenkins
Reviewed-by: Juha Niskanen <juha.niskanen@haltian.com>
Reviewed-by: Jens Bauer <jens@gpio.dk>
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
9 years agohelper: shutdown command should return with 0 exit status
Juha Niskanen [Mon, 9 Mar 2015 11:28:34 +0000 (13:28 +0200)]
helper: shutdown command should return with 0 exit status

Commit a35712a85c42 caused a regression where command

openocd -c "echo a1; shutdown; echo a2"

always returned non-zero exit status to operating system,
even when commands before shutdown all succeeded. This patch
attempt to fix this.

Change-Id: I3f478c2c51d100af810ea0171d2fd4c8fcc657f3
Signed-off-by: Juha Niskanen <juha.niskanen@haltian.com>
Reviewed-on: http://openocd.zylin.com/2589
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
9 years agojtag/tcl: fix incorrect memcpy in jim_newtap_expected_id
Paul Fertser [Thu, 26 Feb 2015 17:18:38 +0000 (20:18 +0300)]
jtag/tcl: fix incorrect memcpy in jim_newtap_expected_id

Found by clang static checker.

On the very first call of jim_newtap_expected_id() pTap->expected_ids
and expected_len are null, and there's nothing to copy. This patch
changes this cryptic code to use realloc() instead.

Change-Id: Ic0b5140d08257a906f15b55a2ae64db7bc06d5f1
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2562
Reviewed-by: Stian Skjelstad <stian@nixia.no>
Tested-by: jenkins
9 years agoturtelizer2-revC: Tested with real hardware.
Uwe Bonnes [Sat, 7 Mar 2015 21:59:37 +0000 (22:59 +0100)]
turtelizer2-revC: Tested with real hardware.

Also some hints around deprecated tcl/interface/turtelizer2.cfg added.

Change-Id: Ifa57b49febffaeddd5d8ff0a48833d3544927b10
Signed-off-by: Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de>
Reviewed-on: http://openocd.zylin.com/2584
Tested-by: jenkins
Reviewed-by: Harald Kipp
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
9 years agolpc2000: Removed cmd51_can_xxxxb variables.
Nemui Trinomius [Mon, 16 Mar 2015 15:00:40 +0000 (00:00 +0900)]
lpc2000: Removed cmd51_can_xxxxb variables.

Current flash driver can fail to write across the sector boundary.
This patch fixes "thisrun_bytes" set to "cmd51_dst_boundary" value instead of "cmd51_can_xxxxb"

Referred to SevenW's post and fix,thanks.
http://sourceforge.net/p/openocd/mailman/openocd-devel/thread/fa32e7d6654df22470dc5f4a3dbc984a%40familiebenschop.nl/#msg33594152

Tested on below listed chips.
LPC810,LPC811,LPC812,LPC824,LPC1115,LPC1343,LPC1347,LPC1227,
LPC1769,LPC1788,LPC54102,LPC4088 and LPC2388.

Change-Id: If1c6a1daa58ca27c405bd959a784e599a7a8f4d4
Signed-off-by: Nemui Trinomius <nemuisan_kawausogasuki@live.jp>
Reviewed-on: http://openocd.zylin.com/2607
Tested-by: jenkins
Reviewed-by: Jens Bauer <jens@gpio.dk>
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
9 years agotcl/board: Add Infineon XMC 2Go config
Andreas Färber [Fri, 27 Feb 2015 23:37:44 +0000 (00:37 +0100)]
tcl/board: Add Infineon XMC 2Go config

Tested with "J-Link Lite-XMC4200 Rev.1 compiled Jan 10 2014 20:31:33".

Change-Id: Iefa9185372341d889db2b5f1f93bce126450b535
Cc: Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Reviewed-on: http://openocd.zylin.com/2564
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agoAdded Atmel SAM4SA16C chip (chip ID 0x28a70ce0).
Patrick Noffke [Mon, 23 Mar 2015 18:11:24 +0000 (13:11 -0500)]
Added Atmel SAM4SA16C chip (chip ID 0x28a70ce0).

Change-Id: I45e8e807a36c39940b910b3edb40698c7d8dabd6
Signed-off-by: Patrick Noffke <patrick@noffke.me>
Reviewed-on: http://openocd.zylin.com/2625
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agotcl/board: Add Infineon XMC1100 Boot Kit config
Andreas Färber [Sun, 18 Jan 2015 00:28:20 +0000 (01:28 +0100)]
tcl/board: Add Infineon XMC1100 Boot Kit config

Tested with "J-Link Lite-XMC4200 Rev.1 compiled Jul 18 2014 17:28:26".

Change-Id: Icc03172cefe38f2217bf44a73f94f8a6fb93dfba
Signed-off-by: Andreas Färber <afaerber@suse.de>
Reviewed-on: http://openocd.zylin.com/2472
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agotcl/target: Add Infineon XMC1000 family target config
Andreas Färber [Sun, 18 Jan 2015 00:02:48 +0000 (01:02 +0100)]
tcl/target: Add Infineon XMC1000 family target config

Basic target config, verified against XMC1100 AA/AB, XMC1200 AA/AB,
XMC1300 AA/AB manuals.

The default adapter_khz was tested with the XMC1100 Boot Kit.

Change-Id: Iff6ed52d875ccb83c0d4ff0d555b90e0f28b860c
Signed-off-by: Andreas Färber <afaerber@suse.de>
Reviewed-on: http://openocd.zylin.com/2471
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agotcl/board: Add Spansion SK-FM4-176L-S6E2CC config
Andreas Färber [Sun, 1 Mar 2015 20:35:12 +0000 (21:35 +0100)]
tcl/board: Add Spansion SK-FM4-176L-S6E2CC config

Works best after update to firmware v2.3.

Change-Id: Id2d3a0ae28bba014ee5338df9280fe39773c3398
Signed-off-by: Andreas Färber <afaerber@suse.de>
Reviewed-on: http://openocd.zylin.com/2570
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agotcl/target: Add Spansion FM4 config
Andreas Färber [Sun, 1 Mar 2015 19:38:36 +0000 (20:38 +0100)]
tcl/target: Add Spansion FM4 config

Assembled by trial-and-error for an S6E2CC.

Change-Id: I317c12d24c9075ce3de286455fa3ee45731c5c81
Signed-off-by: Andreas Färber <afaerber@suse.de>
Reviewed-on: http://openocd.zylin.com/2569
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agostartup: Fixed measure_clk to return kHz instead of MHz.
Ed Beroset [Tue, 3 Mar 2015 20:01:38 +0000 (15:01 -0500)]
startup: Fixed measure_clk to return kHz instead of MHz.

The original code had iterated 10,000,000 times and taken the elapsed
time divided by 10,000, to yield kHz which is mathematically correct
only if we were measuring time in seconds, but we are measuring time in
 milliseconds, so the correct divisor is actually 10,000,000.  Previous
code would report 0.500 for actual measured speed of 500 kHz.

Change-Id: Iba4c4961fe3973e7ccfa6dfa11d606a966ceb50c
Signed-off-by: Ed Beroset <beroset@ieee.org>
Reviewed-on: http://openocd.zylin.com/2573
Tested-by: jenkins
Reviewed-by: Jens Bauer <jens@gpio.dk>
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
9 years agoem357: Corrected EM357 support including errata details
Ed Beroset [Fri, 6 Mar 2015 01:43:09 +0000 (20:43 -0500)]
em357: Corrected EM357 support including errata details

Original submitted code had only been tested with em358, but testing with
actual em357 revealed errors that this patch corrects.

Change-Id: I70cf31210de8ed84e3755a56e76261ad200322bb
Signed-off-by: Ed Beroset <beroset@ieee.org>
Reviewed-on: http://openocd.zylin.com/2581
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agoCortex-A: Don't flush the data/unified cache if MMU is off
Uwe Kleine-König [Mon, 8 Dec 2014 10:42:04 +0000 (11:42 +0100)]
Cortex-A: Don't flush the data/unified cache if MMU is off

When the SCTLR has C set but M unset (i.e. Caching on, but MMU off) the cache
if effectively off. So only flush the cache if MMU is on, otherwise stale
entries might be committed to memory.

Change-Id: Iaff8b6f25b7a41ba838b91d45684c98f99fc0b27
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-on: http://openocd.zylin.com/2429
Tested-by: jenkins
Reviewed-by: Christopher Head <chead@zaber.com>
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-by: Vladimir Svoboda <ze.vlad@gmail.com>
9 years agoRTOS: Add logging to FreeRTOS and general RTOS
Evan Hunter [Fri, 21 Nov 2014 17:07:43 +0000 (17:07 +0000)]
RTOS: Add logging to FreeRTOS and general RTOS

Change-Id: I43d14f3b59daae7f90c344abdf71eaa8f74ef7ef
Signed-off-by: Evan Hunter <ehunter@broadcom.com>
Reviewed-on: http://openocd.zylin.com/2391
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agotcl/interface/parport: default to sane value on non-windows systems
Paul Fertser [Mon, 2 Mar 2015 14:52:47 +0000 (17:52 +0300)]
tcl/interface/parport: default to sane value on non-windows systems

When using ppdev driver 0 is the most appropriate default value as it
corresponds to /dev/parport0. Raw port address is suitable only for
direct access (I think that's parport-giveio on windows).

Reported by danitool on IRC.

Change-Id: I983c22251de6601b433ad31aaf660fb664cee7e9
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2572
Reviewed-by: Andreas Färber <afaerber@suse.de>
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agojtag/core: honour SRST timings in SWD mode
Paul Fertser [Mon, 9 Mar 2015 15:55:03 +0000 (18:55 +0300)]
jtag/core: honour SRST timings in SWD mode

Since SWD is currently abusing the JTAG command queue for reset and
sleep handling (and all other operations are performed in a different
way), sleep needs to be forced explicitly to ensure correct timings.

Change-Id: I5b0da6cbb7d0560154e4077b261aa6828cefc892
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2591
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agotcl/board: Add Infineon XMC4500 Relax Kit config
Jeff Ciesielski [Sat, 28 Feb 2015 01:02:57 +0000 (02:02 +0100)]
tcl/board: Add Infineon XMC4500 Relax Kit config

Tested with "J-Link Lite-XMC4000 Rev.1 compiled Dec  7 2012 19:23:07"
on XMC4500 Relax Lite Kit V1.

Change-Id: Ib680a444fa4cadbf640afba15d607c0e6bd4ab2c
Signed-off-by: Jeff Ciesielski <jeffciesielski@gmail.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Reviewed-on: http://openocd.zylin.com/2567
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agotcl/board: Add Infineon XMC4200 Application Kit config
Jeff Ciesielski [Sat, 28 Feb 2015 01:53:17 +0000 (02:53 +0100)]
tcl/board: Add Infineon XMC4200 Application Kit config

Change-Id: I3a946ba3745da651d470cd574222ba5c7147ac9d
Signed-off-by: Jeff Ciesielski <jeffciesielski@gmail.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Reviewed-on: http://openocd.zylin.com/2566
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agotcl/board: Add Infineon XMC4500 Application Kit configs
Andreas Färber [Sun, 18 Jan 2015 16:56:38 +0000 (17:56 +0100)]
tcl/board: Add Infineon XMC4500 Application Kit configs

Tested CPU_45A-V2 (General Purpose) with ARM-USB-TINY-H (via SWD) and
with "J-Link Lite-Cortex-M V8 compiled Jul 17 2014 11:40:12" firmware.

Tested CPU_45B-V1-006 (SDRAM) with ARM-USB-TINY-H (via SWD) and
with "J-Link Lite-XMC4200 Rev.1 compiled Jul 18 2014 17:28:26" firmware.

Change-Id: I3451117606551671ec77722f6adf7d7a6a4bd576
Signed-off-by: Andreas Färber <afaerber@suse.de>
Reviewed-on: http://openocd.zylin.com/2481
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agotcl/target: Add Infineon XMC4000 family config
Andreas Färber [Sun, 18 Jan 2015 06:14:13 +0000 (07:14 +0100)]
tcl/target: Add Infineon XMC4000 family config

Base config, verified against XMC4500, XMC4400 and XMC4100/XMC4200 manuals.

Change-Id: I10907bdf307bc6d11dc5454bf5391758de49dc30
Signed-off-by: Andreas Färber <afaerber@suse.de>
Reviewed-on: http://openocd.zylin.com/2480
Tested-by: jenkins
Reviewed-by: Jeff Ciesielski <jeffciesielski@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agotcl: icepick: add icepick_d_set_coreid
Felipe Balbi [Thu, 19 Mar 2015 19:59:22 +0000 (14:59 -0500)]
tcl: icepick: add icepick_d_set_coreid

this is just to avoid open coding that in
icepick_d_tapenable. Cleanup only, no functional
changes.

Change-Id: Iabd20291b7bdd95957afa1c74f52171789201227
Signed-off-by: Felipe Balbi <balbi@ti.com>
Reviewed-on: http://openocd.zylin.com/2624
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
9 years agotarget: icepick: call icepick_c_setup
Felipe Balbi [Thu, 19 Mar 2015 18:16:40 +0000 (13:16 -0500)]
target: icepick: call icepick_c_setup

it also works on icepick_d.

Change-Id: I50c0c81286aae673c94ea77e47454ff48eab1668
Signed-off-by: Felipe Balbi <balbi@ti.com>
Reviewed-on: http://openocd.zylin.com/2623
Tested-by: jenkins
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
9 years agotarget: icepick: switch over to icepick_c_router
Felipe Balbi [Thu, 19 Mar 2015 17:59:44 +0000 (12:59 -0500)]
target: icepick: switch over to icepick_c_router

Reusing what's already there to ease maintainability.

Change-Id: I2030581669c644e2d9d9f9968075ab6344445d04
Signed-off-by: Felipe Balbi <balbi@ti.com>
Reviewed-on: http://openocd.zylin.com/2622
Tested-by: jenkins
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
9 years agotcl: target: am437x: pass coreid
Felipe Balbi [Wed, 18 Mar 2015 21:01:00 +0000 (16:01 -0500)]
tcl: target: am437x: pass coreid

This commit is only for the sake of completeness as
default coreid is zero. In any case, coreids 1-4 are
used for the different PRU cores inside the SoC.

Change-Id: I775f2f444b1a908ffaf7bdbc43bcc966f19668c4
Signed-off-by: Felipe Balbi <balbi@ti.com>
Reviewed-on: http://openocd.zylin.com/2621
Tested-by: jenkins
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
9 years agotarget: am437x: use more descriptive names
Felipe Balbi [Wed, 18 Mar 2015 20:50:53 +0000 (15:50 -0500)]
target: am437x: use more descriptive names

Use more descriptive names for JRC and DAPs
so they more closely match documentation.

For example there's no Cortex A9 DAP, that's
the DebugSS DAP where Cortex A9 target sits. In
that same DAP we have have ETM, STM and both
dual-PRU subsystems.

Change-Id: I0e66ebb6299763f96606fae3e4c62e5785c804f2
Signed-off-by: Felipe Balbi <balbi@ti.com>
Reviewed-on: http://openocd.zylin.com/2620
Tested-by: jenkins
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
9 years agotarget: am437x: fix DebugSS DAP ID
Felipe Balbi [Wed, 18 Mar 2015 20:23:06 +0000 (15:23 -0500)]
target: am437x: fix DebugSS DAP ID

Main DAP (where Cortex A9 sits) ID is actually
0x46b6902f. Fix it.

Change-Id: Ifa3335186bcf60d264d4ecea477bfe2f5ca10ead
Signed-off-by: Felipe Balbi <balbi@ti.com>
Reviewed-on: http://openocd.zylin.com/2619
Tested-by: jenkins
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
9 years agotcl: board: add AM437x IDK support
Felipe Balbi [Tue, 17 Mar 2015 16:34:21 +0000 (11:34 -0500)]
tcl: board: add AM437x IDK support

Add support for Texas Instruments AM437x
Industrial Development Kit support.

Change-Id: I33ed71c7392c3805a86cf2c8adce83c0e8aa323d
Tested-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Reviewed-on: http://openocd.zylin.com/2617
Tested-by: jenkins
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
9 years agotcl: am437x: add reset-init event handler
Felipe Balbi [Mon, 16 Mar 2015 23:50:55 +0000 (18:50 -0500)]
tcl: am437x: add reset-init event handler

this event handler will configure and lock PLLs
and configure DDR so platform is placed in usable
state.

Change-Id: Idd02f4c9789181d69578f8606ac3576ea1dd8a0b
Tested-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Reviewed-on: http://openocd.zylin.com/2616
Tested-by: jenkins
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
9 years agotcl: am437x: disable watchdog on reset-end
Felipe Balbi [Mon, 16 Mar 2015 04:15:15 +0000 (23:15 -0500)]
tcl: am437x: disable watchdog on reset-end

sometimes, watchdog might be left running and
it could expire in the middle of a debug session,
to prevent that, just make sure to disable watchdog
on reset-end if current state is 'halted'.

Change-Id: Ib4f2a2321cba17cd8c56ca3ae63114a563a6de90
Tested-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Reviewed-on: http://openocd.zylin.com/2615
Tested-by: jenkins
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
9 years agotcl: am437x: define registers to be used later
Felipe Balbi [Mon, 16 Mar 2015 20:20:41 +0000 (15:20 -0500)]
tcl: am437x: define registers to be used later

a later commit will implement a proper reset-init
handler to lock pll and configure ddr as we should.

Change-Id: I432cf28a5a944bfa83c20aed7298dbd29df30e38
Tested-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Reviewed-on: http://openocd.zylin.com/2614
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
9 years agotcl: board: ti_am43xx_evm: follow xds100v2 requirements
Felipe Balbi [Sat, 14 Mar 2015 00:56:11 +0000 (19:56 -0500)]
tcl: board: ti_am43xx_evm: follow xds100v2 requirements

xds100v2 asks us to call these three commands to
guarantee proper behavior, so do it.

Change-Id: Iecf9c148ce7c2082ef915b46eeb511ceea395cc3
Signed-off-by: Felipe Balbi <balbi@ti.com>
Reviewed-on: http://openocd.zylin.com/2613
Tested-by: jenkins
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
9 years agotcl: board: ti_am437x_evm: select jtag transport
Felipe Balbi [Sat, 14 Mar 2015 00:55:36 +0000 (19:55 -0500)]
tcl: board: ti_am437x_evm: select jtag transport

default already is jtag, but this silences a
warning during startup.

Change-Id: I94478327bbb259649500ef74a5b5c10d51e2a517
Signed-off-by: Felipe Balbi <balbi@ti.com>
Reviewed-on: http://openocd.zylin.com/2612
Tested-by: jenkins
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
9 years agotcl: target: am437x: use entire SRAM area
Felipe Balbi [Sat, 14 Mar 2015 00:32:01 +0000 (19:32 -0500)]
tcl: target: am437x: use entire SRAM area

According to AM4379 TRM [1], table 2-1 L3 Memory Map,
we have a total of 256KiB and there's no reason not to
use it all.

[1] http://www.ti.com/lit/ug/spruhl7b/spruhl7b.pdf

Change-Id: I117f2afe721bc4e3f0df304d3542e1a91aa69d12
Signed-off-by: Felipe Balbi <balbi@ti.com>
Reviewed-on: http://openocd.zylin.com/2611
Tested-by: jenkins
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
9 years agotcl: target: am437x.cfg: pass correct dbgbase
Felipe Balbi [Fri, 13 Mar 2015 22:10:42 +0000 (17:10 -0500)]
tcl: target: am437x.cfg: pass correct dbgbase

Since commit ec9ccaa28849 (arm_adi_v5: make dap_lookup_cs_component()
traverse subtables and handle multicore) AM437x devices can't be used
with OpenOCD anymore. The reason is that dbgbase used to be set to zero
before that commit and that just happens to work with AM437x devices.

A more robust solution is to pass correct dbgbase when creating the
target, which this commit does.

Signed-off-by: Felipe Balbi <balbi@ti.com>
Change-Id: Iaf2617804324de8094b25137943e08b84f14c75f
Reviewed-on: http://openocd.zylin.com/2602
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
9 years agotarget/target.c: fixed rp check bug in asynchronous flash write algorithm.
DmitryShpak [Wed, 25 Mar 2015 11:31:16 +0000 (14:31 +0300)]
target/target.c: fixed rp check bug in asynchronous flash write algorithm.

Bug in read pointer check within flash write algorithm made incorrect check
if block size is more than 4 bytes (bug was detected with 16 bytes block size).

Change-Id: I5b8e7ebca619a0a85ae6e9e496ff792248134d81
Signed-off-by: DmitryShpak <disona@yandex.ru>
Reviewed-on: http://openocd.zylin.com/2657
Tested-by: jenkins
Reviewed-by: Jens Bauer <jens@gpio.dk>
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
9 years agojtag/drivers/ftdi.c: removed memory leak
Mateusz Manowiecki [Thu, 26 Feb 2015 21:06:46 +0000 (22:06 +0100)]
jtag/drivers/ftdi.c: removed memory leak

swd_cmd_queue buffer memory leak removed

Change-Id: Iafcdf034d32a37d577b58b6256c8fd9b064ce228
Signed-off-by: Mateusz Manowiecki <segmentation@fault.pl>
Reviewed-on: http://openocd.zylin.com/2563
Tested-by: jenkins
Reviewed-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agodoc: update RTOS section, add 'mqx' info
Marian Cingel [Mon, 9 Mar 2015 18:52:29 +0000 (19:52 +0100)]
doc: update RTOS section, add 'mqx' info

Change-Id: I20b93d49d275e6daaf5e39c49b4508c70c6fc56f
Signed-off-by: Marian Cingel <cingel.marian@gmail.com>
Reviewed-on: http://openocd.zylin.com/2592
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agoAdd configuration for EFM32 Gecko boards with Segger J-Link.
Uwe Bonnes [Sun, 8 Mar 2015 14:09:14 +0000 (15:09 +0100)]
Add configuration for EFM32 Gecko boards with Segger J-Link.

Tested with Tiny Gecko.

Change-Id: Iddb87170b6aaaf7f15d3c4517c8661dd6394be8f
Signed-off-by: Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de>
Reviewed-on: http://openocd.zylin.com/2585
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agoflash/nor: mrvlqspi: fix printf formatting issues
Mahavir Jain [Thu, 5 Mar 2015 12:12:54 +0000 (17:42 +0530)]
flash/nor: mrvlqspi: fix printf formatting issues

Change-Id: I74cfce7bb8dbc13fbc3005b5a96213417f93a9f2
Signed-off-by: Mahavir Jain <mjain@marvell.com>
Reviewed-on: http://openocd.zylin.com/2577
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-by: Stian Skjelstad <stian@nixia.no>
9 years agotransport: make 'transport select' auto-select the first available transport if not set
Angus Gratton [Tue, 24 Feb 2015 21:19:15 +0000 (08:19 +1100)]
transport: make 'transport select' auto-select the first available transport if not set

This should allow most of the existing configurations for older
versions to remain compatible without forcing the user to change his
or her config to explicitly select transport.

Also in some circumstances can remove the need to chain a "-c transport
select X" when building custom configs on the command line, which seems
like a common new user pitfall.

Change-Id: Ic87a38c0b9b88e88fb6d106385efce2f39381d3d
Suggested-by: Petteri Aimonen <jpa@git.mail.kapsi.fi>
Signed-off-by: Angus Gratton <gus@projectgus.com>
Reviewed-on: http://openocd.zylin.com/2551
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agotarget/adi_v5_swd, cortex_m: properly handle more cases requiring reconnect
Paul Fertser [Wed, 11 Mar 2015 08:33:55 +0000 (11:33 +0300)]
target/adi_v5_swd, cortex_m: properly handle more cases requiring reconnect

This brings SWD reconnection procedure in line with the ARM
documentation and changes cortex_m reset procedure to make use of it.

The motivation behind this patch is to make SAM4L "reset" and "reset
halt" properly without SRST. The complication here is that EDBG issues
an additional read of DP_RDBUFF automatically right after writing
SYSRESETREQ, that leads to a FAULT which needs to be dealt with
properly. With this patch the very first ahbap_debugport_init DAP
access will make SWD layer properly reinitialise the link before
continuing.

Runtime tested with mbed CMIS-DAP + KL25 only.

Change-Id: Ic506f9db30931dfa60860036b83f73b897975909
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2596
Tested-by: jenkins
Reviewed-by: Andrey Yurovsky <yurovsky@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agodrivers/cmsis-dap: port to common SWD framework
Paul Fertser [Sun, 26 Oct 2014 07:51:02 +0000 (10:51 +0300)]
drivers/cmsis-dap: port to common SWD framework

Valgrind-tested.

Comparison of flashing performance on an FRDM-KL25Z board running mbed
CMSIS-DAP variant, 5MHz clock, old driver:

wrote 28096 bytes from file demo.elf in 26.833590s (1.023 KiB/s)
verified 27264 bytes in 1.754972s (15.171 KiB/s)

this implementation:

wrote 28096 bytes from file demo.elf in 3.691939s (7.432 KiB/s)
verified 27264 bytes in 0.598987s (44.450 KiB/s)

Also tested "Keil ULINK-ME CMSIS-DAP" with an STM32F100 target, 5MHz
clock, results reading from flash, old driver:

dumped 131072 bytes in 98.445305s (1.300 KiB/s)

this implementation:

dumped 131072 bytes in 8.242686s (15.529 KiB/s)

Change-Id: Ic64d3124b1d6cd9dd1016445bb627c71e189ae95
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2356
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agotcl/board/twr-k60f120m: remove useless flash bank 0 definition
Paul Fertser [Tue, 10 Mar 2015 19:27:16 +0000 (22:27 +0300)]
tcl/board/twr-k60f120m: remove useless flash bank 0 definition

Since the very first flash bank is already defined in target/kx.cfg,
there's no sense in repeating it.

Reported and tested by Richard Braun.

Change-Id: I417b7072b5e6675ddbf824446e7581b8b7da8f4b
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2595
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agoflash/nor/kinetis: do not attempt mass-erase in place of a bank erase
Paul Fertser [Tue, 10 Mar 2015 19:22:36 +0000 (22:22 +0300)]
flash/nor/kinetis: do not attempt mass-erase in place of a bank erase

Many kinetis parts come in multi-bank configuration, so this
optimisation here can't be performed safely.

Investigated and fixed by Richard Braun.

Change-Id: I2b56614b47951595c403a1a8edd3afe11b85679b
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2594
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agoarmv7m_trace, stlink: provide APIs to capture trace with an adapter
Paul Fertser [Tue, 10 Feb 2015 10:32:07 +0000 (13:32 +0300)]
armv7m_trace, stlink: provide APIs to capture trace with an adapter

Change-Id: I9d193dd5af382912e4fe838bd4f612cffd11b295
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2540
Tested-by: jenkins
9 years agoarmv7m: add generic trace support (TPIU, ITM, etc.)
Paul Fertser [Mon, 9 Feb 2015 14:04:52 +0000 (17:04 +0300)]
armv7m: add generic trace support (TPIU, ITM, etc.)

This provides support for various trace-related subsystems in a
generic and expandable way.

Change-Id: I3a27fa7b8cfb111753088bb8c3d760dd12d1395f
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2538
Tested-by: jenkins
9 years agostm32l1.cfg: Add missing dash to fix f7394049d3 commit.
Uwe Bonnes [Mon, 9 Mar 2015 13:08:48 +0000 (14:08 +0100)]
stm32l1.cfg: Add missing dash to fix f7394049d3 commit.

Change-Id: Ifeb2d4fc2b43813edbc6fe2cf08bfd4c55cd1e86
Signed-off-by: Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de>
Reviewed-on: http://openocd.zylin.com/2590
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-by: Stian Skjelstad <stian@nixia.no>
9 years agotcl: Add default hooks for STM32F3x
Andreas Fritiofson [Thu, 3 Jul 2014 17:33:45 +0000 (19:33 +0200)]
tcl: Add default hooks for STM32F3x

Keep clocks running in low power modes. Stop watchdogs from interfering
with the debug session. Set up PLL and increase clock at reset init.

Change-Id: I984d2018f7d47a1042f1e12894563154fa7b566c
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/2196
Tested-by: jenkins
Reviewed-by: Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de>
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
9 years agoflash/nor/stellaris: allow to recover a locked device that can't be examined
Paul Fertser [Sat, 21 Feb 2015 07:55:41 +0000 (10:55 +0300)]
flash/nor/stellaris: allow to recover a locked device that can't be examined

Change-Id: I28536184053e2d1ba906620e728f7fad6ba39f0a
Reported-by: Ed Beroset <beroset@mindspring.com>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2552
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-by: Ed Beroset <beroset@ieee.org>
9 years agojlink: Add variant "J-Link Lite-XMC4000"
Andreas Färber [Sat, 28 Feb 2015 01:39:44 +0000 (02:39 +0100)]
jlink: Add variant "J-Link Lite-XMC4000"

Avoids "J-Link hw type unknown 0x10" on the Infineon Relax Lite Kit.

Change-Id: I3091623ead2e84b67ac20d9866307ccbb3f26f66
Signed-off-by: Andreas Färber <afaerber@suse.de>
Reviewed-on: http://openocd.zylin.com/2568
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agojlink: Add variant "J-Link Lite-XMC4200"
Andreas Färber [Sat, 28 Feb 2015 00:23:34 +0000 (01:23 +0100)]
jlink: Add variant "J-Link Lite-XMC4200"

Avoids "J-Link hw type unknown 0x11" on various Infineon boards.

Change-Id: If20b9e21110d2acc02be57f5faf28c5e6a39e2c9
Signed-off-by: Andreas Färber <afaerber@suse.de>
Reviewed-on: http://openocd.zylin.com/2565
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agoserver, target, cortex_m: add deinit_target to the API to free resources
Paul Fertser [Wed, 11 Feb 2015 08:08:40 +0000 (11:08 +0300)]
server, target, cortex_m: add deinit_target to the API to free resources

This should facilitate dynamic target creation and removal.

Currently it helps with getting 0 bytes lost report from Valgrind on
exit (after talking to a nucleo board). However, 1,223,886 bytes in
5,268 blocks are still reachable which means the app holds pointers to
that data on exit. The majority comes from the jtag command queue,
there're also many blocks from TCL command registration.

Change-Id: I7523234bb90fffd26f7d29cdd7648ddd221d46ab
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2544
Tested-by: jenkins
Reviewed-by: Stian Skjelstad <stian@nixia.no>
9 years agotarget/target: call event handlers around examine when polling resumes
Paul Fertser [Mon, 9 Feb 2015 13:43:58 +0000 (16:43 +0300)]
target/target: call event handlers around examine when polling resumes

The target might be using Tcl examine-start and examine-end handlers,
they need to be called when the target gets reexamined after polling
succeeds again.

Change-Id: I371380c6f3c427ec7a0206d73426f6589f18a9bd
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2536
Tested-by: jenkins
Reviewed-by: Stian Skjelstad <stian@nixia.no>
9 years agohla/hla_interface: call HLA layout API close() on quit
Paul Fertser [Wed, 11 Feb 2015 08:04:15 +0000 (11:04 +0300)]
hla/hla_interface: call HLA layout API close() on quit

This bug was exposed by Valgrind.

Change-Id: I2e2bc036b49ca3ff22f78f765ee4537763350096
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2543
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agotarget/cortex_m: do not leak memory on reexamination
Paul Fertser [Wed, 11 Feb 2015 08:02:34 +0000 (11:02 +0300)]
target/cortex_m: do not leak memory on reexamination

This bug was exposed by Valgrind.

Change-Id: If50878664d928c0a44e309ca1452089c1ac71466
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2542
Tested-by: jenkins
Reviewed-by: Stian Skjelstad <stian@nixia.no>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agotarget: fix timer callbacks processing
Paul Fertser [Wed, 11 Feb 2015 07:51:17 +0000 (10:51 +0300)]
target: fix timer callbacks processing

Warning, behaviour change: before this patch if a timer callback
returned an error, the other handlers in the list were not called.

This patch fixes two different issues with the way timer callbacks are
called:

1. The function is not designed to be reentrant but a nested call is
possible via: target_handle timer event -> poll -> target events
before/after reexaminantion -> script_command_run ->
target_call_timer_callbacks_now . This patch makes function a no-op
when called recursively;

2. The current code can deal with the case when calling a handler
leads to its removal but not when it leads to removal of the next
callback in the list. This patch defers actual removal to consolidate
it with the calling loop.

These bugs were exposed by Valgrind.

Change-Id: Ia628a744634f5d2911eb329747e826cb9772e789
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2541
Tested-by: jenkins
Reviewed-by: Stian Skjelstad <stian@nixia.no>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agoarm11: initialise DPM and register cache before reading DSCR for the first time
Paul Fertser [Thu, 13 Mar 2014 09:27:45 +0000 (13:27 +0400)]
arm11: initialise DPM and register cache before reading DSCR for the first time

When target was already halted during the initial examination,
arm11_check_init() was trying to read, store and interpret DSCR
contents before the DPM structure is initialised. This caused
a segfault like described on
http://sourceforge.net/apps/trac/openocd/ticket/65 .

This is a totally untested attempt to fix this issue.

Change-Id: I2fff115679a3f0023e7a88c749ccb5f045d6cf01
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2043
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agostlink: avoid null pointer dereference in stlink_usb_close()
Paul Fertser [Sun, 15 Feb 2015 18:37:16 +0000 (21:37 +0300)]
stlink: avoid null pointer dereference in stlink_usb_close()

Otherwise it happens if stlink can not be opened on start.

Change-Id: I7088f10e61508dae230eccfe576a51498c92f5b8
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2550
Tested-by: jenkins
Reviewed-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-by: Stian Skjelstad <stian@nixia.no>
9 years agoopenrisc: add profiling function
Franck Jullien [Fri, 23 Jan 2015 13:09:14 +0000 (14:09 +0100)]
openrisc: add profiling function

Change-Id: Ifee89b289069590e6086a4713b165989578e29ec
Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
Reviewed-on: http://openocd.zylin.com/2494
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agoarmv7m: do not access FPU registers when not present
Paul Fertser [Thu, 29 Jan 2015 10:58:45 +0000 (13:58 +0300)]
armv7m: do not access FPU registers when not present

This is runtime and valgrind tested with l0, l1 and f3 hla boards.

Change-Id: I49b0b042253d5f3bf216997f0203583db319fe23
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2516
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agoarmv7m: add FPU registers support
Paul Fertser [Sun, 1 Apr 2012 13:18:02 +0000 (15:18 +0200)]
armv7m: add FPU registers support

This patch adds the fpv4-sp-d16 registers to the armv7m register set.

The work is inspired by Mathias K but takes a different approach:
instead of having both double and single presicion registers in the
cache this patch works only with the doubles and counts on GDB to
split the data in halves whenever needed.

Tested with HLA only (on an STM32F334 disco board).

Currently this patch makes all ARMv7-M targets report an FPU-enabled
target description to GDB. It shouldn't harm if the user is not trying
to access non-existing FPU. However, the plan is to make this depend
on actual FPU presence later.

Change-Id: Ifcc72c80ef745230c42e4dc3995f792753fc4e7a
Signed-off-by: Mathias K <kesmtp@freenet.de>
[fercerpav@gmail.com: rework to fit target description framework]
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/514
Tested-by: jenkins
Reviewed-by: Peter Stuge <peter@stuge.se>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agojimtcl: update to 0.76 release version
Paul Fertser [Sat, 31 Jan 2015 08:20:51 +0000 (11:20 +0300)]
jimtcl: update to 0.76 release version

It makes sense to use the latest released version to ensure
compatibility.

Change-Id: I0957f927d825fa6fb6a1594ca17bcca46ee6c1a6
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2522
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agotarget/arm_disassembler: add exception related disassembly
pierre Kuo [Fri, 13 Feb 2015 03:27:52 +0000 (11:27 +0800)]
target/arm_disassembler: add exception related disassembly

Add ERET/HVC/SMC disassebly decoding flow, below is testing result

> mdw 0x5c 4
0x0000005c: e160006e e1400072 e1600073 ee110f10
> arm disassemble 0x5c 4
0x0000005c 0xe160006e ERET
0x00000060 0xe1400072 HVC 0x0002
0x00000064 0xe1600073 SMC 0x0003
0x00000068 0xee110f10 MRC p15, 0x00, r0, c1, c0, 0x00
>

Change-Id: I1beccff885b5b37747edd0b2e9fb2297ce466a00
Signed-off-by: pierre Kuo <vichy.kuo@gmail.com>
Reviewed-on: http://openocd.zylin.com/2548
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agotarget/cortex_a: remove dead assignment
Paul Fertser [Thu, 26 Feb 2015 16:48:08 +0000 (19:48 +0300)]
target/cortex_a: remove dead assignment

Found by clang static checker.

Change-Id: I77b0dc18188328fdb28d07b9e5c52e06182d9e2b
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2561
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agoflash/nor/stellaris: remove dead assignment
Paul Fertser [Thu, 26 Feb 2015 16:42:08 +0000 (19:42 +0300)]
flash/nor/stellaris: remove dead assignment

Found by clang static checker.

Change-Id: Ifa58ba383092341c7343916e5cc8ec3c72ab2f60
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2560
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agoflash/nor/sim3x: remove dead assignment
Paul Fertser [Thu, 26 Feb 2015 16:39:50 +0000 (19:39 +0300)]
flash/nor/sim3x: remove dead assignment

Found by clang static code checker.

Change-Id: Ic1370f8d7a48f08da6514afec5aacde38af7dfb6
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2559
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agocontrib/itmdump: fix UB in show_swit, and few compile warnings
Paul Fertser [Fri, 6 Feb 2015 15:28:56 +0000 (18:28 +0300)]
contrib/itmdump: fix UB in show_swit, and few compile warnings

Change-Id: I1c5c99f190f7b4d405dc6fa06533e7ff37a652ec
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2533
Tested-by: jenkins
Reviewed-by: Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agocontrib: itmdump: fix incorrect format printf
Karl Palsson [Fri, 19 Dec 2014 14:20:40 +0000 (14:20 +0000)]
contrib: itmdump: fix incorrect format printf

Change-Id: I29100e4b284e031613586a66daa74987d86ac9e1
Signed-off-by: Karl Palsson <karlp@tweak.net.au>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2449
Tested-by: jenkins
Reviewed-by: Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de>
Reviewed-by: Stian Skjelstad <stian@nixia.no>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agoserver: tcl_notifications command
Austin Morton [Sat, 21 Feb 2015 09:20:33 +0000 (04:20 -0500)]
server: tcl_notifications command

Implements async target notifications to the tcl server

Change-Id: I4d83e9fa209e95426c440030597f99e9f0c3b260
Signed-off-by: Austin Morton <austinpmorton@gmail.com>
Reviewed-on: http://openocd.zylin.com/2336
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agortos: Freescale MQX rtos support
Marian Cingel [Fri, 3 Oct 2014 12:15:16 +0000 (14:15 +0200)]
rtos: Freescale MQX rtos support

ARMv7E-M (CortexM4) architecture

- fix position offset of r2,r3 registers on exception stack
- switch 'calloc' arguments
- remove prototypes of internal function and typedefs
- add NULL check for alloc functions
- remove last line of license "Franklin Street, Fifth Floor"
  because of 'checkpatch' validation
- environment: jlink + twrk60n512

Change-Id: I70840ded15b17dd945ca190ce31e2775078da2d9
Signed-off-by: Marian Cingel <cingel.marian@gmail.com>
Reviewed-on: http://openocd.zylin.com/2353
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agotcl/interface/ftdi/xdsv2: fix and clarify EMU* signals
Matthijs van Duin [Tue, 29 Jul 2014 06:24:29 +0000 (10:24 +0400)]
tcl/interface/ftdi/xdsv2: fix and clarify EMU* signals

The signal names are changed for consistency with TI's docs and
sources.

Change-Id: Ic5c5314daa20f6f610be8a848399f951d47aa137
Signed-off-by: Matthijs van Duin <matthijs@rinnic-vaude.nl>
Reviewed-on: http://openocd.zylin.com/2231
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
9 years agostm32l1.cfg: Add ID Code of Cat.2 devices.
Uwe Bonnes [Thu, 29 Jan 2015 11:03:23 +0000 (12:03 +0100)]
stm32l1.cfg: Add ID Code of Cat.2 devices.

Change-Id: I4eb5020858c1896e294d633213f3df3fa45b6250
Signed-off-by: Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de>
Reviewed-on: http://openocd.zylin.com/2517
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
Tested-by: jenkins
9 years agostm32f3x.cfg: Remove duplicate item.
Uwe Bonnes [Mon, 23 Feb 2015 17:14:45 +0000 (18:14 +0100)]
stm32f3x.cfg: Remove duplicate item.

Change-Id: I812c36688add73fab2e74fc112c733c5d3c201a6
Signed-off-by: Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de>
Reviewed-on: http://openocd.zylin.com/2554
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
9 years agolpc2000: Add LPC407x/8x flash size auto detection
Nemui Trinomius [Tue, 24 Feb 2015 11:37:20 +0000 (20:37 +0900)]
lpc2000: Add LPC407x/8x flash size auto detection

This patch adds auto flash size detection for LPC407x/8x series.

Tested on below listed chips.
LPC4088
LPC1788(regression test)

Change-Id: I82f62678a04eac9b84658bd6d1cfdf45be64c931
Signed-off-by: Nemui Trinomius <nemuisan_kawausogasuki@live.jp>
Reviewed-on: http://openocd.zylin.com/2555
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-by: Jens Bauer <jens@gpio.dk>
9 years agoatmega: add support for the at90usb128 flash
Olivier Esver [Wed, 25 Feb 2015 19:29:24 +0000 (20:29 +0100)]
atmega: add support for the at90usb128 flash

Add support for the at90usb128 flash (tested on the RZUSBstick)

Change-Id: Ic042d7c403b20a5cc533da00c30ae6e2139bbd10
Signed-off-by: Olivier Esver <olg.esver@gmail.com>
Reviewed-on: http://openocd.zylin.com/2557
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
9 years agoAdded system signal handling to Linux version
Mateusz Manowiecki [Mon, 5 Jan 2015 15:40:16 +0000 (16:40 +0100)]
Added system signal handling to Linux version

(with http://www.cons.org/cracauer/sigint.html in mind)

Change-Id: I15f559bc1122a408c3fb9338ba55c16fab3187e1
Signed-off-by: Mateusz Manowiecki <segmentation@fault.pl>
Reviewed-on: http://openocd.zylin.com/2443
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>