You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. OpenOCD config files for Kinetis
  2. ================================
  3. http://nemuisan.blog.bai.ne.jp/?eid=192848#OPENOCD
  4. These are needed for debug and programing bootloader with SWD. To flash keyboard firmware use 'dfu-util'.
  5. Flash security of Freescale kinetis
  6. -----------------------------------
  7. 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.
  8. Example
  9. -------
  10. Debug:
  11. $ openocd -s tool -f tool/openocd.cfg
  12. $ arm-none-eabi-gdb build/infinity.elf -ex "target remote localhost:3333"
  13. Flash bootloader:
  14. $ openocd -s tool -f tool/openocd.cfg -c "mt_flash kiibohd_bootloader.bin"
  15. Infinity SWD pinout
  16. -------------------
  17. SWD pins are placed next to reset button; SWD_CLK, SWD_DIO, GND, 5V from top.
  18. Note that RESET is also needed to get full control with OpenOCD.
  19. --------
  20. | ___ o |CLK
  21. ||RST| o |DIO
  22. ||BTN| o |GND
  23. | --- o |5V
  24. --------
  25. Kinetis sercure state
  26. ----------------------
  27. openocd 0.9.0
  28. Warn : *********** ATTENTION! ATTENTION! ATTENTION! ATTENTION! **********
  29. Warn : **** ****
  30. Warn : **** Your Kinetis MCU is in secured state, which means that, ****
  31. Warn : **** with exception for very basic communication, JTAG/SWD ****
  32. Warn : **** interface will NOT work. In order to restore its ****
  33. Warn : **** functionality please issue 'kinetis mdm mass_erase' ****
  34. Warn : **** command, power cycle the MCU and restart OpenOCD. ****
  35. Warn : **** ****
  36. Warn : *********** ATTENTION! ATTENTION! ATTENTION! ATTENTION! **********
  37. Info : MDM: Chip is unsecured. Continuing.
  38. target state: halted
  39. target halted due to debug-request, current mode: Thread
  40. xPSR: 0x01000000 pc: 0xfffffffe msp: 0xfffffffc
  41. auto erase enabled
  42. Info : Probing flash info for bank 0
  43. Warn : flash configuration field erased, please reset the device
  44. wrote 4096 bytes from file kiibohd_bootloader.bin in 2.442562s (1.638 KiB/s)
  45. Info : MDM: Chip is unsecured. Continuing.
  46. Open On-Chip Debugger 0.9.0-dev-00346-g3e1dfdc-dirty (2015-03-21-20:41)
  47. Licensed under GNU GPL v2
  48. For bug reports, read
  49. http://openocd.sourceforge.net/doc/doxygen/bugs.html
  50. Info : only one transport option; autoselect 'cmsis-dap'
  51. Kinetis MUST need Hardware SRST Control to Recover Secure-State!
  52. adapter_nsrst_delay: 200
  53. srst_only separate srst_gates_jtag srst_open_drain connect_deassert_srst
  54. Info : add flash_bank kinetis k20.pflash
  55. cortex_m reset_config sysresetreq
  56. adapter speed: 1000 kHz
  57. srst_only separate srst_nogate srst_open_drain connect_assert_srst
  58. Info : CMSIS-DAP: SWD Supported
  59. Info : CMSIS-DAP: Interface Initialised (SWD)
  60. Info : CMSIS-DAP: FW Version = 1.0
  61. Info : SWCLK/TCK = 0 SWDIO/TMS = 1 TDI = 0 TDO = 0 nTRST = 0 nRESET = 1
  62. Info : Connecting under reset
  63. Info : DAP_SWJ Sequence (reset: 50+ '1' followed by 0)
  64. Info : CMSIS-DAP: Interface ready
  65. Info : clock speed 1000 kHz
  66. Info : IDCODE 0x2ba01477
  67. Warn : Adapter returned success despite SSTICKYERR being set.
  68. Warn : Adapter returned success despite SSTICKYERR being set.
  69. Warn : Adapter returned success despite SSTICKYERR being set.
  70. Warn : Adapter returned success despite SSTICKYERR being set.
  71. Info : k20.cpu: hardware has 6 breakpoints, 4 watchpoints
  72. Info : MDM: Chip is unsecured. Continuing.
  73. Info : MDM: Chip is unsecured. Continuing.
  74. target state: halted
  75. target halted due to debug-request, current mode: Thread
  76. xPSR: 0x01000000 pc: 0xfffffffe msp: 0xfffffffc
  77. auto erase enabled
  78. Info : Probing flash info for bank 0
  79. Warn : flash configuration field erased, please reset the device
  80. wrote 4096 bytes from file kiibohd_bootloader.bin in 2.446902s (1.635 KiB/s)
  81. Info : MDM: Chip is unsecured. Continuing.
  82. Info : Halt timed out, wake up GDB.
  83. Error: timed out while waiting for target halted
  84. Runtime Error: tool/k20dx32_flash.cfg:81:
  85. in procedure 'mt_flash'
  86. in procedure 'halt' called at file "tool/k20dx32_flash.cfg", line 81