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.6 KiB

  1. #
  2. # script for ATMEL sam4, a Cortex-M4 chip
  3. #
  4. #
  5. # sam4 devices can support both JTAG and SWD transports.
  6. #
  7. source [find target/swj-dp.tcl]
  8. if { [info exists CHIPNAME] } {
  9. set _CHIPNAME $CHIPNAME
  10. } else {
  11. set _CHIPNAME sam4
  12. }
  13. if { [info exists ENDIAN] } {
  14. set _ENDIAN $ENDIAN
  15. } else {
  16. set _ENDIAN little
  17. }
  18. # Work-area is a space in RAM used for flash programming
  19. # By default use 64kB
  20. if { [info exists WORKAREASIZE] } {
  21. set _WORKAREASIZE $WORKAREASIZE
  22. } else {
  23. set _WORKAREASIZE 0x4000
  24. }
  25. #jtag scan chain
  26. if { [info exists CPUTAPID] } {
  27. set _CPUTAPID $CPUTAPID
  28. } else {
  29. set _CPUTAPID 0x4ba00477
  30. }
  31. swj_newdap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_CPUTAPID
  32. dap create $_CHIPNAME.dap -chain-position $_CHIPNAME.cpu
  33. set _TARGETNAME $_CHIPNAME.cpu
  34. target create $_TARGETNAME cortex_m -endian $_ENDIAN -dap $_CHIPNAME.dap
  35. # 16K is plenty, the smallest chip has this much
  36. $_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size $_WORKAREASIZE -work-area-backup 0
  37. # JTAG speed should be <= F_CPU/6. F_CPU after reset is 4 MHz, so use F_JTAG = 0.5MHz
  38. #
  39. # Since we may be running of an RC oscilator, we crank down the speed a
  40. # bit more to be on the safe side. Perhaps superstition, but if are
  41. # running off a crystal, we can run closer to the limit. Note
  42. # that there can be a pretty wide band where things are more or less stable.
  43. adapter speed 500
  44. adapter srst delay 100
  45. if {[using_jtag]} {
  46. jtag_ntrst_delay 100
  47. }
  48. if {![using_hla]} {
  49. # if srst is not fitted use SYSRESETREQ to
  50. # perform a soft reset
  51. cortex_m reset_config sysresetreq
  52. }