klx.cfg 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. # SPDX-License-Identifier: GPL-2.0-or-later
  2. #
  3. # NXP (former Freescale) Kinetis KL series devices
  4. # Also used for Cortex-M0+ equipped members of KVx and KE1xZ series
  5. #
  6. source [find target/swj-dp.tcl]
  7. if { [info exists CHIPNAME] } {
  8. set _CHIPNAME $CHIPNAME
  9. } else {
  10. set _CHIPNAME klx
  11. }
  12. # Work-area is a space in RAM used for flash programming
  13. # By default use 1KiB
  14. if { [info exists WORKAREASIZE] } {
  15. set _WORKAREASIZE $WORKAREASIZE
  16. } else {
  17. set _WORKAREASIZE 0x400
  18. }
  19. if { [info exists CPUTAPID] } {
  20. set _CPUTAPID $CPUTAPID
  21. } else {
  22. set _CPUTAPID 0x0bc11477
  23. }
  24. swj_newdap $_CHIPNAME cpu -irlen 4 -expected-id $_CPUTAPID
  25. dap create $_CHIPNAME.dap -chain-position $_CHIPNAME.cpu
  26. set _TARGETNAME $_CHIPNAME.cpu
  27. target create $_TARGETNAME cortex_m -dap $_CHIPNAME.dap
  28. $_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size $_WORKAREASIZE -work-area-backup 0
  29. set _FLASHNAME $_CHIPNAME.pflash
  30. flash bank $_FLASHNAME kinetis 0 0 0 0 $_TARGETNAME
  31. kinetis create_banks
  32. # Table 5-1. Clock Summary of KL25 Sub-Family Reference Manual
  33. # specifies up to 1MHz for VLPR mode and up to 24MHz for run mode;
  34. # Table 17 of Sub-Family Data Sheet rev4 lists 25MHz as the maximum frequency.
  35. adapter speed 1000
  36. reset_config srst_nogate
  37. if {[using_hla]} {
  38. echo ""
  39. echo "!!!!!!!!!!!!!!!!!!!!!! WARNING !!!!!!!!!!!!!!!!! WARNING !!!!!!!!!!!!!!!!!!!!!!"
  40. echo " Kinetis MCUs have a MDM-AP dedicated mainly to MCU security related functions."
  41. echo " A high level adapter (like a ST-Link) you are currently using cannot access"
  42. echo " the MDM-AP, so commands like 'mdm mass_erase' are not available in your"
  43. echo " configuration. Also security locked state of the device will not be reported."
  44. echo ""
  45. echo " Be very careful as you can lock the device though there is no way to unlock"
  46. echo " it without mass erase. Don't set write protection on the first block."
  47. echo "!!!!!!!!!!!!!!!!!!!!!! WARNING !!!!!!!!!!!!!!!!! WARNING !!!!!!!!!!!!!!!!!!!!!!"
  48. echo ""
  49. } else {
  50. # Detect secured MCU
  51. $_TARGETNAME configure -event examine-fail {
  52. kinetis mdm check_security
  53. }
  54. # if srst is not fitted use SYSRESETREQ to
  55. # perform a soft reset
  56. cortex_m reset_config sysresetreq
  57. }
  58. # Disable watchdog not to disturb OpenOCD algorithms running on MCU
  59. # (e.g. armv7m_checksum_memory() in verify_image)
  60. # Flash driver also disables watchdog before FTFA flash programming.
  61. $_TARGETNAME configure -event reset-init {
  62. kinetis disable_wdog
  63. }