Nios® II Software Developer Handbook

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

15.1.49. alt_load_section()

Prototype

void alt_load_section(alt_u32* from,

alt_u32* to,

alt_u32* end)

Commonly Called By

C/C++ programs

Thread-safe

No.

Available from ISR

No.

Include

<sys/alt_load.h>

Description

When operating in run-from-flash mode, the sections .exceptions, .rodata, and .rwdata are automatically loaded from the boot device to RAM at boot time. However, if there are any additional sections that require loading, the alt_load_section() function loads them manually before these sections are used.

It is recommended to call below the macro ALT_LOAD_SECTION_BY_NAME and before alt_dcache_flush_all() and alt_icache_flush_all().

The input argument from is the start address in the boot device of the section; to is the start address in RAM of the section, and end is the end address in RAM of the section.

To load one of the additional memory sections provided by the default linker script, use the macro ALT_LOAD_SECTION_BY_NAME rather than calling alt_load_section() directly. For example, to load the section .onchip_ram, use the following code:

ALT_LOAD_SECTION_BY_NAME(onchip_ram);

The leading ‘.’ is omitted in the section name. This macro is defined in the header sys/alt_load.h.

Return

--