Source code structure

The structure of the startup code is set by the startup main() function, which follows the start() function in the startup code.

The entry point to the startup program is _start() (e.g., hardware/startup/lib/arm/cstart.S). The _start() function sets up an environment in which the startup main() function can execute. It:

When it completes its work, _start() calls _main(), which:

The pseudo code below shows the structure of the main() function, with links to the entries for each function in the Startup Library chapter:

Global variables

main()
{
    // Initialize hardware 
    Call add_callout_array()

    // Parse commandline arguments
    (Call handle_common_option())

    // Remove ram used by modules in the image
    Call init_raminfo()
    
    // Initialize the MMU
    if (virtual) Call init_mmu()
	
    Call init_intrinfo()
    Call init_qtime()
    Call init_cacheattr()
    Call init_cpuinfo()

    // Set hardware machine name
    Call init_system_private()

	//  Print debugging output
    Call print_syspage()
}
Note: You should examine the commented source for each of the functions in the startup library to see if you need to replace any library functions with your own functions.