Nios® II Software Developer Handbook

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

7.15.5. Boot Modes

The processor’s boot memory is the memory that contains the reset vector. This device might be an external flash or an Intel FPGA EPCS serial configuration device, or it might be an on-chip RAM. Regardless of the nature of the boot memory, HAL-based systems are constructed so that all program and data sections are initially stored in it. The HAL provides a small boot loader program that copies these sections to their run time locations at boot time. You can specify run time locations for program and data memory by manipulating BSP settings.

If the runtime location of the .text section is outside of the boot memory, the Intel FPGA flash programmer places a boot loader at the reset address. This boot loader is responsible for loading all program and data sections before the call to _start. When booting from an EPCS device, this loader function is provided by the hardware.

You can boot a Nios® II processor from Intel FPGA EPCQ flash memory (EPCQx1, EPCQx4) using an Intel FPGA serial flash controller. The Intel FPGA Serial Flash Controller with Avalon interface allows Nios® II processor systems to access an Intel FPGA EPCQ flash memory, which supports standard, quad and single- or dual-I/O mode. The Nios® II processor Software Build Tools (SBT) supports the Nios® II booting from the Intel FPGA Serial Flash Controller. In addition, a Nios® II hardware abstraction layer (HAL) driver is available for the Intel FPGA Serial Flash Controller that allows an application to read, write, or erase flash.

For more information about how to build a bootable system for a Nios® II processor application executing in place (XIP) from EPCQ flash, refer to Nios II Processor Booting Methods.

However, if the runtime location of the .text section is in the boot memory, the system does not need a separate loader. Instead the _reset entry point in the HAL executable program is called directly. The function _reset initializes the instruction cache and then calls _start. This initialization sequence lets you develop applications that boot and execute directly from flash memory.

When running in this mode, the HAL executable program must take responsibility for loading any sections that require loading to RAM. The .rwdata, .rodata, and .exceptions sections are loaded before the call to alt_main(), as required. This loading is performed by the function alt_load(). To load these functions and data into memory manually; and to load any additional sections, use the alt_load_section() function.

For more information about alt_load_section(), refer to the "HAL API Reference" chapter.