UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

AR# 51956

Zynq-7000 Example Design - Modify the 14.2 FSBL to load multiple executable partitions

Description

In 14.2 the FSBL is built to hand-off the code to the first executable partition found in the image.

If your image is structured as follows, then application1.elf gets executed right away and application2.elf does not get copied from flash to memory.

fsbl.elf
bitstream.bit
application1.elf
application2.elf

Solution

Create the FSBL template by selecting New -> Application Project and choosing the standalone FSBL.

Modify the FSBL as follows to load both executable partitions and execute the first one ( application1.elf ).

1. In "image_mover.c" define the global variable:

u32 ExecutionAddress = 0;

2. Modify the code in "image_mover.c" under the "update_status_reg" section to implement the following algorithm:

2.1. After loading a partition, check if it is an executable partition ( for example: application1.elf). If so, store the execution address to the variable ExecutionAddress and keep looking for other partitions.
2.2. Keep loading other partitions. In our example, application2.elf
2.3. After the last partition is loaded, use the ExecutionAddress variable as hand-off address. Application1.elf will execute.

Note: This code has NOT being tested for FALLBACK mechanism.

Note: The current plan is to implement a better, more stable and tested solution for FSBL in future releases.

update_status_reg:

..............................................

if (IsLastPartition(Hap)) {
debug_xil_printf("There are no more partitions to load\r\n");

 NextPartition = PartitionNum;

 // CHANGED: the last partition has benn loaded, what to do next?

if ( ExecutionAddress ) {
// CHANGED: a previous "code partition" has been loaded

 

debug_xil_printf("CHANGED: ready to execute at %x\r\n",ExecutionAddress);

ExecAddr = ExecutionAddress;

SkipPartition = 0;

} else {

// CHANGED: no "code partition" has been found
debug_xil_printf("CHANGED: There are no partitions to execute\r\n");
while(1) {
        PatWDT();

}

}
} else if(IsEmptyHeader(Hap)) {

debug_xil_printf("Empty partition header %x\r\n", NextPartitionAddr);
OutputStatus(EMPTY_PARTITION_HEADER);
return MOVE_IMAGE_FAIL;

} else { // CHANGED: it's not the last partition but it's the one to execute later.


if ( SkipPartition == 0 ) {

SkipPartition = 1;
ExecutionAddress = ExecAddr;
debug_xil_printf("CHANGED: does not execute but prepare to.\r\n");

}
}

..............................................

AR# 51956
Date Created 10/31/2012
Last Updated 04/01/2013
Status Active
Type General Article
Devices
  • Zynq-7000
Tools
  • EDK - 14.2