Last active
November 16, 2024 06:38
-
-
Save lesterlo/6117e223d4177fe22a84f0783a9d0f17 to your computer and use it in GitHub Desktop.
Replacement of "petalinux-boot jtag --prebuilt 3 --hw_server-url "
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mv ./build/xsct/Vitis/2024.1/bin/unwrapped/lnx64.o/rlwrap ./build/xsct/Vitis/2024.1/bin/unwrapped/lnx64.o/rlwrap.old; | |
ln -s /usr/bin/rlwrap ./build/xsct/Vitis/2024.1/bin/unwrapped/lnx64.o/rlwrap; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
./build/xsct/Vitis/2024.1/bin/xsct ./load.tcl <IP> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Develop by Lester Lo | |
# Replacement of "petalinux-boot jtag --prebuilt 3 --hw_server-url" command | |
# Boot the linux with your yocto meta-xilinx layer build | |
# Reference from https://gist.github.com/imrickysu/b911be34cf7fffc1b9259610095973fd | |
# Reference from P.153, https://www.xilinx.com/support/documents/sw_manuals/xilinx2022_2/ug1137-zynq-ultrascale-mpsoc-swdev.pdf | |
if { [llength $argv] > 0 } { | |
set HW_IP [lindex $argv 0] | |
} else { | |
set HW_IP "127.0.0.1" ;# Default IP | |
} | |
# set the parameter | |
set MACHINE_CONF_NAME zub | |
set MACHINE_PATH_NAME zub_zynqmp | |
# set the file path | |
# For yocto-manifest | |
set FPGA_BIT_FILE_PATH build/tmp/work/$MACHINE_PATH_NAME-xilinx-linux/bitstream-extraction/git-r0/image/boot/bitstream/download-$MACHINE_CONF_NAME.bit | |
# For native yocto, scarthgap | |
#set FPGA_BIT_FILE_PATH build/tmp/work/$MACHINE_PATH_NAME-linux/bitstream-extraction/git/deploy-bitstream-extraction/download-$MACHINE_CONF_NAME.bit | |
set PMU_PATH build/tmp/deploy/images/$MACHINE_CONF_NAME/pmu-firmware-$MACHINE_CONF_NAME.elf | |
# set CORE_R5_PATH path/to/r5.elf | |
set FSBL_PATH build/tmp/deploy/images/$MACHINE_CONF_NAME/fsbl-$MACHINE_CONF_NAME.elf | |
set DTB_PATH build/tmp/deploy/images/$MACHINE_CONF_NAME/system.dtb | |
set UBOOT_PATH build/tmp/deploy/images/$MACHINE_CONF_NAME/u-boot-$MACHINE_CONF_NAME.elf | |
set KERNEL_PATH build/tmp/deploy/images/$MACHINE_CONF_NAME/Image | |
# For yocto-manifest | |
set ROOTFS_PATH build/tmp/deploy/images/$MACHINE_CONF_NAME/petalinux-image-minimal-$MACHINE_CONF_NAME.cpio.gz.u-boot | |
# For native yocto, scarthgap | |
set ROOTFS_PATH build/tmp/deploy/images/$MACHINE_CONF_NAME/core-image-minimal-$MACHINE_CONF_NAME.rootfs.cpio | |
set BOOT_SCR_PATH build/tmp/deploy/images/$MACHINE_CONF_NAME/boot.scr | |
# For yocto-manifest | |
set BL31_PATH build/tmp/work/$MACHINE_PATH_NAME-xilinx-linux/arm-trusted-firmware/2.10-xilinx-v2024.1+gitAUTOINC+4f82b6134e-r0/build/zynqmp/release/bl31/bl31.elf | |
# For native yocto, scarthgap | |
set BL31_PATH build/tmp/work/$MACHINE_PATH_NAME-linux/arm-trusted-firmware/2.10-xilinx-v2024.1+git/build/zynqmp/release/bl31/bl31.elf | |
# Start the procedure | |
puts "Start the loading procedure" | |
# Connect to hw_server | |
connect -url tcp:$HW_IP:3121 | |
# --------------------------- PL(FPGA) Zone -------------------------------------- | |
puts "Switch to PL (FPGA)" | |
targets -set -filter {name =~ "*PL*"} | |
after 500 | |
# Download FPGA bitstream | |
puts "Downloading FPGA bitstream" | |
fpga -file $FPGA_BIT_FILE_PATH | |
after 5000 | |
# --------------------------- PSU Zone -------------------------------------- | |
puts "Switch to PSU" | |
targets -set -nocase -filter {name =~ "*PSU*"} | |
# This disables JTAGsecurity gates for DAP, PLTAP and PMU. | |
puts "Disabling JTAGsecurity gates" | |
mwr 0xFFCA0038 0x1FF | |
after 500 | |
# --------------------------- PMU Zone -------------------------------------- | |
puts "Switch to PMU" | |
targets -set -filter {name =~ "MicroBlaze PMU"} | |
after 500 | |
# Download PMUFW to PMU | |
puts "Downloading PMU firmware" | |
dow $PMU_PATH | |
after 2000 | |
con | |
after 500 | |
# --------------------------- RPU Zone -------------------------------------- | |
# after 500 | |
# puts "Switch to RPU" | |
# targets -set -filter {name =~ "Cortex-R5 #0"} | |
# rst -processor | |
# after 2000 | |
# Download Realtime core firmware | |
# puts "Downloading core R5 firmware" | |
# dow $CORE_R5_PATH | |
# after 500 | |
# --------------------------- APU Zone -------------------------------------- | |
puts "Switch to APU" | |
targets -set -filter {name =~ "Cortex-A53 #0"} | |
after 500 | |
# Download FSBL | |
puts "Reset A53 processor" | |
rst -processor | |
puts "Downloading FSBL" | |
dow $FSBL_PATH | |
after 2000 | |
con | |
after 5000 | |
puts "stop FSBL" | |
stop | |
after 2000 | |
# Load system.dtb (device Tree) | |
puts "Loading FPGA system.dtb" | |
dow -data $DTB_PATH 0x100000 | |
after 2000 | |
# Download U-boot | |
puts "Downloading U-boot" | |
dow $UBOOT_PATH | |
after 2000 | |
# Load Kernel | |
puts "Load the kernel" | |
dow -data $KERNEL_PATH 0x200000 | |
after 2000 | |
# Load root file system | |
puts "Load the root file system" | |
dow -data $ROOTFS_PATH 0x4000000 | |
after 2000 | |
# Load boot.scr | |
puts "Load the boot.scr" | |
dow -data $BOOT_SCR_PATH 0x20000000 | |
after 2000 | |
# Download bl31.elf, "Boot Loader Stage 3.1" (BL31) in the ARM Trusted Firmware (ATF) boot process. | |
puts "Download the Boot Loader Stage 3.1 firmware" | |
dow $BL31_PATH | |
after 2000 | |
puts "Now start the system" | |
con | |
after 500 | |
puts "Loaded the firmware to target via JTAG" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment