You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

76 lines
2.0 KiB

  1. # script for stm32
  2. if { [info exists CHIPNAME] } {
  3. set _CHIPNAME $CHIPNAME
  4. } else {
  5. set _CHIPNAME stm32
  6. }
  7. if { [info exists ENDIAN] } {
  8. set _ENDIAN $ENDIAN
  9. } else {
  10. set _ENDIAN little
  11. }
  12. # Work-area is a space in RAM used for flash programming
  13. # By default use 16kB
  14. if { [info exists WORKAREASIZE] } {
  15. set _WORKAREASIZE $WORKAREASIZE
  16. } else {
  17. set _WORKAREASIZE 0x4000
  18. }
  19. # JTAG speed should be <= F_CPU/6. F_CPU after reset is 8MHz, so use F_JTAG = 1MHz
  20. adapter_khz 1000
  21. adapter_nsrst_delay 100
  22. jtag_ntrst_delay 100
  23. #jtag scan chain
  24. if { [info exists CPUTAPID ] } {
  25. set _CPUTAPID $CPUTAPID
  26. } else {
  27. # See STM Document RM0008
  28. # Section 26.6.3
  29. set _CPUTAPID 0x3ba00477
  30. }
  31. jtag newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_CPUTAPID
  32. if { [info exists BSTAPID ] } {
  33. # FIXME this never gets used to override defaults...
  34. set _BSTAPID $BSTAPID
  35. } else {
  36. # See STM Document RM0008
  37. # Section 29.6.2
  38. # Low density devices, Rev A
  39. set _BSTAPID1 0x06412041
  40. # Medium density devices, Rev A
  41. set _BSTAPID2 0x06410041
  42. # Medium density devices, Rev B and Rev Z
  43. set _BSTAPID3 0x16410041
  44. set _BSTAPID4 0x06420041
  45. # High density devices, Rev A
  46. set _BSTAPID5 0x06414041
  47. # Connectivity line devices, Rev A and Rev Z
  48. set _BSTAPID6 0x06418041
  49. # XL line devices, Rev A
  50. set _BSTAPID7 0x06430041
  51. }
  52. jtag newtap $_CHIPNAME bs -irlen 5 -expected-id $_BSTAPID1 \
  53. -expected-id $_BSTAPID2 -expected-id $_BSTAPID3 \
  54. -expected-id $_BSTAPID4 -expected-id $_BSTAPID5 \
  55. -expected-id $_BSTAPID6 -expected-id $_BSTAPID7
  56. set _TARGETNAME $_CHIPNAME.cpu
  57. target create $_TARGETNAME cortex_m3 -endian $_ENDIAN -chain-position $_TARGETNAME
  58. $_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size $_WORKAREASIZE -work-area-backup 0
  59. # flash size will be probed
  60. set _FLASHNAME $_CHIPNAME.flash
  61. flash bank $_FLASHNAME stm32x 0x08000000 0 0 0 $_TARGETNAME
  62. # if srst is not fitted use SYSRESETREQ to
  63. # perform a soft reset
  64. cortex_m3 reset_config sysresetreq