1 # SPDX-License-Identifier: GPL-2.0-or-later
3 # script for ATMEL sam3, a Cortex-M3 chip
30 source [find target/swj-dp.tcl]
32 if { [info exists CHIPNAME] } {
33 set _CHIPNAME $CHIPNAME
38 if { [info exists ENDIAN] } {
44 # Work-area is a space in RAM used for flash programming
46 if { [info exists WORKAREASIZE] } {
47 set _WORKAREASIZE $WORKAREASIZE
49 set _WORKAREASIZE 0x4000
53 if { [info exists CPUTAPID] } {
54 set _CPUTAPID $CPUTAPID
56 set _CPUTAPID 0x4ba00477
59 swj_newdap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_CPUTAPID
60 dap create $_CHIPNAME.dap -chain-position $_CHIPNAME.cpu
62 set _TARGETNAME $_CHIPNAME.cpu
63 target create $_TARGETNAME cortex_m -endian $_ENDIAN -dap $_CHIPNAME.dap
65 # 16K is plenty, the smallest chip has this much
66 $_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size $_WORKAREASIZE -work-area-backup 0
68 $_TARGETNAME configure -event gdb-flash-erase-start {
72 # JTAG speed should be <= F_CPU/6. F_CPU after reset is 4 MHz, so use F_JTAG = 0.5MHz
74 # Since we may be running of an RC oscilator, we crank down the speed a
75 # bit more to be on the safe side. Perhaps superstition, but if are
76 # running off a crystal, we can run closer to the limit. Note
77 # that there can be a pretty wide band where things are more or less stable.
81 adapter srst delay 100
87 # if srst is not fitted use SYSRESETREQ to
88 # perform a soft reset
89 cortex_m reset_config sysresetreq