1# Copyright (c) 2021 Henrik Brix Andersen <henrik@brixandersen.dk>
2# SPDX-License-Identifier: Apache-2.0
3
4if { [info exists CHIPNAME] } {
5    set _CHIPNAME $CHIPNAME
6} else {
7    set _CHIPNAME neorv32
8}
9
10if { [info exists WORKAREASIZE] } {
11    set _WORKAREASIZE $WORKAREASIZE
12} else {
13    set _WORKAREASIZE 256
14}
15
16if { [info exists WORKAREAADDR] } {
17    set _WORKAREAADDR $WORKAREAADDR
18} else {
19    set _WORKAREAADDR 0x80000000
20}
21
22if { [info exists CPUTAPID] } {
23    set _CPUTAPID $CPUTAPID
24} else {
25    set _CPUTAPID 0x0cafe001
26}
27
28transport select jtag
29jtag newtap $_CHIPNAME cpu -irlen 5 -expected-id $_CPUTAPID
30
31set _TARGETNAME $_CHIPNAME.cpu
32target create $_TARGETNAME.0 riscv -chain-position $_TARGETNAME
33
34$_TARGETNAME.0 configure -work-area-phys $_WORKAREAADDR -work-area-size $_WORKAREASIZE -work-area-backup 1
35