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.
 
 
 
 
 
 

65 lines
1.8 KiB

  1. # script for stm32f3x family
  2. if { [info exists CHIPNAME] } {
  3. set _CHIPNAME $CHIPNAME
  4. } else {
  5. set _CHIPNAME stm32f3x
  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. #
  21. # Since we may be running of an RC oscilator, we crank down the speed a
  22. # bit more to be on the safe side. Perhaps superstition, but if are
  23. # running off a crystal, we can run closer to the limit. Note
  24. # that there can be a pretty wide band where things are more or less stable.
  25. adapter_khz 1000
  26. adapter_nsrst_delay 100
  27. jtag_ntrst_delay 100
  28. #jtag scan chain
  29. if { [info exists CPUTAPID] } {
  30. set _CPUTAPID $CPUTAPID
  31. } else {
  32. # See STM Document RM0316
  33. # Section 29.6.3 - corresponds to Cortex-M4 r0p1
  34. set _CPUTAPID 0x4ba00477
  35. }
  36. jtag newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_CPUTAPID
  37. if { [info exists BSTAPID] } {
  38. set _BSTAPID $BSTAPID
  39. } else {
  40. # STM Document RM0316 rev 2 Section 30.6.2 says 0x06432041
  41. # but STM32F303VCT6 rev Y has 0x06422041
  42. set _BSTAPID1 0x06422041
  43. set _BSTAPID2 0x06432041
  44. }
  45. jtag newtap $_CHIPNAME bs -irlen 5 -expected-id $_BSTAPID1 -expected-id $_BSTAPID2
  46. set _TARGETNAME $_CHIPNAME.cpu
  47. target create $_TARGETNAME cortex_m3 -endian $_ENDIAN -chain-position $_TARGETNAME
  48. $_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size $_WORKAREASIZE -work-area-backup 0
  49. set _FLASHNAME $_CHIPNAME.flash
  50. flash bank $_FLASHNAME stm32f1x 0 0 0 0 $_TARGETNAME
  51. # if srst is not fitted use SYSRESETREQ to
  52. # perform a soft reset
  53. cortex_m3 reset_config sysresetreq