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.
 
 
 
 
 
 

70 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. adapter_khz 1000
  21. jtag_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. # High density devices, Rev A
  45. set _BSTAPID4 0x06414041
  46. # Connectivity line devices, Rev A and Rev Z
  47. set _BSTAPID5 0x06418041
  48. }
  49. jtag newtap $_CHIPNAME bs -irlen 5 -expected-id $_BSTAPID1 \
  50. -expected-id $_BSTAPID2 -expected-id $_BSTAPID3 \
  51. -expected-id $_BSTAPID4 -expected-id $_BSTAPID5
  52. set _TARGETNAME $_CHIPNAME.cpu
  53. target create $_TARGETNAME cortex_m3 -endian $_ENDIAN -chain-position $_TARGETNAME
  54. $_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size $_WORKAREASIZE -work-area-backup 0
  55. set _FLASHNAME $_CHIPNAME.flash
  56. flash bank $_FLASHNAME stm32x 0 0 0 0 $_TARGETNAME
  57. # For more information about the configuration files, take a look at:
  58. # openocd.texi