openocd/src
Tomas Vanek 8825804273 target: improve robustness of reset command
Before this change jim_target_reset() checked examined state of a target
and failed without calling .assert_reset in particular target layer
(and without comprehensible warning to user).
Cortex-M target (which refuses access to DP under active SRST):
If connection is lost then reset process fails before asserting SRST
and connection with MCU is not restored.
This resulted in:
1) A lot of Cortex-M MCUs required use of reset button or cycling power
after firmware blocked SWD access somehow (sleep, misconfigured clock etc).
If firmware blocks SWD access early during initialization, a MCU could
become completely inaccessible by SWD.
2) If OpenOCD is (re)started and a MCU is in a broken state unresponsive
to SWD, reset command does not work even if it could help to restore communication.
Hopefully this scenario is not possible under full JTAG.

jim_target_reset() in target.c now does not check examined state
and delegates this task to a particular target. All targets have been checked
and xx_assert_reset() (or xx_deassert_reset()) procedures were changed
to check examined state if needed. Targets except arm11, cortex_a and cortex_m
just fail if target is not examined although it may be possible to use
at least hw reset. Left as TODO for developers familiar with these targets.

cortex_m_assert_reset(): memory access errors are stored
instead of immediate returning them to a higher level.
Errors from less important reads/writes are ignored.
Requested reset always leads to a configured action.

arm11_assert_reset() just asserts hw reset in case of not examined target.
cortex_a_assert_reset() works as usual in case of not examined target.

Change-Id: I84fa869f4f58e2fa83b6ea75de84440d9dc3d929
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/2606
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2016-05-05 07:42:24 +01:00
..
flash flash Kinetis: new KVx family added 2016-05-05 07:35:31 +01:00
helper helper/fileio: Remove nested struct 2016-02-29 21:04:47 +00:00
jtag ftdi: allow selecting device by usb bus location 2016-03-24 08:52:14 +00:00
pld cpld/virtex2: allow JSTART to be disabled 2015-08-06 13:14:01 +01:00
rtos RTOS support: Add FPU support for FreeRTOS 2016-05-04 22:36:23 +01:00
server server/telnet: Check malloc() return values 2016-05-04 22:48:18 +01:00
svf svf: fix progress reporting switch behaviour 2015-11-20 22:27:48 +00:00
target target: improve robustness of reset command 2016-05-05 07:42:24 +01:00
transport transport: make 'transport select' auto-select the first available transport if not set 2015-03-25 21:32:49 +00:00
xsvf xsvf: output a warning suggesting using SVF 2015-11-30 10:11:16 +00:00
hello.c update files to correct FSF address 2013-06-05 19:52:42 +00:00
hello.h update files to correct FSF address 2013-06-05 19:52:42 +00:00
main.c update files to correct FSF address 2013-06-05 19:52:42 +00:00
Makefile.am Makefile.am: link libusb-1.0 after libusb-0.1 to fix dependencies 2015-02-04 21:56:45 +00:00
openocd.c docs: update OpenOCD url's to openocd.org domain 2015-04-16 20:28:21 +01:00
openocd.h Fix some problems with the bin2char utility 2014-08-02 09:01:32 +00:00