Imx51 ROM Boot Code startup Analysis

Source: Internet
Author: User

Turn: http://blog.csdn.net/kickxxx/article/details/7236040

Startup Mode

MX51 supports four startup modes. These modes are determined by the solder joints on the IC Package (boot_mode 0/1). After reset, the two solder joints are sampled, then save their status to the SRC Boot Mode register (sbmr) Register. The solder joints correspond to logic 0. For logic 1, nvcc_per3 is recommended for Freescale.

The four boot modes are internal, reserved, internal boot with fuses, and serial boot through USB/UART.

Bmod [1:0] Boot type
00 Internal boot
01 Reserved
10 Internal boot-Rom select
11 Serial downloader


Internal boot (bmode = 00)

In this mode, the processor starts from internal ROM, starts code to execute HW initialization, and then jumps to AP image.

In internal Boot Mode, the startup process is controlled by efuse settings or gpio pins. The two control options are controlled by gpio boot select (gpio_bt_sel) solder joints:

1 If gpio_bt_sel has been burned and all startup options are controlled by efuse, the boot ROM code reads efuses through the IIM Module

2 If bpio_bt_sel is not passive, the startup option is determined by the sbmr register settings. Some fuse options may be overwritten in this mode. Overwrite is controlled by gpio pins. If yes, the option value is obtained by reading sbmr register.

Internal boot-Rom select (bmode = 10)

The difference between this mode and internal boot boot_mode [1:0] = 00 is that the gpio overwrite is ignored in the 10 mode, that is, the efuse startup setting is used during startup regardless of the gpio_bt_sel setting. This mode is mainly used on mass production devices. It does not need to be pulled up or down by gpio, and is called by serial downloader because the boot pin value is incorrect on the product-level devices.

In this mode, if the startup process finds that bt_blank has not been burned (indicating that Rom has not been burned), it will jump directly to serial Downloader. If bt_blank has been burned, the normal start process and efuse settings are used.

Fuses has not been written before the first use of the board. If the internal Boot Mode bmod = 00 is used, the value connected to the BT gpio pads is used, however, these values may not be required by the system. If the ROM code uses these values incorrectly, the electrical/logic of these pads may be damaged. Internal Boot Mode bmod = 10 can solve this problem. If bt_blank fuse is not burned, the startup process jumps to serial Downloader, after the next bt_blank is burned, the ROM code executes the normal startup process.

Boot efuse description

MX51 boot efuse is the configuration parameter of the startup process, including

Dir_bt_dis direct external memory startup enabling

Bt_mem_ctl [1:0] enable memory type control: supports weiM, NAND Flash, and extended device types. bt_mem_type [1:0] defines these extended device settings

Bt_page_size [1:0]: defines the page size of NAND Flash. This setting corresponds to the NAND Flash type in bt_mem_ctl.

Bt_spare_size defines 4 kbyes page size the spare bytes of NAND Flash. bt_mem_ctl is required to be set to NAND Flash and bt_page_size is 4kb.

Bt_bus_width [1:0] defines the width of the NAND/nor bus.

Bt_mem_type bt_mem_ctl defines a large memory type. bt_mem_type provides a more detailed classification for the corresponding type.

Bt_src [1:0] defines the source of the extended device type: esdhc 1/2/3/4; I2C 1/2, HS-I2C; CSPI, ecspi1/2

Bt_weim select weiM muxed Mode

Bt_uart_src: select the UART Controller Used by serial downloads

Bt_mlc_sel SLC/mlc nand device selection; or emmc fast Boot Mode

....


Gpio boot Overwrite

Some fuse settings can be overwritten by gpio. When gpio_bt_sel is set to 0 and bootm [1:0] = 00, the gpio overwrite takes effect.

Serial downloader (bmod [1:0] = 11)

When the external flash device is not written to the program or encounters a failure during startup, the boot process calls serial Downloader.

Serial downloader is called in the following cases:

1 bmod [1:0] = 11 (Serial downloader Mode)

2 bmod [1:0] = 10 (internal boot with fuses) and efuse_bt_blank = 0

3 bmod [1:0] = 10 (internal boot with fuses) But fuses is not set correctly

4 bmod [1:0] = 00 or 10 (internal or internal boot with fuses), and the flash device does not have a valid image

5 Security hardware failure

6. An exception occurs during running.

7. The HAB function returns an error in product mode.

Summary

As can be seen from the above, before the system enters uboot, imx51 actually needs to execute an internal code ROM boot code,

1. Rom Boot Code reads efuse and boot gpio to obtain startup configuration parameters. These configuration parameters determine the storage location, storage layout, and physical location of uboot code.

2. before executing the uboot code, the system has initialized some system clocks, internal RAM, flash host controllers, and device controllers (until the ROM code is initialized by default when the system is powered on,)

3. The ROM Boot Code will read the top part of uboot and put it in the internal RAM, and point the pointer to the first part of uboot.

4. perform basic initialization for the first half of uboot, read the second half into the external RAM (the NAND device and external RAM have been set for the previous initialization), and then jump to the second part of the uboot address for execution.


Therefore, uboot itself must be divided into two parts: the previous part is loaded from ROM code to internal RAM, and the latter part is loaded by the former part of uboot.

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.