1
0
Fork 0
qmk_firmware/keyboard/infinity/tool/README

104 lines
4.0 KiB
Plaintext

OpenOCD config files for Kinetis
================================
http://nemuisan.blog.bai.ne.jp/?eid=192848#OPENOCD
These are needed for debug and programing bootloader with SWD. To flash keyboard firmware use 'dfu-util'.
Flash security of Freescale kinetis
-----------------------------------
If FSEC of flash config is changed accidentally SWD/JTAG you can't get debug access until doing 'mdm mass_erase' with JTAG, CMSIS-DAP or OpenSAD adapter. HLA(high level adapter) like stlink doesn't work for this.
Example
-------
Debug:
$ openocd -s tool -f tool/openocd.cfg
$ arm-none-eabi-gdb build/infinity.elf -ex "target remote localhost:3333"
Flash bootloader:
$ openocd -s tool -f tool/openocd.cfg -c "mt_flash kiibohd_bootloader.bin"
Infinity SWD pinout
-------------------
SWD pins are placed next to reset button; SWD_CLK, SWD_DIO, GND, 5V from top.
Note that RESET is also needed to get full control with OpenOCD.
--------
| ___ o |CLK
||RST| o |DIO
||BTN| o |GND
| --- o |5V
--------
Kinetis sercure state
----------------------
openocd 0.9.0
Warn : *********** ATTENTION! ATTENTION! ATTENTION! ATTENTION! **********
Warn : **** ****
Warn : **** Your Kinetis MCU is in secured state, which means that, ****
Warn : **** with exception for very basic communication, JTAG/SWD ****
Warn : **** interface will NOT work. In order to restore its ****
Warn : **** functionality please issue 'kinetis mdm mass_erase' ****
Warn : **** command, power cycle the MCU and restart OpenOCD. ****
Warn : **** ****
Warn : *********** ATTENTION! ATTENTION! ATTENTION! ATTENTION! **********
Info : MDM: Chip is unsecured. Continuing.
target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0xfffffffe msp: 0xfffffffc
auto erase enabled
Info : Probing flash info for bank 0
Warn : flash configuration field erased, please reset the device
wrote 4096 bytes from file kiibohd_bootloader.bin in 2.442562s (1.638 KiB/s)
Info : MDM: Chip is unsecured. Continuing.
Open On-Chip Debugger 0.9.0-dev-00346-g3e1dfdc-dirty (2015-03-21-20:41)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.sourceforge.net/doc/doxygen/bugs.html
Info : only one transport option; autoselect 'cmsis-dap'
Kinetis MUST need Hardware SRST Control to Recover Secure-State!
adapter_nsrst_delay: 200
srst_only separate srst_gates_jtag srst_open_drain connect_deassert_srst
Info : add flash_bank kinetis k20.pflash
cortex_m reset_config sysresetreq
adapter speed: 1000 kHz
srst_only separate srst_nogate srst_open_drain connect_assert_srst
Info : CMSIS-DAP: SWD Supported
Info : CMSIS-DAP: Interface Initialised (SWD)
Info : CMSIS-DAP: FW Version = 1.0
Info : SWCLK/TCK = 0 SWDIO/TMS = 1 TDI = 0 TDO = 0 nTRST = 0 nRESET = 1
Info : Connecting under reset
Info : DAP_SWJ Sequence (reset: 50+ '1' followed by 0)
Info : CMSIS-DAP: Interface ready
Info : clock speed 1000 kHz
Info : IDCODE 0x2ba01477
Warn : Adapter returned success despite SSTICKYERR being set.
Warn : Adapter returned success despite SSTICKYERR being set.
Warn : Adapter returned success despite SSTICKYERR being set.
Warn : Adapter returned success despite SSTICKYERR being set.
Info : k20.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : MDM: Chip is unsecured. Continuing.
Info : MDM: Chip is unsecured. Continuing.
target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0xfffffffe msp: 0xfffffffc
auto erase enabled
Info : Probing flash info for bank 0
Warn : flash configuration field erased, please reset the device
wrote 4096 bytes from file kiibohd_bootloader.bin in 2.446902s (1.635 KiB/s)
Info : MDM: Chip is unsecured. Continuing.
Info : Halt timed out, wake up GDB.
Error: timed out while waiting for target halted
Runtime Error: tool/k20dx32_flash.cfg:81:
in procedure 'mt_flash'
in procedure 'halt' called at file "tool/k20dx32_flash.cfg", line 81