openocd.git
5 years agodoc, README: mention all the variants supported by lpc2000 driver 08/2508/3
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
5 years agoflash/nor/at91samd: add small delay before checking nvm status 68/2268/3
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>
5 years agoflash/startup: extend "program" command to accept "exit" 92/2492/3
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>
5 years agoserver: shutdown command should lead to exit without evaluating the rest 11/2511/2
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>
5 years agotarget/profiling: Use the correct method to access registers 79/2479/2
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>
5 years agoxscale: Use the correct method to access registers 78/2478/2
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>
5 years agohla_target: Use the correct method to access registers 77/2477/2
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>
5 years agocortex_m: Use the correct method to access registers 76/2476/2
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>
5 years agonds32: Use the correct method to access registers 75/2475/3
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>
5 years agomips32: add gdb target description support 72/1972/9
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
5 years agomips32: use 'unsigned int' for CPU register indices 16/2216/5
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>
5 years agotcl/interface/ftdi: correct LED config for BusBlaster KT-Link 39/2539/2
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
5 years agosim3x: new flash driver for Silabs SiM3 microcontroller family 78/2078/19
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
5 years agonrf51 - Add async loader. Performance on nrf51822QAA/stlink-v2 from ~3.5KiB/s to... 04/2204/12
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>
5 years agoarmv7a: fix interpretation of MMU table 86/2386/2
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>
5 years agoJ-Link serial number config option 21/2521/3
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>
5 years agocortex_a: Add Cortex-A5 identification 83/2483/2
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>
5 years agoREADME: mention "transport select" in quickstart section 12/2512/2
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>
5 years agotarget/image: fix undefined behaviour when loading with GDB 24/2524/2
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>
5 years agodoc: document the OCL (on chip flash loader) driver 29/2529/2
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>
5 years agotcl: add TP-LINK TL-MR3020 to the firmware recovery script 20/2520/6
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>
5 years agotcl/target|board: add config Atheros ar9331 19/2519/5
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>
5 years agotarget: write gmon.out according to target endianness 68/2168/4
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>
5 years agomini51: support for Nuvoton NuMicro M051 series flash memory 26/2426/3
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>
5 years agotcl/target: add CC2538 and CC26xx target files (with cJTAG procedure) 32/2232/5
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>
5 years agoem357: added target files for em357 and em358 70/2470/8
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>
5 years agojlink: Added hardware version number for JLink firmware on LPC-Link2 98/2298/4
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>
5 years agocfg: TI Tiva C dk-tm4c129x Evaluation Kits 67/1867/6
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>
5 years agolpc2000: add chip IDs for LPC11U6x/LPC11E6x 63/2463/2
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>
5 years agopsoc4: support for Cypress PSoC 41xx/42xx family 82/2282/6
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>
5 years agostm32lx: do not attempt mass-erase in-place of first bank erase 41/2441/7
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
5 years agoflash/nor/stm32lx: use 0 base to autodetect second bank location 03/2503/2
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>
5 years agodoc: add stm32lx mass_erase description 02/2502/2
Paul Fertser [Sat, 24 Jan 2015 10:42:00 +0000 (13:42 +0300)]
doc: add stm32lx mass_erase description

Change-Id: Ibe26f40a105dfabcf336ae12fcdc72f4e87513b6
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2502
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
5 years agoflash/nor/stm32l: unify waiting for busy flag functions 91/2491/3
Paul Fertser [Fri, 23 Jan 2015 09:40:58 +0000 (12:40 +0300)]
flash/nor/stm32l: unify waiting for busy flag functions

Change-Id: I5e6daff8232bb4807dd13a1951fbf335529661d4
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2491
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
5 years agoflash/nor/stm32l: fix mass erase 90/2490/3
Paul Fertser [Fri, 23 Jan 2015 09:33:50 +0000 (12:33 +0300)]
flash/nor/stm32l: fix mass erase

Topaz reports on http://sourceforge.net/p/openocd/tickets/87/ that
protection level constants are mixed up. This leads to device ending
up in protection level 1 after mass erase.

Additional work is required to actually put the device in RDP Level 1
and then back to Level 0, as Option bootloader launch is a special
kind of full target reset.

To be able to flash properly after mass_erase a "reset init" is needed
(it's anyway recommended to always perform it before any flash
operation).

Change-Id: I9a838909458039bb0114d3019723bf134fa4d7c9
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2490
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
5 years agoconfigure: define WIN32_LEAN_AND_MEAN early to make it effective 86/2486/3
Paul Fertser [Tue, 20 Jan 2015 17:09:02 +0000 (20:09 +0300)]
configure: define WIN32_LEAN_AND_MEAN early to make it effective

This macro makes windows builds faster and helps with the old "#define
interface struct" issue as the word "interface" is part of libusb-0.1
API. However, defining it in replacements.h is too late, as windows.h
gets included by that time from somewhere else.

This solution is provided by Ray Donnelly from the MSYS2 team.

Change-Id: I376a5fb3d106786515d7e1ba44dbd751e4dcdb1b
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2486
Tested-by: jenkins
Reviewed-by: Xiaofan <xiaofanc@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
5 years agoMakefile.am: link libusb-1.0 after libusb-0.1 to fix dependencies 85/2485/2
Paul Fertser [Tue, 20 Jan 2015 15:29:31 +0000 (18:29 +0300)]
Makefile.am: link libusb-1.0 after libusb-0.1 to fix dependencies

Since libusb-0.1 might be provided by libusb-compat, it will depend on
libusb-1.0, so needs to be mentioned before it in the link command
line, this is relevant for static linking.

Thanks go to mingwandroid for spotting it during MSYS2 build.

Change-Id: I15cf0b8f084c351b4f93e75686bd0f843477352b
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2485
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
5 years agoflash/nor/stm32f2x: add new revisions of STM32F4x parts 93/2493/2
Paul Fertser [Fri, 23 Jan 2015 18:36:50 +0000 (21:36 +0300)]
flash/nor/stm32f2x: add new revisions of STM32F4x parts

Change-Id: I7585ccbe12fe079e960ce9e33d9a143672a6a08c
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2493
Tested-by: jenkins
Reviewed-by: Rémi PRUD'HOMME <prudhomme.remi@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
5 years agoSubject: [PATCH] update src/flash/nor/stm32f2x.c 84/2484/2
Rémi PRUD’HOMME [Tue, 20 Jan 2015 13:23:08 +0000 (14:23 +0100)]
Subject: [PATCH] update src/flash/nor/stm32f2x.c

Add the new STM32F446 mcu with 512 Ko
Tested with a eval board

Change-Id: I0c16ce7d32d249c7634d697815207c20e7f778c4
Signed-off-by: prudhomme.remi@gmail.com
Reviewed-on: http://openocd.zylin.com/2484
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
5 years agoAdd more STM32F3 IDs in target/stm32f3.cfg. 35/2435/3
Uwe Bonnes [Thu, 11 Dec 2014 15:29:25 +0000 (16:29 +0100)]
Add more STM32F3 IDs in target/stm32f3.cfg.

Change-Id: I4c4462aa025639c4d20e6fa23c8845a69e60afc5
Signed-off-by: Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de>
Reviewed-on: http://openocd.zylin.com/2435
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
5 years agodrivers/stlink: clarify "init mode failed" message 65/2365/3
Paul Fertser [Thu, 30 Oct 2014 13:22:40 +0000 (16:22 +0300)]
drivers/stlink: clarify "init mode failed" message

The message as it was didn't let the user know that something was wrong
with the target or wiring.

Change-Id: Ib609c2d31959e77413e61c348d0e31d7269d5c58
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2365
Tested-by: jenkins
Reviewed-by: Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de>
Reviewed-by: Jens Bauer <jens@gpio.dk>
5 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>
5 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>
5 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
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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
5 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
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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
5 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
5 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>
5 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>
5 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>
5 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
5 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>
5 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>
5 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>
5 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
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>
5 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>