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.
 
 
 
 
 
 

69 lines
1.8 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. jtag_khz 1000
  21. jtag_nsrst_delay 100
  22. jtag_ntrst_delay 100
  23. #use combined on interfaces or targets that can't set TRST/SRST separately
  24. reset_config trst_and_srst
  25. #jtag scan chain
  26. if { [info exists CPUTAPID ] } {
  27. set _CPUTAPID $CPUTAPID
  28. } else {
  29. # See STM Document RM0008
  30. # Section 26.6.3
  31. set _CPUTAPID 0x3ba00477
  32. }
  33. jtag newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_CPUTAPID
  34. if { [info exists BSTAPID ] } {
  35. set _BSTAPID $BSTAPID
  36. } else {
  37. # See STM Document RM0008
  38. # Section 26.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. # High density devices, Rev A
  46. set _BSTAPID4 0x06414041
  47. # Connectivity line devices, Rev A and Rev Z
  48. set _BSTAPID5 0x06418041
  49. }
  50. jtag newtap $_CHIPNAME bs -irlen 5 -ircapture 0x1 -irmask 0x1 -expected-id $_BSTAPID1 -expected-id $_BSTAPID2 -expected-id $_BSTAPID3 -expected-id $_BSTAPID4 -expected-id $_BSTAPID5
  51. set _TARGETNAME $_CHIPNAME.cpu
  52. target create $_TARGETNAME cortex_m3 -endian $_ENDIAN -chain-position $_TARGETNAME
  53. $_TARGETNAME configure -work-area-virt 0 -work-area-phys 0x20000000 -work-area-size $_WORKAREASIZE -work-area-backup 0
  54. flash bank stm32x 0 0 0 0 0
  55. # For more information about the configuration files, take a look at:
  56. # openocd.texi