Author: arm-WinCE
In eboot, after you jump from startup. s to the C program entry, the program can be written in C language, which is much better. Generally, the C language entry is a main function, which may also be called another name. The bootloadermain function will be used in this main function, which is defined in the blcommon module. Generally, the main function is written as follows:
Void (void)
{
// Common Boot Loader (blcommon) main routine.
Bootloadermain ();
// Shocould never get here.
Spinforever ();
}
As can be seen from the program, after entering the C program, eboot only calls the bootloadermain function. As for spinforever function, it is actually an endless loop of while. We can see that all eboot work is completed in bootloadermain, and the source code can be found in "/wince600/public/common/oak/Drivers/ethdbg/blcommon. Procedure
The following describes the specific steps:
1. The bootloadermain function first calls the kernelrelocate function to copy the global variables used in bootloader to ram.
2. Call the oemdebuginit function to initialize the debug debugging function. Generally, the serial port is initialized, so that you can use the serial port to print debugging information.
3. Call the oemplatforminit function to initialize the board. Many platform-related initialization tasks can be completed in this function.
4. Call the oempredownload function. In terms of the process, we should make some preparations for downloading the kernel. After the function is executed, you can choose to download the kernel or jump to the execution based on the returned value. In fact, this function first reads the boot configuration information and then initializes the download device, which is generally a NIC device.
5. If the oempredownload function returns bl_download, the wince image will be downloaded from the host.
6. If the oempredownload function returns bl_jump, it will directly jump to the location where the wince image is located to start execution.
The OEM functions involved must be implemented by the user and then called by the blcommon module. These functions will be introduced later.