I am been having some trouble with FSBL in PetaLinux. The fsbl doesn’t do anything and I don’t get any errors on terminal. The fsbl should at least print something to show that its being executed and there is no error in hardware or SD-Card or power supply. In this post we will have a look at how to enable debug messages in FSBL using PetaLinux SDK or Yocto.
You can watch the video tutorial below and/or read further down below to learn how to do it.
FSBL source code rely on -DFSBL_DEBUG compiler flag to enable debug messages. So we have somehow enable this. To enable there is actually no need to change any of the FSBL source files or header files to include the FSBL compilation flags. Compilation flags can be added using the procedure shown below and in the companion video tutorial.
mkdir -p <plnx-proj-root>/project-spec/meta-user/recipes-bsp/fsbl
nano <plnx-proj-root>/project-spec/meta-user/recipes-bsp/fsbl/fsbl_%.bbappend
Now we can add the flags to this file as shown below.
#Enable appropriate FSBL debug flags
YAML_COMPILER_FLAGS_append = " -DFSBL_DEBUG"
Here we are only enabling FSBL_DEBUG flag. You can add others here as well. For more detailed study refer to Zynq 7000 Software Developers Guide page 34. Below is the table from the same document for quick reference.

Now in order for our changes to take effect, we need to first clean it properly with the help of Mr Proper, remove plnx_workspace and then build it. The commands are:
petalinux-build -x mrproper
rm -rf <plnx-proj-root>/components/plnx_workspace
petalinux-build
Now you can find the newly compiled fsbl in your images/linux directory. Now use the following command to make the BOOT.BIN file.
petalinux-package --boot --fsbl images/linux/zynq_fsbl.elf --fpga images/linux/<fpga>.bit --u-boot
Now copy the generated BOOT.BIN to the FAT partition of your SDCard and boot the board(ZedBoard for me) in SD-card boot mode. Look to learn how to format SD-Card for SD-card boot.
