1# Config Beetle SoC providing a CMSIS-DAP interface.
2
3source [find interface/cmsis-dap.cfg]
4
5source [find target/swj-dp.tcl]
6
7if { [info exists CHIPNAME] } {
8    set _CHIPNAME $CHIPNAME
9} else {
10    set _CHIPNAME beetle
11}
12
13if { [info exists ENDIAN] } {
14    set _ENDIAN $ENDIAN
15} else {
16    set _ENDIAN little
17}
18
19if { [info exists CPUTAPID] } {
20    set _CPUTAPID $CPUTAPID
21} else {
22    set _CPUTAPID 0x2ba01477
23}
24
25adapter speed 1000
26
27set _TARGETNAME $_CHIPNAME.cpu
28
29swj_newdap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_CPUTAPID
30
31target create $_TARGETNAME cortex_m -chain-position $_TARGETNAME
32
33$_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size 0x1000 -work-area-backup 0
34
35# Dont use hardware reset line (even if available) and use SWD "software" reset
36reset_config srst_nogate
37
38# Reset the peripherals and the core
39cortex_m reset_config sysresetreq
40