需准备的软件包:
libminigui-1.6.x-linux.tar.gz //开发库
minigui-res-1.6.tar.gz //资源文件,如bmp,font,icon 等
minigui-dev-1.6.2-for-win32 //
用于在
windows VC
开发的程序包
参考文献:
1 Hily Jiang. MiniGUI
源码走读
.http://hily.iyi.cn
2 uClinux
下显示驱动移植及
minigui
的移植
感谢:
qq
群
.
嵌入式技术交流
02.
小鹤
1 开启uClinux的FrameBuffer支持
1.1
修改
/uClinux-dist/vendors/Samsung/44B0/config.linux-2.4.x
确定 CONFIG_VT=y //VT 应该是Virtual Terminal
1.2 修改/uClinux-dist/linux-2.4.x/drivers/video/s3c44b0xfb.c
默认情况下是支持16灰度屏的,如果是256色屏,则需要将#define LCD_GRAY_16 注释掉。
1.3 增加fb0设备
修改vendors/Samsung/44B0/Makefile
1.4 驱动确定
linux-2.4.x/drivers/video/Config.in
if [ "$CONFIG_CPU_S3C44B0X" = "y" ]; then
tristate ' Samsung S3C44B0X built-in LCD controller frame buffer support' CONFIG_FB_S3C44B0X
fi
linux-2.4.x/drivers/video/Makefile
obj-$(CONFIG_FB_S3C44B0X) +=s3c44b0xfb.o
linux-2.4.x/drivers/video/fbmem.c
extern int s3c44b0xfb_init(void);
extern int s3c44b0xfb_setup(void);
#ifdef CONFIG_FB_S3C44B0X
{“s3c44b0xfb”,s3c440xfb_init,s3c44b0xfb_setup},
#endif
DEVICES = /
fb0,c,29,0
1.5 编译uClinux
对FrameBuffer部分配置的选择
/********************************************************************************
*
* Console drivers
*
VGA text console (CONFIG_VGA_CONSOLE) [N/y/?] (NEW) n
Support Frame buffer devices (CONFIG_FB) [N/y/?] (NEW) y
*
* Frame-buffer support
*
Support for frame buffer devices (EXPERIMENTAL) (CONFIG_FB) [Y/n/?]
Acorn VIDC support (CONFIG_FB_ACORN) [N/y/?] (NEW) n
CLPS711X LCD support (CONFIG_FB_CLPS711X) [N/y/?] (NEW) n
Cyber2000 support (CONFIG_FB_CYBER2000) [N/y/?] (NEW) n
SA-1100 LCD support (CONFIG_FB_SA1100) [N/y/?] (NEW) n
Advanced low level driver options (CONFIG_FBCON_ADVANCED) [N/y/?] (NEW) y
Monochrome support (CONFIG_FBCON_MFB) [N/y/?] (NEW) n
2 bpp packed pixels support (CONFIG_FBCON_CFB2) [N/y/?] (NEW) n
4 bpp packed pixels support (CONFIG_FBCON_CFB4) [N/y/?] (NEW) n
8 bpp packed pixels support (CONFIG_FBCON_CFB8) [N/y/?] (NEW) y
16 bpp packed pixels support (CONFIG_FBCON_CFB16) [N/y/?] (NEW) n
24 bpp packed pixels support (CONFIG_FBCON_CFB24) [N/y/?] (NEW) n
32 bpp packed pixels support (CONFIG_FBCON_CFB32) [N/y/?] (NEW) n
Amiga bitplanes support (CONFIG_FBCON_AFB) [N/y/?] (NEW) n
Amiga interleaved bitplanes support (CONFIG_FBCON_ILBM) [N/y/?] (NEW) n
Atari interleaved bitplanes (2 planes) support (CONFIG_FBCON_IPLAN2P2) [N/y/?] (NEW) n
Atari interleaved bitplanes (4 planes) support (CONFIG_FBCON_IPLAN2P4) [N/y/?] (NEW) n
Atari interleaved bitplanes (8 planes) support (CONFIG_FBCON_IPLAN2P8) [N/y/?] (NEW) n
Amiga bitplanes support (CONFIG_FBCON_AFB) [N/y/?] (NEW) n
Amiga interleaved bitplanes support (CONFIG_FBCON_ILBM) [N/y/?] (NEW) n
Atari interleaved bitplanes (2 planes) support (CONFIG_FBCON_IPLAN2P2) [N/y/?] (NEW) n
Atari interleaved bitplanes (4 planes) support (CONFIG_FBCON_IPLAN2P4) [N/y/?] (NEW) n
Atari interleaved bitplanes (8 planes) support (CONFIG_FBCON_IPLAN2P8) [N/y/?] (NEW) n
Mac variable bpp packed pixels support (CONFIG_FBCON_MAC) [N/y/?] (NEW) n
VGA 16-color planar support (CONFIG_FBCON_VGA_PLANES) [N/y/?] (NEW) n
VGA characters/attributes support (CONFIG_FBCON_VGA) [N/y/?] (NEW) n
HGA monochrome support (EXPERIMENTAL) (CONFIG_FBCON_HGA) [N/y/?] (NEW) n
Support only 8 pixels wide fonts (CONFIG_FBCON_FONTWIDTH8_ONLY) [N/y/?] (NEW) n
Select compiled-in fonts (CONFIG_FBCON_FONTS) [N/y/?] (NEW) y
VGA 8x8 font (CONFIG_FONT_8x8) [N/y/?] (NEW) y
VGA 8x16 font (CONFIG_FONT_8x16) [N/y/?] (NEW) y
Sparc console 8x16 font (CONFIG_FONT_SUN8x16) [N/y/?] (NEW) n
Pearl (old m68k) console 8x8 font (CONFIG_FONT_PEARL_8x8) [N/y/?] (NEW) n
Acorn console 8x8 font (CONFIG_FONT_ACORN_8x8) [N/y/?] (NEW) n
Virtual terminal (CONFIG_VT) [Y/n/?]
Support for console on virtual terminal (CONFIG_VT_CONSOLE) [N/y/?] (NEW) n
*********************************************************************************/
因为LCD是256色的,所以选择下项
8 bpp packed pixels support (CONFIG_FBCON_CFB8) [N/y/?] (NEW) y
如果下载内核后进不去系统,则Virtual Terminal 不选,如果进去后fb0不能用,则要选,因为不选的话会屏蔽Support Frame buffer devices (CONFIG_FB) [N/y/?] (NEW) y的设置,Virtual Terminal 意思是超级终端显示的数据在LCD上显示,同时超级终端也显示。
1.6 测试/dev/fb0
1)测度程序 test1.c
测试/dev/fb0 有没存在,以及其属性
/*******************************************************************************
#include <linux/fb.h>
#include <unistd.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
int main ()
{
int fp=0;
struct fb_var_screeninfo vinfo;
struct fb_fix_screeninfo finfo;
fp = open ("/dev/fb0",O_RDWR);
if (fp < 0){
printf("Error : Can not open framebuffer device/n");
return 0;
}
if (ioctl(fp,FBIOGET_FSCREENINFO,&finfo)){
printf("Error reading fixed information/n");
return 0;
}
if (ioctl(fp,FBIOGET_VSCREENINFO,&vinfo)){
printf("Error reading variable information/n");
return 0;
}
printf("The mem is :%d/n",finfo.smem_len);
printf("The line_length is :%d/n",finfo.line_length);
printf("The xres is :%d/n",vinfo.xres);
printf("The yres is :%d/n",vinfo.yres);
printf("bits_per_pixel is :%d/n",vinfo.bits_per_pixel);
close (fp);
return 0;
}
*******************************************************************************/
2) 测试程序test2.c
在LCD上显示一张图片
/**********************************************************************************
#include <linux/fb.h>
#include <unistd.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
const unsigned char gImage_bmp[76560]={……}
int main()
{
int framebuffer_device;
int line_size,buffer_size,i;
char *screen_memory;
struct fb_var_screeninfo var_info;
struct fb_fix_screeninfo fix_info;
framebuffer_device=open("/dev/fb0",O_RDWR);
ioctl(framebuffer_device,FBIOGET_VSCREENINFO,&var_info);
ioctl(framebuffer_device,FBIOGET_FSCREENINFO,&fix_info);
line_size=var_info.xres*var_info.bits_per_pixel/8;
buffer_size=line_size*var_info.yres;
var_info.xoffset=0;
var_info.yoffset=0;
screen_memory=(char*)mmap(0,buffer_size,PROT_READ|PROT_WRITE,0,framebuffer_device,0);
for(i=0;i<buffer_size;i++)
{
*(screen_memory+i)=gImage_bmp[i];
}
sleep(2);
return 0;
}
**********************************************************************************/
3) 将程序编译进内核
uClinux-dist/romfs/ 里的文件是最终生成的内核文件,也是开发板上系统能看到的文件,要将文件编译进内核,只需把文件放到这里就行,然后make
arm-elf-gcc –elf2flt –o test1 test1.c
arm-elf-gcc –elf2flt –o test2 test.c
将test1 test2 放到uClinux-dist/romfs/usr/里
Make 两次,我发现make一次没装进去。
内核编译后下载进开发板,进入系统,运行程序就可测出/dev/fb0有没存在,FrameBuffer有没配置成功。
2 minigui移植
2.1
安装库和资源
1)
解压
minigui-res-1.6.tar.gz
,
设置config.linux文件,将编译器设置为arm-elf-gcc。并将安装路径设置为arm-elf-gcc所在的目录。
tar –zxvf minigui-res-1.6.tar.gz
修改config.linux
prefix = $(TOPDIR)/usr/local/
CC = arm-elf-gcc
然后
Make install
安装到/usr/local/lib/minigui/res
该res 是MiniGUI.cfg 里面资源引用的位置,也是进行移植的资源。
prefix = $(TOPDIR)/usr/local/arm-elf
CC = arm-elf-gcc
然后
Make install
安装到/usr/local/arm-elf/lib/minigui/res 编译器库里的资源
2)
解压
libminigui-1.6.x-linux.tar.gz,
修改编译参数
tar –zxvf libminigui-1.6.x-linux.tar.gz
修改
libminigui-1.6.2-linux/scripts/mkconfig
if check_value "CONFIG_COMPILER_ARM_ELF"; then
# CFLAGS="$CFLAGS -D__PIC__ -fpic -msingle-pic-base"
CFLAGS="$CFLAGS -D__PIC__ -fno-pic -fno-PIC"
Fi
不然在开发板运行程序时会出现如下错误码:
Unhandled fault:external abort on linefetch (F4) at 0x00000001
Fault-common.c(97):start_code=0xc2b9ca0,start_stack=0xc63ff98)
Pid 28:failed 7
3)
配置编译环境
make menuconfig
System wid option
选择
Clipboard support
Unit of timer is 10ms
Mouse button can do double click
Gal engine option
选择
GAL and its engines:NEWGAL
Include Advanced 2D Graphics APIs
NEWGAL dummy engine
NEWGAL engine on Linux FrameBuffer console
Have console on
IAL engine options
选择
Dummy IAL engine
Font options
选择
Raw bitmap font
Image option
选择
GIF file support
Appearance options
选择
Flat
Ext library options
选择
TreeView control
ListView control
MonthCalendor control
SpinBox control
CoolBar control
Animation control
IconView control
Grid control
Development environment options
The target operating system:uClinux
Compiler:arm-elf-gcc
Libc:uClibc
uClinux-dist directory:/opt/uClinux-dist //uClinux-dist 的位置
Path prefix:/usr/local/arm-elf //arm-elf-gcc 的位置
CFLAGS和LDFLAGS I 不填。
Tarball baler options
选择
uClinux
保存退出
make
make install
安装到/usr/local/arm-elf-gcc/
2.2 移植配置文件和资源
1) 配置文件 MiniGUI.cfg
配置文件的名称必需是MiniGUI.cfg,放在/etc/ 下。
由于DRAM的大小限制,我对MiniGUI的资源进行了裁减,主要是字体部分。fbcon 表示采用Framebuffer,dummy表示没有输入设备,如触摸屏。
[varbitmapfonts]
font_number=0
表示没有varbitmapfonts,会忽略该字段下的资源引用。
/******************************************************************************
[system]
# GAL engine
gal_engine=fbcon
# IAL engine
ial_engine=dummy
mdev=none
mtype=none
[fbcon]
defaultmode=320x240-8bpp
[qvfb]
defaultmode=320x240-8bpp
display=0
# The first system font must be a logical font using RBF device font.
[systemfont]
font_number=1
font0=rbf-fixed-rrncnn-8-16-ISO8859-1
#font1=*-fixed-rrncnn-*-16-GB2312
#font2=*-Courier-rrncnn-*-16-GB2312
#font3=*-Times-rrncnn-*-16-GB2312
#font4=*-Helvetica-rrncnn-*-16-GB2312
default=0
wchar_def=0
fixed=0
caption=0
menu=0
control=0
[rawbitmapfonts]
font_number=1
name0=rbf-fixed-rrncnn-8-16-ISO8859-1
fontfile0=/usr/res/font/8x16-iso8859-1.bin
#name1=rbf-fixed-rrncnn-16-16-GB2312.1980-0
#fontfile1=/usr/res/font/song-16-gb2312.bin
[varbitmapfonts]
font_number=0
name0=vbf-Courier-rrncnn-10-15-ISO8859-1
fontfile0=/usr/res/font/Courier-rr-10-15.vbf
name1=vbf-Helvetica-rrncnn-15-16以上是关于MiniGUI移植总结的主要内容,如果未能解决你的问题,请参考以下文章
s5pv210移植Minigui3.0.12
MiniGUI详细资料大全
手把手教你安装MINIGUI编程环境 (MINIGUI版本3.2.0)
构建MiniGUI编译环境
建立基于ARM-uClinux的MiniGUI开发环境
MiniGUI编译器前的注意点