identified by the
index
field of the initial software last image loaded register (
initswlastld
) in the
romcodegrp
group in the system manager. If the image is invalid, boot ROM code attempts to load up to
three subsequent images from flash memory. If a valid preloader image cannot be found in the on-chip RAM
or flash memory, the boot ROM code checks the FPGA portion of the device for a fallback image.
Loading the Preloader
The boot ROM code loads the preloader image from flash memory into the on-chip RAM and passes control
to the preloader. The boot ROM code checks for a valid image by verifying the header and cyclic redundancy
check (CRC) in the preloader image.
The boot ROM code checks the header for the following information:
• Validation word—validates the preloader image. The validation word has a fixed value of 0x31305341.
• Version—indicates the header version.
• Program length—the total length of the image (in bytes) from offset 0x0 to the end of code area, including
exception vectors and CRC.
• Checksum—a checksum of all the bytes in the header, from offset 0x40 to 0x49.
The preloader image has a maximum size of 60 KB. This size is limited by the on-chip RAM size of 64 KB,
where 4 KB is reserved as a workspace for the boot ROM data and stack. The preloader can use this 4 KB
region (for its stack and data, for example) after the boot ROM code passes control to the preloader. This
4 KB region is overwritten by the boot ROM code on a subsequent reset. The following figure shows the
preloader image layout in the on-chip RAM after being loaded from the boot ROM.
Figure A-6: Preloader Image Layout
Spare/Unused
User-Defined Code
Exception Vectors
Validation Word
Version
Flags
Program Length
Checksum
Reserved at Reset
Header
Entry Point
0xFFFFFFFF
0xFFFFF000
0xFFFF0050
0xFFFF004C
0xFFFF0000
0x40
0x44
0x45
0x46
0x48
0x4A
0xFFFF0040
CRC
Spare (0x0000)
0x4C
Exception vectors—Exception vectors are located at the start of the on-chip RAM. Typically, the preloader
remaps the lowest region of the memory map to the on-chip RAM (from the boot ROM) to create easier
access to the exception vectors.
Header—contains information such as validation word, version, flags, program length, and checksum for
the boot ROM code to validate the preloader image before passing control to the preloader.
Entry point—contains the preloader image address. After the boot ROM code validates the header, the boot
ROM code jumps to this address.
User-defined code—typically contains the program code of the preloader.
Altera Corporation
Booting and Configuration Introduction
A-7
Loading the Preloader
cv_5400a
2013.12.30