Specifications

Boot Modes
The processor’s boot memory is the memory that contains the reset vector. This device might be an
external flash or an Altera 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 Altera 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.
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 any
additional sections, use the alt_load_section() function.
For more information about alt_load_section(), refer to the HAL API Reference chapter of the Nios II
Software Developer’s Handbook.
Related Information
HAL API Reference on page 14-1
Working with HAL Source Files
You might wish to view files in the HAL, especially header files, for reference. This section describes how
to find and use HAL source files.
Finding HAL Files
You determine the location of HAL source files when you create the BSP. HAL source files (and other BSP
files) are copied to the BSP directory.
For more information, refer to "Nios II Software Build Tools Reference" of the Nios II Software Developer’s
Handbook.
Related Information
Nios II Software Build Tools Reference on page 15-1
Nios II Embedded Software Projects on page 4-4
Overriding HAL Functions
HAL source files are copied to your BSP directory when you create your BSP. If you regenerate a BSP, any
HAL source files that differ from the installation files are copied. Avoid modifying BSP files. To override
default HAL code, use BSP settings, or custom device drivers or software packages.
NII5V2
2015.05.14
Boot Modes
6-41
Developing Programs Using the Hardware Abstraction Layer
Altera Corporation
Send Feedback