Skip to content

Commit 4188f58

Browse files
michalsimekdkalowsk
authored andcommitted
boards: amd: kv260_r5: add support for fsbl and bitstream
Some tests requires to also run fsbl and load bitstream before loading Zephyr. Currently only --elf-file and --fsbl are suported. But there could be also bitstream loaded via --bistream parameter but xsdb script is missing it. Tricky part on it is when only fsbl or bitstream are loaded they are sharing the same argument location that's why detect if second parameter is bitstream by matching "*.bit" in it to support all combinations. And also switch board to jtag boot mode all the time. The reason is that starter kits with SOM have preloaded SW already and starting in QSPI boot mode that's why with using XSDB make sure that board is running in jtag boot mode all the time no matter if any SW runs on it. Signed-off-by: Appana Durga Kedareswara rao <appana.durga.kedareswara.rao@amd.com> Signed-off-by: Michal Simek <michal.simek@amd.com>
1 parent 846d819 commit 4188f58

File tree

1 file changed

+72
-9
lines changed

1 file changed

+72
-9
lines changed

boards/amd/kv260_r5/support/xsdb.cfg

Lines changed: 72 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,86 @@
22
#
33
# SPDX-License-Identifier: Apache-2.0
44

5+
proc boot_jtag { } {
6+
# switch to JTAG boot mode #
7+
targets -set -filter {name =~ "PSU*"}
8+
stop
9+
# update multiboot to ZERO
10+
mwr 0xffca0010 0x0
11+
# change boot mode to JTAG
12+
mwr 0xff5e0200 0x0100
13+
# reset
14+
rst -system
15+
}
16+
517
proc load_image args {
618
set elf_file [lindex $args 0]
7-
set fsblelf_file [lindex $args 1]
8-
connect -url 127.0.0.1:3121
19+
set bitfile [lindex $args 1]
20+
set fsblelf_file [lindex $args 2]
21+
22+
if { [info exists ::env(HW_SERVER_URL)] } {
23+
connect -url $::env(HW_SERVER_URL)
24+
} else {
25+
connect
26+
}
27+
928
after 2000
29+
30+
# setup jtag boot mode
31+
boot_jtag
32+
after 2000
33+
1034
targets -set -nocase -filter {name =~ "*R5*#0"}
35+
36+
# load bitstream if passed
37+
if { [string length $bitfile] != 0 } {
38+
fpga -f $bitfile -no-revision-check
39+
}
40+
1141
rst -proc
12-
dow $fsblelf_file
13-
after 1000
14-
con
15-
after 1000
16-
stop
17-
targets -set -nocase -filter {name =~ "*R5*#0"}
42+
43+
# load FSBL if passed
44+
if { [string length $fsblelf_file] != 0 } {
45+
dow $fsblelf_file
46+
after 1000
47+
con
48+
after 1000
49+
stop
50+
}
51+
1852
after 2000
1953
dow $elf_file
2054
con
2155
exit
2256
}
2357

24-
load_image {*}$argv
58+
switch $argc {
59+
"1" {
60+
set zephyr_elf [lindex $argv 0]
61+
set bitstream ""
62+
set fsbl_elf ""
63+
}
64+
"2" {
65+
set par [lindex $argv 1]
66+
set substring "*.bit"
67+
if { [string match -nocase $substring $par] == 0 } {
68+
set bitstream ""
69+
set fsbl_elf $par
70+
} else {
71+
set bitstream $par
72+
set fsbl_elf ""
73+
}
74+
set zephyr_elf [lindex $argv 0]
75+
}
76+
"3" {
77+
set zephyr_elf [lindex $argv 0]
78+
set bitstream [lindex $argv 1]
79+
set fsbl_elf [lindex $argv 2]
80+
}
81+
default {
82+
puts "Unsifficient number for args"
83+
exit -1
84+
}
85+
}
86+
87+
load_image "$zephyr_elf" "$bitstream" "$fsbl_elf"

0 commit comments

Comments
 (0)