2
0

init_kinetis.tcl 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. # this method initializes debug modules which are not affected by software reset
  2. # register names should be referenced including the register group name to improve performance
  3. proc init_debug_modules {} {
  4. # initialize LR to avoid invalid stack after reset
  5. reg "User\\/System Mode Registers/LR" = 0xFFFFFFFF
  6. # clear DWT function registers
  7. reg "Core Debug Registers/DEMCR" = 0x1000001
  8. reg "Data Watchpoint and Trace Unit Registers/DWT_FUNCTION0" = 0x0
  9. reg "Data Watchpoint and Trace Unit Registers/DWT_FUNCTION1" = 0x0
  10. reg "Data Watchpoint and Trace Unit Registers/DWT_FUNCTION2" = 0x0
  11. reg "Data Watchpoint and Trace Unit Registers/DWT_FUNCTION3" = 0x0
  12. # clear FPB comparators
  13. reg "Flash Patch and Breakpoint Unit Registers/FP_COMP0" = 0x0
  14. reg "Flash Patch and Breakpoint Unit Registers/FP_COMP1" = 0x0
  15. reg "Flash Patch and Breakpoint Unit Registers/FP_COMP2" = 0x0
  16. reg "Flash Patch and Breakpoint Unit Registers/FP_COMP3" = 0x0
  17. reg "Flash Patch and Breakpoint Unit Registers/FP_COMP4" = 0x0
  18. reg "Flash Patch and Breakpoint Unit Registers/FP_COMP5" = 0x0
  19. }
  20. proc init_trace_modules {} {
  21. # clear DWT registers
  22. reg "Data Watchpoint and Trace Unit Registers/DWT_CTRL" =0x40000000
  23. reg "Data Watchpoint and Trace Unit Registers/DWT_CYCCNT" =0x0
  24. reg "Data Watchpoint and Trace Unit Registers/DWT_CPICNT" =0x0
  25. reg "Data Watchpoint and Trace Unit Registers/DWT_EXCCNT" =0x0
  26. reg "Data Watchpoint and Trace Unit Registers/DWT_SLEEPCNT" =0x0
  27. reg "Data Watchpoint and Trace Unit Registers/DWT_LSUCNT" =0x0
  28. reg "Data Watchpoint and Trace Unit Registers/DWT_FOLDCNT" =0x0
  29. reg "Data Watchpoint and Trace Unit Registers/DWT_COMP0" =0x0
  30. reg "Data Watchpoint and Trace Unit Registers/DWT_COMP1" =0x0
  31. reg "Data Watchpoint and Trace Unit Registers/DWT_COMP2" =0x0
  32. reg "Data Watchpoint and Trace Unit Registers/DWT_COMP3" =0x0
  33. reg "Data Watchpoint and Trace Unit Registers/DWT_MASK0" =0x0
  34. reg "Data Watchpoint and Trace Unit Registers/DWT_MASK1" =0x0
  35. reg "Data Watchpoint and Trace Unit Registers/DWT_MASK2" =0x0
  36. reg "Data Watchpoint and Trace Unit Registers/DWT_MASK3" =0x0
  37. # clear ITM registers
  38. reg "Instrumentation Trace Macrocell Registers/ITM_LAR" =0xc5acce55
  39. reg "Instrumentation Trace Macrocell Registers/ITM_TER" =0x0
  40. reg "Instrumentation Trace Macrocell Registers/ITM_TPR" =0x0
  41. reg "Instrumentation Trace Macrocell Registers/ITM_TCR" =0x0
  42. reg "Instrumentation Trace Macrocell Registers/ITM_LAR" =0x1
  43. # reset Funnel registers
  44. reg "Embedded Trace Funnel Registers/ETF_FCR" =0x300
  45. # clear MCM registers
  46. reg "Core Platform Miscellaneous Control Module (MCM) Registers/MCM_ETBCC" =0x0
  47. reg "Core Platform Miscellaneous Control Module (MCM) Registers/MCM_ETBRL" =0x0
  48. # set SCB_VTOR register for RAM
  49. reg "System Control Registers/SCB_VTOR" =0x20000000
  50. }
  51. proc envsetup {} {
  52. # Environment Setup
  53. radix x
  54. config hexprefix 0x
  55. config MemIdentifier p
  56. config MemWidth 32
  57. config MemAccess 32
  58. config MemSwap off
  59. }
  60. #-------------------------------------------------------------------------------
  61. # Main
  62. #-------------------------------------------------------------------------------
  63. envsetup
  64. init_debug_modules
  65. init_trace_modules