【正文】
. As the exception happens, the program jump to the exception vector list, and then switch to a corresponded function. The exception vector list should be placed in 8*4 byte space of memory. There are seven interruptions defined in ARM architecture, they are Reset, Undefined, SWI, Prefect, Abort, IRQ, and FIQ. If the starting address of the RAM is 0 when the system is running, the exception vector list should be rebuilt. And if the interrupt is not be used, the function should point to a loop for avoiding the confusion which is caused by the false interrupt. Considering the ARM startup process, the designed Nboot process is shown as Figure 4: The main( ) function that the Nboot calls lastly should perform these tasks: 1) Enable the MMU 2) Initialize the serial port 3) Output the serial port information 4) Initialize NAND flash 5) Read Eboot from NAND flash 6) Load the Eboot . Eboot The first function called by Eboot is Startup( ), then Startup( ) calls the Bootloadermian( ) to perform most of the tasks. It’s executable flow is shown as Figure 5: After system is electrified, the first Eboot function implemented is Startup( ), this function is edited in assembly language, locating on the . The Startup( ) function initializes CPU and other kernel logical devices. The tasks that the Startup( ) function needs to perform may vary depending on the hardware, but in general, the Startup( ) function perform the tasks as follows [3]: 1) Set CPU in supervisor mode, in this mode memory and hardware can be accessed without limits 2) Shield CPU against all interruptions 3) Close the MMU and TLB 4) Make cache and write buffer invalidated 5) Initialize memory controller 6) Initialize other devices on chip, such as clock 7) Set and open MMU to map physical address to logical address, and open cache 8) Copy Eboot code to RAM, jump to Eboot code in RAM 9) Jump to main( ) function Startup( ) function only performs the most basic tasks which acplish the initialization mission , then jumps to main( ) functions. Simultaneously Startup( ) function should determine the booting model, and then dispose the sleep model with a special way. Because each CPU and hardware platform requires different initialization, programmer must modify the file. The next is the description of these functions[2]: 1) BootloaderMain: BootloaderMain ( ) which is the most important function in BLCommon library controls the executable flow, and it is the entry point of the BLCOMMON library. BootloaderMain( ) is the primary function in the BLCOMMON library that implements a mon and consistent framework for a boot loader. 2) OEMDebugInit: OEMDebugInit is the first function that called from the BootloaderMain( ) function when the boot loader is started. The major task that the function should perform is initializing the debugging port, this call is typically used to initialize serial UART debugging port 3) OEMPlatformInit: OEMPlatformInit( ) is the next function called from BLCommon after the OEMDebugInit( ) function pletes. The OEMPlatformInit( ) function is used to perform platformspecific initialization, such as clock, driver, and transport initialization. OEMPlatformInit( ) where the interruption in the boot up process takes place displays the boot loader menu. 4) OEMPreDownLoad: OEMPreDownload( ) is also called from BLCommon before actually downloading a runtime image. This function initializes the TFTP transport or Platform Builder download protocol on development workstation, and OEMPreDownload( ) can obtain an IP address through DHCP, otherwise, it would assign a static address. OEMPreDownload( ) calls EbootInitEtherTransport( ) to perform the major initialization of the work. 5) DownloadImage: Programmer should not modify the DownloadImage( ) function which is in the BLCommon library. The function has nothing to do with the medium of transport. DownloadImage( ) could download a single .bin file, multiBin, multibin packet, or the .nb0 files. The function passes back the image start address and length to the OEM code (OEMLaunch). If the downloading address is a flash memory address, DownloadImage( ) calls the OEM function to burn the image to flash. DownloadImage( ) function calls the Download Function and flash function as the following figure 12 [4] 6) OEMLaunch: the OEMLaunch function collects postdownload connection information from Platform Builder and jumps to the newly downloaded boot loader image. OEMLaunch( ) is the last boot loader function called out of BLCommon library and is responsible for jumping to and launching the runtime image. The tasks that the OEMLaunch( ) function needs to perform are shown as the follows: OEMLaunch( ) can use the EbootWaitForHostConnect( ) function which is defined in to get information about what services to start and from which ports to start the services. Check the arguments returned from EbootWaitForHostConnect( ) and then save the port or IP information. Jump