Embedded Design Handbook

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

5.2.1.2.1. Memcpy-based Boot Copier

The memcpy-based boot copier is the default Nios II processor boot copier that supports Intel® MAX® 10 UFM, EPCS/ EPCQ, CFI, and QSPI flash memory. The memcpy-based boot copier has the following features:
  • Locates the software application in non-volatile memory
  • Unpacks and copies the software application image to Random Access Memory (RAM)
  • Automatically switches processor execution to application code in RAM after copy completes

The boot image is located just right after the boot copier. You need to ensure the Nios II reset vector offset points to the start of the boot copier. Figure 47 shows the flash memory map for EPCS/ EPCQ flash when using a boot copier. This memory map assumes a FPGA image is also stored in the flash memory.

Figure 47. Memory Map for EPCS/EPCQ Flash with Memcpy-based Bootcopier
Note: At the start of the memory map is the FPGA image, followed by the customer data which consists of boot copier and application code. The size of the FPGA image is unknown and the exact size can only be known after the Intel® Quartus® Prime project compilation. The Nios® II reset vector offset must be set in Platform Designer and must point to the start of the boot copier which is located after the FPGA image. You have to determine an upper bound for the size of the FPGA image. For instance, if the size of the FPGA image is estimated to be less than 0x01E00000, you can set the Nios® II Reset Vector offset to 0x01E00000 in Platform Designer, which is also the start of the boot copier.

Figure 48 shows the memory map of a system designed for a Intel® MAX® 10 FPGA device using QSPI/UFM flash with the memcpy-based boot copier. Since the FPGA image (*.sof) is stored in the MAX10 CFM section, the boot copier is located at the base address of QSPI/UFM flash. Hence, the Nios II reset vector offset can be set to address 0x00000000 in Platform Designer.

Figure 48. Memory Map of a System Using UFM with memcpy-based Boot Copier

The memcpy-based boot copier is automatically incorporated as part of the HEX file during the memory initialization file generation ("mem_init_generate") target in the " Nios® II Software Build Tools (SBT)" section.

For more information about mem_init_generate, refer to the " Nios® II SBT Makefile "mem_init_generate" Target" section.

The source code for the memcpy-based boot copier is included with the Nios® II Embedded Design Suite (EDS) under the following directory:
<install_directory>/<version>/nios2eds/components/altera_nios2/boot_loader_sources