MX51 uboot startup sentiment

Source: Internet
Author: User
There is a ROM in the arm, and the Rom has Code. The Code above is the real startup code of the system, and it has nothing to do with uboot.

The following code uses different startup modes:
If NAND automatically reads the code of the first 4 K of uboot into the chip and runs the code in the SDRAM, the Code should complete the CPU initialization and ram initialization (initialize the ram as the peripheral.
--------------------------
I. MX51 does not have NAND but has SD card, but is used as a storage device!
--------------------------
I am always confused that I always think that the first 4 K of uboot is copied to the peripheral RAM for execution, but the off-chip RAM needs to be initialized by the first 4 K, which causes a deadlock.

Take the Freescale imx51 as an example. The Rom is 36 K and the ram128k is

The startup mechanism of imx51 is as follows (writing this content is not involved in actual development, but it gives you a better understanding of the system startup process, the startup process of the system is not only uboot, but also a lot of work has been done before uboot ):

When the system restarts, imx51 samples the Startup Mode gpio pins (boot_mode [1:0]) and stores the sampled values in the sbmr register (system reset controller Boot Mode register ). The startup modes supported by imx51 include: Internal startup mode (start peripherals are determined by gpio pins in startup mode), test mode, and download mode (download code through USB/UART) and internal startup mode (determine the startup peripherals by fuse bit in startup mode ).

Boot_mode [1:0] Startup Mode type Startup Mode details
00 Internal Startup Mode

 

(Determine the startup peripherals through the gpio pin in Startup Mode)

Run the startup code inside the chip on imx51, which can be started from the following devices:

 

  • Nor flash (via weiM)
  • Onenand
  • SPI (Serial Flash CS #1)/I2C EEPROM
  • NAND Flash, MLC/SLC 0.5 K/2 k/4 kb page ECC
  • SD/MMC (Large capacity supported)/movinand (through MMC Interface)
01 Test Mode  
10 Internal Startup Mode

 

(Determine the startup peripherals by using the fuse bit in Startup Mode)

Similar to the 00 mode, the startup peripherals are determined not by the gpio pin in startup mode, but by the internal fuse bit of imx51, which can be written at one time.
00 USB/UART download start Mode Download and execute the code. You can use the following interface:

 

L USB (full speed)

L UART

When the system restarts, imx51 reads the internal fuse bit of gpio_bt_sel:

A) if gpio_bt_sel = 1 (burned), the startup code inside the chip will judge the peripheral correlation by reading the internal fuse bit.

B) If gpio_bt_sel = 0, imx51 will sample the gpio pins of peripheral-related features at startup and store them in the sbmr register. The chip's internal startup Code reads this register to determine the peripheral correlation. Therefore, the fuse bit inside the chip corresponds to the startup-related gpio pins one by one.

Internal startup code of imx51

There is a romcode in imx51. In internal startup mode, this code is executed when the system starts. This Code initializes the most basic hardware, then determine the information of the system's external storage device (by reading the sbmr register ). Then, the system initializes the corresponding peripherals, copies the first part of the code from the peripherals to the memory of the chip, jumps to its header address, and executes the code.

In this way, imx51 can be started from multiple peripherals to increase the startup flexibility. The procedure of imx51 romcode is as follows:

We follow the SD card

1) read the fuse bit or pin in startup mode by sampling the sbmr register <-- reset

2) Determine whether the startup mode is the one through boot_mode [1:0 ].

To maintain the stability of boot_mode [1:0] = 10, the external information is burned to the internal fuse of the chip in the internal start mode (the startup peripherals are determined by the fuse bit in the Start mode, in this way, the system reads related peripheral information from the internal fuse.

3) boot memo ctrol SD/MMC/movinand?

Bt_mem_ctl = peripheral interface extended storage device

'00' = SD/MMC HDD

4) configure the SD/MMC controller esdhc1 Controller

5) basic config and obtain base ADDR of boot device

Basic configuration and obtain the base address of the startup hardware

6) execute the image

Let's talk about these functions: the romcode of imx51 is fixed inside the chip and cannot be modified. The above analysis can help you understand the following points:

1) How imx51 was initially started

2) the status of the system before the bootloader starts to be executed.

A) The imx51 has initialized the hardware part, including the part clock, the internal BUS, the Controller of the external storage device, and the external storage device itself.

B) the bootloader header has been copied to the ram of imx51. Apart from the 1 K MBR header and the flash file header, the remaining part is the executable code. We can see that the rest of the bootloader cannot be put down, so we must divide the bootloader into two parts: xldr and eboot.

C) You can use the DCD segment to initialize some registers. For example, androidbsp uses it to initialize the system DDR2 controller.

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.