Generic Nios II Booting Methods User Guide

ID 683820
Date 5/24/2016

1.4. Nios II Processor Boot Copier

The Nios II processor boot copier has the following features:
  • Locates the software application in memory software application in memory
  • Unpacks and copies software application image to Read Access Memory (RAM)
  • Automatically switches to application code in RAM after copy completes

The boot copier is placed at the reset address if the runtime location of the .text section is outside of the boot memory.

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.

You may enable the alt_load() function in the HAL code. This function operates as a mini boot copier that copies only the writable memory sections to RAM based on the BSP settings. It optionally copies sections from the boot memory to RAM. It can copy data sections (.rodata, .rwdata, .exceptions) to RAM but not the code sections (.text). The code section (.text) section is a read-only section and remains in the booting flash memory region. This partitioning helps to minimize the RAM usage but may limit the code execution performance because accesses to flash memory are slower than accesses to the on-chip RAM. The alt_load() function can be enabled in the BSP Settings.
BSP Settings Functions1
hal.linker.enable_alt_load Enable alt_load() function.
hal.linker.enable_alt_load_copy_rodata alt_load() copies .rodata section to RAM.
hal.linker.enable_alt_load_copy_rwdata alt_load() copies .rwdata section to RAM.
hal.linker.enable_alt_load_copy_exceptions alt_load() copies .exceptions section to RAM.

For more information about the Nios II default sections and the alt_load() function, please refer to the "Nios II Software Build Tools" chapter in the Nios II Classic Software Developer’s Handbook.

Besides the alt_load() function, there are two types of Nios II boot copiers to support Nios II system booting:
  • Memcpy-based boot copier
  • EPCS Controller- based boot copier
1 .text, .rodata, .rwdata and .exceptions are part of the Nios II default section names.