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.
 
 
 
 
 
 

92 lines
3.0 KiB

  1. # TI/Luminary Stellaris LM3S chip family
  2. # Luminary chips support both JTAG and SWD transports.
  3. # Adapt based on what transport is active.
  4. source [find target/swj-dp.tcl]
  5. # For now we ignore the SPI and UART options, which
  6. # are usable only for ISP style initial flash programming.
  7. if { [info exists CHIPNAME] } {
  8. set _CHIPNAME $CHIPNAME
  9. } else {
  10. set _CHIPNAME lm3s
  11. }
  12. # CPU TAP ID 0x1ba00477 for early Sandstorm parts
  13. # CPU TAP ID 0x2ba00477 for later SandStorm parts, e.g. lm3s811 Rev C2
  14. # CPU TAP ID 0x3ba00477 for Cortex-M3 r1p2 (on Fury, DustDevil)
  15. # CPU TAP ID 0x4ba00477 for Cortex-M3 r2p0 (on Tempest)
  16. # ... we'll ignore the JTAG version field, rather than list every
  17. # chip revision that turns up.
  18. if { [info exists CPUTAPID ] } {
  19. set _CPUTAPID $CPUTAPID
  20. } else {
  21. set _CPUTAPID 0x0ba00477
  22. }
  23. # SWD DAP, and JTAG TAP, take same params for now;
  24. # ... even though SWD ignores all except TAPID, and
  25. # JTAG shouldn't need anything more then irlen. (and TAPID).
  26. swj_newdap $_CHIPNAME cpu -irlen 4 -irmask 0xf \
  27. -expected-id $_CPUTAPID -ignore-version
  28. if { [info exists WORKAREASIZE ] } {
  29. set _WORKAREASIZE $WORKAREASIZE
  30. } else {
  31. # default to 8K working area
  32. set _WORKAREASIZE 0x2000
  33. }
  34. set _TARGETNAME $_CHIPNAME.cpu
  35. target create $_TARGETNAME cortex_m3 -chain-position $_CHIPNAME.cpu
  36. # 8K working area at base of ram, not backed up
  37. #
  38. # NOTE: you may need or want to reconfigure the work area;
  39. # some parts have just 6K, and you may want to use other
  40. # addresses (at end of mem not beginning) or back it up.
  41. $_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size $_WORKAREASIZE
  42. # JTAG speed ... slow enough to work with a 12 MHz RC oscillator;
  43. # LM3S parts don't support RTCK
  44. #
  45. # NOTE: this may be increased by a reset-init handler, after it
  46. # configures and enables the PLL. Or you might need to decrease
  47. # this, if you're using a slower clock.
  48. adapter_khz 500
  49. source [find mem_helper.tcl]
  50. $_TARGETNAME configure -event reset-start {
  51. adapter_khz 500
  52. #
  53. # When nRST is asserted on most Stellaris devices, it clears some of
  54. # the debug state. The ARMv7M and Cortex-M3 TRMs say that's wrong;
  55. # and OpenOCD depends on those TRMs. So we won't use SRST on those
  56. # chips. (Only power-on reset should affect debug state, beyond a
  57. # few specified bits; not the chip's nRST input, wired to SRST.)
  58. #
  59. # REVISIT current errata specs don't seem to cover this issue.
  60. # Do we have more details than this email?
  61. # https://lists.berlios.de/pipermail
  62. # /openocd-development/2008-August/003065.html
  63. #
  64. set device_class [expr (([mrw 0x400fe000] >> 16) & 0xff)]
  65. if {$device_class == 0 || $device_class == 1 || $device_class == 3} {
  66. # Sandstorm, Fury and DustDevil are able to use NVIC SYSRESETREQ
  67. cortex_m3 reset_config sysresetreq
  68. } else {
  69. # Tempest and newer default to using NVIC VECTRESET
  70. # this does mean a reset-init event handler is required to reset
  71. # any peripherals
  72. cortex_m3 reset_config vectreset
  73. }
  74. }
  75. # flash configuration ... autodetects sizes, autoprobed
  76. flash bank $_CHIPNAME.flash stellaris 0 0 0 0 $_TARGETNAME