1# Copyright (C) 2021 Space Cubics, LLC.
2# Yasushi SHOJI <yashi@spacecubics.com>
3
4if { [info exists CHIPNAME] } {
5    set  _CHIPNAME $CHIPNAME
6} else {
7    set  _CHIPNAME cortex_m3
8}
9
10if { [info exists CPUTAPID ] } {
11    set _CPUTAPID $CPUTAPID
12} else {
13    set _CPUTAPID 0x4ba00477
14}
15
16if { [info exists WORKAREASIZE] } {
17	set _WORKAREASIZE $WORKAREASIZE
18} else {
19	set _WORKAREASIZE 0x4000
20}
21
22jtag newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_CPUTAPID
23dap create $_CHIPNAME.dap -chain-position $_CHIPNAME.cpu
24
25set _TARGETNAME $_CHIPNAME.cpu
26target create $_TARGETNAME cortex_m -dap $_CHIPNAME.dap
27$_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size $_WORKAREASIZE -work-area-backup 0
28
29if {![using_hla]} {
30   cortex_m reset_config sysresetreq
31}
32