klx.cfg 2.4 KB

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