flash Kinetis: Detect RESET/WDOG loop, fix detection of secured MCU
commit6d5b4d709cb05e8daf0350ac507b928da95d0abb
authorTomas Vanek <vanekt@fbl.cz>
Sun, 17 Jul 2016 14:22:47 +0000 (17 16:22 +0200)
committerAndreas Fritiofson <andreas.fritiofson@gmail.com>
Sun, 14 Aug 2016 08:10:06 +0000 (14 09:10 +0100)
treec4cb5f4b88d3ca9be5d458a9d8533fb6aeec3dad
parent8285ec4cb06b8809761717a6ac420112ea7b2908
flash Kinetis: Detect RESET/WDOG loop, fix detection of secured MCU

Kinetis driver checks MDM STAT register to detect secured state of MCU.
Original version often reported a blank device as secured one.
Change #3010 has not fixed all false reports.
After changes in arm_adi_v5 infrastructure secured devices was not detected
at all.

New algorithm uses multiple MDM STAT reads and counts MDM_STAT_SYSSEC and
MDM_STAT_FREADY bits. Both secured MCU and MCU locked-up in RESET/WDOG loop
are detected reliably.

Detection is run in both kx.cfg and klx.cfg from examine-start event,
not examine-end as before. Event is configured only for non hla adapter.

Minor fix in klx.cfg: commented out adapter_khz 24000 in reset-init.
Such frequency is not supported in VLPR CPU mode and with JTAG.

Change-Id: I2ec2b68c45bde9898159cd15fbdcbcfa538c41d9
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/3547
Tested-by: jenkins
Reviewed-by: Steven Stallion <stallion@squareup.com>
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
src/flash/nor/kinetis.c
tcl/target/klx.cfg
tcl/target/kx.cfg