am335x.cfg 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. source [find target/icepick.cfg]
  2. if { [info exists CHIPNAME] } {
  3. set _CHIPNAME $CHIPNAME
  4. } else {
  5. set _CHIPNAME am335x
  6. }
  7. # set the taps to be enabled by default. this can be overridden
  8. # by setting DEFAULT_TAPS in a separate configuration file
  9. # or directly on the command line.
  10. if { [info exists DEFAULT_TAPS] } {
  11. set _DEFAULT_TAPS "$DEFAULT_TAPS"
  12. } else {
  13. set _DEFAULT_TAPS "$_CHIPNAME.tap"
  14. }
  15. #
  16. # Main DAP
  17. #
  18. if { [info exists DAP_TAPID] } {
  19. set _DAP_TAPID $DAP_TAPID
  20. } else {
  21. set _DAP_TAPID 0x4b6b902f
  22. }
  23. jtag newtap $_CHIPNAME tap -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_DAP_TAPID -disable
  24. jtag configure $_CHIPNAME.tap -event tap-enable "icepick_d_tapenable $_CHIPNAME.jrc 12 0"
  25. dap create $_CHIPNAME.dap -chain-position $_CHIPNAME.tap
  26. #
  27. # M3 DAP
  28. #
  29. if { [info exists M3_DAP_TAPID] } {
  30. set _M3_DAP_TAPID $M3_DAP_TAPID
  31. } else {
  32. set _M3_DAP_TAPID 0x4b6b902f
  33. }
  34. jtag newtap $_CHIPNAME m3_tap -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_M3_DAP_TAPID -disable
  35. jtag configure $_CHIPNAME.m3_tap -event tap-enable "icepick_d_tapenable $_CHIPNAME.jrc 11 0"
  36. dap create $_CHIPNAME.m3_dap -chain-position $_CHIPNAME.m3_tap
  37. #
  38. # ICEpick-D (JTAG route controller)
  39. #
  40. if { [info exists JRC_TAPID] } {
  41. set _JRC_TAPID $JRC_TAPID
  42. } else {
  43. set _JRC_TAPID 0x0b94402f
  44. }
  45. jtag newtap $_CHIPNAME jrc -irlen 6 -ircapture 0x1 -irmask 0x3f -expected-id $_JRC_TAPID -ignore-version
  46. jtag configure $_CHIPNAME.jrc -event setup {
  47. global _DEFAULT_TAPS
  48. enable_default_taps $_DEFAULT_TAPS
  49. }
  50. # some TCK tycles are required to activate the DEBUG power domain
  51. jtag configure $_CHIPNAME.jrc -event post-reset "runtest 100"
  52. #
  53. # helper function that enables all taps passed as argument
  54. #
  55. proc enable_default_taps { taps } {
  56. foreach tap $taps {
  57. jtag tapenable $tap
  58. }
  59. }
  60. #
  61. # Cortex-M3 target
  62. #
  63. set _TARGETNAME_2 $_CHIPNAME.m3
  64. target create $_TARGETNAME_2 cortex_m -dap $_CHIPNAME.m3_dap
  65. #
  66. # Cortex-A8 target
  67. #
  68. set _TARGETNAME $_CHIPNAME.cpu
  69. target create $_TARGETNAME cortex_a -dap $_CHIPNAME.dap -dbgbase 0x80001000
  70. # SRAM: 64K at 0x4030.0000; use the first 16K
  71. $_TARGETNAME configure -work-area-phys 0x40300000 -work-area-size 0x4000
  72. # when putting the target into 'reset halt', we need to disable the watchdog as
  73. # it would otherwise trigger while we're in JTAG
  74. # FIXME: unify with target/am437x.cfg
  75. source [find mem_helper.tcl]
  76. set WDT1_BASE_ADDR 0x44e35000
  77. set WDT1_W_PEND_WSPR [expr {$WDT1_BASE_ADDR + 0x0034}]
  78. set WDT1_WSPR [expr {$WDT1_BASE_ADDR + 0x0048}]
  79. proc disable_watchdog { } {
  80. global WDT1_WSPR
  81. global WDT1_W_PEND_WSPR
  82. global _TARGETNAME
  83. set curstate [$_TARGETNAME curstate]
  84. if { [string compare $curstate halted] == 0 } {
  85. set WDT_DISABLE_SEQ1 0xaaaa
  86. set WDT_DISABLE_SEQ2 0x5555
  87. mww phys $WDT1_WSPR $WDT_DISABLE_SEQ1
  88. # Empty body to make sure this executes as fast as possible.
  89. # We don't want any delays here otherwise romcode might start
  90. # executing and end up changing state of certain IPs.
  91. while { [expr {[mrw $WDT1_W_PEND_WSPR] & 0x10}] } { }
  92. mww phys $WDT1_WSPR $WDT_DISABLE_SEQ2
  93. while { [expr {[mrw $WDT1_W_PEND_WSPR] & 0x10}] } { }
  94. }
  95. }
  96. $_TARGETNAME configure -event reset-end { disable_watchdog }