]> git.sur5r.net Git - openocd/log
openocd
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>
9 years agojtag/drivers/buspirate: add JTAG_STABLECLOCKS cmd
Mateusz Manowiecki [Fri, 23 Jan 2015 20:58:19 +0000 (21:58 +0100)]
jtag/drivers/buspirate: add JTAG_STABLECLOCKS cmd

Solution found on the internet

Change-Id: Ied6f7d9b28131a7ac83b203e4c64d4e9ffec0595
Signed-off-by: Mateusz Manowiecki <segmentation@fault.pl>
Reviewed-on: http://openocd.zylin.com/2496
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
9 years agotarget & board: AT91SAM7A2 and Olimex SAM7-LA2
Arne Wichmann [Thu, 25 Sep 2014 05:21:24 +0000 (07:21 +0200)]
target & board: AT91SAM7A2 and Olimex SAM7-LA2

Initial Support for AT91SAM7A2 on Olimex SAM7-LA2 board.
The board seems not to be able to reset into halted mode, as srst is
connected to NRESET of the cpu (configured srst_pulls_trst).
JTAG RCLK is connected to CLK.
Tested with interface/ftdi/olimex-arm-usb-ocd-h.cfg.

Change-Id: I2bdd67e3683e45f1119c5850bad294aa107891d8
Signed-off-by: Arne Wichmann <arne.wichmann@gmail.com>
Reviewed-on: http://openocd.zylin.com/2318
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
9 years agopsoc4 flash driver: cleaned printf PRI... formats
Tomas Vanek [Wed, 25 Feb 2015 21:21:58 +0000 (22:21 +0100)]
psoc4 flash driver: cleaned printf PRI... formats

Failed build on Mac OS X 10.10.2 was reported in OpenOCD-devel.
Cleaning types and printf formats. uint32_t prefered for flash/sector sizes.
2 minor changes in comments.
Removed redundant bracket.

Change-Id: Ia06b77af59c2c0ffd10869a4b263a760ca8b0a7a
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/2558
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-by: Xiaofan <xiaofanc@gmail.com>
9 years agonrf51: Update known devices table.
Theodore A. Roth [Thu, 29 Jan 2015 00:23:16 +0000 (17:23 -0700)]
nrf51: Update known devices table.

Added new entries to the nrf51_known_devices_table array. New entries
are documented in the "nRF51 Series Compatability Matrix V1.0" found on
the Nordic Semi web site. Reordered entries to match the order found in
the document.

Also added an entry for an undocumented hwid discovered while flashing
the PCA10031 and PCA10028 dev boards.

Change-Id: Icca7da103d437dc28e651f27ab937fe953b9aac9
Signed-off-by: Theodore A. Roth <troth@openavr.org>
Reviewed-on: http://openocd.zylin.com/2514
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
9 years agoflash/nor/spi: add GigaDevice SPI flash
dmitry pervushin [Wed, 4 Feb 2015 10:26:14 +0000 (11:26 +0100)]
flash/nor/spi: add GigaDevice SPI flash

Signed-off-by: dmitry pervushin <dpervushin@gmail.com>
Change-Id: I5a239dc67754ef4be1d9ec36186f434b09aa1e25
Reviewed-on: http://openocd.zylin.com/2530
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
9 years agocfg: add board and target configs for TI SimpleLink Wi-Fi CC3200 LaunchPad
Paul Fertser [Fri, 16 Jan 2015 09:17:40 +0000 (12:17 +0300)]
cfg: add board and target configs for TI SimpleLink Wi-Fi CC3200 LaunchPad

Change-Id: I4396ee737c1dad380aa23894bbd1faf75f26d072
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2465
Tested-by: jenkins
9 years agoProvide genuine F3 nucleo config and source it for STM32F334 Discovery board.
Uwe Bonnes [Thu, 11 Dec 2014 15:24:27 +0000 (16:24 +0100)]
Provide genuine F3 nucleo config and source it  for STM32F334 Discovery board.

The F334 disco board has a stlink V.2-1 as F3 nucleo boards. Normal F3 disco
boards use stlink v2 and can't ne used.

Change-Id: I77ebef93b184592f25ff18bb2da776d636f60ff0
Signed-off-by: Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de>
Reviewed-on: http://openocd.zylin.com/2434
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
9 years agotcl/target|board: add configs for Alphascale asm9260t
Oleksij Rempel [Mon, 19 Jan 2015 15:43:14 +0000 (16:43 +0100)]
tcl/target|board: add configs for Alphascale asm9260t

This adds configs for Alphascale asm9260t ARM based SoC and
Evaluation Kit based on this chip.

Change-Id: Id8d3a1ef204e3ae84540c2693e3d62650ba82f73
Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
Reviewed-on: http://openocd.zylin.com/2515
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
9 years agoRemove long-deprecated "target count" and "target number" commands.
Robert P. J. Day [Thu, 9 Jan 2014 16:59:37 +0000 (11:59 -0500)]
Remove long-deprecated "target count" and "target number" commands.

Given that the manual states that these two subcommands are
deprecated and were scheduled to be removed back in 2010,
remove them and the corresponding documentation from the
manual.

Change-Id: Iaac633349d7fcb8b7f964109c7d26dd0cc5fc233
Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Reviewed-on: http://openocd.zylin.com/1860
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
9 years agocfg: Fix Kinetis kwikstik/kx config
Andreas Fritiofson [Wed, 11 Feb 2015 23:12:15 +0000 (00:12 +0100)]
cfg: Fix Kinetis kwikstik/kx config

The flash definition belongs in the target cfg. Add some working area
and suitable reset_config.

Make kx.cfg more similar to klx.cfg.

Disable rclk as it is dead slow and a fixed 1MHz clock seems to work.

Change-Id: I8328f179c3a33be64403da93616abb48651bdfe6
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/2227
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
9 years agoAdd SWD protocol support to sysfsgpio
Jean-Christian de Rivaz [Thu, 11 Dec 2014 16:50:33 +0000 (17:50 +0100)]
Add SWD protocol support to sysfsgpio

Based on the initial work on bcm2835gpio.c by Paul Fertser with many
additions. Modifications to the GPIO handling was minimal in this
patch. A more big modification is required before cleanup the
interface between bitbang and sysfsgpio.

Change-Id: I54bf2a2aa2ca059368b0e0e105dff6084b73d624
Signed-off-by: Jean-Christian de Rivaz <jc@eclis.ch>
Reviewed-on: http://openocd.zylin.com/2438
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
9 years agoAdd SWD protocol support to bitbang
Jean-Christian de Rivaz [Thu, 11 Dec 2014 18:11:49 +0000 (19:11 +0100)]
Add SWD protocol support to bitbang

This is based on the initial work by Paul Fertser with addition of the
switch sequences and new ACK handling.  In case of WAIT response, the
sticky bits are cleared and the last operation is repeated. The ACK
handling is based on the interpretation of the 8 February 2006 ARM
Debug Interface v5 Architecture Specification

Change-Id: Id50855b1ffff310177ccf9883dc9eb0d1b4458c8
Signed-off-by: Jean-Christian de Rivaz <jc@eclis.ch>
Reviewed-on: http://openocd.zylin.com/2437
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
9 years agogdb_server: ignore stray + in ACK mode
Matej Kupljen [Wed, 11 Feb 2015 08:28:41 +0000 (09:28 +0100)]
gdb_server: ignore stray + in ACK mode

I couldn't make OpenOCD to work with GDB. I was always getting this in GDB:
(gdb) target remote localhost:3333
Remote debugging using localhost:3333
Ignoring packet error, continuing...
Ignoring packet error, continuing...
Ignoring packet error, continuing...
Ignoring packet error, continuing...
Malformed response to offset query, timeout
(gdb)
While debugging gdb remote protocol, I have seen that gdb responds with:
w ++$?#3f
And those two '+' seems to confuse the OpenOCD parser, if it sees another
'+' sign it emits the DEBUG output and sets the noack_mode to 2. The
problem is that we weren't even IN noack mode, this was set to 0 and then
it explicitly sets it to 2 and thus turning the noack mode on.

Change-Id: If267c9226e57fa83121ded09cf69829f8f0b4b93
Signed-off-by: Matej Kupljen <matej.kupljen@gmail.com>
Reviewed-on: http://openocd.zylin.com/2545
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
9 years ago cortex_m: Add Cortex-M0 identification to ROM-table display.
Uwe Bonnes [Fri, 13 Feb 2015 15:48:23 +0000 (16:48 +0100)]
 cortex_m: Add Cortex-M0 identification to ROM-table display.

Change-Id: Id7715a83ba9793844475629aaffd10a81ce586b6
Signed-off-by: Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de>
Reviewed-on: http://openocd.zylin.com/2549
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-by: Stian Skjelstad <stian@nixia.no>
9 years agoCortex A: fix extra memory read and non-word sizes
Christopher Head [Fri, 7 Nov 2014 22:44:17 +0000 (14:44 -0800)]
Cortex A: fix extra memory read and non-word sizes

Without this patch, to perform a memory read, OpenOCD first issues an
LDC instruction into DBGITR in Stall mode (thus executing the
instruction), then switches to Fast mode and reads from DBGDTRTX once
for each word to transfer.

At the very end of the transfer, the final Fast mode read of DBGDTRTX
has, as always, the side effect of re-issuing the LDC instruction. This
causes two problems:

(1) If the word immediately beyond the end of the requested region is
inaccessible, this spurious LDC will cause a fault. On a fast CPU, the
LDC will finish executing by the time the poll of DSCR takes place,
failing the entire memory read. On a slow CPU, the LDC might finish
executing later, leaving an unexpected and confusing sticky fault lying
around for the next operation to see.

(2) If the LDC succeeds, it will leave the loaded word in DBGDTRTX, thus
setting DBGDSCR.TXFULL=1. The cortex_a_read_apb_ab_memory routine
completes without consuming that last word, thus confusing the next
routine that tries to use DBGDTRTX (this may not have any visible effect
on some implementations, because writing to DBGDTRTXint when TXFULL=1 is
defined as Unpredictable, but I believe it caused a visible problem for
me).

With this patch, the bulk mem_ap_sel_read_buf_noincr is modified to omit
the last word of the block. The second-to-last read of DBGDTRTX by that
function will cause the issue of the LDC for the last word. After
switching back to Normal mode and waiting for that instruction to
finish, do a final read of DBGDTRTX to extract the last word into the
buffer, leaving TXFULL=0.

Without this patch, memory accesses are always expanded such that they
are aligned to the access size. With this patch, accesses are issued
exactly as ordered by the caller. The caller is expected to handle
fragments at the beginning and end of the transfer if the address is
unaligned and an unaligned access is not desired.

Without this patch, the DFAR and DFSR registers, which report the
location and status of data faults, are ignored while performing memory
accesses, which could cause problems debugging an OS page fault handler.
With this patch, DFAR and DFSR are preserved across memory accesses, and
DFSR is decoded in the event of a synchronous fault to provide the
caller with more information about the reason for failure.

Thanks to Boris Brezillon for the original patch whose ideas led to the
non-word access mechanism implemented here and to various code reviewers
for their comments.

Change-Id: I11ae7104fbe69a522efadefc705c9a217a7eef41
Signed-off-by: Christopher Head <chead@zaber.com>
Reviewed-on: http://openocd.zylin.com/2381
Tested-by: jenkins
Reviewed-by: Olivier Schonken <olivier.schonken@gmail.com>
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
9 years agodoc: stellaris driver supports Tiva C too
Paul Fertser [Tue, 27 Jan 2015 17:45:47 +0000 (20:45 +0300)]
doc: stellaris driver supports Tiva C too

Change-Id: I3b77bf0617c0bbba85cfd678adece57aa7d03e32
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2509
Tested-by: jenkins
9 years agoflash/nor/stm32lx: add all the IDs and revisions from current RM
Paul Fertser [Fri, 23 Jan 2015 20:17:06 +0000 (23:17 +0300)]
flash/nor/stm32lx: add all the IDs and revisions from current RM

RM0038 Rev.12 lists these new parts and introduces the category naming
scheme.

RM0367 Rev.2 (STM32L0x3 RM) doesn't add any new codes.

Change-Id: Id95dd48dda64d5f108dac57d265d29a7db3a1bd1
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Signed-off-by: Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de>
Reviewed-on: http://openocd.zylin.com/2495
Tested-by: jenkins
9 years agoREADME, doc: add mrvlqspi flash driver information
Paul Fertser [Tue, 27 Jan 2015 18:01:44 +0000 (21:01 +0300)]
README, doc: add mrvlqspi flash driver information

Change-Id: I7a270cdaf3d9119aa75285a8d1e063c2fe2a31b7
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2510
Tested-by: jenkins
9 years agodoc, README: mention all the variants supported by lpc2000 driver
Paul Fertser [Tue, 27 Jan 2015 17:25:20 +0000 (20:25 +0300)]
doc, README: mention all the variants supported by lpc2000 driver

Change-Id: I66f9a201426a68fc1314ab7f02b27e36dcab33ba
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2508
Tested-by: jenkins
9 years agoflash/nor/at91samd: add small delay before checking nvm status
Andrej Kazmin [Fri, 22 Aug 2014 07:35:06 +0000 (11:35 +0400)]
flash/nor/at91samd: add small delay before checking nvm status

OpenOCD's SWD subsystem doesn't currently have a consistent WAIT
handling (i.e. it doesn't ever retry, just returns an error), so right
after a row write a small delay is needed as AHB access is stalled
during the flashing operation.

The issue was exposed with a samd20 using ftdi SWD transport.

Change-Id: I07d99d3a96845cc689c3904a41f4d41344f200aa
Signed-off-by: Andrej Kazmin <funnyfish@funnyfish.botik.ru>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2268
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
9 years agoflash/startup: extend "program" command to accept "exit"
Paul Fertser [Fri, 23 Jan 2015 08:38:31 +0000 (11:38 +0300)]
flash/startup: extend "program" command to accept "exit"

This optional argument tells OpenOCD to exit after finishing (either
succesfully, or with an error) the programming sequence. Without it
OpenOCD stays running.

Change-Id: I6ecaf33ff985eea9a9cd02ff644a74403ae3e1e5
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2492
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 agoserver: shutdown command should lead to exit without evaluating the rest
Paul Fertser [Tue, 27 Jan 2015 18:10:18 +0000 (21:10 +0300)]
server: shutdown command should lead to exit without evaluating the rest

Currently

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

outputs both "a1" and "a2" and only then shuts down. This patch fixes
it by making shutdown command throw an exception, so unless it's
caught the shutdown will behave as expected.

Change-Id: I764268b3a9046ff3e9717d04095ea0673f1d755a
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2511
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 agotarget/profiling: Use the correct method to access registers
Andreas Fritiofson [Sun, 18 Jan 2015 14:36:52 +0000 (15:36 +0100)]
target/profiling: Use the correct method to access registers

Change-Id: I6b8590dc9d07886b885013b1b767fe2f0739cd6a
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/2479
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
9 years agoxscale: Use the correct method to access registers
Andreas Fritiofson [Sun, 18 Jan 2015 14:36:24 +0000 (15:36 +0100)]
xscale: Use the correct method to access registers

Change-Id: I900a0787812cb24d1f74ca50eb6bb4f85375a353
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/2478
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
9 years agohla_target: Use the correct method to access registers
Andreas Fritiofson [Sun, 18 Jan 2015 14:35:34 +0000 (15:35 +0100)]
hla_target: Use the correct method to access registers

Change-Id: I853fc5117bdf07ecbc4584ff59d324367b2cb3e3
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/2477
Tested-by: jenkins
Reviewed-by: Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de>
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
9 years agocortex_m: Use the correct method to access registers
Andreas Fritiofson [Sun, 18 Jan 2015 14:34:42 +0000 (15:34 +0100)]
cortex_m: Use the correct method to access registers

Convert the DWT register store to use a byte array and fix the byte order
bug uncovered by that. Also fix an incorrect access of the PC value.

Change-Id: Idb5acab71bdf5a96895c358324b05c335e4d32ca
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/2476
Tested-by: jenkins
Reviewed-by: Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de>
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
9 years agonds32: Use the correct method to access registers
Andreas Fritiofson [Sun, 18 Jan 2015 14:13:20 +0000 (15:13 +0100)]
nds32: Use the correct method to access registers

The registers are represented as bit arrays intended to be accessed using
the buf_set_* and buf_get_* functions. Storing the register values in
integers enables accessing them directly, which gives different results
depending on host byte order.

Convert the register store to use a byte array instead and fix all the
byte order bugs uncovered by that.

Also merge the 32 and 64 bit register fields. Only one of them is used at
a time and after the change to byte arrays their types are also the same.

Change-Id: I456869a1737f4b4f5e8ecbfc1c63c49a75d21619
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/2475
Tested-by: jenkins
Reviewed-by: Hsiangkai Wang <hsiangkai@gmail.com>
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
9 years agomips32: add gdb target description support
Antony Pavlov [Tue, 25 Feb 2014 20:16:58 +0000 (00:16 +0400)]
mips32: add gdb target description support

This commit is inspired by

    commit 1255b18fc650193094666ba8afd2018089cc9794
    Author: Spencer Oliver <spen@spen-soft.co.uk>
    Date:   Fri Sep 13 09:44:36 2013 +0100

        armv7m: add gdb target description support

Change-Id: I75c3971fd0599d34ed49fb73975378b57f2a4af0
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Salvador Arroyo <sarroyofdez@yahoo.es>
CC: Spencer Oliver <spen@spen-soft.co.uk>
CC: Oleksij Rempel <linux@rempel-privat.de>
CC: Paul Fertser <fercerpav@gmail.com>
CC: Gregory Fong <gregory.0xf0@gmail.com>
Reviewed-on: http://openocd.zylin.com/1972
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
Tested-by: jenkins
9 years agomips32: use 'unsigned int' for CPU register indices
Antony Pavlov [Tue, 15 Jul 2014 07:59:04 +0000 (11:59 +0400)]
mips32: use 'unsigned int' for CPU register indices

Change-Id: I77e94b2fe0943a87e1d18d88ebf2a0133aaad728
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Reviewed-on: http://openocd.zylin.com/2216
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
9 years agotcl/interface/ftdi: correct LED config for BusBlaster KT-Link
Anton Kuzmin [Mon, 9 Feb 2015 19:23:22 +0000 (22:23 +0300)]
tcl/interface/ftdi: correct LED config for BusBlaster KT-Link

Configure the LED to be off by default, blink on activity.

Change-Id: I8515ee66c49bddf866268b85811be15c2dbc086c
Signed-off-by: Anton Kuzmin <anton.kuzmin@cs.fau.de>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2539
Tested-by: jenkins
9 years agosim3x: new flash driver for Silabs SiM3 microcontroller family
Andreas Bomholtz [Thu, 8 Jan 2015 13:08:26 +0000 (14:08 +0100)]
sim3x: new flash driver for Silabs SiM3 microcontroller family

This is a new driver for Silicon Laboratories SiM3 microcontroller
family, based on the work of Ladislav Bábel. The driver will try to
detect the type of MCU from the device id register, and if this
fails it will use the flash size from the flash bank command.
Driver added to the documentation and to the README.
TCL script added.

Tests:
* Hardware: SiM3C166 (pre-production) and SiM3U167
* Binary: 4kb, 197kb, 256kb
* Flash protect not tested

Change-Id: I701e0cf505ca8ad99be7f83543fe5055b2f65dcc
Signed-off-by: Andreas Bomholtz <andreas@seluxit.com>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2078
Tested-by: jenkins
9 years agonrf51 - Add async loader. Performance on nrf51822QAA/stlink-v2 from ~3.5KiB/s to...
Angus Gratton [Fri, 27 Jun 2014 06:13:24 +0000 (16:13 +1000)]
nrf51 - Add async loader. Performance on nrf51822QAA/stlink-v2 from ~3.5KiB/s to ~19.5KiB/s.

Change-Id: Ib0bf41a0cec85f0bd5728551f8ad7f6255e4ea04
Signed-off-by: Angus Gratton <gus@projectgus.com>
[spamjunkeater@gmail.com: Cleanup buffer allocation, detect -1 for unknown pages]
Signed-off-by: Erdem U. Altunyurt <spamjunkeater@gmail.com>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2204
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
9 years agoarmv7a: fix interpretation of MMU table
Daniel Glöckner [Thu, 20 Nov 2014 22:57:26 +0000 (23:57 +0100)]
armv7a: fix interpretation of MMU table

On armv7 there no longer are 1kB pages. Instead the bit that in
older architectures distinguished 1kB pages from 4kB pages is on
armv7 used for as execute-never marker. There may now also be 16MB
supersections with 40 bit physical address.

Change-Id: I959bdb8012782a9d07d968907a21f50e3d9b356a
Signed-off-by: Daniel Glöckner <daniel-gl@gmx.net>
Reviewed-on: http://openocd.zylin.com/2386
Tested-by: jenkins
Reviewed-by: Vladimir Svoboda <ze.vlad@gmail.com>
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
9 years agoJ-Link serial number config option
Joerg Fischer [Sat, 31 Jan 2015 12:00:12 +0000 (13:00 +0100)]
J-Link serial number config option

Add serial option to jlink config commands, handy when there is more than one
adapter connected.

To select adapter 0123456 for OpenOCD, use

jlink serial 0123456

Change-Id: Ib29ce3f0c4975e1169211721a4531bf4db61f1ee
Signed-off-by: Joerg Fischer <turboj@gmx.de>
Reviewed-on: http://openocd.zylin.com/2521
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
9 years agocortex_a: Add Cortex-A5 identification
Olivier Schonken [Tue, 20 Jan 2015 12:17:20 +0000 (14:17 +0200)]
cortex_a: Add Cortex-A5 identification

Add Cortex-A5 identification to ROM-table display, and also
to cortex_a_init_debug_access. This change is mostly cosmetic.

Change-Id: I7b1dd8755d70d45eb5f315aa1918d44a813b3cdf
Signed-off-by: Olivier Schonken <olivier.schonken@gmail.com>
Reviewed-on: http://openocd.zylin.com/2483
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
9 years agoREADME: mention "transport select" in quickstart section
Paul Fertser [Tue, 27 Jan 2015 19:43:11 +0000 (22:43 +0300)]
README: mention "transport select" in quickstart section

Change-Id: I027635c3c8632efcf58cf979b9cb2f99e9e7f046
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2512
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 agotarget/image: fix undefined behaviour when loading with GDB
Paul Fertser [Sun, 1 Feb 2015 19:19:38 +0000 (22:19 +0300)]
target/image: fix undefined behaviour when loading with GDB

The image struct is malloc'd and hence base_address_set doesn't have a
defined value.

Caught by Valgrind.

Change-Id: Ice15b2299fc768e44e8034eeb93e035076eacd03
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2524
Tested-by: jenkins
Reviewed-by: Stian Skjelstad <stian@nixia.no>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agodoc: document the OCL (on chip flash loader) driver
Paul Fertser [Tue, 3 Feb 2015 21:49:42 +0000 (00:49 +0300)]
doc: document the OCL (on chip flash loader) driver

Change-Id: I8afe870c7a16b04473f4822c2df9a7607f0480e7
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2529
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agotcl: add TP-LINK TL-MR3020 to the firmware recovery script
Oleksij Rempel [Fri, 30 Jan 2015 20:40:49 +0000 (21:40 +0100)]
tcl: add TP-LINK TL-MR3020 to the firmware recovery script

This adds the board to the list of supported devices for the easy
recovery procedure. Only ram_boot is supported for this target.

Change-Id: I144e1836f8b6257e96a42c98c2668da74ce243f6
Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
Reviewed-on: http://openocd.zylin.com/2520
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
Tested-by: jenkins
Reviewed-by: Andreas Färber <afaerber@suse.de>
9 years agotcl/target|board: add config Atheros ar9331
Oleksij Rempel [Fri, 30 Jan 2015 12:05:31 +0000 (13:05 +0100)]
tcl/target|board: add config Atheros ar9331

Add configs for Atheros ar9331 MIPS based WiSoC and
board based on this chip: TP-LINK TL-MR3020

Change-Id: I9e99719bce4bbb28311f6e9cddb32288db6e7b91
Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
Reviewed-on: http://openocd.zylin.com/2519
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
9 years agotarget: write gmon.out according to target endianness
Jose de Sousa [Wed, 11 Jun 2014 23:05:20 +0000 (00:05 +0100)]
target: write gmon.out according to target endianness

After profiling gmon.out was being written in little endian format only
which would cause gprof to issue and error and exit on big endian targets.

Change-Id: I526a40adae0f9a439fc5b77cef30fda228198b48
Signed-off-by: Jose de Sousa <jose.t.de.sousa@gmail.com>
Reviewed-on: http://openocd.zylin.com/2168
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
9 years agomini51: support for Nuvoton NuMicro M051 series flash memory
Pawel Si [Sat, 6 Dec 2014 16:31:18 +0000 (17:31 +0100)]
mini51: support for Nuvoton NuMicro M051 series flash memory

adds flash support for Nuvoton M052, M054, M058, M0516 microcontrollers
into the mini51 driver, patch also adds support for programing LDROM,
flash data and flash config.

I've tested it on a M0516LBN microcontroller using an ST-LINK/V2:
1. removing security lock:
   openocd -f interface/stlink-v2.cfg  -f target/m051.cfg -c "init ; halt ; mini51 chip_erase; exit"
2. flashing:
   openocd -f interface/stlink-v2.cfg  -f target/m051.cfg -c "program file.hex"

Change-Id: I918bfbb42461279c216fb9c22272d77501a2f202
Signed-off-by: Pawel Si <stawel+openocd@gmail.com>
Reviewed-on: http://openocd.zylin.com/2426
Tested-by: jenkins
Reviewed-by: Nemui Trinomius <nemuisan_kawausogasuki@live.jp>
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
9 years agotcl/target: add CC2538 and CC26xx target files (with cJTAG procedure)
Jacob Palsson [Tue, 29 Jul 2014 12:36:40 +0000 (14:36 +0200)]
tcl/target: add CC2538 and CC26xx target files (with cJTAG procedure)

Added support for the Cortex-M3 based TI low power RF SoC CC2538 and
the CC26xx family.

These chips need a start sequence for switching from cJTAG to JTAG
before being used with OpenOCD, this is done in the tcl proc
ti_cjtag_to_4pin_jtag in the ti-cjtag.cfg config.

The configs for CC2538 and CC26xx run the start sequence on post-reset
event and set the ICEPick IDCODE in the data register for OpenOCD to
read, this is done so that every time OpenOCD resets the device, it
will enable JTAG.

Change-Id: I7db620211c0e7e03fad59d24fe31d23a9cdcfedc
Signed-off-by: Jacob Palsson <jaaacke@gmail.com>
Reviewed-on: http://openocd.zylin.com/2232
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
9 years agoem357: added target files for em357 and em358
Ed Beroset [Sat, 17 Jan 2015 22:04:10 +0000 (17:04 -0500)]
em357: added target files for em357 and em358

This patch adds support for Silicon Labs (formerly Ember) EM357
and EM358 chips and derivatives.

Change-Id: Ie63aed95a2f4ef1a6b955e301a51b4de1b3a5462
Signed-off-by: Ed Beroset <beroset@ieee.org>
Reviewed-on: http://openocd.zylin.com/2470
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
9 years agojlink: Added hardware version number for JLink firmware on LPC-Link2
Nemui Trinomius [Fri, 12 Sep 2014 22:44:55 +0000 (07:44 +0900)]
jlink: Added hardware version number for JLink firmware on LPC-Link2

JLink firmware on LPC-Link2 has unique hardware version number(0x12).

Change-Id: I76b6e27c47d236da75c61dd6b83d6a823615968d
Signed-off-by: Nemui Trinomius <nemuisan_kawausogasuki@live.jp>
Reviewed-on: http://openocd.zylin.com/2298
Tested-by: jenkins
Reviewed-by: Anders Oleson <anders@openpuma.org>
Reviewed-by: Xiaofan <xiaofanc@gmail.com>
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
9 years agocfg: TI Tiva C dk-tm4c129x Evaluation Kits
Heinz Schweiger [Sun, 12 Jan 2014 10:25:40 +0000 (11:25 +0100)]
cfg: TI Tiva C dk-tm4c129x Evaluation Kits

New Texas Instruments Tiva C Series Boards
http://www.ti.com/tool/dk-tm4c129x

Change-Id: I44f96982e91786b977b3d29e0f4c7053d584a703
Signed-off-by: Heinz Schweiger <openocd@htl-steyr.ac.at>
Reviewed-on: http://openocd.zylin.com/1867
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
9 years agolpc2000: add chip IDs for LPC11U6x/LPC11E6x
Michael Brown [Thu, 15 Jan 2015 15:35:21 +0000 (10:35 -0500)]
lpc2000: add chip IDs for LPC11U6x/LPC11E6x

Change-Id: I53568674951ec8a5db5e191c7b50c60b5a84d0b6
Signed-off-by: Michael Brown <fractalmbrown@gmail.com>
Reviewed-on: http://openocd.zylin.com/2463
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
9 years agopsoc4: support for Cypress PSoC 41xx/42xx family
Tomas Vanek [Mon, 8 Sep 2014 08:34:10 +0000 (10:34 +0200)]
psoc4: support for Cypress PSoC 41xx/42xx family

New NOR flash driver was derived from stm32lx.
Procedure ocd_process_reset_inner is overriden in psoc4.cfg
to handle reset halt and system ROM peculiarities.

Change-Id: Ib835324412d106ad749e1351a8e18e6be34ca500
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/2282
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
9 years agostm32lx: do not attempt mass-erase in-place of first bank erase
Jussi Kivilinna [Wed, 17 Dec 2014 10:14:32 +0000 (12:14 +0200)]
stm32lx: do not attempt mass-erase in-place of first bank erase

Commit 832f0a5bfb439 'stm32: add mass erase support for STM32L' added
use of mass-erase in-place of bank-erase. This is triggered if first
bank is requested to be fully erased.

This erroneous action completely fails on STM32L162VEY (has 512 KiB
flash in two 256 KiB banks) and also unintently destroying contents of
EEPROM and second flash bank.

Change-Id: I0f13f7b0346747a09c755d72b5b95775ceff5a6f
Signed-off-by: Jussi Kivilinna <jussi.kivilinna@haltian.com>
Reviewed-on: http://openocd.zylin.com/2441
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
Tested-by: jenkins
9 years agoflash/nor/stm32lx: use 0 base to autodetect second bank location
Paul Fertser [Sat, 24 Jan 2015 10:57:58 +0000 (13:57 +0300)]
flash/nor/stm32lx: use 0 base to autodetect second bank location

Change-Id: I3c296b3e276fcd4d92e4180fc0d2133eebfcc240
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2503
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>