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.
 
 
 
 
 
 

76 lines
2.0 KiB

  1. #
  2. # Microchip (former Atmel) SAM E54, E53, E51 and D51 devices
  3. # with a Cortex-M4 core
  4. #
  5. #
  6. # Devices only support SWD transports.
  7. #
  8. source [find target/swj-dp.tcl]
  9. if { [info exists CHIPNAME] } {
  10. set _CHIPNAME $CHIPNAME
  11. } else {
  12. set _CHIPNAME atsame5
  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 32kB (the smallest RAM size is 128kB)
  21. if { [info exists WORKAREASIZE] } {
  22. set _WORKAREASIZE $WORKAREASIZE
  23. } else {
  24. set _WORKAREASIZE 0x8000
  25. }
  26. if { [info exists CPUTAPID] } {
  27. set _CPUTAPID $CPUTAPID
  28. } else {
  29. set _CPUTAPID 0x4ba00477
  30. }
  31. swj_newdap $_CHIPNAME cpu -irlen 4 -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. $_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size $_WORKAREASIZE -work-area-backup 0
  36. # SAM DSU will hold the CPU in reset if TCK is low when RESET_N
  37. # deasserts
  38. #
  39. # dsu_reset_deassert configures whether we want to run or halt out of reset,
  40. # then instruct the DSU to let us out of reset.
  41. $_TARGETNAME configure -event reset-deassert-post {
  42. atsame5 dsu_reset_deassert
  43. }
  44. # SRST (wired to RESET_N) resets debug circuitry
  45. # srst_pulls_trst is not configured here to avoid an error raised in reset halt
  46. reset_config srst_gates_jtag
  47. # Do not use a reset button with other SWD adapter than Atmel's EDBG.
  48. # DSU usually locks MCU in reset state until you issue a reset command
  49. # in OpenOCD.
  50. # SAM E5x/D51 runs at SYSCLK = 48 MHz from RC oscillator after reset.
  51. # Atmel's EDBG (on-board cmsis-dap adapter of Xplained kits) works
  52. # without problem at clock speed over 5000 khz. Atmel recommends
  53. # adapter speed less than 10 * CPU clock.
  54. adapter speed 2000
  55. if {![using_hla]} {
  56. # if srst is not fitted use SYSRESETREQ to
  57. # perform a soft reset
  58. cortex_m reset_config sysresetreq
  59. }
  60. set _FLASHNAME $_CHIPNAME.flash
  61. flash bank $_FLASHNAME atsame5 0x00000000 0 1 1 $_TARGETNAME