TI Davinci DM6446 Development Guide - UBL Porting
[Copy link]
The programming of UBL is relatively simple compared to UBOOT, KERNEL, ROOTFS, device driver, and DSP development. Let's start with the startup of DAVINCI to understand the position and role of UBL in the DAVIN system. For the Davinci dm644x embedded system whose firmware program is burned in NAND FLASH, the power-on startup process is: RBL->UBL->U-Boot->Kernel->APPs RBL (ARM ROM Boot Loader) has been burned into ROM when the chip leaves the factory, so you don't need to worry about it. After power-on, RBL will automatically execute instructions from EMIFA EM_CS2 memory space (0x0200 0000). This address is the chip select start address of NAND FLASH or NOR FLASH. When your system is set to NAND BOOT, UBL (User Boot Loader) is essential, otherwise RBL cannot directly boot UBOOT, because RBL only supports 14K NAND FLASH BOOT program, and the bin file compiled by UBOOT is generally larger than 80K, especially the higher the version, the larger the UBOOT code, so you need to write a UBL at this time. UBL reads UBOOT from NAND FLASH, and then copies UBOOT to the relevant address of DDR2 (RAM), and then boots UBOOT. According to the provisions of TI DAVIN RBL, the address saved by UBL is different for different models of NAND FLASH. The address saved by NAND with 512 bytes PAGE (i.e. SMALL PAGE) is: 0x00004000; the address saved by NAND with 2048 bytes PAGE (i.e. LARGE PAGE) is: 0x20000. The transplantation of UBL is relatively simple. Of course, the prerequisite is that you have set up the cross-compilation environment. Enter the top folder of the UBL file 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 related *.h files and two makefiles. If the top makefile selects $(MAKE) -C src FLASH=nand, it means using ARM nand flash boot mode, then the c files related to NOR, UART BOOT mode will not be compiled. Introduction: ubl_davinci.lds: specifies the SECTIONS of UBL and the entry address of UBL itself; ubl.c: starts running from the selfcopy function, copies itself to RAM, then jumps to the normal entry address, executes boot(), main() and other functions, calls DM644xInit(), copies UBOOT to the RAM related address, and finally executes the entry address (EntryPoint) of UBOOT, then UBOOT can run. dm644x.c: mainly configures the minimum system, such as disabling interrupts, PLL1, PLL2 settings, DDR2 timing settings, UART settings, etc. util.c: some related malloc and other public functions. nand.c: mainly the driver of NAND FLASH; nandboot.c: mainly implements NAND_Copy, copying UBOOT from NAND to the corresponding DDR2 (RAM). There are not many things to be transplanted in UBL, mainly in dm644x.c to define: Uint32 PLL1_Mult = 22; // DSP=594 MHz for DM6446, DM6441 generally uses Uint32 PLL1_Mult = 19; // DSP=513 MHz. In the PLL2Init() function, different parameters need to be set when using different types of DDR, such as timing parameters, which is the key point. The main purpose of porting Nand.c and nand.h is 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), need to be modified unless your NAND type is compatible with TI EVM. The main task of nandboot.c is to correctly copy u-boot.bin or u-boot.img with header to DDR. This is the easiest place to go wrong. The compiled U-BOOT file usually has Valid magic number (MAGIC_NUMBER_VALID) and entry address entrypaoit. If these information are incorrect, UBOOT will not run. It is recommended to read or copy UBOOT's image.h. UBL runs UBOOT, and many things can be done, such as LINUX KERNEL, ROOTFS, NFS, DSP, device driver, application, etc., and can all be developed step by step. [ This post was last edited by kooking on 2013-10-30 20:42 ]
|