atsamv.cfg 1.8 KB

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