atsamv.cfg 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. # SPDX-License-Identifier: GPL-2.0-or-later
  2. # ATMEL SAMV, SAMS, and SAME chips are Cortex-M7 parts
  3. # The chips are very similar; the SAMV series just has
  4. # more peripherals and seems like the "flagship" of the
  5. # family. This script will work for all of them.
  6. source [find target/swj-dp.tcl]
  7. if { [info exists CHIPNAME] } {
  8. set _CHIPNAME $CHIPNAME
  9. } else {
  10. set _CHIPNAME samv
  11. }
  12. if { [info exists ENDIAN] } {
  13. set _ENDIAN $ENDIAN
  14. } else {
  15. set _ENDIAN little
  16. }
  17. # Work-area is a space in RAM used for flash programming
  18. # By default use 16kB
  19. if { [info exists WORKAREASIZE] } {
  20. set _WORKAREASIZE $WORKAREASIZE
  21. } else {
  22. set _WORKAREASIZE 0x4000
  23. }
  24. if { [info exists CPUTAPID] } {
  25. set _CPUTAPID $CPUTAPID
  26. } else {
  27. set _CPUTAPID 0x0bd11477
  28. }
  29. swj_newdap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_CPUTAPID
  30. dap create $_CHIPNAME.dap -chain-position $_CHIPNAME.cpu
  31. set _TARGETNAME $_CHIPNAME.cpu
  32. target create $_TARGETNAME cortex_m -endian $_ENDIAN -dap $_CHIPNAME.dap
  33. $_TARGETNAME configure -work-area-phys 0x20400000 -work-area-size $_WORKAREASIZE -work-area-backup 0
  34. adapter speed 1800
  35. if {![using_hla]} {
  36. # if srst is not fitted use SYSRESETREQ to
  37. # perform a soft reset
  38. cortex_m reset_config sysresetreq
  39. # Set CSW[27], which according to ARM ADI v5 appendix E1.4 maps to AHB signal
  40. # HPROT[3], which according to AMBA AHB/ASB/APB specification chapter 3.7.3
  41. # makes the data access cacheable. This allows reading and writing data in the
  42. # CPU cache from the debugger, which is far more useful than going straight to
  43. # RAM when operating on typical variables, and is generally no worse when
  44. # operating on special memory locations.
  45. $_CHIPNAME.dap apcsw 0x08000000 0x08000000
  46. }
  47. set _FLASHNAME $_CHIPNAME.flash
  48. flash bank $_FLASHNAME atsamv 0x00400000 0 0 0 $_TARGETNAME