atsame5x.cfg 2.1 KB

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