Start wince6.0 + based on SD card

Source: Internet
Author: User

 

* ****************************** Loongembedded ******* *************************

Author: loongembedded (Kandi)

Time: 2011.11.02

Category: Wince-driven development

* ****************************** Loongembedded ******* *************************

 

1. Principle of irom-based SD/MMC startup

We know that cloud6410 supports irom boot (internal Rom booting). irom boot refers to the method of starting from onenand, SD/mmccard, and NAND flash storage device. For details, refer:

Figure 1 irom Startup Process

It is the workflow of the system startup based on irom. The main work of this process is briefly described below:

1) After the processor is powered on, when om [] = 1111, execute the boot codes in irom. This startup code is called bl0, which will perform initialization.

2) Select the device to start based on the GPN [] pin settings. according to Figure 2, if you want to start the device from SD card in SD/MMC channel 0, then GPN [] = 000, so that bl0 will read the first 4 kb program in BL1 from the SD card to stepping stone through the SD controller, and then stepping stone to execute the BL1 code.

3) BL1 can initialize the system clock, UART, SDRAM, and other devices, and then copy bootloader2 (bl2) to the address memory of the SDRAM.

4) then jump to the "bl2" in the SDRAM to continue running. bl2 supports more powerful functions, and further initializes the hardware and copies the wince kernel image to the memory of the (0x80100000) Address of the SDRAM.

5) execute NK again in the SDRAM mode.

Figure 2 startup modes supported by cloud6410

 

Here is an uncertain problem. irom_applicationnote mentioned that irom Boot Code (bl0) can load 4 kb of bootloader code to stepping stone (8 KB, however, bl0 can load 8 KB stepldr_irom_sd.nb0 to stepping stone. If you do not know how to understand this conflict, please let us know.

 

2. Overview of implementation based on SD card startup

The butler application program burned irom_sd_eboot.nb0 to the SD card, and then burned the new stepldr, eboot, and OS to nandflash through irom_sd_eboot.nb0 when starting the SD card, in this way, you can start nandflash later.

 

After the irom_sd_eboot.nb0 file is burned to the SD card through the irom fusing tool, the file cannot be seen in the SD card, because it is not written to the SD card sector by using the fat method, but directly, in this way, the sdio controller is used to read the slice directly when starting from the SD card. irom_sd_eboot.nb0 is composed of stepldr_irom_sd.nb0 (equivalent to bl2) and eboot_sdfuser.nb0 (equivalent to BL1, BL1 and bl2 mean the first and second phases of boot loading, which is the distribution of boot blocks for SD/MMC devices.

Figure 3 SD/MMC device startup block distribution

We can see that the last block (block, which is the sector, and each sector is 512 bytes) of the SD card cannot be used because it is reserved, the second-to-last block specifies the tag used for the SD card. The 16 blocks, from [last-18] to [last-3], are used to save BL1, the location of bl2 on the SD card can be determined based on the size of bl2.

 

3. Burn irom_sd_eboot.nb0 to SD card

According to the above description, we know the specific location of irom_sd_eboot.nb0 to be burned to the SD card. Next let's take a look at the irom fusing tool.exe application interface.

Figure 4 irom_fusing_tool.exe Interface

When you select start, let's take a look at the main implementation of irom_fusing_tool.exe source code. The first part is as follows:

Figure 5 irom_fusing_tool.exe write operations

Why is the file system identifier in the 5 bytes from 0x52 to 0x56? We use the winhex tool to view the content of the SD card startup zone. These contents are written into the SD card when the SD card is formatted, as shown below:

Figure 6 enable 1 gb sd card in winhex

Next we will continue to look at the Second part:

Figure 7 irom_fusing_tool.exe write operations

The distribution of boot blocks for sdhc devices is as follows:

Figure 8 Distribution of boot blocks of sdhc Devices

 

4. Read irom_sd_eboot.nb0 and

After the startup of, the CPU executes the bl0 startup code based on the irom + SD startup method. bl0 will use the SD card controller to set BL1 (stepldr_irom_sd.nb0, the size is 8 KB), and then the BL1 code is executed in stepping stone. BL1 will call the main function during execution, as shown below:

Figure 9 main function of BL1

The content of bl2 has been copied to the memory address specified by SDRAM and executed. Then, you can manually or automatically download block0 and eboot through the irom_sd_eboot.nb0 download function. bin or NK. bin to nandflash.

 

4.1 global variables for saving SD/mmccard Information

When SD/mmccard is used as the boot device, the SD/mmccard information must be saved in the specified region. See:

Figure 10 address and usage definitions for saving SD/mmccard Information

 

4.2 device copy Function)

The kernel contains the ROM code of the block assignment function of the boot device, so developers do not need to implement the device copy function. These internal functions can copy data from any device to the SDRAM, you can use these functions after the internal ROM code is executed, because these functions are initialized in the bl0 stage. The following table describes the replication functions of these devices.

Figure 11 device assignment function description

 

4.3 irom_sd_eboot.nb0 file composition and size

Irom_sd_eboot.nb0 file and the size of each file, which helps you understand

Figure 12 Composition of irom_sd_eboot.nb0

 

 

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.