openocd.git
9 years agotcl/target: add lpc8xx.cfg 64/2464/4
Paul Fertser [Thu, 15 Jan 2015 20:48:42 +0000 (23:48 +0300)]
tcl/target: add lpc8xx.cfg

This adds a trivial config for LPC8xx chips based on the already
existing infrastructure in lpc1xxx.cfg.

Change-Id: I7384df1f3c2e3e8ab767319728db5c4f8149480f
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2464
Tested-by: jenkins
Reviewed-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Nemui Trinomius <nemuisan_kawausogasuki@live.jp>
9 years agojtag/drivers: remove useless checks causing build failure with clang 3.5.0 82/2482/2
Paul Fertser [Mon, 19 Jan 2015 09:05:04 +0000 (12:05 +0300)]
jtag/drivers: remove useless checks causing build failure with clang 3.5.0

Change-Id: Icafab6ac1e3e79c6da1bc163c30744eee4bde8d3
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2482
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
9 years agoarmv4_5: Continue the change from uint32_t to uint8_t[4] for regs 73/2473/2
Andreas Fritiofson [Sun, 18 Jan 2015 11:08:05 +0000 (12:08 +0100)]
armv4_5: Continue the change from uint32_t to uint8_t[4] for regs

Also remove an unrelated no-op cast.

Change-Id: Ibeb6c72e5b0b0347abb568947a05a179661faf2d
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/2473
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
Tested-by: jenkins
9 years agoUse (uint8_t *) for buf_(set|get)_u(32|64) instead of (void *) 67/2467/3
Paul Fertser [Sat, 17 Jan 2015 12:15:11 +0000 (15:15 +0300)]
Use (uint8_t *) for buf_(set|get)_u(32|64) instead of (void *)

This helps to uncover incorrect usage when a pointer to uint32_t is
passed to those functions which leads to subtle bugs on BE systems.

The reason is that it's normally assumed that any uint32_t variable
holds its value in host byte order, but using but_set_u32 on it
silently does implicit pointer conversion to (void *) and the
assumption ends up broken without any indication.

Change-Id: I48ffd190583d8aa32ec1fef8f1cdc0b4184e4546
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2467
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
9 years agostm32f2x: Fix byte order bug. 66/2466/2
Jens Bauer [Fri, 16 Jan 2015 22:57:09 +0000 (23:57 +0100)]
stm32f2x: Fix byte order bug.

Do not use buf_set_u32 on integers; they're not buffers.
If using buf_set_u32 on integers, bytes will be exchanged on Big Endian targets.
In this particular case, FLASH_OPTCR was incorrectly written, causing it to often
contain one of these values: 0x00aaaae1, 0x00aaffef, 0x00ffabe1 or 0x00abffe1.
This write-protected the device before flash-programming, causing this command...
flash write_image erase unlock myfile.elf
... to fail, complaining about write-protection.
Repeating the above command would change the OPTCR register each time.
After applying this patch, the OPTCR remains "unchanged".

Change-Id: I73d510fcc2e81a01973ad5c6e1aa22715ebd2743
Signed-off-by: Jens Bauer <jens@gpio.dk>
Reviewed-on: http://openocd.zylin.com/2466
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
9 years agoflash/nor/kinetis: pull SRST low during mass erase 24/2424/2
Paul Fertser [Fri, 5 Dec 2014 10:18:36 +0000 (13:18 +0300)]
flash/nor/kinetis: pull SRST low during mass erase

Mass erase operation might be impacted by different factors,
apparently the most reliable way is to do it while asserting the chip
reset line.

Change-Id: Id6ab57eaec86e402ffdf4f5c8843e7735640f03e
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2424
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agojtag: Rewrite TAP verification/auto-probe logic 36/2236/3
Andreas Fritiofson [Fri, 9 Jan 2015 00:10:04 +0000 (01:10 +0100)]
jtag: Rewrite TAP verification/auto-probe logic

Enable auto-creating additional discovered TAPs even if some TAPs are
predefined, avoiding initialization failure when it's not necessary.

Also, drop the arbitrary limit on the number of predefined TAPs. Still,
don't auto-create any if there are more than 20 TAPs already, to stop
a noisy connection from creating unlimited TAPs.

Create auto-probed TAPs with less noise.

Reduce code duplication between verification and auto-probing.

Change-Id: I82a504d92dbcc0060206e71f10c5158256b5f561
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/2236
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
9 years agoARMv7-A: remove useless switch construct 30/2430/3
Uwe Kleine-König [Tue, 9 Dec 2014 10:11:30 +0000 (11:11 +0100)]
ARMv7-A: remove useless switch construct

The default label does just return the same error code as the case for
zero, so this can be handled by a simple if statement.

Change-Id: I61a8cb51b5e261f21eca386af7d8cbf17ffa2d44
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-on: http://openocd.zylin.com/2430
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
9 years agojtag/drivers/cmsis-dap-usb: fix cmsis_dap_serial 87/2487/2
Jaakko Kukkohovi [Wed, 21 Jan 2015 14:16:31 +0000 (16:16 +0200)]
jtag/drivers/cmsis-dap-usb: fix cmsis_dap_serial

Previously the serial wasn't actually used in hid_open() call,
which meant that the first device with matching vid:pid was opened
irrespective of the actual serial number.

Change-Id: I45216ae5d9e0798e97be693c30e2f03c89b9a02b
Signed-off-by: Jaakko Kukkohovi <jkukkohovi@gmail.com>
Reviewed-on: http://openocd.zylin.com/2487
Tested-by: jenkins
Reviewed-by: Jörg Wunsch <openocd@uriah.heep.sax.de>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agotcl/board: frdm kinetis boards have SRST connected 62/2462/2
Paul Fertser [Sat, 10 Jan 2015 11:12:37 +0000 (14:12 +0300)]
tcl/board: frdm kinetis boards have SRST connected

Change-Id: I1a56b5e9d1ac6466bba11cc694ee3eaa2c9b504f
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2462
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agotcl/target/stellaris: Snowflake supports SYSRESETREQ too 61/2461/2
Paul Fertser [Sat, 10 Jan 2015 10:56:27 +0000 (13:56 +0300)]
tcl/target/stellaris: Snowflake supports SYSRESETREQ too

Change-Id: If4bf472ab8867c54a976bdb5803f7e4f79f350a8
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2461
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-by: Ed Beroset <beroset@ieee.org>
9 years agotcl/target: consolidate Kinetis configs 60/2460/2
Paul Fertser [Sat, 10 Jan 2015 10:52:35 +0000 (13:52 +0300)]
tcl/target: consolidate Kinetis configs

Change-Id: I75fe6b239ff435f700459e7d7040616503fa458e
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2460
Reviewed-by: Andreas Färber <afaerber@suse.de>
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agojtag/drivers/stlink: demote the output of available speeds to DEBUG 69/2469/2
Paul Fertser [Sat, 17 Jan 2015 18:56:24 +0000 (21:56 +0300)]
jtag/drivers/stlink: demote the output of available speeds to DEBUG

Change-Id: If0afb6fb1cb2f39619e4e614573065c145255c3e
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2469
Reviewed-by: Jens Bauer <jens@gpio.dk>
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agojtag/hla_interface: avoid segfault with adapters that do not have configurable speed 68/2468/2
Paul Fertser [Sat, 17 Jan 2015 18:54:29 +0000 (21:54 +0300)]
jtag/hla_interface: avoid segfault with adapters that do not have configurable speed

Change-Id: I0386cbfc85ba8b28d3819530f9950b31545d6821
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2468
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agostm32f07/9: Both devices have 256 kByte Flash Maximum. 58/2458/2
Uwe Bonnes [Fri, 9 Jan 2015 10:23:12 +0000 (11:23 +0100)]
stm32f07/9: Both devices have 256 kByte Flash Maximum.

See RM0091, Rev.7. page 56.

Change-Id: I9a98094d49739686f93e26a5112eb0a2a8a7c883
Signed-off-by: Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de>
Reviewed-on: http://openocd.zylin.com/2458
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agostm32f0x: Remove duplicate code for revision string. 57/2457/2
Uwe Bonnes [Fri, 9 Jan 2015 10:21:10 +0000 (11:21 +0100)]
stm32f0x: Remove duplicate code for revision string.

As of RM0091, Rev. 7, all F0 have the same revisioning scheme.

Change-Id: I0b344a1d3ca3f61f48fa151e83c549ca5333ae47
Signed-off-by: Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de>
Reviewed-on: http://openocd.zylin.com/2457
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agostm32f09x: Print info in get_stm32x_info. 56/2456/2
Uwe Bonnes [Fri, 9 Jan 2015 10:16:04 +0000 (11:16 +0100)]
stm32f09x: Print info in get_stm32x_info.

Change-Id: I5f9b765fe04906e124e2c95ff6bf7193be9d4ce2
Signed-off-by: Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de>
Reviewed-on: http://openocd.zylin.com/2456
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agotcl/board: Add ST NUCLEO L152RE configuration 89/2489/3
Thomas Eichinger [Thu, 22 Jan 2015 16:42:52 +0000 (17:42 +0100)]
tcl/board: Add ST NUCLEO L152RE configuration

Added support for the ST nucleo l152re board with a stm32l152ret6 MCU,
analog to st_nucleo_f* configurations.

Change-Id: Id2c61dc7a7cb2e1cc64442191b367bab4247bdeb
Signed-off-by: Thomas Eichinger <eicht@lepus.uberspace.de>
Reviewed-on: http://openocd.zylin.com/2489
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agocfg: add srst_nogate to the supported targets, remove from board configs 59/2459/3
Paul Fertser [Sat, 10 Jan 2015 10:19:26 +0000 (13:19 +0300)]
cfg: add srst_nogate to the supported targets, remove from board configs

It depends on the particular target whether it can work with SRST
asserted or not, so this belongs to the target config rather than the
board config.

Also, this allows for simple

openocd -f myboard.cfg -c "reset_config connect_assert_srst"

command to be used whenever a user feels a need to connect to an
unresponsive target.

Change-Id: I3d8da9ae47088fc0c75a20bfdd20074be1014de0
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2459
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agostm32f4/nucleo: Use only one configuration for all stm32f4 nucleo boards. 97/2397/4
Uwe Bonnes [Fri, 21 Nov 2014 17:30:43 +0000 (18:30 +0100)]
stm32f4/nucleo: Use only one configuration for all stm32f4 nucleo boards.

Change-Id: Ic3d0b47b19dae9cb09c11d24f16fea85a1b90c0b
Signed-off-by: Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de>
Reviewed-on: http://openocd.zylin.com/2397
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agostm32f0/nucleo: Use only one configuration for all stm32f0 nucleo boards. 96/2396/4
Uwe Bonnes [Fri, 21 Nov 2014 17:18:51 +0000 (18:18 +0100)]
stm32f0/nucleo: Use only one configuration for all stm32f0 nucleo boards.

Change-Id: Ib2ddcd7a92c0d7ad503ef8e953f2bc304241a9f0
Signed-off-by: Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de>
Reviewed-on: http://openocd.zylin.com/2396
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agoflash/nor/stm32f1: Add handling of stm32f09, nearly same as stm32f07. 94/2394/5
Uwe Bonnes [Fri, 21 Nov 2014 12:21:04 +0000 (13:21 +0100)]
flash/nor/stm32f1: Add handling of stm32f09, nearly same as stm32f07.

Change-Id: I9cb2aa75decca0e8a065fe7f5353de44d6877274
Signed-off-by: Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de>
Reviewed-on: http://openocd.zylin.com/2394
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agotarget/stm32xx: Endian is not configurable. 46/2446/2
Karl Palsson [Tue, 9 Dec 2014 13:06:21 +0000 (13:06 +0000)]
target/stm32xx: Endian is not configurable.

So remove it from all the configs, it's misleading, and leads to cargo
culting of config files.

Change-Id: I2b77e60d5e96f9759c7c9fc91b20e73be2e95d9a
Signed-off-by: Karl Palsson <karlp@tweak.net.au>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2446
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agoflash: add AT91SAM4SD16C device 55/2455/2
Jörg Wunsch [Thu, 8 Jan 2015 14:36:25 +0000 (15:36 +0100)]
flash: add AT91SAM4SD16C device

Change-Id: I12f740a1a2d10637b0e5b1e8d054dd912576d190
Signed-off-by: Jörg Wunsch <openocd@uriah.heep.sax.de>
Reviewed-on: http://openocd.zylin.com/2455
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
9 years agocontrib: itmdump: fix multi byte decoding 48/2448/2
Karl Palsson [Fri, 19 Dec 2014 14:17:52 +0000 (14:17 +0000)]
contrib: itmdump: fix multi byte decoding

Incorrect byte manipulations.

Change-Id: Id8c3f457b39f4b2b75613076d403359c4972a69d
Signed-off-by: Karl Palsson <karlp@tweak.net.au>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2448
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agotcl/interface/ftdi: add config for the IoT-LAB adapter 15/2415/2
Paul Fertser [Thu, 27 Nov 2014 14:36:34 +0000 (17:36 +0300)]
tcl/interface/ftdi: add config for the IoT-LAB adapter

This is an integrated adapter used on the IoT-LAB boards.

Schematics are available from
https://github.com/iot-lab/iot-lab/wiki/Docs/openm3-schematics.pdf

Change-Id: I1c80e72653c3f319bb04d01e3dfddb1c2447c398
Tested-by: Quentin Lampin <quentin.lampin@orange.com>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2415
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agotcl/board: Add TI TMDX570LS20SUSB board config 40/2440/2
Andreas Färber [Mon, 15 Dec 2014 15:28:06 +0000 (16:28 +0100)]
tcl/board: Add TI TMDX570LS20SUSB board config

It is derived from ti_tmdx570ls31usb.cfg, using a different TAP ID.

Change-Id: I2d911995c76ea4f75a780cc230d61f4959825809
Signed-off-by: Andreas Färber <afaerber@suse.de>
Reviewed-on: http://openocd.zylin.com/2440
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agostlink: add reconfigurable speed support 35/2335/9
Spencer Oliver [Thu, 9 Oct 2014 19:08:23 +0000 (20:08 +0100)]
stlink: add reconfigurable speed support

The ability to change the speed has been added to firmware versions J22 and
above. Any attempt to change on earlier versions will be ignored without error,
as the existing code does.

For supported firmware versions the driver will attempt to get as close as
possible to supported speeds (never higher).

The default stlink speed on power up is 1.8MHz.
The driver will now also print supported clocl speeds during init.

Change-Id: Iee9bd018bb8b6f94672a12538912d41c23d48a7e
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/2335
Tested-by: jenkins
9 years agohla: add ability to change adapter speed (if supported) 34/2334/5
Spencer Oliver [Thu, 9 Oct 2014 18:48:56 +0000 (19:48 +0100)]
hla: add ability to change adapter speed (if supported)

As a note we need to cache the requested speed setting, as the
hla interface may not be ready when the first adapter_khz is called.

Change-Id: I2fa6807d5f0bd3f0365cf178bd10a230c39415a7
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/2334
Tested-by: jenkins
9 years agocfg: stm32l1: Use specific chipname 47/2447/2
Karl Palsson [Tue, 16 Dec 2014 13:19:48 +0000 (13:19 +0000)]
cfg: stm32l1: Use specific chipname

This should have been corrected earlier with the split of l1/l0 code
apart.

Change-Id: I87b94a310ae7e76318554a9cd2705348a942d58b
Signed-off-by: Karl Palsson <karlp@tweak.net.au>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2447
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agojtag/hla: output possible idcode candidates in case of mismatch 51/2451/2
Paul Fertser [Wed, 7 Jan 2015 12:41:38 +0000 (15:41 +0300)]
jtag/hla: output possible idcode candidates in case of mismatch

Output a similar message to what we have on low-level JTAG adapters to
avoid confusing users. Reported on IRC by chickensk.

Change-Id: I96d58410ef715b966e32d79c0aacf38596c5eb3f
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2451
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agojtag: Avoid extra SRSTn resets when connecting 98/2398/2
Evan Hunter [Fri, 21 Nov 2014 17:42:23 +0000 (17:42 +0000)]
jtag: Avoid extra SRSTn resets when connecting

Previously the jtag_add_reset(1, 0) caused the processor to be released,
and if SRSTn existed then it would then be reset again two lines later.

Change-Id: I58b7a12607f46f83caa7ed3b3cebc4195eb51ef6
Signed-off-by: Evan Hunter <ehunter@broadcom.com>
Reviewed-on: http://openocd.zylin.com/2398
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agodocs: update bug tracker URL 54/2454/3
Spencer Oliver [Wed, 7 Jan 2015 23:43:22 +0000 (23:43 +0000)]
docs: update bug tracker URL

Change-Id: I6a362020a29ccb9222f7909b5b34e5c35a02ed4b
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/2454
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
9 years agolpc2000: Improve lpc2000 flash driver. 42/2442/2
Nemui Trinomius [Thu, 18 Dec 2014 23:24:25 +0000 (08:24 +0900)]
lpc2000: Improve lpc2000 flash driver.

This patch adds flash programming support for LPC5410x and LPC82x.
And adds auto flash size detection for LPC800 series.
Tested on below listed boards/chips.
LPC54102(LPCLPC54102Xpresso)
LPC824(LPCXpresso824-MAX)
LPC812(LPC812MAX)
LPC811,LPC810

Change-Id: Ie68b6d425b17ccfa83814607ee61056e99800c1c
Signed-off-by: Nemui Trinomius <nemuisan_kawausogasuki@live.jp>
Reviewed-on: http://openocd.zylin.com/2442
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
9 years agocortex_a: Add support for A7 MPCore 44/2344/2
Alexander Stein [Tue, 14 Oct 2014 09:55:27 +0000 (11:55 +0200)]
cortex_a: Add support for A7 MPCore

A7 MPCore needs unlocking the debug registers same as with A15 MPCore.
Found out by hacking on the code.

Change-Id: I613cb4fb35007b85b4a9a401577b47768bc1a08b
Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com>
Reviewed-on: http://openocd.zylin.com/2344
Tested-by: jenkins
Reviewed-by: Kamal Dasu <kamal.dasu@gmail.com>
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
9 years agocortex_a: Add support for A15 MPCore 01/1601/12
Kamal Dasu [Thu, 29 Aug 2013 18:02:19 +0000 (14:02 -0400)]
cortex_a: Add support for A15 MPCore

Added Cortex-A15 support for DAP AHB-AP init code as per ADI V5 spec.
Also added changes to make the APB MEM-AP to work with A15.
Made the the cortex_a target code  generic to work with A8, A9
and A15 single core or multicore implementation. Added armv7a code
for os_border calculation to work for known A8, A9 and A15
platforms based on the ARM DDI 0344H, ARM DDI 0407F, ARM DDI 0406C
ARMV7A architecture docs.

Change-Id: Ib2803ab62588bf40f1ae4b9192b619af31525a1a
Signed-off-by: Kamal Dasu <kdasu.kdev@gmail.com>
Reviewed-on: http://openocd.zylin.com/1601
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
9 years agoChibiOS: struct ChibiOS_params_list[] should not be const 27/2427/3
Tomas Vanek [Mon, 8 Dec 2014 14:16:05 +0000 (15:16 +0100)]
ChibiOS: struct ChibiOS_params_list[] should not be const

Procedure ChibiOS_update_memory_signature() sets struct member signature.

Change-Id: I45adbd14fa7cda99413fd0b516d45b3fb55e322d
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/2427
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agotransport: clarify error message when transport is not selected 06/2406/2
Karl Palsson [Fri, 21 Nov 2014 22:05:41 +0000 (22:05 +0000)]
transport: clarify error message when transport is not selected

When no transport is selected, the error message dumps the available
transports, but not how to actually select one.

Change-Id: I63da2a4b59e3f6cc8d30bd631e41a82636a056ef
Signed-off-by: Karl Palsson <karlp@tweak.net.au>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2406
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agoflash: fix kinetis driver typos 85/2385/2
Spencer Oliver [Thu, 20 Nov 2014 21:38:06 +0000 (21:38 +0000)]
flash: fix kinetis driver typos

Change-Id: I0a4557f08507c61cb8ab33b38d2b6b069c344c09
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/2385
Tested-by: jenkins
9 years agocfg: fix lpc17xx regression 84/2384/2
Spencer Oliver [Thu, 20 Nov 2014 21:33:42 +0000 (21:33 +0000)]
cfg: fix lpc17xx regression

commit b5a6ba46 broke the following board files, update to new cfg.

Change-Id: Ic3b776bd32eb72eae6ad1e130e329268ce9ba71a
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/2384
Tested-by: jenkins
9 years agoavoid segfaulting when attempting to set an unavailable type of breackpoint 42/2342/2
Salvador Arroyo [Sat, 11 Oct 2014 21:37:08 +0000 (23:37 +0200)]
avoid segfaulting when attempting to set an unavailable type of breackpoint

For example "bp 0x20000000 8 2" makes openocd segfaulting on a
stm32f4x Discovery board.

Change-Id: I1ddd46b1fa9ade78db2234ed975ccefb72539331
Signed-off-by: Salvador Arroyo <sarroyofdez@yahoo.es>
Reviewed-on: http://openocd.zylin.com/2342
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agoMac/PPC: Fix build. 60/2360/2
Jens Bauer [Tue, 28 Oct 2014 04:14:05 +0000 (05:14 +0100)]
Mac/PPC: Fix build.

GCC-4.2 on Mac/PPC complains about size_t is expected for %zx and the build stops.
In order to avoid other problems, I've chosen simply to typecast.

Change-Id: I99b569c4d1100e729712e31d24d6539f8b5971b6
Signed-off-by: Jens Bauer <jens@gpio.dk>
Reviewed-on: http://openocd.zylin.com/2360
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
9 years agoswd: handle various failure conditions 71/2371/3
Paul Fertser [Sun, 2 Nov 2014 12:16:13 +0000 (15:16 +0300)]
swd: handle various failure conditions

When communication with target fails for whatever reason, it makes
sense to do JTAG-to-SWD (in case the target got power-cycled or the
DAP method was reset anyhow), SWD line reset sequence (part of
JTAG-to-SWD already) and the mandatory IDCODE read. Schedule that to
be performed on the next poll.

Fix the return values for ftdi and jlink drivers to be consistent with
OpenOCD error codes and remove ad-hoc calls to perform DAP method
switching (as it's now done from the upper layer automatically).

Change-Id: Ie18797d4ce7ac43d8249f8f81f1064a2424e02be
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2371
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-by: Mateusz Manowiecki <segmentation@fault.pl>
9 years agotarget: improve robustness of polling and reexamination 70/2370/2
Paul Fertser [Sun, 2 Nov 2014 12:03:16 +0000 (15:03 +0300)]
target: improve robustness of polling and reexamination

When a target was present on OpenOCD start but later disappeared for
whatever reason (typically unstable connection or target going to
sleep) and reappeared only for a brief period of time, reexamination
would fail, and poll would no longer run. This patch fixes it.

Change-Id: I61f9b5a3f366a761320e233f4e1689f926b5556d
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2370
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Tested-by: jenkins
9 years agortos: free gdb packet allocated memory 82/2382/2
Spencer Oliver [Fri, 14 Nov 2014 09:23:12 +0000 (09:23 +0000)]
rtos: free gdb packet allocated memory

compile tested only.

Change-Id: I3bc06c212967a3ce44a875f802b554c178537d1d
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/2382
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
9 years agocheckpatch: fix check for the FSF address 14/2414/3
Paul Fertser [Thu, 27 Nov 2014 07:54:07 +0000 (10:54 +0300)]
checkpatch: fix check for the FSF address

Commit 4525c0a4c4d0aaa199c37a6d2245617e8445f213 cherry-picked check
for the FSF address presence from upstream. However, it has a typo
resulting in this obscure error when triggered:

Use of uninitialized value in concatenation (.) or string at /home/jenkins/.jenkins/jobs/openocd-gerrit/workspace/tools/scripts/checkpatch.pl line 1258.
ERROR:

This patch fixes it.

Change-Id: Ia417ef4782d21c8b3f1d39de88c4ab850a5a6630
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2414
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
9 years agojtag: Remove unnecessary global variable 35/2235/2
Andreas Fritiofson [Wed, 30 Jul 2014 21:21:09 +0000 (23:21 +0200)]
jtag: Remove unnecessary global variable

Change-Id: I96e5f13b12da2970eafc5fca24b7952d427eeca9
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/2235
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agojtag: Fix memory leaks in jtag_tap_free() 34/2234/2
Andreas Fritiofson [Wed, 30 Jul 2014 21:18:41 +0000 (23:18 +0200)]
jtag: Fix memory leaks in jtag_tap_free()

Change-Id: I953fbb346fbf168fb50b349d245f2aa64dbfdcb3
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/2234
Tested-by: jenkins
9 years agostm32l: split l0/l1 support no jtag, different HSI settings 05/2405/2
Karl Palsson [Fri, 21 Nov 2014 22:14:57 +0000 (22:14 +0000)]
stm32l: split l0/l1 support no jtag, different HSI settings

L0 is cortex m0+, so different id codes, SWD only, different addresses
for the clock speedup.  It has no endian options, no boundary scan.

Removed all L0 specific portions from L1 files, and renamed files to clarify
their purpose.  The deprecated stm32lx_stlink.cfg is kept as is, as it is only
around for backwards compatibility with prior releases.

Tested on STM32L053 Discovery and STM32L151 Discovery.

Has _not_ been tested with jtag on L1.

Change-Id: I8eea890d2f92a302d9e9c8a8832d218ee1b6bcfc
Signed-off-by: Karl Palsson <karlp@tweak.net.au>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2405
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-by: Juha Niskanen <juha.niskanen@haltian.com>
9 years agostm32: Fix L0/1xx CPUTAPID setting and add new L1xx BSTAPIDs 76/2376/2
Juha Niskanen [Wed, 5 Nov 2014 13:39:58 +0000 (15:39 +0200)]
stm32: Fix L0/1xx CPUTAPID setting and add new L1xx BSTAPIDs

Fix script parse error, when using JTAG, introduced in
commit 0187ced9ed2

Add several BS TAPIDs with comments about ST documentation.

Change-Id: I8d0370b244ccaf7ea0dbe1919bfad1915f7317d4
Signed-off-by: Juha Niskanen <juha.niskanen@haltian.com>
Reviewed-on: http://openocd.zylin.com/2376
Tested-by: jenkins
Reviewed-by: Rémi PRUD'HOMME <prudhomme.remi@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agotcl/target/stm32f4: ramp up JTAG speed, HSI is 16MHz there 83/2383/2
Uwe Bonnes [Tue, 18 Nov 2014 14:30:44 +0000 (17:30 +0300)]
tcl/target/stm32f4: ramp up JTAG speed, HSI is 16MHz there

Since all F4 parts have an internal HSI providing 16MHz, it's safe to
use 2MHz JTAG frequency by default.

Change-Id: I2702d5a1d642d4acd4af2db54c028949132c6900
Signed-off-by: Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2383
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agotcl/target/stm32f4x: add F401 and F411 IDs 79/2379/3
Uwe Bonnes [Thu, 6 Nov 2014 15:31:21 +0000 (16:31 +0100)]
tcl/target/stm32f4x: add F401 and F411 IDs

Change-Id: I12079586dafb8a7614bdf4cc0b13cd5030301742
Signed-off-by: Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de>
Reviewed-on: http://openocd.zylin.com/2379
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agolpc2000: ignore status of part ID IAP command 64/2364/3
Grigori Goronzy [Thu, 30 Oct 2014 00:14:58 +0000 (01:14 +0100)]
lpc2000: ignore status of part ID IAP command

The IAP firmware won't return a proper status with some versions. This
happens on my CCC r0ket board and others have seen it as well [1]. So
just ignore the status code and do a (weak) consistency check instead.

[1] http://www.lpcware.com/content/forum/lpc1343-iap-read-part-identification-command

Change-Id: I0daa779d520a540629677c56857bbc20d6db422d
Signed-off-by: Grigori Goronzy <greg@chown.ath.cx>
Reviewed-on: http://openocd.zylin.com/2364
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
9 years agocheckpatch.pl: check for the FSF mailing address 41/2341/2
Antony Pavlov [Fri, 10 Oct 2014 04:27:14 +0000 (08:27 +0400)]
checkpatch.pl: check for the FSF mailing address

This check code is imported from Linux v3.17 checkpatch.pl.

Change-Id: If39d834ee9b6131bccc92de38fd7c108650bd2f1
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Reviewed-on: http://openocd.zylin.com/2341
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Tested-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agoor1k: remove address of the Free Software Foundation 40/2340/2
Antony Pavlov [Fri, 10 Oct 2014 04:34:51 +0000 (08:34 +0400)]
or1k: remove address of the Free Software Foundation

The FSF address has changed; The FSF site says that
address is

  Free Software Foundation
  51 Franklin Street, Fifth Floor
  Boston, MA 02110-1301
  USA

(see http://www.fsf.org/about/contact/)

Instead of updating it each time the address changes,
just drop it completely treewide.

Change-Id: I27199f7625901f677d8105d1e8876cff00147b71
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Reviewed-on: http://openocd.zylin.com/2340
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agocheckpatch.pl: check for openocd tree, not for kernel tree 39/2339/4
Antony Pavlov [Fri, 10 Oct 2014 04:13:46 +0000 (08:13 +0400)]
checkpatch.pl: check for openocd tree, not for kernel tree

checkpatch.pl looks for linux kernel specific paths and files
to check source tree. As openocd misses kernel files it ends
with this error message:

    Must be run from the top-level dir. of a kernel tree

This patch also renames 'kernel' -> 'openocd'
in source tree-related messages.

Due to checkpatch checking modifications on itself, lift the
restriction on having no spaces at the start of a line for Perl
scripts. This can be readded back later.

Change-Id: I89b7ca976bef5e13785bd3a43e597c9feb4c2df4
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Reviewed-on: http://openocd.zylin.com/2339
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agomips32: fix typos 38/2338/2
Antony Pavlov [Tue, 7 Oct 2014 08:36:55 +0000 (12:36 +0400)]
mips32: fix typos

Change-Id: Ibb98fe3da68bf670a5bb83600bb49647db8a4163
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Reviewed-on: http://openocd.zylin.com/2338
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agodoc: flash: write_image writes only loadable sections 48/2348/2
Alexei Colin [Sun, 19 Oct 2014 21:46:05 +0000 (17:46 -0400)]
doc: flash: write_image writes only loadable sections

The code that takes only sections marked PT_LOAD is in
image_elf_read_headers in src/target/image.c

(Just trying to save some time for the next person with same question.)

Change-Id: I493c102c908fca2b7238276ddbbecbe8c7cd9a0a
Signed-off-by: Alexei Colin <ac@alexeicolin.com>
Reviewed-on: http://openocd.zylin.com/2348
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agoAdded FPU support for ChibiOS/RT 54/2354/2
Christian Gudrian [Fri, 24 Oct 2014 21:22:40 +0000 (23:22 +0200)]
Added FPU support for ChibiOS/RT

When an enabled FPU is detected we now use an appropriate stacking.

Change-Id: I1b0f43ec22e1c55c4f10e2ffa97d4aaa77bca5ee
Signed-off-by: Christian Gudrian <christian.gudrian@gmx.de>
Reviewed-on: http://openocd.zylin.com/2354
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agortos: add support for ChibiOS/RT 3.0 52/2352/5
Christian Gudrian [Tue, 21 Oct 2014 20:23:40 +0000 (22:23 +0200)]
rtos: add support for ChibiOS/RT 3.0

In ChibiOS/RT 3.0 the ready list pointer "rlist" is now part of the system
data structure. Since the ready list is the first element in that
structure it can be accessed via the structure's symbol "ch".

Change-Id: Idc7eaa87cb7bbad0afa0ff1dafd54283bf429766
Signed-off-by: Christian Gudrian <christian.gudrian@gmx.de>
Reviewed-on: http://openocd.zylin.com/2352
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agortos: allow symbols to be optional for a particular RTOS 55/2355/3
Paul Fertser [Sat, 25 Oct 2014 07:20:10 +0000 (11:20 +0400)]
rtos: allow symbols to be optional for a particular RTOS

Default to non-optional.

Change-Id: Ifc9ddb1ab701a19c3760f95da47da6f7d412ff2e
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2355
Tested-by: jenkins
Reviewed-by: Christian Gudrian <christian.gudrian@gmx.de>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agoflash: at91samd: fix use of is_erased in check 68/2368/2
Andrey Yurovsky [Thu, 30 Oct 2014 18:56:08 +0000 (11:56 -0700)]
flash: at91samd: fix use of is_erased in check

is_erased can be one of -1, 0, or 1 so it must not be checked like a
boolean value.  In this case we want to erase a page unless we know it's
already erased so we just check for is_erased != 1.

Thanks to Jim Paris for pointing this out on another driver.

Change-Id: I4591186228153b64e5a9608a2aac18745e578d4a
Signed-off-by: Andrey Yurovsky <yurovsky@gmail.com>
Reviewed-on: http://openocd.zylin.com/2368
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agojtag/drivers/jlink: implement register command to fix SWD 31/2331/6
Paul Fertser [Fri, 31 Oct 2014 11:30:57 +0000 (14:30 +0300)]
jtag/drivers/jlink: implement register command to fix SWD

Some J-Link fw versions require registration to be performed before
SWD operation is possible. It doesn't harm anyway, vendor's utilities
do it unconditionally.

Thanks go to Segger for providing the necessary information.

Change-Id: Iabd76c743eca86e2c817a97cb93c969fec3f7ac6
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2331
Tested-by: jenkins
9 years agoat91sam4: Adding support for the AT91SAM4S4A. 54/2254/2
Thomas Schmid [Fri, 15 Aug 2014 21:08:23 +0000 (15:08 -0600)]
at91sam4: Adding support for the AT91SAM4S4A.

Added the chip definition for the Atmel AT91SAM4S4A. This chip is a 48-pin
package with 256k flash and 64k ram.

Change-Id: I8ada7d5735e31e0ce086f96f5906c7358464245c
Signed-off-by: Thomas Schmid <thomas@rfranging.com>
Reviewed-on: http://openocd.zylin.com/2254
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agoflash/nor/lpcspifi.c: fix bug that prevented clean reset after flash write 59/2359/2
Anders [Mon, 27 Oct 2014 19:55:50 +0000 (12:55 -0700)]
flash/nor/lpcspifi.c: fix bug that prevented clean reset after flash write

After SPI flash was written by the assembly language stub,
the last SPI command was not terminated by raising CS.
This left the SPI device in a hung state that prevented the
flash from being read by the M4 SPIFI controller, even after
the M4 was fully reset. To access the flash via SPIFI, it was
necessary to completely power cycle the board.

This fix adds the missing instructions to raise CS and
terminate the SPI command after the last byte. This allows
the M4 to be resumed or reset cleanly after flashing. The
SPIFI memory is now immediately accessable at address
0x1400 0000 after flashing is complete.

Change-Id: I4d5e03bded0fa00c430c2991f182dc18611d5f48
Signed-off-by: Anders <anders@openpuma.org>
Reviewed-on: http://openocd.zylin.com/2359
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agoHacking: Some note how to review. 80/2380/3
Uwe Bonnes [Fri, 7 Nov 2014 13:28:43 +0000 (14:28 +0100)]
Hacking: Some note how to review.

Change-Id: Ied682884abdba27da265f1ce3632417f54a80fe2
Signed-off-by: Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de>
Reviewed-on: http://openocd.zylin.com/2380
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agolpc2000: Added LPC1500 series flash programming support. 04/2304/2
Nemui Trinomius [Fri, 19 Sep 2014 15:06:00 +0000 (00:06 +0900)]
lpc2000: Added LPC1500 series flash programming support.

This patch adds flash programming support for LPC1547/8/9 and LPC1517/8/9.
Tested on LPC1549(LPC1549 LPCXpresso Board with CMSIS-DAP firmware).

Change-Id: Ic95b4d62055bb9fdc2ca484696a38ccaf49ad951
Signed-off-by: Nemui Trinomius <nemuisan_kawausogasuki@live.jp>
Reviewed-on: http://openocd.zylin.com/2304
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-by: Grigori G <greg@chown.ath.cx>
9 years agonrf51: fix checks for is_erased 66/2366/3
Jim Paris [Wed, 29 Oct 2014 23:09:49 +0000 (19:09 -0400)]
nrf51: fix checks for is_erased

is_erased can take the value 0 (no), 1 (yes), or -1 (unknown).
Checks like (!is_erased) don't do the right thing if it's -1.

Change-Id: I10ba32c99494ca803e0a7a1ba56fdd78184b96bb
Signed-off-by: Jim Paris <jim@jtan.com>
Reviewed-on: http://openocd.zylin.com/2366
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agonrf51: verify that UICR needs erasing before triggering an error about it 63/2363/4
Jim Paris [Wed, 29 Oct 2014 23:00:52 +0000 (19:00 -0400)]
nrf51: verify that UICR needs erasing before triggering an error about it

If the UICR is already empty, there's no reason to return an error
just because it can't be erased again.  This happens, for example,
when flashing UICR from GDB after a "monitor nrf51 mass_erase".

Change-Id: Ia6d28c43189205fb5a7120b1c7312e45eb32edb7
Signed-off-by: Jim Paris <jim@jtan.com>
Reviewed-on: http://openocd.zylin.com/2363
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agonrf51: fix UICR erase 62/2362/3
Jim Paris [Wed, 29 Oct 2014 03:15:31 +0000 (23:15 -0400)]
nrf51: fix UICR erase

nrf51_erase_page() checks for (sector->offset == NRF51_UICR_BASE) to
determine if the UICR should be erased.  However, sector->offset for
the UICR bank is set to 0 in nrf51_probe, so this code is never hit.
Attempting to erase UICR ends up erasing the first flash sector.

Use bank->base instead to determine if UICR is being erased.

Change-Id: Ie5df0f9732f23662085ae2b713d64968cd801472
Signed-off-by: Jim Paris <jim@jtan.com>
Reviewed-on: http://openocd.zylin.com/2362
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agonrf51: fix UICR region size 61/2361/3
Jim Paris [Tue, 28 Oct 2014 20:20:16 +0000 (16:20 -0400)]
nrf51: fix UICR region size

The UICR region is actually 0x100 bytes in size.  Besides making the
full region accessible, having the right value is important because
GDB rounds flash addresses to the nearest multiple of the block size
when determing which flash blocks to erase.

Change-Id: I416c391cbfc7be41a03a9b9c6e42326c87391f38
Signed-off-by: Jim Paris <jim@jtan.com>
Reviewed-on: http://openocd.zylin.com/2361
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Tested-by: jenkins
9 years agoarm_adi_v5: added two CoreSight peripheral IDs 69/2369/4
Peter Lawrence [Sun, 2 Nov 2014 00:31:49 +0000 (17:31 -0700)]
arm_adi_v5: added two CoreSight peripheral IDs

added "Single Wire Output" and "Trace Memory Controller" peripheral
IDs to dap_rom_display(), which is invoked by the "dap info" command

Change-Id: Iea3201007bb98e6376fbb50be40a4a2e031b0a03
Signed-off-by: Peter Lawrence <majbthrd@gmail.com>
Reviewed-on: http://openocd.zylin.com/2369
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
9 years agotcl/interface/ftdi/swd-resistor-hack: clarify and add schematic diagram 57/2357/2
Paul Fertser [Sun, 26 Oct 2014 10:49:51 +0000 (13:49 +0300)]
tcl/interface/ftdi/swd-resistor-hack: clarify and add schematic diagram

Change-Id: I8600ee983de85e4225430ae508a50cd938122d89
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2357
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
9 years agocmsis-dap: add serial number support 29/2329/3
Spencer Oliver [Thu, 2 Oct 2014 20:54:23 +0000 (21:54 +0100)]
cmsis-dap: add serial number support

Change-Id: I66926d1013e2b3a43ce0d18d3599771428706b6a
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/2329
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
9 years agocmsis-dap: refactor HID PID/VID check loop 28/2328/2
Spencer Oliver [Thu, 2 Oct 2014 20:47:22 +0000 (21:47 +0100)]
cmsis-dap: refactor HID PID/VID check loop

In preparation for adding serial number support.

Change-Id: I3c9fb411b79d54a4d2de067039255436ba6708c7
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/2328
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
9 years agobuild: make makeinfo optional 25/2325/2
Spencer Oliver [Tue, 30 Sep 2014 10:22:40 +0000 (11:22 +0100)]
build: make makeinfo optional

This means the user does not have to install texinfo to build OpenOCD.

Change-Id: Id9f42da798d3c2b79e95214c9e2559cf32802251
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/2325
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
9 years agocfg: remove incorrect execute permissions 33/2333/2
Spencer Oliver [Mon, 6 Oct 2014 18:50:40 +0000 (19:50 +0100)]
cfg: remove incorrect execute permissions

Change-Id: I0ba9dfdf876bc99df4e2d1f1f3bc0c9ccc6c98c2
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/2333

9 years agostm32: add mass erase support for STM32L 19/2319/4
Rémi PRUD'HOMME [Wed, 1 Oct 2014 21:43:03 +0000 (22:43 +0100)]
stm32: add mass erase support for STM32L

The mass erase for STM32L was lack because the procedure is more complex
than the procedure for the STM32F4xx.

The reference manual RM0038 (L100 subfamily) page 79 is more accurate
than the reference manual for the STM32L0xx. On the L0, the mass-erase
erase also the EEPROM. This is a limit to mass erase on L0.

The mass erase procedure is a command of telnet interface.

Tested on Discovery L053 and Discovery L100.

Change-Id: I6a1d7a3669789aea89c59a006ab2d883f3d827ca
Signed-off-by: Rémi PRUD'HOMME <prudhomme.remi@gmail.com>
Reviewed-on: http://openocd.zylin.com/2319
Tested-by: jenkins
Reviewed-by: Andrey Yurovsky <yurovsky@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agostm32: Add config file for a new board STM32L052 dsicovery 17/2317/4
Rémi PRUD'HOMME [Wed, 24 Sep 2014 20:50:51 +0000 (22:50 +0200)]
stm32: Add config file for a new board STM32L052 dsicovery

this board use STLink-V2-1, the STM32L1xx use the STLink-V2.

Change-Id: Ie58f45affcb1e9a6fed711b48c3c03b5035ab2b2
Signed-off-by: Rémi PRUD'HOMME <prudhomme.remi@gmail.com>
Reviewed-on: http://openocd.zylin.com/2317
Tested-by: jenkins
Reviewed-by: Andrey Yurovsky <yurovsky@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agostm32: add L0xx CPUTAPID 15/2315/4
Rémi PRUD'HOMME [Wed, 24 Sep 2014 20:26:50 +0000 (22:26 +0200)]
stm32: add L0xx CPUTAPID

Add CPUTAPID for stm32 L0xx mcu devices. Using -expected-id to
add the new id with the id for L1xx devices. This for reduce the
duplicated code.

Change-Id: I48bd230884ecf38fa200c620b547bdf3b5f59132
Signed-off-by: Rémi PRUD'HOMME <prudhomme.remi@gmail.com>
Reviewed-on: http://openocd.zylin.com/2315
Tested-by: jenkins
Reviewed-by: Andrey Yurovsky <yurovsky@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agoflash/nor/stellaris: implement protection statuses and procedures 67/2267/4
Paul Fertser [Thu, 21 Aug 2014 11:16:55 +0000 (15:16 +0400)]
flash/nor/stellaris: implement protection statuses and procedures

This should make protection work as expected on all stellaris
families, including the latest Tiva C Snowflake.

Run-time tested on TM4C123x (Blizzard).

Change-Id: Ia017edb119bec32382b08fc037b5bbc02dd9000c
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2267
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agolibusb: introduce jtag_libusb_choose_interface() and use it for JLink 27/2327/3
Paul Fertser [Wed, 1 Oct 2014 06:36:02 +0000 (10:36 +0400)]
libusb: introduce jtag_libusb_choose_interface() and use it for JLink

This introduces a new common function that allows auto-discovery of a
suitable USB interface based on class, subclass and protocol
matching. It claims the interface and returns the corresponding
endpoints number to the caller.

The need for this arised due to nRF51822 USB dongle which comes with
an "on-board Segger J-link debugger" having 3 interfaces, so the
current code can't work at all with it (in this particular case the
last interface needs to be choosen). This also removes special
handling of JLink-OB endpoint numbers as it's now possible to
autodetect them as well as the standard JLink endpoints.

Change-Id: I4d990a7a3b373efdd2949a394b32d855a168e138
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2327
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agoflash/nor/stellaris: actually enable protection and unprotection with ICDI 64/2264/4
Paul Fertser [Tue, 19 Aug 2014 17:54:31 +0000 (21:54 +0400)]
flash/nor/stellaris: actually enable protection and unprotection with ICDI

This is still limited to pre-Snowflake parts and the first 64K of
flash.

Change-Id: I9ca872ada3d1a87dba6261464b2a72a15eda5ecf
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2264
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agohla: add a way to pass arbitrary commands from user to layout and use for ICDI 63/2263/4
Paul Fertser [Tue, 19 Aug 2014 17:16:20 +0000 (21:16 +0400)]
hla: add a way to pass arbitrary commands from user to layout and use for ICDI

TI's ICDI adapter supports some additional commands which a user might
want to run for debugging or other purposes, the most useful of them
being "debug unlock" that fully mass-erases the device and unprotects
the flash.

Change-Id: I26990e736094367f92106fa891e9bb8fb0382efb
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2263
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agointerface/ftdi/olimex-arm-usb-ocd-h: fix nTRST control definition 86/2286/4
Paul Fertser [Wed, 10 Sep 2014 08:29:23 +0000 (12:29 +0400)]
interface/ftdi/olimex-arm-usb-ocd-h: fix nTRST control definition

According to my inspection of an Olimex ARM-USB-OCD-H adapter ACBUS0
is connected directly to an SN74LVC2T45 buffer input B2, and the
corresponding output A2 is connected directly to the JTAG
connector. It seems the information in the Olimex flyer is incorrect
for the -H version and TRST can't be tri-stated, ACBUS2 is unused.

The older ARM-USB-OCD device has SN74AC244 for an output buffer and
ACBUS2 controls its !2OE, ACBUS0 connected to 2A1 (2Y1 is nTRST), in
accordance with the information flyer.

Change-Id: I22828b7b959b6f62c3f51367feb8fab9705641e5
Reported-by: Tim Sander <tim@krieglstein.org>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2286
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-by: Tim Sander <tim@krieglstein.org>
9 years agojtag/drivers/jlink.c: fix for LPC Link-2 running JLink firmware on Linux 97/2297/3
Anders [Fri, 12 Sep 2014 15:44:33 +0000 (08:44 -0700)]
jtag/drivers/jlink.c: fix for LPC Link-2 running JLink firmware on Linux

Change 2288 fixed the extraneous reset caused by set_configuration that
crashed the LPC Link-2 running JLink firmware and works on windows platforms.
On Linux however, conditional code was still calling USB reset and caused
the adapter to crash on any non-windows platforms.

Change-Id: Ibf2a02d0dcdd91ccb71d86231cd8311dcadfee1e
Signed-off-by: anders@openpuma.org
Reviewed-on: http://openocd.zylin.com/2297
Tested-by: jenkins
Reviewed-by: Xiaofan <xiaofanc@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agojtag/drivers/libusb1_common: avoid device reset when reselecting configuration 88/2288/4
Anders [Thu, 2 Oct 2014 02:42:33 +0000 (19:42 -0700)]
jtag/drivers/libusb1_common: avoid device reset when reselecting configuration

According to [1], we shouldn't reselect an already active configuration to avoid needless device reset. This is known to cause issues with e.g. LPC Link2 with JLink firmware.

[1] http://libusb.sourceforge.net/api-1.0/caveats.html#configsel

Change-Id: I3568ada77780a521548c450090db7173f8d0b2dd
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Signed-off-by: Anders Oleson <anders@openpuma.org>
Reviewed-on: http://openocd.zylin.com/2288
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agohelper: constify log_strings 96/2296/4
Spencer Oliver [Thu, 11 Sep 2014 21:14:58 +0000 (22:14 +0100)]
helper: constify log_strings

Change-Id: I5bdd8958e79b754d56bb7aee2892856e557eed76
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/2296
Tested-by: jenkins
9 years agotarget: constify structures 95/2295/4
Spencer Oliver [Thu, 11 Sep 2014 21:14:31 +0000 (22:14 +0100)]
target: constify structures

Change-Id: I875cfab8dec4ade72ed9c9cd7d52baaca182a1ef
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/2295
Tested-by: jenkins
9 years agojtag: constify driver arrays 94/2294/4
Spencer Oliver [Thu, 11 Sep 2014 21:09:36 +0000 (22:09 +0100)]
jtag: constify driver arrays

Change-Id: I81574fa8ca3cc748526dc61b75a2c75d6335ef04
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/2294
Tested-by: jenkins
9 years agoflash: constify driver data structures 93/2293/3
Spencer Oliver [Thu, 11 Sep 2014 21:08:34 +0000 (22:08 +0100)]
flash: constify driver data structures

Change-Id: Ia5c3de48119f036e1d7a41be62a672a6fb37e59b
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/2293
Tested-by: jenkins
9 years agortos: constify symbol names and lists 92/2292/3
Spencer Oliver [Thu, 11 Sep 2014 21:07:10 +0000 (22:07 +0100)]
rtos: constify symbol names and lists

Change-Id: I72f3cd50fc6a33a178e72e169c9660e707751524
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/2292
Tested-by: jenkins
9 years agonuc1x: fix typos 91/2291/2
Spencer Oliver [Thu, 11 Sep 2014 21:03:00 +0000 (22:03 +0100)]
nuc1x: fix typos

Change-Id: Ia67b55ccb2bea71a99daa176def82960f487ca9f
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/2291
Tested-by: jenkins
9 years agoat91samd: fix protect, add EEPROM and boot commands 26/2326/5
Andrey Yurovsky [Tue, 30 Sep 2014 20:02:49 +0000 (13:02 -0700)]
at91samd: fix protect, add EEPROM and boot commands

There were two problems with the _protect() feature:
1. The address written was off by a factor of two because the address
register takes 16-bit rather than 8-bit addresses.  As a result the
wrong sectors were (un)protected with the protect command.  This has
been fixed.
2. The protection settings issued via the lock or unlock region commands
don't persist after reset.  Making them persist requires modifying the
LOCK bits in the User Row using the infrastructure described below.

The Atmel SAMD2x MCUs provide a User Row (the size of which is one
page).  This contains a few settings that users may wish to modify from
the debugger, especially during production.  This change adds commands
to inspect and set:
- EEPROM size, the size in bytes of the emulated EEPROM region of the
  Flash.
- Bootloader size, the size in bytes of the protected "boot" section of
  the Flash.

This is done by a careful read-modify-write of the special User Row
page, avoiding erasing when possible and disallowing the changing of
documented reserved bits.  The Atmel SAMD20 datasheet was used for bit
positions and descriptions, size tables, etc. and testing was done on a
SAMD20 Xplained Pro board.

It's technically possible to store arbitrary user data (ex: serial
numbers, MAC addresses, etc) in the remaining portion of the User Row
page (that is, beyond the first 64 bits of it).  The infrastructure used
by the eeprom and bootloader commands can be used to access this as
well, and this seems safer than exposing the User Row as a normal Flash
sector that openocd understands due to the delicate nature of some of
the data stored there.

Change-Id: I29ca1bdbdc7884bc0ba0ad18af1b6bab78c7ad38
Signed-off-by: Andrey Yurovsky <yurovsky@gmail.com>
Reviewed-on: http://openocd.zylin.com/2326
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agoat91samd: add erase/secure commands, minor fix 39/2239/7
Andrey Yurovsky [Wed, 6 Aug 2014 21:28:37 +0000 (14:28 -0700)]
at91samd: add erase/secure commands, minor fix

Reference code for the SAMD2x disables caching in the NVM controller when
issuing NVM commands.  Let's do this as well to be consistent and safer.

Add a "chip-erase" for the Atmel SAMD targets that issues a complete Chip Erase
via the Device Service Unit (DSU).  This can be used to "unlock" or otherwise
unbrick a chip that can't be halted or inspected, allowing the user to reflash
with new firmware.

Add a "set-security" command which issues an SSB.  Once that's done and the
device is power-cycled, the flash cannot be written to until a "chip-erase" is
issued.  The chip-erase cannot be issued by openocd at this time because
the device will not respond to a request for the DAP IDCODE.

Change-Id: I80122f0bbf7e3aedffe052c1e77d69dc2dba25ed
Signed-off-by: Andrey Yurovsky <yurovsky@gmail.com>
Reviewed-on: http://openocd.zylin.com/2239
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agoarm_adi_v5: make dap_lookup_cs_component() traverse subtables and handle multicore 20/1920/4
Paul Fertser [Sun, 2 Feb 2014 21:19:00 +0000 (01:19 +0400)]
arm_adi_v5: make dap_lookup_cs_component() traverse subtables and handle multicore

When looking for a debug base address of a core, one should search
through all the ROM tables, not just the top-level one.

This code also assumes that the first found entry (in a depth-first
search) will correspond to core 0, the second to core 1 etc.

The patch is supposed to be an alternative implementation of
http://openocd.zylin.com/#/c/1313/.

Change-Id: Ifc88971a02fe3d9c00d9bf72a822ade5804d4e09
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/1920
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agodoc/openocd.texi: add SWD to the transports supported by jlink 24/2324/2
Paul Fertser [Mon, 29 Sep 2014 13:11:53 +0000 (17:11 +0400)]
doc/openocd.texi: add SWD to the transports supported by jlink

Since 67332532194b16b99f0535a41b4179ca5df349b0 jlink adapter driver
supports SWD in addition to JTAG.

Change-Id: I9376aa02d9281f3e2734d8f127cd42162633d95b
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2324
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agogdb_server: Include current RTOS thread in signal packets 03/2303/2
Jon Burgess [Thu, 18 Sep 2014 18:57:34 +0000 (19:57 +0100)]
gdb_server: Include current RTOS thread in signal packets

This allows GDB to automatically switch to the thread that has
been interrupted and show you where it has stopped.

Change-Id: Icb9500dc42a61eb977e9fac55ce9503c9926bf5d
Signed-off-by: Jon Burgess <jburgess777@gmail.com>
Reviewed-on: http://openocd.zylin.com/2303
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agocortex_m.c: Use two byte breakpoint for 32bit Thumb-2 request 12/2312/2
Jon Burgess [Sun, 21 Sep 2014 19:40:01 +0000 (20:40 +0100)]
cortex_m.c: Use two byte breakpoint for 32bit Thumb-2 request

When GDB requests a breakpoint on a 32bit Thumb-2 instruction it
sends a length of 3 which the current code rejects. Using the
existing two byte breakpoint for this case appears to work fine.

The use of length==3 for this case is mentioned in a few places:
https://sourceware.org/gdb/onlinedocs/gdb/ARM-Breakpoint-Kinds.html
http://sourceforge.net/p/openocd/mailman/message/30012280/

Change-Id: I59cd69ba4d1bc9a37b86569738c6bb2a67c3eb7a
Signed-off-by: Jon Burgess <jburgess777@gmail.com>
Reviewed-on: http://openocd.zylin.com/2312
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
9 years agovsllink: improve the performance when using swd 02/2302/3
Simon Qian [Tue, 16 Sep 2014 13:10:13 +0000 (21:10 +0800)]
vsllink: improve the performance when using swd

Versaloon firmware has been updated for reporting
errors if fail on swd transactions.

Change-Id: I49ac0ad034cc9ad83cc4e43953579811d1243063
Signed-off-by: Simon Qian <openocd@versaloon.com>
Reviewed-on: http://openocd.zylin.com/2302
Reviewed-by: Fatih Aşıcı <fatih.asici@gmail.com>
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)