s32k.cfg 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. # SPDX-License-Identifier: GPL-2.0-or-later
  2. #
  3. # Freescale S32K devices
  4. # Similar to Kinetis Kx series devices.
  5. #
  6. source [find target/swj-dp.tcl]
  7. if { [info exists CHIPNAME] } {
  8. set _CHIPNAME $CHIPNAME
  9. } else {
  10. set _CHIPNAME s32k
  11. }
  12. # Work-area is a space in RAM used for flash programming
  13. # By default use 4kB
  14. if { [info exists WORKAREASIZE] } {
  15. set _WORKAREASIZE $WORKAREASIZE
  16. } else {
  17. set _WORKAREASIZE 0x1000
  18. }
  19. if { [info exists CPUTAPID] } {
  20. set _CPUTAPID $CPUTAPID
  21. } else {
  22. set _CPUTAPID 0x0995001d
  23. }
  24. swj_newdap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -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 -s32k
  31. kinetis create_banks
  32. adapter speed 1000
  33. reset_config srst_nogate
  34. if {[using_hla]} {
  35. echo ""
  36. echo "!!!!!!!!!!!!!!!!!!!!!! WARNING !!!!!!!!!!!!!!!!! WARNING !!!!!!!!!!!!!!!!!!!!!!"
  37. echo " Kinetis MCUs have a MDM-AP dedicated mainly to MCU security related functions."
  38. echo " A high level adapter (like a ST-Link) you are currently using cannot access"
  39. echo " the MDM-AP, so commands like 'mdm mass_erase' are not available in your"
  40. echo " configuration. Also security locked state of the device will not be reported."
  41. echo " Expect problems connecting to a blank device without boot ROM."
  42. echo ""
  43. echo " Be very careful as you can lock the device though there is no way to unlock"
  44. echo " it without mass erase. Don't set write protection on the first block."
  45. echo "!!!!!!!!!!!!!!!!!!!!!! WARNING !!!!!!!!!!!!!!!!! WARNING !!!!!!!!!!!!!!!!!!!!!!"
  46. echo ""
  47. } else {
  48. # Detect secured MCU or boot lock-up in RESET/WDOG loop
  49. $_TARGETNAME configure -event examine-fail {
  50. kinetis mdm check_security
  51. }
  52. # During RESET/WDOG loop the target is sometimes falsely examined
  53. $_TARGETNAME configure -event examine-end {
  54. kinetis mdm check_security
  55. }
  56. # if srst is not fitted use SYSRESETREQ to
  57. # perform a soft reset
  58. cortex_m reset_config sysresetreq
  59. }
  60. # Disable watchdog not to disturb OpenOCD algorithms running on MCU
  61. # (e.g. armv7m_checksum_memory() in verify_image)
  62. # Flash driver also disables watchdog before FTFA flash programming.
  63. $_TARGETNAME configure -event reset-init {
  64. kinetis disable_wdog
  65. }