Skip to content

Commit 40d58ce

Browse files
MicBisoborneoa
authored andcommitted
tcl/target/renesas_rz_g2: Rename to renesas_rz and add RZ/V2L-G3S
Rename file to get it more generic and add more targets belonging to the same family. Add support for two new devices: RZ/V2L and RZ/G3S Change-Id: Idb7f4d81d2f95ad15ef686e940f43ed29f49f343 Signed-off-by: MicBiso <[email protected]> Reviewed-on: https://review.openocd.org/c/openocd/+/8211 Reviewed-by: Antonio Borneo <[email protected]> Tested-by: jenkins
1 parent 3b261fb commit 40d58ce

File tree

1 file changed

+58
-20
lines changed

1 file changed

+58
-20
lines changed

tcl/target/renesas_rz_g2.cfg renamed to tcl/target/renesas_rz.cfg

Lines changed: 58 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,25 @@
11
# SPDX-License-Identifier: GPL-2.0-or-later
22

3-
# Renesas RZ/G2 SOCs
3+
# Renesas RZ SOCs
44
# - There are a combination of Cortex-A57s, Cortex-A53s, Cortex-A55, Cortex-R7
55
# and Cortex-M33 for each SOC
6-
# - Each SOC can boot through the Cortex-A5x cores
6+
# - Each SOC can boot through the Cortex-A5x cores or the Cortex-M33
77

8-
# Supported RZ/G2 SOCs and their cores:
8+
# Supported RZ SOCs and their cores:
99
# RZ/G2H: Cortex-A57 x4, Cortex-A53 x4, Cortex-R7
1010
# RZ/G2M: Cortex-A57 x2, Cortex-A53 x4, Cortex-R7
1111
# RZ/G2N: Cortex-A57 x2, Cortex-R7
1212
# RZ/G2E: Cortex-A53 x2, Cortex-R7
1313
# RZ/G2L: Cortex-A55 x2, Cortex-M33
14+
# RZ/V2L: Cortex-A55 x2, Cortex-M33
1415
# RZ/G2LC: Cortex-A55 x2, Cortex-M33
1516
# RZ/G2UL: Cortex-A55 x1, Cortex-M33
17+
# RZ/G3S: Cortex-A55 x1, Cortex-M33 x2
1618

1719
# Usage:
1820
# There are 2 configuration options:
1921
# SOC: Selects the supported SOC. (Default 'G2L')
20-
# BOOT_CORE: Selects the booting core. 'CA57', 'CA53' or 'CA55'
22+
# BOOT_CORE: Selects the booting core. 'CA57', 'CA53', 'CA55' or CM33
2123

2224
transport select jtag
2325
reset_config trst_and_srst srst_gates_jtag
@@ -77,6 +79,13 @@ switch $_soc {
7779
set _boot_core CA55
7880
set _ap_num 0
7981
}
82+
V2L {
83+
set _CHIPNAME r9a07g054l
84+
set _num_ca55 2
85+
set _num_cm33 1
86+
set _boot_core CA55
87+
set _ap_num 0
88+
}
8089
G2LC {
8190
set _CHIPNAME r9a07g044c
8291
set _num_ca55 2
@@ -91,6 +100,13 @@ switch $_soc {
91100
set _boot_core CA55
92101
set _ap_num 0
93102
}
103+
G3S {
104+
set _CHIPNAME r9a08g045s
105+
set _num_ca55 1
106+
set _num_cm33 2
107+
set _boot_core CA55
108+
set _ap_num 0
109+
}
94110
default {
95111
error "'$_soc' is invalid!"
96112
}
@@ -112,16 +128,16 @@ if { [info exists DAP_TAPID] } {
112128
set _DAP_TAPID 0x6ba00477
113129
}
114130

115-
echo "\t$_soc - $_num_ca57 CA57(s), $_num_ca55 CA55(s), $_num_ca53 CA53(s), $_num_cr7 CR7(s), \
116-
$_num_cm33 CM33(s)"
131+
echo "\t$_soc - $_num_ca57 CA57(s), $_num_ca55 CA55(s), $_num_ca53 CA53(s), \
132+
$_num_cr7 CR7(s), $_num_cm33 CM33(s)"
117133
echo "\tBoot Core - $_boot_core\n"
118134

119135
set _DAPNAME $_CHIPNAME.dap
120136

121137

122138
# TAP and DAP
123-
jtag newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_DAP_TAPID \
124-
-ignore-version
139+
jtag newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf \
140+
-expected-id $_DAP_TAPID -ignore-version
125141
dap create $_DAPNAME -chain-position $_CHIPNAME.cpu
126142
echo "$_CHIPNAME.cpu"
127143

@@ -133,8 +149,8 @@ set CA53_DBGBASE {0x80C10000 0x80D10000 0x80E10000 0x80F10000}
133149
set CA53_CTIBASE {0x80C20000 0x80D20000 0x80E20000 0x80F20000}
134150
set CR7_DBGBASE 0x80910000
135151
set CR7_CTIBASE 0x80918000
136-
set CM33_DBGBASE 0xE000E000
137-
set CM33_CTIBASE 0xE0042000
152+
set CM33_DBGBASE {0xE000E000 0xE010E000}
153+
set CM33_CTIBASE {0xE0042000 0xE0142000}
138154

139155
set smp_targets ""
140156

@@ -145,7 +161,8 @@ proc setup_a5x {core_name dbgbase ctibase num boot} {
145161
cti create $_CTINAME -dap $::_DAPNAME -ap-num $::_ap_num \
146162
-baseaddr [lindex $ctibase $_core]
147163
target create $_TARGETNAME aarch64 -dap $::_DAPNAME \
148-
-ap-num $::_ap_num -dbgbase [lindex $dbgbase $_core] -cti $_CTINAME
164+
-ap-num $::_ap_num -dbgbase [lindex $dbgbase $_core] \
165+
-cti $_CTINAME
149166
if { $_core > 0 || $boot == 0 } {
150167
$_TARGETNAME configure -defer-examine
151168
}
@@ -160,13 +177,29 @@ proc setup_cr7 {dbgbase ctibase} {
160177
target create $_TARGETNAME cortex_r4 -dap $::_DAPNAME \
161178
-ap-num 1 -dbgbase $dbgbase -defer-examine
162179
}
163-
164-
proc setup_cm33 {dbgbase ctibase} {
165-
set _TARGETNAME $::_CHIPNAME.m33
166-
set _CTINAME $_TARGETNAME.cti
167-
cti create $_CTINAME -dap $::_DAPNAME -ap-num 2 -baseaddr $ctibase
168-
target create $_TARGETNAME cortex_m -dap $::_DAPNAME \
169-
-ap-num 2 -dbgbase $dbgbase -defer-examine
180+
proc setup_cm33 {dbgbase ctibase num boot} {
181+
if { $::_soc == "G2L" || $::_soc == "V2L" \
182+
|| $::_soc == "G2LC" || $::_soc == "G2UL" } {
183+
set _ap_num 2
184+
} elseif { $::_soc == "G3S" } {
185+
set _ap_num 3
186+
}
187+
for { set _core 0 } { $_core < $num } { incr _core } {
188+
if { $num <= 1 } {
189+
set _TARGETNAME $::_CHIPNAME.m33
190+
} else {
191+
set _TARGETNAME $::_CHIPNAME.m33.$_core
192+
}
193+
set _CTINAME $_TARGETNAME.cti
194+
cti create $_CTINAME -dap $::_DAPNAME -ap-num $_ap_num \
195+
-baseaddr [lindex $ctibase $_core]
196+
target create $_TARGETNAME cortex_m -dap $::_DAPNAME \
197+
-ap-num $_ap_num -dbgbase [lindex $dbgbase $_core]
198+
if { $boot == 0 } {
199+
$_TARGETNAME configure -defer-examine
200+
}
201+
incr $_ap_num
202+
}
170203
}
171204

172205
# Organize target list based on the boot core
@@ -180,12 +213,17 @@ if { $_boot_core == "CA57" } {
180213
setup_cr7 $CR7_DBGBASE $CR7_CTIBASE
181214
} elseif { $_boot_core == "CA55" } {
182215
setup_a5x a55 $CA55_DBGBASE $CA55_CTIBASE $_num_ca55 1
183-
setup_cm33 $CM33_DBGBASE $CM33_CTIBASE
216+
setup_cm33 $CM33_DBGBASE $CM33_CTIBASE $_num_cm33 0
217+
} elseif { $_boot_core == "CM33" } {
218+
setup_a5x a55 $CA55_DBGBASE $CA55_CTIBASE $_num_ca55 0
219+
setup_cm33 $CM33_DBGBASE $CM33_CTIBASE $_num_cm33 1
184220
}
221+
185222
echo "SMP targets:$smp_targets"
186223
eval "target smp $smp_targets"
187224

188-
if { $_soc == "G2L" || $_soc == "G2LC" || $_soc == "G2UL" } {
225+
if { $_soc == "G2L" || $_soc == "V2L" || $_soc == "G2LC" \
226+
|| $_soc == "G2UL" || $_soc == "G3S"} {
189227
target create $_CHIPNAME.axi_ap mem_ap -dap $_DAPNAME -ap-num 1
190228
}
191229

0 commit comments

Comments
 (0)