From: Patrick S. <pat...@ne...> - 2014-11-06 12:23:12
|
> Hi, > > Please avoid top-posting. > > On Thu, Aug 28, 2014 at 04:06:39PM +0000, Patrick Stewart wrote: > > After this has happened the chip flash becomes protected, and get > > stuck in a fast reset loop that prevents openocd from talking to it. > > Hm, with KL25 mdm command to unlock a protected part works 100% > reliably, I know this firsthand. It would be rather cool to get it working for the > other kinetis parts as well. > > > I've been using a j-link debugger (not with openocd) to get it out of > > that state. I've been trying it with lots of minor variations in > > settings, and it actually worked once and I got a fully working debug > > session. However it wouldn't work again with the same settings, so I > > think there might be some kind of race/timing issue. > > So what about my suggestion to nullify the default gdb-flash-erase-start > event? > > -- > Be free, use free (http://www.gnu.org/philosophy/free-sw.html) software! > mailto:fer...@gm... I got this working in the end with your suggestion to override gdb-flash-erase-start, and fixed the mass_erase by adding in a 'reset halt' which prevents the watchdog reset loop. ApoIogies for not replying earlier, and thanks for your help. For anyone who's having similar problems, here's my configs: kinetis-unsecure.cfg: interface ftdi ftdi_device_desc "SWD SPI Debug Interface" ftdi_vid_pid 0x0403 0x7988 ftdi_channel 1 ftdi_layout_init 0x0000 0x000b ftdi_layout_signal nSRST -data 0x0010 -oe 0x0010 ftdi_layout_signal SWD_EN -data 0 ftdi_layout_signal SWDIO_OE -data 0 transport select swd set CHIPNAME MKL26Z256VMP4 set _CHIPNAME $CHIPNAME set _ENDIAN little set _WORKAREASIZE 0x1000 set _CPUTAPID 0x0bc11477 swd newdap $_CHIPNAME cpu -irlen 4 -expected-id $_CPUTAPID set _TARGETNAME $_CHIPNAME.cpu target create $_TARGETNAME cortex_m -endian $_ENDIAN -chain-position $_CHIPNAME.cpu $_TARGETNAME configure -event examine-end { kinetis mdm mass_erase } $_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size $_WORKAREASIZE -work-area-backup 0 set _FLASHNAME $_CHIPNAME.flash flash bank $_FLASHNAME kinetis 0x00000000 0x40000 0 4 $_TARGETNAME adapter_khz 1000 reset_config srst_only srst_open_drain srst_nogate connect_assert_srst cortex_m reset_config sysresetreq init reset halt shutdown devboard.cfg: interface ftdi ftdi_device_desc "SWD SPI Debug Interface" ftdi_vid_pid 0x0403 0x7988 ftdi_channel 1 ftdi_layout_init 0x0000 0x000b ftdi_layout_signal nSRST -data 0x0010 -oe 0x0010 ftdi_layout_signal SWD_EN -data 0 ftdi_layout_signal SWDIO_OE -data 0 transport select swd set CHIPNAME MKL26Z256VMP4 set _CHIPNAME $CHIPNAME set _ENDIAN little set _WORKAREASIZE 0x1000 set _CPUTAPID 0x0bc11477 swd newdap $_CHIPNAME cpu -irlen 4 -expected-id $_CPUTAPID set _TARGETNAME $_CHIPNAME.cpu target create $_TARGETNAME cortex_m -endian $_ENDIAN -chain-position $_CHIPNAME.cpu $_TARGETNAME configure -event examine-end { kinetis mdm check_security } $_TARGETNAME configure -event gdb-attach { echo "Halting target" reset halt } $_TARGETNAME configure -event gdb-flash-erase-start { halt } $_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size $_WORKAREASIZE -work-area-backup 0 set _FLASHNAME $_CHIPNAME.flash flash bank $_FLASHNAME kinetis 0x00000000 0x40000 0 4 $_TARGETNAME adapter_khz 1000 reset_config srst_only srst_open_drain srst_nogate connect_assert_srst cortex_m reset_config sysresetreq init reset halt |