Detecting Failed Boot. march 2025 *** Version 2024.1 *** We build the petalinux project at: $TRAINING_PATH/detectFailedBoot/ZCU104 instead of $TRAINING_PATH/detectFailedBoot/lab/ZCU104 (one level up) 0. Copy Zip file and uncompress in $TRAINING_PATH ------------------------------------------------- *** 1-2. Run a provided Python script. Open a terminal. cd $TRAINING_PATH/detectFailedBoot/support vitis -s detectFailedBoot_builder.py zcu104 1-3-2. Set the workspace.Browse to the following location: $TRAINING_PATH/detectFailedBoot/lab vitis -w $TRAINING_PATH/detectFailedBoot/lab 1-4. Open xpfw_config.h in the editor. 1-6. Add symbols PMU firmware. 1-6-1. . Enter UserConfig.cmake Add Symbols (-D) ENABLE_EM ENABLE_RECOVERY ENABLE_SCHEDULER 1-7-2. Locate the line starting with [EM_ERR_ID_FPD_SWDT]. 1-8. Change the default timeout value to an unreasonably small value. This is done so that the booting process cannot possibly complete, thus guaranteeing failure. This will ensure a watchdog timer timeout interrupt and invoke the recovery behavior from the PMU firmware. 1-8-1. Open xpfw_restart.c. 1-8-2. Press replace the occurrences of "XPMU_XTTCPS_9" with "XPMU_XTTCPS_0". 1-8-6. Mmodify the UserConfig.cmake file by adding the following symbol: RECOVERY_TIMEOUT=10 ------------------------------------------------- 2. Creating the Linux Image for Enabling the Watchdog Timer Features source $PETALINUX_PATH/settings.sh source /opt/amd/PetaLinux/2024.1/tool/settings.sh 2-3. Use the petalinux-create cd $TRAINING_PATH/detectFailedBoot/ petalinux-create -t project --name ZCU104 --template zynqMP 2-4. Import the hardware configuration. cd ZCU104 petalinux-config --get-hw-description=$TRAINING_PATH/detectFailedBoot/support/UED_failedBoot.xsa --silentconfig 2-5. Configure the Linux kernel. petalinux-config -c kernel 2-5-2. Verify whether the WDT driver is enabled Device Drivers (1) > Watchdog Timer Support (2) - Watchdog Timer Support is about 37 entries down from the top. - descend into the Watchdog Timer Support menu (3). - Verify that Cadence Watchdog Timer is enabled (4). 2-6. Modify the system-user.dtsi file to make the FPD WDT available to Linux. cd $TRAINING_PATH/detectFailedBoot/ZCU104 gedit project-spec/meta-user/recipes-bsp/device-tree/files/system-user.dtsi Add the code: &watchdog0 { status = "okay"; reset-on-timeout; timeout-sec = <60>; }; ------------------------------------------------- 2-7. Include the feedthewatchdog.c application in the Linux image. cd $TRAINING_PATH/detectFailedBoot/lab/ZCU104 petalinux-create -t apps --name feedthewatchdog --enable source $TRAINING_PATH/detectFailedBoot/support/IncludeApp.sh 2-8. Configure the rootfs (glibc libraries on which the application is dependent). petalinux-config -c rootfs Filesystem Packages (1) > misc (2) > glibc (3) to enable the glibc library and its components. ------------------------- - Optional (recomended): petalinux-conf -c rootfs image-features -> serial-autologin-root image-features -> debug-tweeks add user electra:electra Petalinux RootFS settings -> Add Extra user add electra to sudoers petalinux-conf - Fix IP. subsystem AUTO HW settings (leave defaul 192.168.0.10) - for network support: DTG settings ->(template) Machine Name, change to zcu104-revc -Firmware version configuration. change hostname and product name to electra ------------------------- 2-10. Build the Linux image. petalinux-build ------------------------------------------------- 2-11.[Optional] Use the prebuilt Linux image. source $TRAINING_PATH/detectFailedBoot/support/tenSecTimeoutSetup.sh ------------------------------------------------- 3 - Putting It All Together 3-1. Add all the output images to the SD card. • First Stage Boot Loader (zynqmp_fsbl) • Second Stage Boot Loader (u-boot) • Customized PMU firmware (pmu_fw) [from the Vitis Unified IDE's boot project] • Arm® Trusted Firmware (bl31) • Booting script for U-boot (boot.scr) • Linux image, rootfs, dtb, and applications (image.ub), which is created by mkimage and is part of the PetaLinux tool set • Illustrative bitstream for the target board (system.bit) cd $TRAINING_PATH/detectFailedBoot/lab/ZCU104 3-1-2. Copy the customized PMU ELF file from the Vitis platform. [Using the image you built yourself]: cp $TRAINING_PATH/detectFailedBoot/lab/detectFailedBoot_plat/export/detectFailedBoot_plat/sw/boot/pmufw.elf $TRAINING_PATH/detectFailedBoot/ZCU104/images/linux [Using the prebuilt image]: cp $TRAINING_PATH/detectFailedBoot/lab/detectFailedBoot_plat/export/detectFailedBoot_plat/sw/boot/pmufw.elf $TRAINING_PATH/detectFailedBoot/ZCU104/pre-built/images/linux 3-1-3. create the BOOT.BIN image: source $TRAINING_PATH/detectFailedBoot/support/packageAll.sh The script will ask if you want to use the prebuilt or your "homemade" PetaLinux image. It will then create the products needed for a bootable SD card. Answer 'y' if you are using the prebuilt image or 'n' if you are using the image you built yourself. --------------------------------------------------------------- . Enter UserConfig.cmake Update RECOVERY_TIMEOUT=60 if you close petalinux source /opt/amd/PetaLinux/2024.1/tool/settings.sh 4-6. Recreate BOOT.BIN cd $TRAINING_PATH/detectFailedBoot/lab/ZCU104 4-6-2. Copy the updated PMU ELF file [Using the image you built yourself]: sudo cp $TRAINING_PATH/detectFailedBoot/lab/detectFailedBoot_plat/export/detectFailedBoot_plat/sw/boot/pmufw.elf $TRAINING_PATH/detectFailedBoot/ZCU104/images/linux [Using the prebuilt image]: sudo cp $TRAINING_PATH/detectFailedBoot/lab/detectFailedBoot_plat/export/detectFailedBoot_plat/sw/boot/pmufw.elf $TRAINING_PATH/detectFailedBoot/ZCU104/pre-built/images/linux 4-6-3. Re-create the BOOT.BIN image: source $TRAINING_PATH/detectFailedBoot/support/packageAll.sh #run the system feedthewatchdog while true; do printf '%s\r' "$(date)"; done