Skip to content

Commit 3f18516

Browse files
Wanja Zaeskedadada
Wanja Zaeske
authored andcommitted
add preliminary version of xilinx-utils directly to this repo
1 parent 29d2cd8 commit 3f18516

33 files changed

+3915
-109
lines changed

flake.lock

+3-20
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

+10-13
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
{
22
inputs.flake-utils.url = "github:numtide/flake-utils";
33
inputs.devshell.url = "github:numtide/devshell";
4-
inputs.fpga-utils.url = "git+ssh://[email protected]/ft-ssy-aes/XANDAR/xilinx-workspace.git";
5-
inputs.fpga-utils.flake = false;
64

75
outputs = { self, nixpkgs, flake-utils, ... } @ inputs:
86
flake-utils.lib.eachSystem [ "x86_64-linux" ] (system:
@@ -153,12 +151,6 @@
153151
nix flake check
154152
'';
155153
};
156-
env = [
157-
{
158-
name = "UTILS_ROOT";
159-
value = inputs.fpga-utils;
160-
}
161-
];
162154
commands =
163155
let
164156
commandTemplate = command: ''
@@ -174,15 +166,20 @@
174166
help = "";
175167
}
176168
{
177-
name = "restore";
178-
command = commandTemplate "restore";
179-
help = "restore a project using a generated restore script";
169+
name = "create-project";
170+
command = commandTemplate "create-project";
171+
help = "creates a new project based on a template";
180172
}
181173
{
182-
name = "create-restore-script";
183-
command = commandTemplate "create-restore-script";
174+
name = "store";
175+
command = commandTemplate "store";
184176
help = "create a restore script for a given project";
185177
}
178+
{
179+
name = "restore";
180+
command = commandTemplate "restore";
181+
help = "restore a project using a generated restore script";
182+
}
186183
{
187184
name = "generate-hw-config";
188185
command = commandTemplate "generate-hw-config";
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
diff --git a/main.c b/main.c
2+
index 43b5ce1..86ae48b 100644
3+
--- a/main.c
4+
+++ b/main.c
5+
@@ -296,17 +296,17 @@ int main(void)
6+
/*
7+
* DDR Read/write test
8+
*/
9+
- Status = DDRInitCheck();
10+
- if (Status == XST_FAILURE) {
11+
- fsbl_printf(DEBUG_GENERAL,"DDR_INIT_FAIL \r\n");
12+
- /* Error Handling here */
13+
- OutputStatus(DDR_INIT_FAIL);
14+
- /*
15+
- * Calling FsblHookFallback instead of Fallback
16+
- * since, devcfg driver is not yet initialized
17+
- */
18+
- FsblHookFallback();
19+
- }
20+
+// Status = DDRInitCheck();
21+
+// if (Status == XST_FAILURE) {
22+
+// fsbl_printf(DEBUG_GENERAL,"DDR_INIT_FAIL \r\n");
23+
+// /* Error Handling here */
24+
+// OutputStatus(DDR_INIT_FAIL);
25+
+// /*
26+
+// * Calling FsblHookFallback instead of Fallback
27+
+// * since, devcfg driver is not yet initialized
28+
+// */
29+
+// FsblHookFallback();
30+
+// }
31+
32+
33+
/*
34+
@@ -380,6 +380,8 @@ int main(void)
35+
BootModeRegister = Xil_In32(BOOT_MODE_REG);
36+
BootModeRegister &= BOOT_MODES_MASK;
37+
38+
+ BootModeRegister = JTAG_MODE;
39+
+
40+
/*
41+
* QSPI BOOT MODE
42+
*/
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
diff --git a/main.c b/main.c
2+
index 43b5ce1..86ae48b 100644
3+
--- a/main.c
4+
+++ b/main.c
5+
@@ -296,17 +296,17 @@ int main(void)
6+
/*
7+
* DDR Read/write test
8+
*/
9+
- Status = DDRInitCheck();
10+
- if (Status == XST_FAILURE) {
11+
- fsbl_printf(DEBUG_GENERAL,"DDR_INIT_FAIL \r\n");
12+
- /* Error Handling here */
13+
- OutputStatus(DDR_INIT_FAIL);
14+
- /*
15+
- * Calling FsblHookFallback instead of Fallback
16+
- * since, devcfg driver is not yet initialized
17+
- */
18+
- FsblHookFallback();
19+
- }
20+
+// Status = DDRInitCheck();
21+
+// if (Status == XST_FAILURE) {
22+
+// fsbl_printf(DEBUG_GENERAL,"DDR_INIT_FAIL \r\n");
23+
+// /* Error Handling here */
24+
+// OutputStatus(DDR_INIT_FAIL);
25+
+// /*
26+
+// * Calling FsblHookFallback instead of Fallback
27+
+// * since, devcfg driver is not yet initialized
28+
+// */
29+
+// FsblHookFallback();
30+
+// }
31+
32+
33+
/*
34+
@@ -380,6 +380,8 @@ int main(void)
35+
BootModeRegister = Xil_In32(BOOT_MODE_REG);
36+
BootModeRegister &= BOOT_MODES_MASK;
37+
38+
+ BootModeRegister = JTAG_MODE;
39+
+
40+
/*
41+
* QSPI BOOT MODE
42+
*/

tcl-lib/jtag_boot/boot.tcl

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env xsct
2+
3+
set jtag_id [dict get [lindex [ jtag targets -filter {level == 0} -target-properties] 0] name]
4+
5+
if { $jtag_id == "JTAG-ONB4 251633007674A" } {
6+
puts "jtag device: $jtag_id"
7+
puts "no bootmode adaption needed"
8+
} else {
9+
puts "jtag device: $jtag_id"
10+
puts "boot mode adaption required"
11+
}

tcl-lib/jtag_boot/ultrascale_init.tcl

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
#!/usr/bin/env xsct
2+
3+
if { $argc != 6 } {
4+
set prog_name [file tail $argv0]
5+
puts "usage: $prog_name bit_file xsa_file pmufw_file fsbl_file zynqmp_utils elf_file"
6+
exit 0
7+
}
8+
9+
set bit_file [lindex $argv 0]
10+
set xsa_file [lindex $argv 1]
11+
set pmufw_file [lindex $argv 2]
12+
set fsbl_file [lindex $argv 3]
13+
set zynqmp_utils [lindex $argv 4]
14+
set elf_file [lindex $argv 5]
15+
16+
source $zynqmp_utils
17+
18+
connect -url tcp:127.0.0.1:3121
19+
20+
set jtag_id [dict get [lindex [ jtag targets -filter {level == 0} -target-properties] 0] name]
21+
22+
if { ($jtag_id == "JTAG-ONB4 2516330067ABA") || ($jtag_id == "JTAG-ONB4 2516330067ACA") } {
23+
puts "Set bootmode to JTAG"
24+
targets -set -nocase -filter {name =~ "*PSU*"}
25+
stop
26+
mwr 0xff5e0200 0x0100
27+
rst -system
28+
}
29+
30+
targets -set -nocase -filter {name =~"APU*"}
31+
rst -system
32+
after 3000
33+
#targets -set -filter {jtag_cable_name =~ "JTAG-ONB4 2516330067ACA" && level==0} -index 0
34+
#targets -set -filter {jtag_cable_name =~ "JTAG-ONB4 2516330594A9A" && level==0} -index 0
35+
fpga -file $bit_file
36+
targets -set -nocase -filter {name =~"APU*"}
37+
loadhw -hw $xsa_file -mem-ranges [list {0x80000000 0xbfffffff} {0x400000000 0x5ffffffff} {0x1000000000 0x7fffffffff}]
38+
39+
#Disable Security gates to view PMU MB target
40+
targets -set -filter {name =~ "PSU"}
41+
mwr 0xffca0038 0x1ff
42+
after 500
43+
44+
#Load and run PMU FW
45+
targets -set -filter {name =~ "MicroBlaze PMU"}
46+
dow $pmufw_file
47+
con
48+
after 500
49+
50+
configparams force-mem-access 1
51+
targets -set -nocase -filter {name =~"APU*"}
52+
set mode [expr [mrd -value 0xFF5E0200] & 0xf]
53+
54+
targets -set -nocase -filter {name =~ "*A53*#0"}
55+
rst -processor
56+
dow $fsbl_file
57+
set bp_24_56_fsbl_bp [bpadd -addr &XFsbl_Exit]
58+
con -block -timeout 60
59+
bpremove $bp_24_56_fsbl_bp
60+
targets -set -nocase -filter {name =~ "*A53*#0"}
61+
rst -processor
62+
63+
dow $elf_file
64+
65+
configparams force-mem-access 0
66+
67+
targets -set -nocase -filter {name =~ "*A53*#0"}
68+
con
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
#!/usr/bin/env xsct
2+
3+
if { $argc != 5 } {
4+
set prog_name [file tail $argv0]
5+
puts "usage: $prog_name bit_file xsa_file pmufw_file fsbl_file elf_file"
6+
exit 0
7+
}
8+
9+
set bit_file [lindex $argv 0]
10+
set xsa_file [lindex $argv 1]
11+
set pmufw_file [lindex $argv 2]
12+
set fsbl_file [lindex $argv 3]
13+
set elf_file [lindex $argv 4]
14+
15+
source ./zynqmp_utils.tcl
16+
17+
connect -url tcp:127.0.0.1:3121
18+
19+
set jtag_id [dict get [lindex [ jtag targets -filter {level == 0} -target-properties] 0] name]
20+
21+
if { ($jtag_id == "JTAG-ONB4 2516330067ABA") || ($jtag_id == "JTAG-ONB4 2516330067ACA") } {
22+
puts "Set bootmode to JTAG"
23+
targets -set -nocase -filter {name =~ "*PSU*"}
24+
stop
25+
mwr 0xff5e0200 0x0100
26+
rst -system
27+
}
28+
29+
targets -set -nocase -filter {name =~"APU*"}
30+
rst -system
31+
after 3000
32+
#targets -set -filter {jtag_cable_name =~ "JTAG-ONB4 2516330067ACA" && level==0} -index 0
33+
#targets -set -filter {jtag_cable_name =~ "JTAG-ONB4 2516330594A9A" && level==0} -index 0
34+
fpga -file $bit_file
35+
targets -set -nocase -filter {name =~"APU*"}
36+
loadhw -hw $xsa_file -mem-ranges [list {0x80000000 0xbfffffff} {0x400000000 0x5ffffffff} {0x1000000000 0x7fffffffff}]
37+
38+
#Disable Security gates to view PMU MB target
39+
targets -set -filter {name =~ "PSU"}
40+
mwr 0xffca0038 0x1ff
41+
after 500
42+
43+
#Load and run PMU FW
44+
targets -set -filter {name =~ "MicroBlaze PMU"}
45+
dow $pmufw_file
46+
con
47+
after 500
48+
49+
configparams force-mem-access 1
50+
targets -set -nocase -filter {name =~"APU*"}
51+
set mode [expr [mrd -value 0xFF5E0200] & 0xf]
52+
53+
targets -set -nocase -filter {name =~ "*A53*#0"}
54+
rst -processor
55+
dow $fsbl_file
56+
set bp_24_56_fsbl_bp [bpadd -addr &XFsbl_Exit]
57+
con -block -timeout 60
58+
bpremove $bp_24_56_fsbl_bp
59+
targets -set -nocase -filter {name =~ "*A53*#0"}
60+
rst -processor
61+
62+
dow $elf_file
63+
64+
configparams force-mem-access 0
65+
66+
targets -set -nocase -filter {name =~ "*A53*#0"}
67+
con
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#!/usr/bin/env xsct
2+
3+
if { $argc != 5 } {
4+
set prog_name [file tail $argv0]
5+
puts "usage: $prog_name bit_file xsa_file pmufw_file fsbl_file elf_file"
6+
exit 0
7+
}
8+
9+
set bit_file [lindex $argv 0]
10+
set xsa_file [lindex $argv 1]
11+
set pmufw_file [lindex $argv 2]
12+
set fsbl_file [lindex $argv 3]
13+
set elf_file [lindex $argv 4]
14+
15+
source ./zynqmp_utils.tcl
16+
17+
connect -url tcp:127.0.0.1:3121
18+
19+
targets -set -nocase -filter {name =~"APU*"}
20+
rst -system
21+
after 3000
22+
fpga -file $bit_file
23+
targets -set -nocase -filter {name =~"APU*"}
24+
loadhw -hw $xsa_file -mem-ranges [list {0x80000000 0xbfffffff} {0x400000000 0x5ffffffff} {0x1000000000 0x7fffffffff}]
25+
26+
#Disable Security gates to view PMU MB target
27+
targets -set -filter {name =~ "PSU"}
28+
mwr 0xffca0038 0x1ff
29+
after 500
30+
31+
#Load and run PMU FW
32+
targets -set -filter {name =~ "MicroBlaze PMU"}
33+
dow $pmufw_file
34+
con
35+
after 500
36+
37+
configparams force-mem-access 1
38+
targets -set -nocase -filter {name =~"APU*"}
39+
set mode [expr [mrd -value 0xFF5E0200] & 0xf]
40+
41+
targets -set -nocase -filter {name =~ "*A53*#0"}
42+
rst -processor
43+
dow $fsbl_file
44+
set bp_24_56_fsbl_bp [bpadd -addr &XFsbl_Exit]
45+
con -block -timeout 60
46+
bpremove $bp_24_56_fsbl_bp
47+
targets -set -nocase -filter {name =~ "*A53*#0"}
48+
rst -processor
49+
50+
dow $elf_file
51+
52+
configparams force-mem-access 0
53+
54+
targets -set -nocase -filter {name =~ "*A53*#0"}
55+
con

0 commit comments

Comments
 (0)