at91sam4XXX.cfg 1.6 KB

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