Visible to Intel only — GUID: fkw1641452788901
Ixiasoft
Visible to Intel only — GUID: fkw1641452788901
Ixiasoft
4.4.2.3. HAL Initialization
As for any other C program, the first part of the HAL's initialization is implemented by the Nios® V processor's crt0.S routine. After crt0.S completes the C run-time initialization, it calls the HAL alt_main() function, which initializes the HAL BSP run-time library and subsystems.
The HAL alt_main() function performs the following steps:
- Initializes interrupts—Sets up interrupt support for the Nios® V processor with the alt_irq_init() function.
- Starts RTOS—Starts the RTOS, if this OS is configured to run (with the ALT_OS_INIT and ALT_SEM_CREATE functions). For additional information about using and initializing RTOS, refer to Selecting the Operating System.
- Initializes device drivers—Initializes device drivers (with the alt_sys_init() function). The Nios® V processor tools automatically find all peripherals supported by the HAL, and automatically insert a call to a device configuration function for each peripheral in the alt_sys_init() code. To override this behavior, you can disable a device driver with the BSP Editor, in the Drivers tab. For information about enabling and disabling device drivers, refer to Managing Device Drivers.
- Configures stdio functions—Initializes stdio services for stdin, stderr, and stdout. These services enable the application to use the GNU newlib stdio functions and map the file pointers to supported character devices. For more information about configuring the stdio services, refer to Character Mode Devices.
- Initializes C++ global constructors and destructors—Handles initialization of global C++ constructor and destructor functions. These function calls are necessary if your application is written in the C++ programming language.
- Calls main()—Calls function main(), or application program. Most applications are constructed using a main() function declaration and begin execution at this function.
By default, the HAL configuration mechanism enables support for the C++ programming language. Disabling this feature reduces your application's code footprint, as noted in Reducing Code Footprint in Embedded System. The Nios® V processor C++ language support depends on the GCC tool chain.