Zynq-7000 All Programmable Soc Software Developers Guide: Ug821 (V12.0) September 30, 2015
Zynq-7000 All Programmable Soc Software Developers Guide: Ug821 (V12.0) September 30, 2015
Programmable SoC
Software Developers Guide
Chapter 4: Linux
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
Git Server and Gitk Command. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
Linux BSP Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
U-Boot. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
Overview
This document summarizes the software-centric information required for designing with
Xilinx® Zynq®-7000 All Programmable SoC devices. It assumes that you are:
Introduction
The addition of extensibility of the SoC for both hardware and software programmability
imposes new requirements on design flows for both hardware and software.
Certain hardware features are unique to Xilinx, such as hardware co-simulation and
co-debug functionality that make it possible to verify custom logic implemented on
Zynq-7000 AP SoC devices or in a logic simulation environment while applications execute
on a Zynq-7000 AP SoC processor on a physical board or an emulator.
• Vivado Design Suite Tutorial: Embedded Processor Hardware Design (UG940) [Ref 6]
• Vivado Design Suite User Guide: Embedded Processor Hardware Design (UG898) [Ref 5]
• Vivado Design Suite Tutorial: Zynq-7000 All Programmable SoC Embedded Design
(UG1165) [Ref 16]
VIDEO: See Enabling Smarter Systems for quick-take videos on the Zynq-7000 AP SoC devices.
Architectural Decisions
You must make several architectural decisions before beginning embedded development
on applications to run on the Zynq-7000 AP SoC.
Because the Zynq-7000 AP SoC devices have dual-core ARM Cortex™-A9 processors, you
must determine whether to use Asymmetric Multiprocessing (AMP) or Symmetric
Multiprocessing (SMP).
The same decision must be made for all embedded software projects: which operating
system(s) to use (if any). This introduction defines both AMP and SMP, and provides an
assessment of the trade-offs and concerns with each method.
Multiprocessing Considerations
The following subsections describe the two multiprocessing considerations.
Asymmetric Multiprocessing
Asymmetric multiprocessing (AMP) is a processing model in which each processor in a
multiple-processor system executes a different operating system image while sharing the
same physical memory. Each image can be of the same operating system, but more
typically, each image is a different operating system, complementing the other OS with
different characteristics:
• A full-featured operating system, such as Linux, lets you connect to the outside world
through networking and user interfaces.
• A smaller, light-weight operating system can be more efficient with respect to memory
and real-time operations.
A typical example is running Linux as the primary operating system along with a smaller,
light-weight operating system, such as FreeRTOS or a bare-metal system, which is described
in Chapter 4, Linux, as the secondary operating system.
The division of system devices (such as the UART, timer-counter, and Ethernet) between the
processors is a critical element in system design. In general:
Communication between processors is a key element that allows both operating systems to
be effective. It can be achieved in many different ways, including inter-processor interrupts,
shared memory, and message passing.
Symmetric Multiprocessing
Symmetric multiprocessing (SMP) is a processing model in which each processor in a
multiple-processor system executes a single operating system image. The scheduler of the
operating system is responsible for scheduling processes on each processor.
This is an efficient processing model when the selected single operating system meets the
system requirements. The operating system uses the processing power of multiple
processors automatically and is consequently transparent to the end user. Programmers
can:
It is a full-featured operating system that takes advantage of the memory management unit
(MMU) in the processor, and is consequently regarded as a protected operating system.
Linux also provides SMP capabilities to take advantage of multiple processors.
For a detailed list of operating systems supported on Zynq-7000 devices from Xilinx
partners, see the Zynq-7000 Ecosystem page.
Introduction
The Zynq®-7000 All Programmable (AP) SoC software application development flows let
you create software applications using a unified set of Xilinx ® tools, and leverage a broad
range of tools offered by third-party vendors for the ARM ® Cortex™-A9 processors.
This chapter focuses on Xilinx tools and flows; however, the concepts are generally
applicable to third party tools, and the Zynq-7000 AP SoC device solutions incorporate
familiar components such as an Eclipse-based integrated development environment (IDE)
and the GNU compiler toolchain.
This chapter also provides an overview of bare-metal and Linux software application
development flows using Xilinx tools, which mirror support available for other Xilinx
embedded processors, with differences as noted. This chapter also references boot, device
configuration, and OS usage within the context of application development flows. Those
topics are covered in-depth in other chapters and references to other material.
The following figure shows a block diagram of the Zynq-7000 AP SoC device processor.
X-Ref Target - Figure 2-1
$3
,2
3URFHVVLQJ6\VWHP
3HULSKHUDOV &ORFN $SSOLFDWLRQ3URFHVVRU8QLW
86% 5HVHW :'7
*HQHUDWLRQ
27* )38DQG1(21(QJLQH )38DQG1(21(QJLQH
86% 86% 77&
27*
$50&RUWH[$ $50&RUWH[$
,23 008 008
*LJD( *LJ( 6\VWHP &38 &38
0DVWHU
*LJD( 6' ,QWHUFRQQHFW /HYHO .% .% .% .%
6' &RQWURO ,&DFKH '&DFKH ,&DFKH '&DFKH
6',2 5HJV
6' ,54 6QRRS&RQWUROOHU8QLW
6',2 *,&
0,2(0,2
;
The addition of hardware programmability to the hardware and software interface imposes
new requirements on design flows. Certain hardware features are unique to Xilinx, such as
hardware co-simulation and co-debug functionality that make it possible to verify custom
logic implemented on Zynq-7000 AP SoC devices or in a logic simulation environment while
applications execute on a Zynq-7000 AP SoC device processor on a physical board or an
emulator.
Xilinx provides design tools for developing and debugging software applications for
Zynq-7000 AP SoC devices, that include:
• Software IDE
• GNU-based compiler toolchain
• JTAG debugger
• Associated utilities
Custom logic and user software can run various combinations of physical hardware or
simulation, with the ability to monitor hardware events. For example:
Software solutions are also available from third-party sources that support Cortex-A9
processors, including, but not limited, to:
• Software IDEs
• Compiler toolchains
• Debug and trace tools
• Embedded OS and software libraries
• Simulators
• Models and virtual prototyping tools
Third party tool solutions vary in the level of integration and direct support for Zynq-7000
AP SoC devices. Xilinx does not provide tools that target Kernel development and debug,
but those tools can be obtained from third party vendors.
The following subsections provide a summary of the available Xilinx development tools.
Tools are available on 32- and 64-bit Windows and x86 Linux host computing platforms.
The Vivado Design Suite IP integrator provides a block diagram for the Zynq-7000 AP SoC
wherein you can set Programmable Logic (PL) information in an XML file, INIT files
(.h,.c, and .tcl), which are then used by software design tools to create and configure
Board Support Package (BSP) libraries, infer compiler options, define JTAG settings, and
automate other operations that require information about the hardware.
• Vivado Design User Guide: Embedded Processor Hardware Design (UG898) [Ref 5]
• Vivado Design Suite Tutorial: Embedded Processor Hardware Design (UG940) [Ref 6]
• Vivado Design Suite User Guide: Using the Vivado IDE (UG893) [Ref 7]
• Vivado Design Suite User Guide: Designing IP Subsystems Using IP Integrator (UG994)
[Ref 8]
SDK Availability
SDK is available as a download with the Vivado Design Suite, and as a standalone
application. SDK also includes an application template for creating a First Stage Bootloader
(FSBL), as well as a graphical interface for building a boot image.
SDK contains a complete help system that describes concepts, tasks, and reference
information. See the Xilinx Software Development Kit Help (UG782) [Ref 14], for more
information.
You can launch SDK from Vivado when you export a hardware definition, as shown in
Figure 2-2.
X-Ref Target - Figure 2-2
See the following links for more information regarding SPM [Ref 15]:
• “Chapter 3” in the Xilinx Software Development Kit (SDK): System Performance (UG1145)
• “Chapter 5” in the Xilinx Software Development Kit (SDK): System Performance (UG1145)
Also, see System Performance Analysis of an All Programmable SoC (XAPP1219) [Ref 17].
The Xilinx Sourcery CodeBench Lite toolchain in SDK contains the same GNU tools, libraries
and documentation as the standard Sourcery CodeBench Lite Edition EABI and Linux compiler
toolchains, but adds the following enhancements:
Analysis Tools
Vivado Lab Tool
The Vivado IDE has integrated debugging capability. See Vivado Design Suite User Guide:
Programming and Debugging (UG908) [Ref 11] for more information.
System Generator supports rapid simulation of the DSP hardware, reducing overall
development time, and automates the generation of co-processors that can be connected
to the PS. The SDK co-debug feature lets you run and debug programs running on the
processor in SDK, while retaining visibility and control over the hardware under
development in System Generator.
IMPORTANT: The direct hardware interface does not add additional overhead to the device driver
function call overhead, as it is typically implemented as a set of manifest constants and macros.
I
X-Ref Target - Figure 2-3
%XAMPLE !PPLICATIONS 5SER !PPLICATION
LIBXILA /PTIONAL ,AYER 24/3 !DAPTER
,IBRARIES ,AYER $EVICE $RIVER
$IRECT (ARDWARE )NTERFACE
8ILINX /FFERING IN 3$+
8
5SER $ESIGN
Adapters typically:
• Communicate directly to the RTOS as well as the Layer 1 interface of the device driver
• Reference functions and identifiers specific to the RTOS. This layer is therefore not
portable across operating systems
• Can use memory management
• Can use RTOS services such as threading and inter-task communication
• Can be simple or complex depending upon the RTOS interface and requirements for
the device driver
Xilinx embedded design tools create a set of hardware platform data files that include:
The bare-metal Board Support Package (BSP) is a collection of libraries and drivers that
form the lowest layer of your application.
Using the hardware platform data and bare-metal BSP, you can develop, debug, and deploy
bare-metal applications using SDK.
(ARDWARE
03
3PECIFICATION
#ONFIGURATION 8ILINX 3$+ "30 -IDDLEWARE
&ILE 8-,
8ILINX
(ARDWARE
'.5 %MBEDDED
(ANDOFF
%CLIPSE ## #OMPILER 3OFTWARE
$EBUGGER
)$% 4OOLKIT 4OOL
0, "2!- #HAIN
#ONFIGURATION #ONFIGURATION $RIVERS !PPLICATIONS
BITSTREAM "--
)MPORT (ARDWARE 0LATFORM 2UN 4HE !PPLICATION
"UILD !PPLICATION $EPLOY !PPLICATION
#ONFIGURE 03 AND 0,
8
The following subsections summarize these SDK development flow steps. See the SDK
online help, for more details and examples of SDK tool usage.
The application generator is invoked by the Xilinx C or C++ Application wizard. You can
either create an empty application or import existing applications to port to the bare-metal
BSP. Each application project is associated with a BSP project.
Code development tools include editors, search, refactoring, and features available in the
base Eclipse platform and CDT plug-in.
For automatically managed projects, SDK updates the makefile as needed when source
files are added or removed, source files are compiled when changes are saved and the ELF
is built automatically; in Eclipse CDT terminology, the application project is a managed
make project.
Where possible, SDK infers or sets default build options based on the hardware platform
and BSP used, including compiler, linker, and library path options.
Bitstream (BIT) and block memory map (BMM) data are downloaded to the Zynq-7000 AP
SoC to load any custom design logic into the PL, but this step can be omitted when running
applications that require only the PS.
Create an SDK configuration run to download and run the application ELF file. A terminal
view is available to interact with the application using STDIN and STDOUT.
By specifying the path to a software repository containing custom drivers and metadata,
SDK can also include them in the bare-metal BSP.
You can also create library projects to manage and build custom driver source files, and
build their applications using library projects together with the bare-metal BSP.
As the Hardware platform changes you might want to configure the custom IP driver. To
customize the software drivers, a Microprocessor Driver Definition (MDD) file along with a
Tcl file is used.
The driver parameters to be configured are specified in the MDD file. The procedure to
generate the .h or .c files is present in the Tcl file. For more information, see the
Generating Software Platforms Reference Guide, (UG1138) [Ref 4].
For more information about boot image format, see Chapter 3, Boot and Configuration.
Xilinx embedded design tools create a set of hardware platform data files that include:
Linux is an open-source operating system. The Xilinx open source solution includes support
for a single processor and Symmetric Multiprocessing (SMP). XIlinx provides drivers for the
peripherals in the Processor System (PS). (You can add drivers for custom logic in the PL.)
See the Standalone BSP (UG652) that is included in the OS and Libraries Document
Collection (UG643) [Ref 3]. See this document for information about the Bare-Metal BSP.
See Chapter 4, Linux for a description of the Linux the U-Boot bootloader, and see the links
[Ref ] to the Xilinx Open Source Wiki that provide more information.
Using the hardware platform data and Linux Kernel, programmers can develop, debug and
deploy Linux user applications with the Xilinx Software Development Kit (SDK). SDK does
not support Linux Kernel debug. Linux Kernel configuration and build processes are not
discussed in this section.
1. Booting Linux
2. Creating an Application Project
3. Building the Application Project
4. Running the Application
5. Debugging the Application
6. Adding Driver Support for Custom IP in the PL
7. Profiling the Application
8. Adding Application to Linux File System
9. Modifying the Linux BSP (Kernel or File System)
The flowchart in Figure 2-5 provides an overview of the flow for Linux application
development.
X-Ref Target - Figure 2-5
(ARDWARE
03
3PECIFICATION
#ONFIGURATION 8ILINX 3$+ "30 -IDDLEWARE
&ILE 8-,
8ILINX
(ARDWARE
'.5 %MBEDDED
(ANDOFF
%CLIPSE ## #OMPILER 3OFTWARE
$EBUGGER
)$% 4OOLKIT 4OOL
0, "2!- #HAIN
#ONFIGURATION #ONFIGURATION $RIVERS !PPLICATIONS
BITSTREAM "--
)MPORT (ARDWARE 0LATFORM $EBUG 4HE !PPLICATION
"OOT ,INUX !DD #USTOM )0 $RIVER 3UPPORT
#REATE ,INUX !PPLICATION 0ROFILE !PPLICATION
"UILD !PPLICATION !DD !PPLICATION TO &ILESYSTEM
2UN 4HE !PPLICATION -ODIFY ,INUX "30
8
The following subsections describe the steps in this flow. See the SDK Help [Ref 14], for
more details and examples of SDK tool usage.
Booting Linux
You can boot Linux in multiple ways, depending on your preferred work flow:
• Program the boot image into flash and power up or reset the board
• Download and run the FSBL, followed by the U-Boot and then the Linux Kernel
• Use U-Boot to load and run images
With Linux running on the Zynq-7000 AP SoC, SDK can treat the PS platform as a remote
Linux host, with functionality that varies depending on the components included in the file
system.
Flash memory offsets differ for NAND, NOR, and Quad-SPI. Partitions can include FSBL,
U-boot, linux kernel, device tree, RAMdisk, and user application.
During the boot process, FSBL is run to set up the PS, followed by U-Boot, which can be
used to load the Linux Kernel image and boot Linux. The actual boot sequence and flash
image creation process vary depending on the type of flash and other requirements. For
example, the FSBL can be used to configure the PL containing custom logic and it is
possible for a U-Boot image to include the FSBL.
Users can also create an empty application or import existing Linux applications for porting.
Code development tools include editors, search, refactoring and features available in the
base Eclipse platform and CDT plug-in.
SDK provides a Bootgen utility to generate bootable images (.bin and .mcs). You need to
provide all the images and the load addresses to the bootgen tool to create the boot image.
SDK also provides a utility to flash images onto the flash device.
You can also run the application using a command line shell. Use:
This debug perspective should be familiar if you have used Eclipse-based IDEs with the CDT
plug-in, and it includes a debug window showing the state of the session with a call stack,
source viewers, disassembly, memory, register and other views, and the console. You can set
breakpoints and control execution with standard debugger commands.
Additionally, you can add dynamic, loadable drivers. The Linux driver supports these drivers.
See the OS and Libraries Document Collection (UG643) [Ref 3].
Custom IP in the PL are highly configurable, and the device tree parameters define both the
set of IP available in the system and the hardware features enabled in each IP.
See Chapter 4, Linux for additional details on the Linux Kernel and boot sequence.
For profiling all running code in the user application, the Kernel, interrupt handlers, and
other modules, SDK includes an OProfile plug-in that supports visualization of its call
profiling capabilities. OProfile is an open source system-wide profiler for Linux; it
requires a Kernel driver and daemon to collect sample data.
• While Linux is running on the Zynq-7000 AP SoC, you can copy the files using sftp if
the Linux environment includes SSH.
• In SDK, a remote system explorer (RSE) plug-in lets you copy files using drag-and-drop.
• In workflows outside of SDK, add the application and libraries to the file system folder
before creating the file system image and programming it to flash.
Also, see the Xilinx Forums and Wiki Links, page 67 that provide more information.
Additional Information
For additional information related to topics mentioned in this chapter, consult the
references listed in the introduction. For further reading, review the following in the
Zynq-7000 All Programmable SoC Technical Reference Manual (UG585) [Ref 13].
Overview
You can boot or configure Zynq®-7000 All Programmable SoC devices in secure mode
using static memories only (JTAG disabled) or in non-secure mode using either JTAG or
static memories.
• An internal BootROM stores the stage-0 boot code, which configures one of the ARM ®
processors and the necessary peripherals to start fetching the First Stage Bootloader
(FSBL) boot code from one of the boot devices. The programmable logic (PL) is not
configured by the BootROM. The BootROM is not writable.
• The FSBL boot code is typically stored in one of the flash memories, or can be
downloaded through JTAG. BootROM code copies the FSBL boot code from the chosen
flash memory to on-chip memory (OCM). The size of the FSBL loaded into OCM is
limited to 192 kilobyte. The full 256 kilobyte is available after the FSBL begins
executing.
• Another boot mode supported through FSBL is eMMC boot mode. This boot mode is
possible only when the primary boot mode (set through the boot mode pins) is QSPI.
This is used when you have a small QSPI flash and would like to store all the other
partitions on a larger flash memory like eMMC. In this case, place the FSBL on the QSPI
flash, and all the other partitions on eMMC flash.
• The FSBL source code is available from the git server; the link to the git server is listed
in Appendix B. Additional Resources and Legal Notices. You can build the FSBL from a
command line after you have downloaded the source files.
The FSBL boot code is completely under user control and is referred to as user boot code.
This provides you with the flexibility to implement whatever boot code is required for your
system. Xilinx® provides sample FSBL boot code that you can tailor to your own needs.
The FSBL boot code includes initialization code for the peripherals in the processing system
(PS), see the FSBL code provided with SDK for details on the FSBL initialization sequence of
the FSBL. The boot image can contain a bitstream for the programmable logic (PL).
The PL is not required to be configured at this stage, because the PS is fully operational
when the PL is not configured. You can customize the FSBL boot code to use other PS
peripherals such as Ethernet, USB, or STDIO to boot and/or configure the PL.
Note: DDR and SCU are not enabled by the BootROM. See the Zynq-7000 AP SoC Technical
Reference Manual (UG585) [Ref 13] for details.
Boot Modes
The following boot modes are available:
For details on these boot modes, see “Boot and Configuration” in the Zynq-7000 AP SoC
Technical Reference Manual (UG585) [Ref 13].
Boot Stages
Zynq-7000 AP SoC devices support secure and non-secure boot processes, as follows:
Figure 3-1, page 29 shows the flow of FSBL loading in OCM by the BootROM code.
ŽŽƚZKD
zĞƐ
&ŽƵŶĚ /ŶĐƌĞŵĞŶƚƚŽƚŚĞ
EŽ
sĂůŝĚ ŶĞdžƚϯϮ<ŽĨĨƐĞƚ
/ŵĂŐĞ͍ Dh>d/KKdͺZ
zĞƐ
EŽ >ŽĂĚ&^>
y/W͍ ƚŽKD
zĞƐ
:ƵŵƉƚŽƚŚĞ :ƵŵƉƚŽ&^>^ƚĂƌƚ
&ůĂƐŚKĨĨƐĞƚ
yϭϮϱϳϴ
• Initializing with the PS configuration data that Xilinx hardware configuration tools
provide (see Zynq PS Configuration, page 47).
• Programming the PL using a bitstream (if provided).
• Loading second stage bootloader or bare-metal application code into DDR memory.
• Handoff to the second stage bootloader or bare-metal application.
Note: Before handoff to the second stage bootloader or bare-metal application, the FSBL invalidates
the instruction cache and disables the cache and MMU, because U-Boot assumes it is disabled upon
start. See the FSBL code provided with SDK for details on the initialization sequence of the FSBL.
System
Initialization
Boot device
Initialization
Authentication
Enabled ?
No
Yes
No
RSA Verify Partition
Partition Encrypted No
Yes
Route Partition to
Route Partition to AES-HMAC
the destination
Engine and then Destination
Last Partition ?
Yes
PS partition
No JTAG exit
present?
Yes
Handoff to the
PS partition
The bitstream for the PL and the second stage bootloader or bare-metal application data, as
well as other code and data used by the second stage bootloader, Linux (or other operating
system), or bare-metal application are grouped into partitions in the flash image. See
section Boot Image Format, page 48, for a description of how they are organized.
The FSBL traverses the partition header table to find the bitstream and second stage
bootloader or bare-metal application partition. See Appendix A. Using Bootgen, for details.
See Boot Image Creation, page 48, for details on how the boot image containing these
partitions is constructed.
You stitch the FSBL with the bitstream and an application using the Bootgen program. SDK
has a Create Boot Image wizard option, shown in the following figure, to add the partition
images and create a bootable image that you can then flash.
X-Ref Target - Figure 3-3
• The first partition must be the FSBL ELF followed by the bitstream partition and then
the application ELF.
• Bitstream is optional. FSBL does a handoff to the first application in the BIF order.
IMPORTANT: The order within the BIF file is important. Bitstream must be the partition after
FSBL. Bitstream is not mandatory. The bitstream is required only if the PL must be
programmed.
FSBL does not remap the DDR; consequently, DDR that is lower than 1Mb cannot be used.
IMPORTANT: The application ELF must have an execution address of greater than 1Mb.
^ƚĂƌƚ&^>
;ĨƌŽŵKDͿ
D/K͕ůŽĐŬ͕Z/ŶŝƚŝĂůŝnjĂƚŝŽŶ
ĂŶĚĚĞǀŝĐĞŝŶŝƚŝĂůŝnjĂƚŝŽŶ
'ĞƚƚŚĞ
/ŶĐƌĞŵĞŶƚDƵůƚŝƚ
ƉĂƌƚŝƚŝŽŶ ZĞŐŝƐƚĞƌƚŽƚŚĞŶĞdžƚϯϮ<
EŽ
ĂŶĚǀĂůŝĚĂƚĞ KĨĨƐĞƚŝŶ&ůĂƐŚĂŶĚĚŽĂ^ŽĨƚ
ƚŚĞŚĞĂĚĞƌ͍ ZĞƐĞƚ;&ĂůůďĂĐŬͿ
zĞƐ
>ŽĂĚƚŚĞƉĂƌƚŝƚŝŽŶƐĨƌŽŵƚŚĞ
ƐĞůĞĐƚĞĚƚĨůĂƐŚ͘/ĨŝƚƐďŝƚƐƚƌĞĂŵ
ƚŚĞŶƉƌŽŐƌĂŵƚŚĞW>ĂŶĚŝĨŝƚƐ
ĂƉƉůŝĐĂƚŝŽŶƚŚĞŶĐŽƉLJŝƚƚŽZ
ƉƉůŝĐĂƚŝŽŶŚĂŶĚŽĨĨƚŽ
ZůŽĐĂƚŝŽŶ
yϭϯϬϵϮ
Use this option when there is a small QSPI flash and you would like to store all the other
partitions on a larger flash memory like eMMC. In this case, place the FSBL on the QSPI flash
and all the other partitions are on eMMC flash.
1. Create a BSP with the library and set enable_mmc in the SDK options. For more details,
see the library documentation.
2. Enable the MMC_SUPPORT flag through SDK and build FSBL. The FSBL image build
(fsbl.elf) now has eMMC support.
3. Stitch the boot image with FSBL as the only partition (using Bootgen).
4. Place the boot image in the QSPI flash.
5. Stitch an image (using Bootgen) with all the other required partitions (like the bitstream
or the U-Boot) and place it in the eMMC flash.
6. Set the boot mode to QSPI.
7. Power cycle the board.
BootROM comes up, loads the FSBL from QSPI flash to OCM and does a hand-off to FSBL.
FSBL then picks all the other partitions from the eMMC device, loads them to DDR, then
hands over control to the application.
In this case, FSBL ignores the configured primary boot mode (configured through the boot
mode pins on the board) which is QSPI and loads the other partitions from eMMC.
To have FSBL and U-Boot on the QSPI flash, the MMC_SUPPORT flag need not be enabled in
FSBL; however, the U-Boot auto-configuration file must be updated to indicate to U-Boot to
load the rest of the partitions from eMMC flash.
In this case, FSBL loads U-Boot to DDR and hands over the control to U-Boot.
U-Boot handles loading the rest of the partitions from the eMMC flash. The limitation here
is that the partitions present on the eMMC flash cannot be RSA authenticated because
U-Boot does not support RSA authentication.
Note: There is no need to change any of the FSBL source files or header files to include these flags.
X-Ref Target - Figure 3-5
In the secure boot scenario, with the AES key stored in eFUSE, the Fallback scenario is
handled by FSBL without going through a soft reset. See Secure Fallback Flow with BBRAM,
page 39 and Secure Fallback Flow with eFUSE, page 41, and Secure Boot Support, page 46.
For more information about eFUSE, see the LibXil SKey for Zynq-7000 AP SoC Devices in the
SDK Help [Ref 14] and in
<Installation_Directory>\SDK\<version>\data\embeddedsw\lib\sw_servi
ces\<library_name><version>\doc.
• After power on reset (POR), BootROM executes and validates the Image 1 Boot header.
° If there is no corruption, BootROM hands over control to the FSBL, which then loads
the other partitions in the image.
° If there is corruption in the boot header, BootROM does a fallback search to find
the next valid image. In the example shown in Figure 3-6, page 36, BootROM
validates the Image 2 boot header, and, if no corruption, hands over the Image 2 to
FSBL, which processes the rest of the partitions in Image 2.
3RZHURQ5HVHW
%RRW520
$XWKHQWLFDWLRQ'HFU\SWLRQ
)6%/
,PDJH 3DVVHV
8SGDWH,PDJH
268%RRW$SSOLFDWLRQ %RRW520+DQGV
2YHU&RQWURO
&RUUXSWLRQ)DLOXUH
%RRW520SHUIRUPV)DOOEDFN±6HDUFKHV
DQG
)LQGV,PDJH*ROGHQ,PDJH
,PDJH
*ROGHQ,PDJH
)6%/268ERRW$SSOLFDWLRQ
The following figure represents the Flash image format for non-secure cases.
X-Ref Target - Figure 3-7
)6%/,PDJH
8ERRWHOI
26&XVWRPHU$SSV
)6%/,PDJH
8ERRWHOI
26&XVWRPHU$SSV
In the case of non-secure Fallback with RSA authentication enabled, the following actions
occur:
• After POR, BootROM executes and validates the Boot Header in Image 1.
• If there is no corruption in the Boot Header, BootROM hand over control to the FSBL,
which then authenticates the rest of the partitions and loads those partitions.
• If there is corruption in the Boot Header or the FSBL image, BootROM does a fallback
search to find the next valid image. In this example, in Image 2, the BootROM validates
the Image 2 boot header. If the boot header validation is successful, then BootROM
authenticates the FSBL in Image 2 and hands control over to FSBL.
• In this case, when there is corruption in the bitstream, U-Boot, or the OS, FSBL
authentication fails and does fallback by a soft reset of the system and BootROM
locates the golden image.
The following figure shows the Fallback flow for RSA only.
X-Ref Target - Figure 3-8
)DOOEDFN)ORZ±56$2QO\
3RZHURQ5HVHW
%RRW520
$XWKHQWLFDWLRQ)6%/
,PDJH 3DVVHV
8SGDWH,PDJH
268%RRW$SSOLFDWLRQ %RRW520+DQGV
2YHU&RQWURO
&RUUXSWLRQ)DLOXUH
%RRW520SHUIRUPV)DOOEDFN±6HDUFKHV
DQG
)LQGV,PDJH*ROGHQ,PDJH
,PDJH
*ROGHQ,PDJH
)6%/268%RRW$SSOLFDWLRQ
;
The following figure represents the Flash image format for non-secure cases.
X-Ref Target - Figure 3-9
)6%/,PDJH
,PDJH 'HVLJQELW
8SGDWH
8ERRWHOI
26&XVWRPHU$SSV
)6%/,PDJH
8ERRWHOI
26&XVWRPHU$SSV
In the secure Fallback flow using BBRAM, the following actions occur:
• BootROM executes and decrypts the FSBL1 and authenticates if RSA is enabled.
° If the validation is successful, the BootROM hands over the control to FSBL, which
then loads, decrypts, and authenticates (if enabled) the other partitions, then hands
the control to the OS, U-Boot, and/or application.
° If the boot header of Image1 is corrupted, BootROM searches for the Image2,
decrypts the FSBL, and hands off the decryption to FSBL in Image2. Then the FSBL
does any required decryption and authentication (if enabled) of the rest of the
partitions and hands over to the U-Boot, OS, or Standalone application. In this
process, if FSBL finds any image to be corrupted, then it initiates a Fallback.
The following figure shows the secure Fallback flow with BBRAM.
X-Ref Target - Figure 3-10
6HFXUH)DOOEDFN)ORZ
%%5$0
%RRW520
$XWKHQWLFDWLRQ'HFU\SWLRQ
)6%/
,PDJH 3DVVHV
8SGDWH,PDJH
268%RRW$SSOLFDWLRQ %RRW520+DQGV
2YHU&RQWURO
&RUUXSWLRQ)DLOXUH
%RRW520SHUIRUPV)DOOEDFN±6HDUFKHV
DQG
)LQGV,PDJH*ROGHQ,PDJH
,PDJH
*ROGHQ,PDJH
)6%/268%RRW$SSOLFDWLRQ
The following figure shows the Flash partitions for secure boot in BBRAM.
X-Ref Target - Figure 3-11
)ODVKIRU6HFXUH%RRW
%%5$0
)6%/,PDJH
8ERRWHOI
26&XVWRPHU$SSOLFDWLRQV
)6%/,PDJH
8ERRWHOI
26&XVWRPHU$SSOLFDWLRQ
The secure Fallback flow with eFUSE during power on reset (POR) is as follows: In this case
FSBL handles the Fallback without going through a soft reset.
• BootROM executes, decrypts the FSBL* (where *=FSBL Prime), authenticates (if
enabled), and passes control back to the FSBL*.
Note: (FSBL Prime) must be used for Fallback with Authentication.
• The FSBL* then:
° Finds no other partitions; consequently, does a Fallback, searching for the next valid
image.
- Finds Image 2, and validates the boot header of the Image 2.
- If valid, skips over the FSBL in Image2 and processes all the other partitions in
Image 2, then hands over control to the application in Image 2.
• FSBL* to error out with a message to indicate that the Image 2 is corrupt. (FSBL in
Image 1 still controls the files and performs Fallback to search for the next Image.)
• FSBL* searches for loads Image 3, then:
° Skips over the FSBL in Image 3 and processes the rest of the partitions in Image 3.
The following figure shows the secure Fallback flow with eFUSE.
X-Ref Target - Figure 3-12
6HFXUH)DOOEDFN)ORZH)86(
%RRW520
$XWKHQWLFDWLRQ'HFU\SWLRQ)6%/
,PDJH±)6%/
1R3DUWLWLRQVVHDUFKHGIRU,PDJH
)LQGV,PDJH8SGDWH,PDJH
$XWKHQWLFDWHVRSWLRQDO,PDJH
,PDJH 3DVVHV
8SGDWH,PDJH
)6%/268ERRW$SSOLFDWLRQ )6%/
+DQGV
2YHU&RQWURO
&RUUXSWLRQ)DLOXUH
)6%/'RHV)DOOEDFN
6HDUFKHVDQG)LQGV,PDJH*ROGHQ,PDJH
$XWKHQWLFDWHVRSWLRQDO,PDJH
,PDJH 3DVVHV
*ROGHQ,PDJH
)6%/268ERRW$SSOLFDWLRQ )6%/+DQGV2YHU
&RQWURO
Note: The Secure flow for Fallback when the AES keys are stored in the PL eFUSE is different than the
other flows. RSA authentication in optional.
• If the FSBL* (FSBL in Image 1) fails authentication, the BootROM goes into a secure
lockdown; consequently, you must ensure that Image 1 is not corrupted.
• If the boot header of Image 1 is not valid, the BootROM jumps to Image 2 and the FSBL
in Image 2 executes.
RECOMMENDED: It is recommended in secure mode that you configure Watchdog timers for Interrupt
and not SRST. You can route the Watchdog Interrupt to do POR through a GPIO.
RECOMMENDED: In secure fallback with efuse as key source, it is recommended to have same FSBL in
all the images.
The following figure shows the FSBL* partitions for Secure Boot with eFUSE.
X-Ref Target - Figure 3-13
)6%/
,PDJH
,PDJH
1RRWKHUSDUWLWLRQV
)6%/,PDJH
GHVLJQELW
8ERRWHOI
,PDJH 8SGDWH
&XVWRPHU$SS/LQX[
)6%/,PDJH
GHVLJQELW
,PDJH
8ERRWHOI *ROGHQ
&XVWRPHU$SS/LQX[
;
FSBL Multiboot
Multiboot is the scenario where you want to load some other version of FSBL, other than the
one currently executing. For example, you might want to execute a version of FSBL; any
image that performs self test and diagnostics, and then jump to the actual application.
In this scenario, after executing the image which performs the diagnostics you can update
the multiboot register with the sequence number of the load file which contains the actual
application and issue a soft reset.
While the system boots up through the soft reset, the BootROM reads the multiboot
register and jumps to that loadable image instead of the first loadable image.
In the secure boot scenario, with the AES key stored in eFUSE, the Multiboot scenario must
be handled by the user (without going through a soft reset).
Calculate_multiboot API
1. Calculate the page size for the NAND part being used.
2. Calculate the bytes per page for the NAND.
3. Based upon the start address of the boot image, calculate the source block number
which is SourceAddress BytesPerBlock.
4. Calculate the number of bad blocks preceding the source block by checking if each of
the blocks is a good block or a bad block.
LOOP till SourceBlock
Check if the current block is BAD:
IF "Block is BAD" THEN
Increment the bad block count
ENDIF
LOOP END
To effect this mode, the images should have only (FSBL+U-Boot) to fit in the <128Mb
memory. Then, the rest of the partitions, possibly residing in a portion of memory that is
>128Mb, must be handled by U-Boot. In this case, update the zynq_common.h file to add
the commands to load the required partitions. You can find further details on the usage,
along with an example, in the Xilinx Zynq-7000 AP SoC Solution Center [Ref 1].
FSBL Hooks
FSBL hooks provide an easy way to plug-in used defined functions, (for example, initializing
PL IPs after loading a bitstream). The FSBL hook functions are located in the fsbl_hook.c
file.
By using these hook functions you can plug-in any application-specific customized code
into the flow sequence of the FSBL.
After the feature is enabled, FSBL does the DDR initialization required to enable the ECC.
FSBL does not provide support for error handling for the ECC errors; you must account for
error handling within your program.
DDR starts from 1Mb because FSBL does not remap DDR; consequently, the application
program must consider using the DDR from 1Mb. If you need to use a DDR smaller than
1Mb, you must handle the DDR initialization required for supporting ECC.
FSBL operates in the secure mode, based upon what secure features you enable.
If RSA authentication is enabled, the FSBL uses the public key to authenticate the FSBL
before it is decrypted or executed. You can enable the RSA authentication by providing this
as an option to Bootgen while generating the bootable image. Based upon the
configuration provided in the partition header (Authentication/Encryption/Both), the FSBL
performs the required authentication of the image and then the decryption.
predecessor, SHA-1. SHA-2 currently consists of a set of six hash functions with digests that
are 224, 256, 384 or 512 bits.
For more details about RSA authentication, see the Zynq-7000 AP SoC Technical Reference
Manual (UG585) [Ref 13].
Zynq PS Configuration
Using the Zynq-7000 AP SoC configuration interface, the Xilinx hardware configuration tool
generates code for initialization of the DDR, MIO, and SLCR registers. See the SDK Help for
more information regarding the creation of ps7* files.
• ps7_init.c and ps7_init.h, which can be used to initialize CLK, DDR, and MIO. The
initialization performed by the ps7_init.tcl is the same as by the code in
ps7_init.c.
• ps7_init.tcl file, which can be used to initialize CLK, DDR, and MIO. The
initialization performed in the ps7_init.tcl is the same as the initialization
performed by the code in ps7_init.c.
Note: The Tcl file is helpful while debugging an application using XMD. For example, you can run
the ps7_init.tcl file and then can load your application to DDR and debug. There is no need
to run the FSBL in this case.
• ps7_init.html, which describes the initialization data.
When the PCFG_POR_CNT_4K (override) bit in the devcfg is set it cuts down the TPoR for
PL. This bit is set by FSBL when the corresponding checkbox is selected in Vivado PS-PL
configuration. For more details see the Vivado Design Suite User Guide: Embedded Processor
Hardware Design (UG898) [Ref 5].
Note: The Xilinx hardware configuration tools maintain synchronization between the PL bitstream
and this initialization data. It is not advisable to change these settings manually.
The utility is driven by a configuration file known as the Boot Image Format (BIF) file with a
file extension of *.bif.
For advanced authentication flows, Bootgen can be used to output intermediate hash files
that can be signed offline. Otherwise, Bootgen uses the provided private keys to sign the
authentication certificates included in the boot image.
The format of the boot image conforms to a hybrid of hardware and software requirements.
The boot image header is required by the Zynq-7000 AP SoC BootROM loader which loads
a single partition, typically the FSBL. The remainder of the boot image is loaded and
processed by the FSBL.
See Appendix A. Using Bootgen, for more information about the utility.
In this example, Bootgen produces the file myDesignImage.bin that contains the boot
header followed by the data partitions created from the data files described in
myDesign.bif.
• BootROM header
• FSBL image
• One or more partition images
• Unused space, if available
Figure 3-14, page 49 shows the layout of the boot image format.
ŽŽƚ/ŵĂŐĞ,ĞĂĚĞƌ
ZĞŐŝƐƚĞƌ/ŶŝƚŝĂůŝnjĂƚŝŽŶ
/ŵĂŐĞ,ĞĂĚĞƌdĂďůĞ
WĂƌƚŝƚŝŽŶ,ĞĂĚĞƌdĂďůĞ
,ĞĂĚĞƌƵƚŚĞŶƚŝĐĂƚŝŽŶ
;KƉƚŝŽŶĂůͿ
ŶĐƌLJƉƚĞĚ&^>
;^Θ,DͿ
&^>Z^ĂƵƚŚĞŶƚŝĐĂƚŝŽŶ
ĐĞƌƚŝĨŝĐĂƚĞ;KƉƚŝŽŶĂůͿ
WĂƌƚŝƚŝŽŶ
WĂƌƚŝƚŝŽŶZ^ĂƵƚŚĞŶƚŝĐĂƚŝŽŶ
ĐĞƌƚŝĨŝĐĂƚĞ;KƉƚŝŽŶĂůͿ
WĂƌƚŝƚŝŽŶ
WĂƌƚŝƚŝŽŶZ^ĂƵƚŚĞŶƚŝĐĂƚŝŽŶ
ĐĞƌƚŝĨŝĐĂƚĞ;KƉƚŝŽŶĂůͿ
WĂƌƚŝƚŝŽŶ
WĂƌƚŝƚŝŽŶZ^ĂƵƚŚĞŶƚŝĐĂƚŝŽŶ
ĐĞƌƚŝĨŝĐĂƚĞ;KƉƚŝŽŶĂůͿ
Figure 3-14: Zynq-7000 AP SoC Device Processor Secure Boot Image Format
Authentication Certificate
The Authentication Certificate is appended to the end of each authenticated partition. An
optional header Authentication Certificate can appear after all of the Image header and
Partition Headers, which authenticates the contents of these headers.
All integers are stored in little-endian order, including the 2048 bit modulus.
Table 3-2 lists the Offset, Size, Field, and Description for Authentication Certificate.
To reduce overhead on the FSBL, Bootgen precalculates the modulus extenstion which is
used in the Montgomery reduction for modular exponentiation. These values are stored in
the certificate after the modulus fields. Table 3-3 shows the authentication certificate bits,
field, and values.
The following figure shows an example of the Zynq-7000 AP SoC Linux boot image
partitions.
X-Ref Target - Figure 3-15
&^> WĂƌƚŝƚŝŽŶ
ŝƚƐƚƌĞĂŵWĂƌƚŝƚŝŽŶ
hͲŽŽƚWĂƌƚŝƚŝŽŶ
>ŝŶƵdžnj/ŵĂŐĞWĂƌƚŝƚŝŽŶ
>ŝŶƵdžĞǀŝĐĞ dƌĞĞWĂƌƚŝƚŝŽŶ
>ŝŶƵdžŝƐŬ/ŵĂŐĞWĂƌƚŝƚŝŽŶ
Linux
Introduction
Xilinx® Zynq®-7000 AP SoC Linux is based upon open source software (the Kernel from
kernel.org). Xilinx provides support for Xilinx-specific parts of the Linux Kernel (drivers
and board support packages (BSPs).
Xilinx also supports Linux through the Embedded Linux forum. As with many open source
projects, Xilinx also expects customers to use the open source mailing lists for Linux in areas
that are not specific to Xilinx Zynq-7000 AP SoC.
More information about Xilinx Zynq-7000 AP SoC Linux and other Xilinx open source
projects is available on the Xilinx Zynq-7000 AP SoC Solution Center [Ref 1] or the most
current Linux information.
Xilinx provides a public git server that contains a Linux Kernel, a BSP for Xilinx boards, and
drivers for selected IP, which allows third parties to build embedded Linux distributions for
Xilinx hardware. In essence, the git server also allows companies who have Linux expertise
to develop their own Linux rather than buying a distribution.
• The public Git tree is located at http://git.xilinx.com, along with the directions for how
to snapshot the repository. You can browse the code from the website.
The main branch of the public repository is the master branch. This is considered the most
stable and tested code from Xilinx.
The gitk tool provides a graphical display of a git tree. It can be helpful for exploring the
branches in a tree. It is installed with git, and can be run using gitk from the command line.
Note: The directory containing the Kernel is referred to as a “Kernel tree.” It is assumed that the
reader is familiar with the Linux Kernel directory structure.
The following figure shows a high order Linux Kernel diagram to help visualize how the
different functions relate to the different layers.
X-Ref Target - Figure 4-1
(UMAN
&UNCTIONS 3YSTEM .ETWORKING 3TORAGE -EMORY 0ROCESSING
)NTERFACE
,AYERS
0AGE -EMORY
$EVICE
"RIDGES #ACHE -APPING 3YNCHRONIZATION
-ODEL
.&3 3WAP
3YSTEM 2UN ,OGICAL
0ROTOCOLS ,OGICAL () #LASS
,OGICAL -ODELS 'ENERIC &ILESYSTEMS 3CHEDULER
4#0 5$0 )0 -EMORY $RIVERS
(7 !CCESS EXT EXT
.ETWORK "LOCK ()
(ARDWARE 0AGE )NTERRUPTS
"US $RIVERS $EVICES AND $EVICES AND 0ERIPHERALS
)NTERFACES $RIVERS $RIVERS
!LLOCATOR #ORE
$RIVERS
Drivers
See Xilinx SDK online driver documentation.
U-Boot
Microprocessors can execute code that reside in memory, while operating systems normally
reside in large-capacity devices such as hard disks, CD-ROMs, USB disks, network servers,
and other permanent storage media. When the processor is powered on, the memory does
not contain an operating system, so special software is needed to bring the OS into
memory from the media on which it resides. This software is normally a small piece of code
called the bootloader.
U-Boot is an open source bootloader that is frequently used in the Linux community, and
used by Xilinx for the MicroBlaze™ processor and the Zynq-7000 AP SoC processor for
Linux.
A bootloader initializes hardware that the Linux Kernel does not necessarily initialize (such
as the serial port and DDR). System providers often put U-Boot into flash memory. U-Boot
is an example of a Second Stage Bootloader.
This gives it many useful features, including the ability to load and execute images from
Ethernet, flash memory, SD/MMC, and USB the ability to start a Kernel image from memory,
and the availability of a command interpreter with many commands such as: reading and
writing to/from memory, and network operations, such as the ping command.
• Zynq U-boot
• Zynq Release Notes
Using Bootgen
Introduction
Bootgen is a standalone tool for creating a bootable image suitable for the Zynq®-7000 AP
SoC processor. The program assembles the boot image by prefixing a header block to a list
of partitions. Optionally, you can encrypt the bitstream, each partition and authenticate it
with Bootgen. The output is a single file that can be directly programmed into the boot
flash memory of the system. Other peripheral files can be generated by the tool to support
authentication and encryption as well.
The tool can be integrated into SDK for automatic image generation, or can be used in a
command-line oriented script.
• The name and the {...} grouping brackets the files that are to be made into partitions in
the ROM image. One or more data files are listed in the {...} brackets.
• The type of image data (ELF, BIT, RBT, or INT - data files with the [init] attribute) is
inferred from the file extension, and any special preparations needed are applied based
on the file type.
• Data files can have an optional set of attributes preceding the data file name with the
syntax ["attributes"].
• Attributes apply some quality to the data file.
• Multiple attributes can be listed separated with a “,” as a separator. The order of
multiple attributes is not important. Some attributes are one keyword, some are
keyword equates.
• You can also add a filepath to the file name if the file is not in the current directory.
How you list the files is free form; either all on one line (separated by any white space,
and at least one space), or on separate lines.
• White space is ignored, and can be added for readability.
• You can use C-style block comments of /*...*/, or C++ line comments of //...
the_ROM_image:
{
[init]init_data.int
[bootloader]myDesign.elf
Partition1.bit
Partition1.rbt
Partition2.elf
}
The following example is of a BIF file where partitions are encrypted and authenticated:
image {
[aeskeyfile]secretkey.nky /* this is the key file used for AES */
[pskfile]primarykey.pem /* primary secret key file for authen.*/
[sskfile]secondarykey.pem /* secondary secret key file for authen.*/
[bootloader,authentication=rsa] fsbl.elf /*first stage bootloader */
[authentication=rsa]uboot.elf /* second stage bootloader */
linux.gz /* OS image (compressed)*/
}
The following table lists BIF file attributes and attribute types.
:
Set initialization pairs with a text file that has a.int file extension by default, but can have
any file extension.
The [init] file attribute precedes the file name to identify it as the INIT file in the BIF file.
• an address value
• an = character
• a data value
The line is terminated with a semicolon (;). This is one .set. operation directive; for
example:
.set. 0xE0000018 = 0x00000411; // This is the 9600 uart setting.
Bootgen fills the boot header initialization from the INT file up to the 256 pair limit. When
the BootROM runs, it looks at the address value. If it is not 0xFFFFFFFF, the BootROM uses
the next 32-bit value following the address value to write the value of address. The
BootROM loops through the initialization pairs, setting values, until it encounters a
0xFFFFFFFF address, or it reaches the 256th initialization pair.
The numbers can be hex (0x), octal (0o), or decimal digits. Number expressions are
maintained as 128-bit fixed-point integers. You can add white space around any of the
expression operators for readability.
The preprocessor allows parameterization of BIF and INT files, or BIF and INT files that
contain multiple configurations to be selectable from the command line. It would be
convenient to use an include file with INT files that would allow for symbolic usage instead
of naked values.
For example:
#include "register_defs.h"
Values can also be passed in to be used in BIT or INT files with #if-like directives to select
different configurations.
Encryption Overview
The encryption private key is stored in the eFUSE or block BRAM memory.
This key can be written to the eFUSE/Block RAM memory using the Standalone driver
provided along with SDK. For further details, see the Secure Boot of Zynq-7000 All
Programmable SoC (XAPP1175) [Ref 12].
The BootROM uses the encryption private key to decode the first FSBL partition boot image.
The actual decryption is done by the AES/HMAC engine of the Zynq-7000 AP SoC device
hardware.
To encrypt a partition:
1. Give the –encrypt option on the command line with either efuse or bbram
arguments.
2. List the key file with the [aeskeyfile] attribute in the BIF file.
3. Ensure that the [encryption=aes] attribute is present for each image file listed in the
BIF file that should be encrypted.
The following is an example command line:
Bootgen …. –encrypt efuse
image: {
[aeskeyfile]secretkey.nky
[bootloader,encryption=aes] fsbl.elf
[encryption=aes]uboot.elf
linux.gz
}
Authentication Overview
Zynq-7000 AP SoC device processor RSA authentication uses primary and secondary keys.
the primary keys authenticate the secondary keys. The secondary keys authenticate
partitions.
The first letter of the acronyms used to describe the keys is either P for primary or S for
secondary. The second letter of the acronym used to describe the keys is either P for public
or S for secret. There are four possible keys:
• Supply the PSK and SSK. The SPK signature is calculated on-the-fly using these two
inputs.
• Supply the PPK and SSK and the SPK signature as inputs. This is used in cases where the
PSK is not known.
The primary key is hashed and stored in the eFUSE. This hash is compared against the hash
of the primary key stored in the boot image by the FSBL. This hash can be written to the PS
eFUSE memory using standalone driver provided along with SDK. See the Secure Boot of
Zynq-7000 All Programmable SoC (XAPP1175) [Ref 12] for more details.
image {
[aeskeyfile]secretkey.nky
[pskfile]primarykey.pem
[sskfile]secondarykey.pem
[bootloader,authentication=rsa] fsbl.elf
[authentication=rsa]uboot.elf
linux.gz
}
The image header table does not need to be contiguous, but it is generated contiguously by
bootgen. Each Image header is linked to the next Image header through
NextEntryOffset.
Note: Offsets are specified in word, not byte offsets. To convert, multiply the word offset by 4 to get
the byte offset.
The Image Header Table Header is followed by a sequential list of Image Headers when
generated by Bootgen, although the specification of the boot image can allow the Image
Headers to be scattered throughout the boot image.
0x8 Total Partition Word Length (Includes The total encrypted + padding + expansion
Authentication Certificate) +authentication length.
0x0C Destination Load Address The RAM address into which this partition is
to be loaded.
0x10 Destination Execution Address The executable address of this partition
after loading.
0x14 Data Word Offset in Image The position of the partition data relative to
the start of the boot image.
0x18 Attribute Bits See Table A-6.
0x20 Checksum Word Offset The location of the checksum word in the
boot image.
0x24 Image Header Word Offset The location of the Image Header in the
boot image
0x28 Authentication Certification Word Offset The location of the Authentication
Certification in the boot image.
0x2C unused Must be 0x00000000
Image Header
Table A-7: Image Header
Offset Name Notes
0x0 Word Offset to Next Image Header Link to next Image Header. 0 if last Image
Header.
0x4 Word Offset to First Partition Header Link to first associated PartitionHeader.
0x8 Partition Count Always 0
Xilinx Resources
For support resources such as Answers, Documentation, Downloads, and Forums, see Xilinx
Support.
Solution Centers
See the Xilinx Solution Centers for support on devices, software tools, and intellectual
property at all stages of the design cycle. Topics include design assistance, advisories, and
troubleshooting tips.
References
Zynq-7000 AP SoC Product Page
Vivado Documentation
1. Xilinx Zynq-7000 AP SoC Solution Center
2. Vivado Design Suite User Guide: Release Notes, Installation, and Licensing (UG973)
3. OS and Libraries Document Collection (UG643)
4. Generating Basic Software Platforms (UG1138)
5. Vivado Design Suite User Guide: Embedded Hardware Design (UG898)
6. Vivado Design Suite Tutorial: Embedded Hardware Design (UG940)
7. Vivado Design Suite User Guide: Using the Vivado IDE (UG893)
8. Vivado Design Suite Tutorial: Designing IP Subsystems Using IP Integrator (UG995)
9. Vivado Design Suite User Guide: Designing IP Subsystems Using IP Integrator (UG994)
10. Embedded System Tools Reference Manual (UG1043)
11. Vivado Design Suite User Guide: Programming and Debugging (UG908)
12. Secure Boot of Zynq-7000 All Programmable SoC (XAPP1175)
13. Zynq-7000 All Programmable SoC Technical Reference Manual (UG585)
14. Xilinx Software Development Kit Help (UG782)
15. Xilinx Software Development Kit (SDK) User Guide: System Performance (UG1145)
16. Zynq-7000 All Programmable SoC: Embedded Design Tutorial (UG1165)
17. System Performance Analysis of an All Programmable SoC (XAPP1219)
Vivado Design Suite QuickTake Video Tutorials
Vivado Design Suite Documentation