Nios® V Processor Software Developer Handbook

ID 743810
Date 10/02/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

6.11.9. Eliminate Unused alt_load()

When booting Nios® V processor using execute-in-place, the crt0 code block calls the alt_load() macros. The alt_load() macros handles the copying of sections (except .text) on reset from a memory into the system RAM. There can be two possible elimination methods to reduce the code footprint.

  1. Partial Elimination

    If you are booting from On-Chip Memory (OCRAM), you need to enable enable_alt_load_copy_rwdata to preserve a copy of the .rwdata section of the application code. This ensures that the .rwdata is restored from modification during run-time, thus the application is initialized with the same .rwdata sections after every system reset.

    To enable the alt_load() function partially,

    set_setting hal.linker.enable_alt_load {true}

    set_setting hal.linker.enable_alt_load_copy_exceptions {false}

    set_setting hal.linker.enable_alt_load_copy_rodata {false}

    set_setting hal.linker.enable_alt_load_copy_rwdata {true}

    set_setting hal.linker.enable_exception_stack {false}

  2. Complete Elimination

    If you are re-programming a fresh hardware SOF file with initialized OCRAM, or redownloading software ELF file after each system startup, you may disable the entire alt_load() functions. Since there is always a fresh .rwdata section before each system startup, there is no obligation to preserve it using the enable_alt_load_copy_rwdata.

    To disable the alt_load() function entirely.

    set_setting hal.linker.enable_alt_load {false}

    set_setting hal.linker.enable_alt_load_copy_exceptions {false}

    set_setting hal.linker.enable_alt_load_copy_rodata {false}

    set_setting hal.linker.enable_alt_load_copy_rwdata {false}

    set_setting hal.linker.enable_exception_stack {false}