Splash Screen in usbloader

Source: Internet
Author: User

The launch of the QC film is from qcpbl to qcsbl, to oemsbl, and then to usbloader of Android. Here, my version is android1.6 donut. Google adds lk to later versions, but it is the same for adding splashscreen to bootloader. The reason why oembootloader is not added to oembootloader is that it is inconvenient to log and debugging is not good. Therefore, it is implemented in usbloader and then transplanted to qcsbl.

Logically speaking, to realize the boot screen, it is relatively simple to run MDP and lcdc, and then initialize the panel, finally, you can throw the data to be displayed on the buffer. However, we still need to make some effort in implementation. We need to understand the hardware functions and sort out the work that needs to be done to achieve this goal:

1) The first step is to add it to bootlaoder. Therefore, you must be familiar with bootloader. It is more appropriate to set the position of the screen when the bootloader is running. Here, we need to consider where the bootloader runs, and some of the APIS we need can be used. We can just click the screen if those things can be initialized and used.

2) then MDP and lcdc need to run and understand what operations must be done to make the two chips work. This generally requires reference to the QC code, because after all, we do not know much about the chip. Apart from the clock, we do not know which registers need to be initialized and which ones are not needed.

3) The last step is the initialization of the Panel. Here the main difference is the use of asynchronous screen or synchronous screen problem, here we use SPI-RGB synchronous screen, SPI initialization we use gpio simulation, the most important question here is how to manipulate gpio in bootloader.

4) The last step is the data to be displayed. There are two methods: Write the binary data of the image to be displayed into the array, and put the image to be displayed into the NAND partition.

After learning about the work that needs to be done, the following are the various attacks ~~ First, let's talk about bootloader. After the main chip is powered on, the reset is followed by the clock, and then it will jump to a specific address on the Rom to execute the code. Here it is qcpbl, qcsbl will use config_data data to initialize Ram and NAND, then load qcsbl into RAM for execution, qcsbl will load oemsbl as a dynamic link library, and then oemsbl will load usbloader into memory, and reset arm11, so that arm11 starts to execute usbloader. Then, ARM9 loads AMSS into the memory. After the AMSS is loaded, it notifies arm11 to load the Linux kernel. Then, the systems on the last two cores run.

Let's focus on usbloader. Basically, bootloader is a form. First, it is a piece of init. s or start. assembly S is used to set some registers of arm, such as stack pointer R13, PC pointer R14, and store some parameters using R1-R3. After the Assembly is executed, blx will start to execute functions such as main or start of bootloader. In fact, the bootloader code is still quite nice. After all, it is much better to run a single thread all the way, than that of camera that does not open three threads for interaction. Generally, main initializes Ram and NAND, sets some clocks, initializes some necessary drivers, reads the kernel from the NAND and puts it into RAM, and finally gives the control to the kernel. This is because usbloader does not need to initialize Ram, mainly for clock and NAND partition table settings. Here is a simple answer, our splash screen can be placed behind the clock settings and board-level initialization.

After learning about the startup process, let's take a look at MDP and lcdc. to make these two things run, generally the Enable of power and clock, and then the initialization of related registers. Here I refer to the MDP and lcdc driver codes of QC, but the register settings must be supported by QC. We do not know the chip, it is impossible to set a value for each register. Here, I will briefly describe the registers that need to be assigned values. The image processor is generally interconnected. It will be useful for other chips in the future.

It is important to include the address of the DMA buffer, the RGB Data Type of the buffer, the buffer size, alignment, and other FB-related registers, and then some registers about the lcdc signal polarity, then there are some registers such as lcdc hsync vsync, such as start and end. Another important thing is pclk rate. Basically, after the Enable MDP and lcdc clock are completed, the chip can correctly send data after these registers are set. If there is a problem, then... Then debug it slowly ~~ I didn't set the pclk rate at the beginning, so the image was not correct ~~

Finally, we initialized the panel. The most important aspect of panel Initialization is the use of gpio, because we are currently using a dual-core, and the gpio settings are actually on the arm11, we need to set the specific permissions of gpio on arm11. Here, usbloader controls gpio by writing the gpio shadow register. Here, we note that the gpio permission must be assigned to arm11, otherwise the shadow register is useless. Knowing how to operate gpio makes the initialization process simple.

There is a difference between a synchronous screen and an asynchronous screen. The synchronous screen itself does not have a timing circuit, and all the time sequences must be provided by MPU, and it does not have an lcdc controller, therefore, the screen data must be refresh at a frequency. The asynchronous screen has its own lcdc controller, which does not require the lcdc of the main chip. to display the image, you only need to update the image and do not need to provide the signal continuously.

Now the screen is working normally. Let's take a look at how to display our images. To display the image, you only need to put the RGB data into the buffer, and the DMA will send the data to the Panel for display. Therefore, the data type must match the register settings. Here, I use the array method to save the data to be displayed. Of course, I can also read the class content in the partition table. In general, the splash screen is generated by running a serial code of raw data *. RLE file. The following describes how to obtain the expected pixel array:

First, convert the PNG Image to rawdata using the covert command provided by imagemagic. The command is: Convert *. PNG-depth 8 RGB :*. raw then uses the rgb2565 Command provided by Android to convert the data to RLE format, rgb2565-RLE <*. raw> *. rle uses xxd-I *. rle> initlogo. h. Convert the RLE file into an array. Note that the array obtained using xxd is of the unsigned char type, and the RLE files are stored in the short format. In this way, you need to combine the two Char into a short, in Linux on x86, litte-edian is used to store data. Therefore, when merging data, you must note that the High Level is actually behind. Special attention should be paid here. At first, because I did not pay attention to it, the image is always wrong.

This is basically the case ~~ I will try again later ~~

 

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.