The relationship between RBL, UBL, and uboot porting at the underlying layer

Source: Internet
Author: User

FirstRBL= Rom bootloader,UBL= User bootloader
Uboot= Universal boot loader.

RBLIsBootloader,After OMAP is powered on, it will first run RBL, then load UBL through RBL, and then load uboot through UBL, AndUbootIs used to load the Linux kernel. If you do not need to use Linux in a specific application process (in fact, it is generally used ),UbootEvenUBLCan be omitted.

UBL is Level 1 bootloader, uboot is Level 2 bootloader, the size of the first-level bootloader is limited (it should be less than 64 KB and no specific value is found), which is why there is second-level bootloader. If the Program of an application is smaller than this size, we do not need to burn UBL , you just need to burn the binfile corresponding to the application (the following 3rd points will explain how to get this file.
UBL is relatively simple for uboot, kernel, rootfs, device drivers, and DSP development. Let's start with DaVinci and learn about the position and role of ubl in the Davin system. For the DaVinci dm644x embedded system where the firmware program is written in NAND Flash, the power-on startup process is as follows:

1. RBL stage:
after the system is reset, The RBL program stored in the On-Chip Rom starts to run, the RBL program judges the startup mode based on the level of the btsel [0-3] pin. [00] indicates that it is the NAND startup mode, and the RBL program reads UBL data from the external NAND flash to the internal RAM (UBL can be up to 14 K ), go to UBL Code and run it. [01] indicates that it is emifa startup mode, and RBL directly goes to emifa em_cs2 memory space (0x02000000) the data and address bus width of emifa are determined by the em_width and aeaw [] pins. [10] indicates that it is HPI startup mode, and RBL obtains UBL through HPI transmission code, go to the UBL code and run it. [11] indicates that it is a UART startup mode. RBL obtains UBL through the uart0 transmission code and then runs it in the UBL code. In the first, third, and fourth modes, RBL downloads UBL to arm
ram0 and arm ram1 (0x0-0x3fff, 16 K in total), and then transfers it to UBL for running. Whether the DSP is self-guided or guided by arm is determined by the dsp_bt pin level. If it is high, it is self-guided. If it is low, it is guided by arm.

2. UBL stage, that is, U-boot stage :
Ti officially provides U-boot, so the U-boot startup process is described here. In the initial phase of U-boot, the system clock and DDR frequency are initialized to prepare the environment for loading the C program. At this time, the program runs in arm Ram or nor flash, which is determined by the startup method. Copy the U-boot code to the DDR and jump to the start_armboot node of the C program (in DDR2 ).
the specific setting process of U-boot is as follows:
(1) in the U-boot code, first set the most basic system hardware environment, including system PLL and DDR2 initialization, PSC configuration, and enable uart0, aemif, and other hardware modules;
(2) configure the system memory (via ATAG _ mem block and MEM =) NAND Flash and DDR2;
(3) load the kernel to the specified storage address in flash or through TFTP;
(4) initialize the boot parameters passed to the kernel (EMAC address, serial port, console, video format, etc)
(5) obtain the ARM Linux server type value (dvevm: #901);
(6) set the kernel tagged list;
(7) use the initial value to set the arm register.
(8) Call the Linux kernel.

Dm644x settings include:
(1) Guanzhong disconnection and MMU.
(2) Enable the DSP power field (ptcmd) to reset the DSP.
(3) initialize the PLL, enable DDR2, soft reset DDR2, and re-enable DDR2, so that it is out of the reset state.
(4) initialize the system PLL.
(5) configure the aemif pin as the nor flash interface.
(6) VTP calibration.

3. Linux kernel startup phase:

(1) In the kernelBoot/compressed/Head. s Code starts to run,Save the parameters passed in from U-boot, execute a piece of processor-related code, and then make some judgments and processing in the middle. FinallyDecompress the compressed kernel.

(2) In the kernelKernel/The head. s Code starts to run and initializes the page table, cache, and MMU.

(3) start_kernel () Run, according to get the parameters from U-boot and other initialization settings (in the board-evm.c), a series of kernel initialization, for example, Io address ing, timer and serial port initialization, and memory page table re- ing.

(4) The first process in Linux is INIT (), which initializes the system according to the system configuration. Start the file system from flash or NFS based on the parameters obtained from U-boot;
(5) Start shell.

 

RBL (arm ROM Boot Loader) has been burned to the ROM when the chip is released. This does not need to be concerned. After power-on, RBL is automatically transferred from emifa em_cs2 memory space (0x0200 0000 ). run the command. This address is the starting address of the NAND Flash or nor flash chip selection. When your system is set to NAND boot, UBL (user boot loader) is essential; otherwise, RBL cannot directly give uboot to boot, because RBL only supports 14 K
nand flash Boot programs, the binfiles compiled by uboot are generally larger than 80 K. In particular, the higher the version, the larger the uboot code, therefore, you need to write an UBL. UBL reads uboot from NAND Flash, copies uboot to the address related to DDR2 (RAM), and then delivers uboot to boot. According to Ti Davin RBL, the addresses stored by UBL are different for different types of NAND Flash. The 512-byte page NAND (small page) stores the following addresses: 0x00004000; the NAND
(large page) Address of the 2048-byte page is: 0x20000. As for how to use the xds560 simulator to burn UBL or UART boot to write UBL, I put it in the Article transplanted by DaVinci uboot. (Note: Do not confuse RBL and UBL! Take a look at the boot sequence diagram .)

UBL porting is simple. Of course, you have set up a cross-compilation environment on the prerequisites. Go to the upper-level folder of the UBL package and use make to compile: ubl_davinci_nand.bin. UBL mainly includes: UBL. c dm644x. c util. c NAND. c nandboot. c nor. c norboot. c UART. c uartboot. c ubl_davinci.lds

*. H file and two makefile files. If $ (make)-c src flash = NAND is selected for the makefile at the top layer, the arm nand flash Boot Mode is used. At this time, C files related to the nor and UART boot modes are not compiled.

Introduction:
Ubl_davinci.lds: Specify the UBL sections and UBL entry address; UBL. c: run the selfcopy function, copy yourself to ram, then jump to the normal entry address, execute functions such as boot () and main (), and call dm644xinit (), copy uboot to the ram-related address, and finally run the uboot entry address (entrypoint). Then uboot can run. Dm644x. C: Mainly used to configure the minimum system, such as Guanzhong disconnection, pll1, pll2 settings, DDR2 timing settings, UART settings, and so on. Util. C: it is a number of related common functions such as malloc. Nand. C: mainly driven by NAND Flash; Nandboot. C: Implements nand_copy to copy uboot from NAND to the corresponding DDR2 (RAM. UBL does not have many things to transplant, mainly because it should be defined in dm644x. C, Uint32 pll1_mult = 22; // DSP = 594 MHz for dm6446, dm6441 generally uses uint32 pll1_mult = 19; // DSP = 513 MHz. In the pll2init () function, you need to set different parameters and real-time sequence parameters when using different models of DDR. This is the key. Nand. C and NAND. H is mainly to define the storage address of uboot in NAND. Different types of NAND Flash, such as small page (512 bytes) and large page (2048 bytes) these must be modified unless your NAND type is compatible with Ti EVM. Nandboot. c The main task is how to copy the u-boot.bin or a u-boot.img with a header to the DDR, the most likely problem here, the compiled U-BOOT file is generally with valid magic number (magic_number_valid ), endpoint: entrypaoit. If this information is incorrect, uboot cannot run. We recommend that you check the image or copy the image of uboot. h. UBL can run uboot in many ways, such as Linux kernel, rootfs, NFS, DSP, device driver, and application, you can start step-by-step development.

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.