gd32e23x.cfg 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. # SPDX-License-Identifier: GPL-2.0-or-later
  2. # script for GigaDevice gd32e23x Cortex-M23 Series
  3. # https://www.gigadevice.com/microcontroller/gd32e230c8t6/
  4. #
  5. # gd32e23x devices support SWD transports only.
  6. #
  7. source [find target/swj-dp.tcl]
  8. source [find mem_helper.tcl]
  9. if { [info exists CHIPNAME] } {
  10. set _CHIPNAME $CHIPNAME
  11. } else {
  12. set _CHIPNAME gd32e23x
  13. }
  14. # Work-area is a space in RAM used for flash programming
  15. # By default use 4kB (as found on some GD32E230s)
  16. if { [info exists WORKAREASIZE] } {
  17. set _WORKAREASIZE $WORKAREASIZE
  18. } else {
  19. set _WORKAREASIZE 0x1000
  20. }
  21. # Allow overriding the Flash bank size
  22. if { [info exists FLASH_SIZE] } {
  23. set _FLASH_SIZE $FLASH_SIZE
  24. } else {
  25. # autodetect size
  26. set _FLASH_SIZE 0
  27. }
  28. #jtag scan chain
  29. if { [info exists CPUTAPID] } {
  30. set _CPUTAPID $CPUTAPID
  31. } else {
  32. # this is the SW-DP tap id not the jtag tap id
  33. set _CPUTAPID 0x0bf11477
  34. }
  35. swj_newdap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_CPUTAPID
  36. dap create $_CHIPNAME.dap -chain-position $_CHIPNAME.cpu
  37. set _TARGETNAME $_CHIPNAME.cpu
  38. target create $_TARGETNAME cortex_m -dap $_CHIPNAME.dap
  39. $_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size $_WORKAREASIZE -work-area-backup 0
  40. # flash size will be probed
  41. set _FLASHNAME $_CHIPNAME.flash
  42. flash bank $_FLASHNAME stm32f1x 0x08000000 $_FLASH_SIZE 0 0 $_TARGETNAME
  43. # SWD speed (may be updated to higher value in board config file)
  44. adapter speed 1000
  45. reset_config srst_nogate
  46. if {![using_hla]} {
  47. # if srst is not fitted use SYSRESETREQ to
  48. # perform a soft reset
  49. cortex_m reset_config sysresetreq
  50. }
  51. $_TARGETNAME configure -event examine-end {
  52. # Debug clock enable
  53. # RCU_APB2EN |= DBGMCUEN
  54. mmw 0x40021018 0x00400000 0
  55. # Stop watchdog counters during halt
  56. # DBG_CTL0 |= WWDGT_HOLD | FWDGT_HOLD | STB_HOLD | DSLP_HOLD | SLP_HOLD
  57. mmw 0x40015804 0x00000307 0
  58. }