Embedded Design Handbook

ID 683689
Date 8/28/2023
Public
Document Table of Contents

5.3.3.3. The Default EPCS/EPCQ Boot Copier

When the Nios® II processor reset address is set to the base address of an EPCS/EPCQ controller in the Platform Designer system integration tool, the default EPCS/EPCQ boot copier is implemented. The EPCS/EPCQ controller supports the Nios® II processor boot sequence with a small block of on-chip memory mapped to the EPCS/EPCQ controller base address. During Intel® Quartus® Prime compilation, the EPCS/EPCQ boot copier is designated as the initial contents of this on-chip memory. When booting from EPCS/EPCQ, the elf2flash utility does not include a boot copier in the .flash. Instead, it includes the application code, packaged into a boot record. The flash programmer downloads the data, which is read by the EPCS/EPCQ boot copier located in on-chip memory.

For IV-series and earlier devices, after the Nios® II processor completes reset, the boot copier executes from the on-chip memory block in the EPCS/EPCQ controller. The boot copier reads the Control Block (CB) header to check if a Programmer Object File (POF) FPGA configuration image is located at the beginning of the EPCS device. If it finds such a file, the boot copier reads the POF data to extract the size of the FPGA configuration image. The boot copier then looks for the software application boot record at the EPCS/EPCQ offset immediately following the last byte of the FPGA configuration image.

For V-series and later devices, after the Nios® II processor completes reset, the boot copier executes from the on-chip memory block in the EPCS/EPCQ controller. The boot copier reads the POF header to check if the image is a POF file. The POF header is the first three bytes of the FPGA configuration image generated by the sof2flash utility. The boot copier then reads the POF header for the size of the FPGA configuration image and looks for the software application boot record at the EPCS/EPCQ offset immediately following the last byte of the FPGA configuration image.

When a boot record is found, the boot copier reads it and copies the application code to RAM. After copying completes, the boot copier reads the entry point of the application code from the boot record. The boot copier executes the jump to that address, and the application software begins executing.

The source code for both variants of the default boot copier is included with the Nios® II Embedded Design Suite (EDS) in the <install directory>/ <version>/nios2eds/components/altera_nios2/boot_loader_sources directory.