Share via


Creating the Boot Loader Main Function

The main function, which is an entry point routine, is called by the boot loader's StartUp function. The main function turns around and calls BootloaderMain, which is defined in the BLCOMMON library. The routine can continue to perform any number of initialization tasks, but it should end in a call to the BLCOMMON library entry point. The BLCOMMON library defines the basic structure of a boot loader and drives many of the implementation details for the boot loader development process. For more information about the BLCOMMON library, see BLCOMMON Code Library.

To create a boot loader main function

  1. Create a file called Main.c.

  2. Add the implementation for the main routine in the Main.c file.

    The following code example shows the implementation of the main routine for the hardware platform used in this boot loader example.

    void main(void)
    {
        // Common boot loader (blcommon) main routine.
        //
        BootloaderMain();
    
        // Should never get here.
        //
        SpinForever();
    }
    

See Also

How to Develop a Boot Loader

Last updated on Wednesday, April 13, 2005

© 2005 Microsoft Corporation. All rights reserved.