Specifications

Function alt_main() calls function main(). After main() returns, the default alt_main() enters an
infinite loop. Alternatively, your custom alt_main() might terminate by calling exit(). Do not use a
return statement.
The following line of code is the prototype for alt_main():
void alt_main (void)
The HAL build environment includes mechanisms to override default HAL BSP code. This lets you
override boot loaders, as well as default device drivers and other system code, with your own implementa‐
tion.
alt_sys_init.c is a generated file, which you must not modify. However, the Nios II SBT enables you to
control the generated contents of alt_sys_init.c. To specify the initialization sequence in alt_sys_init.c, you
manipulate the auto_initialize and alt_sys_init_priority properties of each driver, using the
set_sw_property Tcl command.
For more information about generated files and how to control the contents of alt_sys_init.c, refer to the
"Nios II Software Build Tools" chapter.
For more information about alt_sys_init.c, refer to the "Developing Device Drivers for the Hardware
Abstraction Layer" chapter.
For more information about the set_sw_property Tcl command, refer to the "Nios II Software Build
Tools" chapter.
Related Information
Nios II Software Build Tools on page 4-1
For more information about generated files and how to control the contents of alt_sys_init.c; and for
more information about the set_sw_property Tcl command.
Developing Device Drivers for the Hardware Abstraction Layer
For more information about alt_sys_init.c.
Memory Usage
This section describes how the HAL uses memory and arranges code, data, stack, and other logical
memory sections, in physical memory.
Memory Sections
By default, HAL-based systems are linked using a generated linker script that is created by the Nios II
SBT. This linker script controls the mapping of code and data to the available memory sections. The
autogenerated linker script creates standard code and data sections (.text, .rodata, .rwdata, and .bss),
plus a section for each physical memory device in the system. For example, if a memory component
named sdram is defined in the system.h file, there is a memory section named .sdram.
The memory devices that contain the Nios II processor’s reset and exception addresses are a special case.
The Nios II tools construct the 32-byte .entry section starting at the reset address. This section is reserved
exclusively for the use of the reset handler. Similarly, the tools construct a .exceptions section, starting at
the exception address.
6-36
Memory Usage
NII5V2
2015.05.14
Altera Corporation
Developing Programs Using the Hardware Abstraction Layer
Send Feedback