Blog

Enable debug messages in FSBL using PetaLinux SDK or Yocto

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.

Tutorial: Enable FSBL Debug flags

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.

Sources:

The Journey Begins

Thanks for joining me!

I always wanted to start a blog as a thank you to all the Science and Engineering community. Who is constantly helping me learn more and more using blogs, stackoverflow, github/gitlab etc. Sometimes I learn something and it takes a little more effort than it should have been and here on this blog I intend to document those cases so that other people in looking for the same things can find them relatively easy.

This is my first blog and I may have some learning to do. I would really appreciate your constructive criticism. I will try my best to show the correct approaches or solutions but can’t take any responsibility. So follow these guides/tips at your own risk.

Furthermore, I might start doing these blog posts with a video as well which demonstrate how to follow the described steps. I will try to make these videos simple and to the point and the corresponding blog post will server as explanations and will contains more details.

I hope you will like this blog and share it with others.

Cheers.

Waqar Rashid