U-Boot display support on i.MX51

Published on September 15, 2010

Archived Notice

This article has been archived and may contain broken links, photos and out-of-date information. If you have any questions, please Contact Us.

At long last, the boundary20100817 branch of our U-Boot tree has support for text and graphics output on up to two displays.

Operating system support

Eventually, you'll be able to configure the boot loader with the proper display settings and both Linux and Windows CE will honor them. In the meantime, you'll still need to pass command-line arguments to Linux and have a Windows CE image compiled for the proper display.

Configuration and testing

Displays are configured through the use of a command named 'lcdpanel', which has a number of use cases as shown in help lcdpanel. U-Boot > help lcdp lcdpanel - lcdpanel [panelName|*|?|+|-] initialize lcd panel with panel name Usage: lcdpanel * will display a short decription of each supported panel ? will display a full decription of each + will prompt for panel details - will disable all panels Separate multiple panels with '&' Used with no arguments, lcdpanel will show the current settings. U-Boot > lcdp ------------------------------------ name : vesafb pixclock : 63500000 xres : 1024 yres : 768 pclk_redg : 1 hsyn_acth : 0 vsyn_acth : 1 oepol_actl : 0 hsync_len : 104 left_margin : 152 right_margin : 48 vsync_len : 4 upper_margin : 23 lower_margin : 3 active : 1 CRT ? 1 vesafb:63500000,1024,768,1,0,1,0,104,152,48,4,23,3,1,1 fbAddress ? 0xafe80000 fbMemSize ? 1572864 bytes 1 panel(s) defined Called with a single parameter of '*', lcdpanel will show all compiled-in panel settings: U-Boot > lcdp * xres yres CRT name 320 240 N hitachi_qvga 320 240 N sharp_qvga 320 240 N okaya_qvga ... 1360 480 Y lg1360x480 Called with a single parameter of '+', lcdpanel will prompt you for each of more than a dozen parameters that describe the panel. For the sake of simplicity, I'll skip describing most of the details. Let's just say that tweaking each of these parameters has been necessary in order to support one or more of the panels we've glued up to either a PXA-based processor or an i.MX device. If invoked with a single parameter of something else, lcdpanel will attempt to parse a panel description in one of three forms:
  1. A panel name from the list given by 'lcdpanel *', or
  2. A short-hand panel description matching the VESA Generalized Timing Formula of the form 'vesa:WxHxHz[C]' where
    • W is the width or x-resolution in pixels,
    • H is the height or y-resolution in pixels,
    • Hz is the frequency in Hertz, and
    • C indicates that the display is connected through the CRT (HDMI) port, not directly to the parallel RGB signals
  3. A fully-qualified string of the form 'name:Hz,xres,yres,...'. Since these strings are pretty long, we recommend that you either first go through the process of adding a panel using the 'lcdpanel +' command or start by grabbing the fully qualified string from another panel spec and edit it as necessary.
Everything I said above is actually false. The parsing of a single-parameter command-line first tries to split the parameter into parts separated by an ampersand (&). If multiple parts are present, the lcdpanel command tries to parse each component individually. That's how you specify multiple  displays. No matter how you configured the display, the result will be stored in the panel environment variable. In order to save the setting, use the saveenv command. At boot time, U-Boot will initialize the display based on the value of that variable just as if you entered lcdpanel $panel.

Usage by boot scripts:

Once you have one or more displays configured, you can use them to display either text or graphics. Output text using the lecho command: U-Boot> lecho "Hello world" Each call to lecho will advance the cursor to the next line. The only font is an 8x8 fixed font. I don't believe it contains the full UTF8 character set. You can output graphics through the use of the bmp display command. Support is limited to 8-bit palettized, uncompressed BMP files. If you have ImageMagick installed, you can convert nearly anything to this form using a command-line like this: user@host:~$ convert splash.jpg -colors 255 -compress none splash.bmp If you don't have ImageMagick, go get it. It's a really handy tool! To display graphics, you first need to load a BMP file into RAM through either filesystem commands such as 'fatload' or network commands like 'tftp'. We typically use this script fragment to try to load a file named logosomething.bmp from the first (FAT) partition and display it at [0,0]. if fatload mmc 0 92000000 logo*.bmp ; then bmp display 92000000 ; fi

What about multiple displays?

You may have noticed that neither the lecho or bmp display commands have a reference to which display they operate on. This reference is implicit through an internal variable that can be set with the curpanel command. Used with no arguments, the curpanel command will show you each display and place an asterisk next to the active panel: U-Boot > curpanel *0 afe3e000/ 1843200 bytes 1280 720 000000 00ffff 0:2 mxcfb:raw 1 afcbe000/ 1572864 bytes 1024 768 000000 00ffff 0:2 mxcfb:raw If you give curpanel a panel number argument (0 or 1), it will switch to that panel: U-Boot > curpanel 1 0 afe3e000/ 1843200 bytes 1280 720 000000 00ffff 0:2 mxcfb:raw *1 afcbe000/ 1572864 bytes 1024 768 000000 00ffff 0:2 mxcfb:raw U-Boot > lecho "Hello display 1" U-Boot > curpanel 0 *0 afe3e000/ 1843200 bytes 1280 720 000000 00ffff 0:2 mxcfb:raw 1 afcbe000/ 1572864 bytes 1024 768 000000 00ffff 0:3 mxcfb:raw U-Boot > lecho "Hello display 0" That's it for now. We'll send updates when Linux and Windows CE have been updated to honor the U-Boot settings.