traveo2_68m_common.cfg 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. #
  2. # Copyright (C) <2019-2021>
  3. # <Cypress Semiconductor Corporation (an Infineon company)>
  4. #
  5. # Common configuration for TRAVEO™II family of microcontrollers.
  6. #
  7. source [find target/swj-dp.tcl]
  8. source [find target/mxs40/mxs40_common.cfg]
  9. if { [info exists WORKAREAADDR] } {
  10. set _WA_ADDR $WORKAREAADDR
  11. unset WORKAREAADDR
  12. } else {
  13. set _WA_ADDR 0x28000800
  14. }
  15. if { [info exists WORKAREASIZE] } {
  16. set _WA_SIZE $WORKAREASIZE
  17. unset WORKAREASIZE
  18. } else {
  19. set _WA_SIZE 0x8000
  20. }
  21. # (large_sector_num << 16) | small_sector_num
  22. set ${_CHIPNAME}::MAIN_FLASH_SIZE_OVERRIDE [ expr {($MAIN_LARGE_SECTOR_NUM << 16) | $MAIN_SMALL_SECTOR_NUM} ]
  23. set ${_CHIPNAME}::WORK_FLASH_SIZE_OVERRIDE [ expr {($WORK_LARGE_SECTOR_NUM << 16) | $WORK_SMALL_SECTOR_NUM} ]
  24. if { $_ENABLE_ACQUIRE } {
  25. kitprog3 acquire_config on 3 0 2
  26. }
  27. global TARGET
  28. set TARGET $_CHIPNAME.cpu
  29. swj_newdap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf
  30. dap create $_CHIPNAME.dap -chain-position $_CHIPNAME.cpu
  31. # Set CSW[27], which according to ARM ADI v5 appendix E1.4 maps to AHB signal
  32. # HPROT[3], which according to AMBA AHB/ASB/APB specification chapter 3.7.3
  33. # makes the data access cacheable. This allows reading and writing data in the
  34. # CPU cache from the debugger, which is far more useful than going straight to
  35. # RAM when operating on typical variables, and is generally no worse when
  36. # operating on special memory locations.
  37. $_CHIPNAME.dap apsel 2
  38. $_CHIPNAME.dap apcsw [expr {(1 << 24) | (1 << 25) | (1 << 27) | (1 << 29) | (1 << 31)}]
  39. $_CHIPNAME.dap apsel 3
  40. $_CHIPNAME.dap apcsw [expr {(1 << 24) | (1 << 25) | (1 << 27) | (1 << 29) | (1 << 31)}]
  41. proc enable_cm7x {} {
  42. mww 0x40261244 0x80000000
  43. mww 0x40261248 0x80000000
  44. mww 0x4020040C 15
  45. mww 0x4020000C 15
  46. mww 0x40201200 0x05FA0001
  47. mww 0x40201200 0x05FA0003
  48. mww 0x40201210 0x05FA0001
  49. mww 0x40201210 0x05FA0003
  50. }
  51. global _TRAVEO_VARIANT_C2D_4M
  52. if { ![info exists _TRAVEO_VARIANT_C2D_4M] } {
  53. set _TRAVEO_VARIANT_C2D_4M 0
  54. }
  55. if { $_TRAVEO_VARIANT_C2D_4M } {
  56. set _FLASH_DRIVER_NAME traveo21
  57. } else {
  58. set _FLASH_DRIVER_NAME traveo22
  59. }
  60. target create ${TARGET}.cm0 cortex_m -dap $_CHIPNAME.dap -ap-num 1 -coreid 0
  61. ${TARGET}.cm0 configure -work-area-phys $_WA_ADDR -work-area-size $_WA_SIZE -work-area-backup 0
  62. ${TARGET}.cm0 cortex_m reset_config sysresetreq
  63. ${TARGET}.cm0 configure -event examine-end "cy_get_set_device_param ${_FLASH_DRIVER_NAME} ${_CHIPNAME}_main_cm0 ${_CHIPNAME}_work_cm0; enable_cm7x"
  64. ${TARGET}.cm0 configure -event reset-deassert-post "mxs40_reset_deassert_post traveo2 ${TARGET}.cm0; enable_cm7x"
  65. target create ${TARGET}.cm70 cortex_m -dap $_CHIPNAME.dap -ap-num 2 -coreid 1
  66. ${TARGET}.cm70 configure -work-area-phys $_WA_ADDR -work-area-size $_WA_SIZE -work-area-backup 0
  67. ${TARGET}.cm70 configure -event reset-assert {}
  68. ${TARGET}.cm70 configure -event reset-deassert-post "mxs40_reset_deassert_post traveo2 ${TARGET}.cm70"
  69. flash bank ${_CHIPNAME}_main_cm0 ${_FLASH_DRIVER_NAME} 0x10000000 0 0 0 ${TARGET}.cm0
  70. flash bank ${_CHIPNAME}_work_cm0 ${_FLASH_DRIVER_NAME} 0x14000000 0 0 0 ${TARGET}.cm0
  71. flash bank ${_CHIPNAME}_super_cm0 ${_FLASH_DRIVER_NAME} 0x17000000 0 0 0 ${TARGET}.cm0
  72. flash bank ${_CHIPNAME}_efuse_cm0 ${_FLASH_DRIVER_NAME}_efuse 0x90700000 1024 1 1 ${TARGET}.cm0 external
  73. flash bank ${_CHIPNAME}_main_cm70 virtual 0x10000000 0 0 0 ${TARGET}.cm70 ${_CHIPNAME}_main_cm0
  74. flash bank ${_CHIPNAME}_work_cm70 virtual 0x14000000 0 0 0 ${TARGET}.cm70 ${_CHIPNAME}_work_cm0
  75. flash bank ${_CHIPNAME}_super_cm70 virtual 0x17000000 0 0 0 ${TARGET}.cm70 ${_CHIPNAME}_super_cm0
  76. flash bank ${_CHIPNAME}_efuse_cm70 virtual 0x90700000 1024 1 1 ${TARGET}.cm70 ${_CHIPNAME}_efuse_cm0 external
  77. if { $_TRAVEO_VARIANT_C2D_4M == 0} {
  78. target create ${TARGET}.cm71 cortex_m -dap $_CHIPNAME.dap -ap-num 3 -coreid 2
  79. ${TARGET}.cm71 configure -work-area-phys $_WA_ADDR -work-area-size $_WA_SIZE -work-area-backup 0
  80. ${TARGET}.cm71 configure -event reset-assert {}
  81. ${TARGET}.cm71 configure -event reset-deassert-post "mxs40_reset_deassert_post traveo2 ${TARGET}.cm71"
  82. flash bank ${_CHIPNAME}_main_cm71 virtual 0x10000000 0 0 0 ${TARGET}.cm71 ${_CHIPNAME}_main_cm0
  83. flash bank ${_CHIPNAME}_work_cm71 virtual 0x14000000 0 0 0 ${TARGET}.cm71 ${_CHIPNAME}_work_cm0
  84. flash bank ${_CHIPNAME}_super_cm71 virtual 0x17000000 0 0 0 ${TARGET}.cm71 ${_CHIPNAME}_super_cm0
  85. flash bank ${_CHIPNAME}_efuse_cm71 virtual 0x90700000 1024 1 1 ${TARGET}.cm71 ${_CHIPNAME}_efuse_cm0 external
  86. }
  87. unset _TRAVEO_VARIANT_C2D_4M
  88. targets ${TARGET}.cm0
  89. if {[using_jtag]} {
  90. jtag newtap $_CHIPNAME bs -irlen 4 -expected-id 0
  91. }