Debugging FSBL Using the Vitis Debugger¶
Creating First Stage Boot Loader for Arm Cortex-A53-Based APU¶
FSBL can load the required application or data to memory and launch applications on the target CPU core. One FSBL has been provided in the platform project but you can create an additional FSBL application as a general application for further modification or debugging purposes.
In this example, you will create an FSBL image targeted for Arm™ Cortex-A53 core 0.
Launch the Vitis IDE if it is not already open.
Set the workspace path based on the project you created in Zynq UltraScale+ MPSoC Processing System Configuration. For example,
C:\\edt
.Select File → New → Application Project. The New Project dialog box opens.
Use the information in the following table to make your selections in the New Project wizard:
Screen | System Properties | Settings |
---|---|---|
Platform | Select platform from repository | edt_zcu102_wrapper |
Application project details | Application project name | fsbl_a53 |
System project name | fsbl_a53_system | |
Target processor | psu_cortexa53_0 | |
Domain | Domain | standalone on |
psu_cortexa53_0 | ||
Templates | Available templates | Zynq MP FSBL |
In the Templates page, select Zynq MP FSBL.
Click Finish.
The Vitis IDE creates the system project and the FSBL application.
By default, the FSBL is configured to show basic print messages. Next, you will modify the FSBL build settings to enable debug prints. For a list of the possible debug options for FSBL, refer to the
fsbl_a53/src/xfsbl_debug.h
file.
For this example, enable FSBL_DEBUG_INFO by doing the following:
In the Explorer view, right-click the fsbl_a53 application.
Click C/C++ Build Settings.
Select Settings → ARM V8 gcc compiler → Symbols.
Click the Add button.
Enter FSBL_DEBUG_INFO.
The symbols settings are as shown in the following figure.
Click OK to accept the changes and close the Settings view.
Navigate to the BSP settings. Under Overview → Drivers → psu_cortexa53_0 → extra_compiler_flags, edit extra_compiler_flags to append -Os -flto -ffat-lto- objects.
Right-click the fsbl_a53 application and select Build Project.
The FSBL executable is now saved as
fsbl_a53/debug/fsbl_a53.elf
.In this tutorial, the application name
fsbl_a53
is to identify that the FSBL is targeted for the APU (the Arm Cortex-A53 core).Note: If the system design demands, the FSBL can be targeted to run on the RPU.
Debugging FSBL Using the Vitis Debugger¶
The FSBL is built with size optimization and link time optimization flags, that is -Os and LTO optimizations by default in the Vitis debugger. This reduces the memory footprint of FSBL. This needs to be disabled for debugging FSBL.
Removing optimization can lead to increased code size, resulting in
failure to build the FSBL. To disable the optimization (for
debugging), some FSBL features that are not required need to be
disabled in the xfsbl_config.h
file of the FSBL.
Now, create a new FSBL for this section instead of modifying the FSBL created in the Build Software for PS Subsystems. This is to avoid disturbing the FSBL_a53 project, which will be used extensively in rest of the chapters in this tutorial.
Create and Modify FSBL¶
Use the following steps to create an FSBL project.
Launch the Vitis debugger if it is not already open.
Set the Workspace path based on the project you created in Build Software for PS Subsystems. For example, C:\edt.
Select File→ New → Application Project. The New Project dialog box opens.
Use the information in the following table to make your selections in the New Project dialog box.
Table 8: Settings to Create FSBL_debug Project
Wizard Screen | System Properties | Settings |
---|---|---|
Platform | Select platform from repository | edt_zcu102_wrapper |
Application project details | Application project name | fsbl_debug |
System project name | fsbl_debug_system | |
Target processor | psu_cortexa53_0 | |
Domain | Domain | psu_cortexa53_0 |
Templates | Available templates | Zynq MP FSBL |
Click Finish.
The Vitis debugger creates the System project and an FSBL application. Now disable Optimizations as shown below.
In the Explorer view, right-click the fsbl_debug application.
Click C/C++ Build Settings.
Select Settings→ Tool Settings page→ Arm v8 gcc Compiler→ Miscellaneous.
Remove
-flto -ffat-lto-objects
from other flags, as shown below.Similarly, the fsbl_debug_bsp needs to be modified to disable optimization.
Right-click fsbl_debug_bsp and select Board Support Package Settings.
Under Overview → Drivers → psu_cortexa53_0 → extra_compiler_flags, edit extra_compiler_flags to ensure extra compiler has this value
-g -Wall -Wextra -Os
as shown below.Click OK, to save these settings. BSP rebuilds automatically after this.
Go to the fsbl_debug→ src → fsbl_config.h file. In the FSBL code include the options and disable the following:
#define FSBL_NAND_EXCLUDE_VAL (1U)
#define FSBL_SECURE_EXCLUDE_VAL (1U)
#define FSBL_SD_EXCLUDE_VAL (1U)
Note: ‘1’ is disable and ‘0’ is enable.
At this point, FSBL is ready to be debugged.
You can either debug the FSBL like any other standalone application (as shown in Debugging Using XSCT, or debug FSBL as a part of a Boot image by using the ‘Attach to running target’ mode of System Debugger.
© Copyright 2017-2021 Xilinx, Inc.
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.