Skip to main content.

Topic UBootBitmapSupport not in WebOrder Bitmap Support

By adding the CONFIG_CMD_BMP option to your CONFIG_COMMANDS command selections you can enable support for bitmap images in U-Boot. This will add bmp to the list of commands in your configuration of U-Boot:

=> help bmp
bmp info <imageAddr>    - display image info
bmp display <imageAddr> - display image
This command can be used to show information about bitmap images or to display the images on your screen.

Example:
 
=> tftp 100000 /tftpboot/LWMON/denk_startup.bmp
TFTP from server 192.168.3.1; our IP address is 192.168.3.74
Filename '/tftpboot/LWMON/denk_startup.bmp'.
Load address: 0x100000
Loading: #############################################################
done
Bytes transferred = 308278 (4b436 hex)
=> bmp info 100000
Image size    : 640 x 480
Bits per pixel: 8
Compression   : 0
=> bmp display 100000

To keep the code in U-Boot simple and as fast as possible, the bitmap images must match the color depth of your framebuffer device. For example, if your display is configured for a color depth of 8 bpp (bit per pixel) then the bmp command will complain if you try to load images with a different color depth:

=> tftp 100000 /tftpboot/LWMON/Bergkirchen.bmp
TFTP from server 192.168.3.1; our IP address is 192.168.3.74
Filename '/tftpboot/LWMON/Bergkirchen.bmp'.
Load address: 0x100000
Loading: #################################################################
         #################################################################
         ###################################################
done
Bytes transferred = 921654 (e1036 hex)
=> bmp i 100000
Image size    : 640 x 480
Bits per pixel: 24
Compression   : 0
=> bmp d 100000
Error: 8 bit/pixel mode, but BMP has 24 bit/pixel

(As you can see above, the sub-commands "info" and "display" can be abbreviated as "i" resp. "d" .)

Images that are bigger than your framebuffer device will be clipped on the top and right hand side.

Images that are smaller than the display will be loaded into the top left corner.

ALERT! Since loading an image will define a new color map, the remainder of the display will appear with incorrect colors. It is therefore recommended that all images match exactly the size of the current display device. We accepted these restrictions since speed was top priority, and all attempts to implement scaling or optimizing the color maps would slow down the display too much. It is much easier to perform the necessary transformations on the development host, where a plethora of tools is available.

For example, to convert existing images to bitmap files with the required color depth (here: 8 bpp), the "PBM" -Tools can be used (PBM = portable pix map - see "man 5 ppm" ):

bash$ jpegtopnm Bergkirchen.jpg | \
> ppmquant 256 | \
> ppmtobmp -bpp 8 >Bergkirchen-8bit.bmp
jpegtopnm: WRITING PPM FILE
ppmquant: making histogram...
ppmquant: too many colors!
ppmquant: scaling colors from maxval=255 to maxval=127 to improve clustering...
ppmquant: making histogram...
ppmquant: too many colors!
ppmquant: scaling colors from maxval=127 to maxval=63 to improve clustering...
ppmquant: making histogram...
ppmquant: 9760 colors found
ppmquant: choosing 256 colors...
ppmquant: mapping image to new colors...
ppmtobmp: analyzing colors...
ppmtobmp: 231 colors found
ppmtobmp: Writing 8 bits per pixel with a color pallette

This gives the following results on the target:

=> tftp 100000 /tftpboot/LWMON/Bergkirchen-8bit.bmp
TFTP from server 192.168.3.1; our IP address is 192.168.3.74
Filename '/tftpboot/LWMON/Bergkirchen-8bit.bmp'.
Load address: 0x100000
Loading: #############################################################
done
Bytes transferred = 308278 (4b436 hex)
=> bmp i 100000
Image size    : 640 x 480
Bits per pixel: 8
Compression   : 0
=> bmp d 100000