stm32f102.cfg 2.0 KB

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