AN 709: HPS SoC Boot Guide - Cyclone V SoC Development Kit

ID 683265
Date 1/27/2016
Give Feedback Boot ROM

The HPS boot process starts when the processor is released from reset, and jumps to the reset vector address, located in the Boot ROM address space.

Typically, the main responsibilities of the Boot ROM are:

  • Detect the selected boot source
  • Perform minimal HPS initialization
  • Load the next boot stage (typically the Preloader) from Flash to OCRAM and jump to it

The behavior of the Boot ROM is influenced by the BSEL and CSEL options, and also by the registers in System Manger (for RAM boot) as shown later in the document.

For the scenarios where the next boot stage is located in Flash, the Boot ROM can use up to four different images:

  • On Cold reset, the Boot ROM always starts with the first image, and checks the CRC. If the CRC is OK, then it passes control to it. If the CRC is not OK, then it tries the next image and so on. Before an image is passed control, the Boot ROM updates the register sysmgr.romcodegrp.initswlastld with the image index.
  • On a Warm reset, the Boot ROM looks at the register sysmgr.romcodegrp.initswstate for the magic value 0x49535756. If it is there, it means last Preloader executed OK, so it loads it again and executes it. If the magic value is not found, it means the previous Preloader was not OK, and the Boot ROM advances to the next image and increment sysmgr.romcodegrp.initswlastld.
  • If all images are exhausted, the Boot ROM tries to fallback on the FPGA image. It continues to be reset by the Watchdog, but never tries to boot from Flash until the next Cold reset.
Note: The BootROM requires a special header to be placed at the beginning of the images that need to be loaded from flash. The header also contains a checksum that is used for validating the image. The header can be attached to the image by using the mkpimage tool that is included with the SoC EDS.