stm32mp13x.cfg 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. # SPDX-License-Identifier: GPL-2.0-or-later
  2. # STMicroelectronics STM32MP13x (Single Cortex-A7)
  3. # http://www.st.com/stm32mp1
  4. # HLA does not support custom CSW nor AP other than 0
  5. if { [using_hla] } {
  6. echo "ERROR: HLA transport cannot work with this target."
  7. echo "ERROR: To use STLink switch to DAP mode, as in \"board/stm32mp13x_dk.cfg\"."
  8. shutdown
  9. }
  10. source [find target/swj-dp.tcl]
  11. if { [info exists CHIPNAME] } {
  12. set _CHIPNAME $CHIPNAME
  13. } else {
  14. set _CHIPNAME stm32mp13x
  15. }
  16. if { [info exists CPUTAPID] } {
  17. set _CPUTAPID $CPUTAPID
  18. } else {
  19. if { [using_jtag] } {
  20. set _CPUTAPID 0x6ba00477
  21. } else {
  22. set _CPUTAPID 0x6ba02477
  23. }
  24. }
  25. # Chip Level TAP Controller, only in jtag mode
  26. if { [info exists CLCTAPID] } {
  27. set _CLCTAPID $CLCTAPID
  28. } else {
  29. set _CLCTAPID 0x06501041
  30. }
  31. swj_newdap $_CHIPNAME tap -expected-id $_CPUTAPID -irlen 4
  32. if { [using_jtag] } {
  33. jtag newtap $_CHIPNAME.clc tap -expected-id $_CLCTAPID -irlen 5
  34. }
  35. dap create $_CHIPNAME.dap -chain-position $_CHIPNAME.tap -ignore-syspwrupack
  36. # NOTE: keep ap-num and dbgbase to speed-up examine after reset
  37. # NOTE: do not change the order of target create
  38. target create $_CHIPNAME.ap1 mem_ap -dap $_CHIPNAME.dap -ap-num 1
  39. target create $_CHIPNAME.axi mem_ap -dap $_CHIPNAME.dap -ap-num 0
  40. target create $_CHIPNAME.cpu cortex_a -dap $_CHIPNAME.dap -ap-num 1 -coreid 0 -dbgbase 0xE00D0000
  41. $_CHIPNAME.cpu cortex_a maskisr on
  42. $_CHIPNAME.cpu cortex_a dacrfixup on
  43. # interface does not work while srst is asserted
  44. # this is target specific, valid for every board
  45. # srst resets the debug unit, behavior equivalent to "srst_pulls_trst"
  46. reset_config srst_gates_jtag srst_pulls_trst
  47. adapter speed 5000
  48. adapter srst pulse_width 200
  49. # bootrom has an internal timeout of 1 second for detecting the boot flash.
  50. # wait at least 1 second to guarantee we are out of bootrom
  51. adapter srst delay 1100
  52. add_help_text axi_secure "Set secure mode for following AXI accesses"
  53. proc axi_secure {} {
  54. $::_CHIPNAME.dap apsel 0
  55. $::_CHIPNAME.dap apcsw 0x10006000
  56. }
  57. add_help_text axi_nsecure "Set non-secure mode for following AXI accesses"
  58. proc axi_nsecure {} {
  59. $::_CHIPNAME.dap apsel 0
  60. $::_CHIPNAME.dap apcsw 0x30006000
  61. }
  62. axi_secure
  63. proc dbgmcu_enable_debug {} {
  64. # keep clock enabled in low-power
  65. ## catch {$::_CHIPNAME.ap1 mww 0xe0081004 0x00000004}
  66. # freeze watchdog 1 and 2 on core halted
  67. catch {$::_CHIPNAME.ap1 mww 0xe008102c 0x00000004}
  68. catch {$::_CHIPNAME.ap1 mww 0xe008104c 0x00000008}
  69. }
  70. proc toggle_cpu_dbg_claim0 {} {
  71. # toggle CPU0 DBG_CLAIM[0]
  72. $::_CHIPNAME.ap1 mww 0xe00d0fa0 1
  73. $::_CHIPNAME.ap1 mww 0xe00d0fa4 1
  74. }
  75. # FIXME: most of handlers below will be removed once reset framework get merged
  76. $_CHIPNAME.ap1 configure -event reset-deassert-pre {
  77. adapter deassert srst deassert trst
  78. catch {dap init}
  79. catch {$::_CHIPNAME.dap apid 1}
  80. }
  81. $_CHIPNAME.cpu configure -event reset-deassert-pre {$::_CHIPNAME.cpu arp_examine}
  82. $_CHIPNAME.cpu configure -event reset-deassert-post {toggle_cpu_dbg_claim0; dbgmcu_enable_debug}
  83. $_CHIPNAME.ap1 configure -event examine-start {dap init}
  84. $_CHIPNAME.ap1 configure -event examine-end {dbgmcu_enable_debug}