esp32s2.cfg 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. # SPDX-License-Identifier: GPL-2.0-or-later
  2. #
  3. # The ESP32-S2 only supports JTAG.
  4. transport select jtag
  5. set CPU_MAX_ADDRESS 0xFFFFFFFF
  6. source [find bitsbytes.tcl]
  7. source [find memory.tcl]
  8. source [find mmr_helpers.tcl]
  9. # Source the ESP common configuration file
  10. source [find target/esp_common.cfg]
  11. if { [info exists CHIPNAME] } {
  12. set _CHIPNAME $CHIPNAME
  13. } else {
  14. set _CHIPNAME esp32s2
  15. }
  16. if { [info exists CPUTAPID] } {
  17. set _CPUTAPID $CPUTAPID
  18. } else {
  19. set _CPUTAPID 0x120034e5
  20. }
  21. set _TARGETNAME $_CHIPNAME
  22. set _CPUNAME cpu
  23. set _TAPNAME $_CHIPNAME.$_CPUNAME
  24. jtag newtap $_CHIPNAME $_CPUNAME -irlen 5 -expected-id $_CPUTAPID
  25. proc esp32s2_memprot_is_enabled { } {
  26. # IRAM0, DPORT_PMS_PRO_IRAM0_0_REG
  27. if { [get_mmr_bit 0x3f4c1010 0] != 0 } {
  28. return 1
  29. }
  30. # DRAM0, DPORT_PMS_PRO_DRAM0_0_REG
  31. if { [get_mmr_bit 0x3f4c1028 0] != 0 } {
  32. return 1
  33. }
  34. # PERI1, DPORT_PMS_PRO_DPORT_0_REG
  35. if { [get_mmr_bit 0x3f4c103c 0] != 0 } {
  36. return 1
  37. }
  38. # PERI2, DPORT_PMS_PRO_AHB_0_REG
  39. if { [get_mmr_bit 0x3f4c105c 0] != 0 } {
  40. return 1
  41. }
  42. return 0
  43. }
  44. target create $_TARGETNAME esp32s2 -endian little -chain-position $_TAPNAME
  45. $_TARGETNAME configure -event gdb-attach {
  46. # necessary to auto-probe flash bank when GDB is connected and generate proper memory map
  47. halt 1000
  48. if { [esp32s2_memprot_is_enabled] } {
  49. # 'reset halt' to disable memory protection and allow flasher to work correctly
  50. echo "Memory protection is enabled. Reset target to disable it..."
  51. reset halt
  52. }
  53. }
  54. xtensa maskisr on
  55. $_TARGETNAME configure -event examine-end {
  56. # Need to enable to set 'semihosting_basedir'
  57. arm semihosting enable
  58. arm semihosting_resexit enable
  59. if { [info exists _SEMIHOST_BASEDIR] } {
  60. if { $_SEMIHOST_BASEDIR != "" } {
  61. arm semihosting_basedir $_SEMIHOST_BASEDIR
  62. }
  63. }
  64. }
  65. $_TARGETNAME configure -event reset-assert-post { soft_reset_halt }
  66. gdb_breakpoint_override hard
  67. source [find target/xtensa-core-esp32s2.cfg]