Proteus 虚拟键值 二进制终端显示不正确,16进制没有显示出0x90,0x30,0x64

传感器proteus虚拟实验_图文_百度文库
两大类热门资源免费畅读
续费一年阅读会员,立省24元!
传感器proteus虚拟实验
&&传感器proteus虚拟实验
阅读已结束,下载文档到电脑
想免费下载本文?
定制HR最喜欢的简历
下载文档到电脑,方便使用
还剩17页未读,继续阅读
定制HR最喜欢的简历
你可能喜欢查看: 1159|回复: 2
16*64点阵程序+Proteus仿真
16*64点阵单片机仿真文件下载:
#include&reg52.h&
#define uchar unsigned char
#define uint unsigned int
sbit DS_red=P3^5;
sbit SHC=P3^2;
sbit STC=P3^3;
sbit OE_red=P3^4;
sbit SW1=P3^6;
sbit SW2=P3^7;
uint count,
uchar p,next,k,high,low,
unsigned char flag,a,i;
uchar code hang[]={0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f};
uchar code hanzi[10][32]={
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},& && && && && && && && && && && && && && && && &
{0x04,0x80,0x08,0x80,0x34,0x80,0xE7,0xFE,0x24,0x84,0x24,0x88,0x00,0x02,0x09,0x02,
0x09,0x04,0xFF,0xC8,0x09,0x30,0x92,0x28,0x52,0x44,0x12,0x82,0x02,0x1F,0x00,0x00},/*&钱&,0*/
{0x20,0x00,0x20,0x02,0x20,0x04,0x27,0xD8,0x24,0x40,0x24,0x42,0xA4,0x41,0x64,0x7E,
0x24,0x40,0x24,0x40,0x24,0x40,0x27,0xD0,0x20,0x08,0x20,0x06,0x20,0x00,0x00,0x00},/*&京&,1*/
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
& && && && && && && && && && && && && && && && &&&
void delay(uint z)
while(z--);
void delay1(uint z)
for(x=z;x&0;x--)
for(y=110;y&0;y--);
void SendByte(uchar date)
for(p=0;p&8;p++)
& &DS_red=date&0x80;
& &date=date&&1;
void Send_move(uchar date,uchar f)
&&DS_red=1;
&&for(i=0;i&f;i++)
& && && & SHC=0;
& && &&&DS_red=date&0x80;
& && &&&SHC=1;
& && && &date=date&&1;
void SendBytefew(uchar temp1,uchar temp2,few)
temp=temp1;
temp=(temp&&8)|temp2;
for(p=0;p&p++)
&&DS_red=temp&0x8000;
&&temp=temp&&1;
void main()
& && &&&TMOD=0x11;
& && &&&TH0=0
& && &&&TL0=0x90;
& && &&&EA=1;
& && &&&ET0=1;
& && &&&TR0=1;
& && &&&OE_red=0;
& && &&&speed=100;
& && &&&next=0;
&&while(1)
&&if(!SW1)
&&{delay(20);
& && && & if(!SW1)
& && && & if(speed&=300)
& && && & speed+=20;
& && && & while(!SW1);
& && && & delay(20);& && &&&
& & if(!SW2)
&&{delay(20);
& && && & if(!SW2)
& && && & if(speed&10)
& && && & speed-=30;
& && && & while(!SW2);
& && && & delay(20);& && &&&
void timer0() interrupt 1
&&TL0=0x90;
&&count++;
&&SendByte(hanzi[0+next][p]);
SendByte(hanzi[0+next][p+1]);
&&SendByte(hanzi[1+next][p]);
&&SendByte(hanzi[1+next][p+1]);
&&SendByte(hanzi[2+next][p]);
&&SendByte(hanzi[2+next][p+1]);
&&SendByte(hanzi[3+next][p]);
SendByte(hanzi[3+next][p+1]);
& &SendBytefew(hanzi[4+next][p],hanzi[4+next][p+1],yige);
&&OE_red=1;
& &P1=hang[k];
& &OE_red=0;
& &if(p==32)
& &if(k==16)
& && && && & k=0;
& &if(count&=speed)
& && && && &count=0;
& && && &yige++;
& && && &if(yige==16)
& && && &{
& && && &&&yige=0;
& && && &&&next++;
& && && &&&if(next==32)
& && && &&&next=0;
& && && &}
共享资料的黑币奖励!
这个只能加5分了 没有电路图,有图的话可加50分
#include&reg52.h&
#define uchar unsigned char
#define uint&&unsigned int
sbit DS_red=P3^0;&&//串行数据输入端,红色灯
sbit DS_green=P3^1;
sbit SHC=P3^2;& &&&//数据在上升沿进入移位寄存器
sbit STC=P3^3;& &//上升沿时将数据输出到并行端口
sbit OE_red=P3^4;&&//HC595是能段,必须设置!
sbit OE_green=P3^5;
sbit SW1=P3^6;& &//滚动减速
sbit SW2=P3^7;& &//滚动加速
uint count,&&//滚动速度
uchar p,next,k,high,low,
uchar code hang[]={0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,
0x0c,0x0d,0x0e,0x0f}; //刷行,控制74154管脚输出
uchar code hanzi[][32]={
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x7F,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x04,0x00,0x04,0x00,0x0F,0xF0,0x0C,0x20,0x12,0x40,0x61,0x80,0x02,0x60,0x0D,0x1E,0x71,0x08,0x1F,0xFC,0x01,0x00,0x09,0x20,0x11,0x18,0x21,0x08,0x05,0x00,0x02,0x00},
{0x05,0x00,0x45,0x00,0x29,0x00,0x13,0xFE,0x32,0x02,0x4C,0x02,0x89,0xF2,0x19,0x12,0x29,0x12,0x49,0x12,0x89,0xF2,0x09,0x02,0x08,0x02,0x08,0x04,0x50,0x14,0x20,0x08},
{0x08,0x20,0x08,0x20,0x7F,0xFC,0x08,0x20,0x08,0x20,0x0F,0xE0,0x08,0x20,0x0F,0xE0,0x08,0x20,0x08,0x20,0xFF,0xFE,0x08,0x40,0x0C,0x20,0x18,0x10,0x30,0x18,0x40,0x10},
{0x01,0x00,0x00,0x80,0x3F,0xFE,0x28,0x04,0x46,0x88,0x04,0x80,0x08,0x80,0x06,0x80,0x04,0x80,0x7F,0xFE,0x00,0x80,0x01,0x40,0x02,0x20,0x04,0x10,0x18,0x18,0x60,0x10},
{0x10,0x10,0x08,0x18,0x06,0x10,0x04,0x20,0x7F,0xFC,0x04,0x20,0x04,0x20,0x04,0x20,0x7F,0xFE,0x04,0x20,0x04,0x20,0x04,0x20,0x08,0x20,0x08,0x20,0x10,0x20,0x20,0x20},
{0x00,0x04,0x7F,0xFE,0x01,0x80,0x01,0x00,0x01,0x00,0x01,0x00,0x03,0x60,0x05,0x30,0x09,0x18,0x11,0x0C,0x21,0x08,0x41,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x00,0x00},
{0x00,0x00,0x7E,0x3C,0x05,0xD0,0x09,0x50,0x11,0x50,0x15,0x50,0x19,0x50,0x31,0x50,0xD1,0x50,0x51,0x48,0x11,0x48,0x11,0x64,0x12,0x56,0x12,0xFA,0x54,0x50,0x20,0x00},
{0x08,0x20,0x06,0x30,0x04,0x40,0x3F,0xF8,0x21,0x08,0x3F,0xF8,0x21,0x08,0x21,0x08,0x3F,0xF8,0x21,0x08,0x01,0x00,0xFF,0xFE,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x30,0x00,0x10,0x00,0x20,0x00,0x00,0x00},
{0x10,0x00,0x10,0xFC,0x10,0x84,0xFE,0xFC,0x38,0x84,0x34,0xFC,0x54,0x84,0x50,0x84,0x90,0xFC,0x00,0x00,0x01,0x00,0x08,0x84,0x28,0x82,0x28,0x12,0x67,0xF0,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x7F,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x04,0x00,0x04,0x00,0x0F,0xF0,0x0C,0x20,0x12,0x40,0x61,0x80,0x02,0x60,0x0D,0x1E,0x71,0x08,0x1F,0xFC,0x01,0x00,0x09,0x20,0x11,0x18,0x21,0x08,0x05,0x00,0x02,0x00},
{0x05,0x00,0x45,0x00,0x29,0x00,0x13,0xFE,0x32,0x02,0x4C,0x02,0x89,0xF2,0x19,0x12,0x29,0x12,0x49,0x12,0x89,0xF2,0x09,0x02,0x08,0x02,0x08,0x04,0x50,0x14,0x20,0x08},
{0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x7F,0xFE,0x00,0xC0,0x01,0x40,0x01,0x40,0x02,0x40,0x04,0x40,0x08,0x40,0x10,0x40,0x60,0x40,0x00,0x40,0x01,0x40,0x00,0x80},
{0x00,0x00,0x7E,0x3C,0x05,0xD0,0x09,0x50,0x11,0x50,0x15,0x50,0x19,0x50,0x31,0x50,0xD1,0x50,0x51,0x48,0x11,0x48,0x11,0x64,0x12,0x56,0x12,0xFA,0x54,0x50,0x20,0x00},
{0x08,0x20,0x06,0x30,0x04,0x40,0x3F,0xF8,0x21,0x08,0x3F,0xF8,0x21,0x08,0x21,0x08,0x3F,0xF8,0x21,0x08,0x01,0x00,0xFF,0xFE,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
};//刷列
void delay(uint z)
{
while(z--);
}
void delay1(uint z)
{
uint x,y;
for(x=z;x&0;x--)
for(y=110;y&0;y--);&&
}
//点阵显示位传送
void SendByte(uchar date)//595数据传送
{
for(p=0;p&8;p++)
{
SHC=0;
DS_red=date&0x80;
date=date&&1;
void Send_move(uchar date,uchar f)
{
DS_red=1;
for(i=0;i&f;i++)
{
SHC=0;
DS_red=date&0x80;
SHC=1;
date=date&&1;
}
}
void SendBytefew(uchar temp1,uchar temp2,few)//将十六位数据传给595
{
temp=temp1;
temp=(temp&&8)|temp2;
for(p=0;p&p++)
{
SHC=0;
DS_red=temp&0x8000;
SHC=1;
temp=temp&&1;
}
}
void main()
{
TMOD=0x11;
TH0=0&&
TL0=0x90;
EA=1;
ET0=1;
TR0=1;
OE_red=0;
speed=100;
next=0;
while(1)
{
if(!SW1)
{
delay(20);
if(!SW1)
{
if(speed&300)
speed+=20;
while(!SW1);
delay(20);
}
}
if(!SW2)
{
delay(20);
if(!SW2)
{
if(speed&10)
speed-=30;
while(!SW2);
delay(20);
}
}
}
}
void timer0() interrupt 1
{
TH0=0&&
TL0=0x90;
count++;
//先刷四个空格
SendByte(hanzi[0+next][p]);
SendByte(hanzi[0+next][p+1]);
SendByte(hanzi[1+next][p]);
SendByte(hanzi[1+next][p+1]);
SendByte(hanzi[2+next][p]);
SendByte(hanzi[2+next][p+1]);
SendByte(hanzi[3+next][p]);
SendByte(hanzi[3+next][p+1]);
SendBytefew(hanzi[4+next][p],hanzi[4+next][p+1],yige);//刷文字
OE_red=1;
STC=0;
STC=1;
P2=hang[k];//行显示
OE_red=0;//打开595使能端
k++;
p+=2;
if(p==32)
p=0;
if(k==16)
{
k=0;
if(count&=speed)
{
count=0;
yige++;
if(yige==16)
{
yige=0;
next++;
if(next==21)//注意next的值必须等于文字个数
next=0;
}
}
}
}
复制代码
Powered by非常详细的ok6410的linux系统移植《转载》
今天听了宋宝华(http://www.embedu.org/lecture/index.htm)的讲座,一下子恍然大悟,我必须做点什么。。。。。。
Linux 3.3.5系统移植
将arch/arm/mach-s3c6410/下的,mach-smdk6410.c cp为mach-my6410.c;
打开arch/arm/mach-s3c6410/下的Kconfig,仿照MACH_SMDK6410做一个菜单项:
config MACH_MY6410
bool "MY6410"
select CPU_S3C6410
select SAMSUNG_DEV_ADC
select S3C_DEV_HSMMC
select S3C_DEV_HSMMC1
select S3C_DEV_I2C1
select SAMSUNG_DEV_IDE
select S3C_DEV_FB
select S3C_DEV_RTC
select SAMSUNG_DEV_TS
select S3C_DEV_USB_HOST
select S3C_DEV_USB_HSOTG
select S3C_DEV_WDT
select SAMSUNG_DEV_BACKLIGHT
select SAMSUNG_DEV_KEYPAD
select SAMSUNG_DEV_PWM
select HAVE_S3C2410_WATCHDOG if
select S3C64XX_SETUP_SDHCI
select S3C64XX_SETUP_I2C1
select S3C64XX_SETUP_IDE
S3C64XX_SETUP_FB_24BPP
select S3C64XX_SETUP_KEYPAD
Machine support for the Pillar
打开arch/arm/tools/mach-types文件,这里面存的是机器ID必须要和uboot里面的ID保持一致,将其283行复制添加在后面并修改为:
smdk6410 MACH_SMDK6410 SMDK
xx6410 MACH_XX6410 XX 这个机器ID和UBOOT里的机器ID相同时才能启动内核;
修改BSP文件mach-my6410.c,内容如下:
将mach-mach-my6410.c文件中的所有smdk6410改成my6410(不要改大写SMDK6410的)
MACHINE_START(MY6410, "MY6410")//这个要和Kconfig里的MACH-MY6410匹配
在当前目录的Makefile最后一行加上 obj-$(CONFIG_MACH_MY6410) +=
mach-my6410.o
修改顶层的Makefile:
ARCH ?= arm
CROSS_COMPILE ?=
/usr/local/arm/4.2.2-eabi/usr/bin/arm-linux-
复制arch/arm/configs/下的s3c6400-defconfig文件,然后将其保存为.config,配置内核支持EABI,再选中XX6410
board这一项,保存退出;
执行make menuconfig对内核进行配置:
执行make编译
执行make zImage生成zImage
将uboot根目录下的mkimage拷贝到/user/bin目录下
执行make uImage生成uImage
通过以上几步linux内核移植完了,剩下就移植驱动了。
这里需要注意,每一次修改Kconfig文件都需要make menuconfig对内核进行配置。
LED驱动移植
Linu内核下drivers/leds/leds&gpio.c实现了一个体系结构无关的GPIO
LED驱动,使用此LED 驱动,开发者不需要修改一行代码,只需要在 BSP 的板文件(对于OK6410
为arch/arm/mach&s3c6410/mach&my6410.c)中定义相关的platform设备和数据。在
MY6410开发板上,GPM0~GPM3 实现了四个 LED,因此其对应的platform 信息如下:
arch/arm/mach&s3c6410/mach&my6410.c:
static struct gpio_led my6410_leds[]
.name = "LED1",
.gpio = S3C64XX_GPM(0),
.name = "LED2",
.gpio = S3C64XX_GPM(1),
.name = "LED3",
.gpio = S3C64XX_GPM(2),
.name = "LED4",
.gpio = S3C64XX_GPM(3),
static struct gpio_led_platform_data
my6410_gpio_led_pdata ={
.num_leds =
ARRAY_SIZE(my6410_leds),
.leds =my6410_leds,
static struct platform_device
my6410_device_led ={
.name = "leds-gpio",
.platform_data =
&my6410_gpio_led_pdata,
将&my6410_device_led添加到static struct platform_device
*my6410_devices[] __initdata中。
配置内核:
Device Drivers
[*] LED Support
&*& LED Support for
GPIO connected LEDs
下载内核后开发板上的四个LED这时候已经全部都亮了
按键驱动移植
Linux内核下的drivers/input/keyboard/gpio_keys.c 实现了一个体系结构无关的 GPIO
按键驱动,使用此按键驱动,开发者不需要修改一行代码,只需要在BSP 的板文件(对于
MY6410为arch/arm/mach&s3c6410/mach&my6410.c)中定义相关的platform
设备和数据。在 MY6410开发板上,用 GPN0~GPN5实现了DOWN、ENTER、HOME、UP、TAB、END
六个按键,因此其对应的 platform 信息如下:
arch/arm/mach&s3c6410/mach&my6410.c:
static struct gpio_keys_button
my6410_buttons[] = {
.gpio = S3C64XX_GPN(0),
.code = KEY_UP,
.desc = "Up",
.active_low = 1,
.wakeup = 0,
.gpio = S3C64XX_GPN(1),
.code = KEY_DOWN,
.desc = "Down",
.active_low = 1,
.wakeup = 0,
.gpio = S3C64XX_GPN(2),
.code = KEY_LEFT,
.desc = "Left",
.active_low = 1,
.wakeup = 0,
.gpio = S3C64XX_GPN(3),
.code = KEY_RIGHT,
.desc = "Right",
.active_low = 1,
.wakeup = 0,
.gpio = S3C64XX_GPN(4),
.code = KEY_ENTER,
.desc = "Enter",
.active_low = 1,
.wakeup = 0,
.gpio = S3C64XX_GPN(5),
.code = KEY_ESC,
.desc = "Esc",
.active_low = 1,
.wakeup = 0,
static struct gpio_keys_platform_data
my6410_button_data ={
.buttons =my6410_buttons,
=ARRAY_SIZE(my6410_buttons),
static struct platform_device
my6410_device_button = {
.name ="gpio-keys",
.platform_data
=&my6410_button_data,
my6410_device_button添加到static struct platform_device
*my6410_devices[] __initdata中
配置linux内核
Device Drivers
Input device support
[*] Keyboards
在移植按键驱动时候可能出现一下错误:
arch/arm/mach-s3c64xx/mach-my6410.c:298: error: array type has
incomplete element type
arch/arm/mach-s3c64xx/mach-my6410.c:300: error: field name not
in record or union initializer
arch/arm/mach-s3c64xx/mach-my6410.c:300: error: (near
initialization for 'my6410_buttons')
arch/arm/mach-s3c64xx/mach-my6410.c:301: error: field name not
in record or union initializer
arch/arm/mach-s3c64xx/mach-my6410.c:301: error: (near
initialization for 'my6410_buttons')
arch/arm/mach-s3c64xx/mach-my6410.c:302: error: field name not
in record or union initializer
arch/arm/mach-s3c64xx/mach-my6410.c:302: error: (near
initialization for 'my6410_buttons')
arch/arm/mach-s3c64xx/mach-my6410.c:303: error: field name not
in record or union initializer
arch/arm/mach-s3c64xx/mach-my6410.c:303: error: (near
initialization for 'my6410_buttons')
arch/arm/mach-s3c64xx/mach-my6410.c:304: error: field name not
in record or union initialize
………………..
………………………
……………………………………
可以看出这个错误提示的意思是没有找到定义的数组,然后其他的就引起一连串的错误,解决的办法很简单就是把
这个头文件添加进去就可以了。
今天已经就做这么多吧,人都快累垮了。。。。。。明天继续。。。。。。
LCD驱动移植
向mach-my6410.c里面填入相应的平台信息:
static struct s3c_fb_pd_win
my6410_fb_win0 = {
.win_mode = {
.left_margin = 2,
.right_margin = 2,
.upper_margin = 2,
.lower_margin = 2,
.hsync_len = 41,
.vsync_len = 10,
.xres = 480,
.yres = 272,
.max_bpp = 32,
.default_bpp = 16,
pixclock =
1000000 / DCLK = 1000000 / 9 =
left_margin =
right_margin =
hsync_len = Thp
upper_margin =
lower_margin =
vsync_len = Tvp
xres = Thd =
Yres = Tvd =
static struct map_desc my6410_iodesc[]
.virtual =
(unsigned long)S3C_VA_LCD,
__phys_to_pfn(S3C_PA_FB),
MT_DEVICE,
然后将28内核中的drviers/video/samsung拷贝到drviers/video/目录下
修改drviers/video/的Kconfig文件,在文件中加入
source "drivers/video/samsung/Kconfig"
修改修改drviers/video/的Makefie文件,再最后一行添加:
obj-$(CONFIG_FB_S3C_EXT) += samsung/
在arch/arm/plat-samsung/include/plat/map-base.h里面添加
#define S3C_VA_LCD S3C_ADDR(0x)
在include/generated/atuoconfig.h里面添加
#define CONFIG_FB_S3C_EXT_NUM 4
把drivers/video/samsung/s3cfb_fimd4x.c里面的
第1417行:
s3c6410_pm_do_save(s3c_lcd_save, ARRAY_SIZE(s3c_lcd_save));
s3c_pm_do_save(s3c_lcd_save, ARRAY_SIZE(s3c_lcd_save));
s3c6410_pm_do_restore(s3c_lcd_save,
ARRAY_SIZE(s3c_lcd_save));
s3c_pm_do_restore(s3c_lcd_save,
ARRAY_SIZE(s3c_lcd_save));
配置内核:
Device Drivers
Graphics support
&*& Support for frame
buffer devices ---& (里面的都空选)
&*& Support for frame
buffer devices ---&
[ ] Backlight & LCD
device support ---&
&*& S3C Framebuffer
Support (eXtended)(修改Kconfig之后才有这个选)
Select LCD Type (4.3 inch
480x272 TFT LCD) ---&
(X) 4.3 inch 480x272 TFT
&*& Advanced options
for S3C Framebuffer
Select BPP(Bits Per Pixel)
(16 BPP) ---&
(4) Number of
Framebuffers
[ ] Enable Virtual
[*] Enable Double
Console display driver
support ---&
&*& Framebuffer
Console support
[*] Bootup logo
---&(显示小企鹅)
[*] Standard 224-color Linux
如果驱动移植成功内核启动的时候会打印一下信息:
S3C_LCD clock got enabled :: 133.000 Mhz
LCD TYPE :: LTE480WV will be initialized
Window[0] - FB1: map_video_memory: clear ffdf800
FB1: map_video_memory: dma=5f900000 cpu=ffd80000
Window[0] - FB2: map_video_memory: clear ffdbfc00:0003fc00
FB2: map_video_memory: dma=5f93fc00 cpu=ffdbfc00
size=0003fc00
Console: switching to colour frame buffer device 60x34
fb0: s3cfb frame buffer device
Window[1] - FB1: map_video_memory: clear ffdf800
FB1: map_video_memory: dma=5f980000 cpu=ffd00000
Window[1] - FB2: map_video_memory: clear ffd3fc00:0003fc00
FB2: map_video_memory: dma=5f9bfc00 cpu=ffd3fc00
size=0003fc00
fb1: s3cfb frame buffer device
Window[2] - FB1: map_video_memory: clear ffccfc00
FB1: map_video_memory: dma=5fa00000 cpu=ffcc0000
size=0003fc00
fb2: s3cfb frame buffer device
Window[3] - FB1: map_video_memory: clear ffcfc00
FB1: map_video_memory: dma=5fa40000 cpu=ffc80000
size=0003fc00
fb3: s3cfb frame buffer device
在LCD还会显示小企鹅:
相应的驱动程序都在
drviers/video/Samsung/s3cfb.c目录下
今天就为这驱动搞了一天,其实早就可以成功的,TMMD的不知道是不是手贱还是怎么的,
竟然把System Type ---&
[* ] SMDK6400
选上了,最后系统一直打印都是SMDK6400的信息。幸好我靠
printk(KERN_INFO "DEBUG\n\n\n\n");
找到了原因。
以后有时间好好对LCD驱动做一下分析。
DM9000网卡驱动移植
Linux内核里面已经
支持了dm9000的网卡驱动,所以驱动程序我们不需要写了,只需要添加
相应的平台信息。在linux-3.3.5/arch/arm/mach-s3c64xx/mach-my6410.c里面添加都文件#include
在linux-3.3.5/arch/arm/mach-s3c64xx/mach-my6410.c里面添加以下平台信息:
#define S3C64XX_PA_DM00000)
#define S3C64XX_SZ_DM9000 SZ_1M
static struct resource my6410_dm9000_resources[] = {
.start= S3C64XX_PA_DM9000,
.end= S3C64XX_PA_DM9000 + 3,
.flags= IORESOURCE_MEM,
.start= S3C64XX_PA_DM9000 + 4,
.end= S3C64XX_PA_DM9000 + S3C64XX_SZ_DM9000 - 1,
.flags= IORESOURCE_MEM,
.start= IRQ_EINT(7),
.end= IRQ_EINT(7),
.flags= IORESOURCE_IRQ | IRQF_TRIGGER_HIGH,
static struct dm9000_plat_data
my6410_dm9000_platdata = {
.flags= DM9000_PLATF_16BITONLY,
.dev_addr= { 0x08, 0x90, 0x00, 0xa0,
0x90, 0x90 },
static struct platform_device
my6410_device_dm9000 = {
.name= "dm9000",
.num_resources=
ARRAY_SIZE(my6410_dm9000_resources),
.resource=
my6410_dm9000_resources,
.platform_data =
&my6410_dm9000_platdata,
然后在static struct platform_device *my6410_devices[] __initdata
&my6410_device_dm9000,
配置内核,这里网络配置的选项很多,但都要根据实际选对:
出现的问题及解决方案:
编译的时候出现:
SYSMAP System.map
SYSMAP .tmp_System.map
Inconsistent kallsyms data
This is a bug - please report about it
Try make KALLSYMS_EXTRA_PASS=1 as a workaround
make: *** [vmlinux] 错误 1
这样的错误没有任何提示,经过总结,我发现这样的错误出现的原因就是内核中有些设备没有配置但是在BSP里面却定义了,或者是
BSP里面定义了,但是内核没有配置。
解决方法是把static struct platform_device *my6410_devices[]
__initdata里面一些三星的东西去掉,其实如果从一个空模版移植是不会出现这类问题的,这里我还是有些偷懒。修改以后的内容如下:
static struct platform_device *my6410_devices[] __initdata =
#ifdef CONFIG_SMDK6410_SD_CH0
&s3c_device_hsmmc0,
&my6410_device_button,
&my6410_device_led,
&my6410_device_dm9000,
#ifdef CONFIG_SMDK6410_SD_CH1
&s3c_device_hsmmc1,
&s3c_device_i2c0,
//&s3c_device_i2c1,
&s3c_device_fb,
&s3c_device_ohci,
&s3c_device_usb_hsotg,
&samsung_asoc_dma,
//&s3c64xx_device_iisv4,
//&samsung_device_keypad,
#ifdef CONFIG_REGULATOR
//&my6410_b_pwr_5v,
//&my6410_lcd_powerdev,
//&my6410_smsc911x,
//&s3c_device_adc,
//&s3c_device_cfcon,
&s3c_device_rtc,
&s3c_device_ts,
//&s3c_device_wdt,
启动过程中出现这样的问题:
smsc911x: failed to claim resource
0(这个提示原来在这儿我怎么没有发现)
------------[ cut here ]------------
WARNING: at drivers/base/core.c:194
device_release+0x74/0x80()
Device 'platform-lcd.0' does not have a release() function, it
is broken and must be fixed.
Modules linked in:
[] (unwind_backtrace+0x0/0xf8) from []
(warn_slowpath_common+0x4c/0x64)
[] (warn_slowpath_common+0x4c/0x64) from []
(warn_slowpath_fmt+0x30/0x40)
[] (warn_slowpath_fmt+0x30/0x40) from []
(device_release+0x74/0x80)
[] (device_release+0x74/0x80) from []
(kobject_release+0x44/0x78)
[] (kobject_release+0x44/0x78) from []
(platform_add_devices+0x54/0x68)
[] (platform_add_devices+0x54/0x68) from []
(customize_machine+0x20/0x30)
[] (customize_machine+0x20/0x30) from []
(do_one_initcall+0x11c/0x170)
[] (do_one_initcall+0x11c/0x170) from []
(kernel_init+0x84/0x128)
[] (kernel_init+0x84/0x128) from []
(kernel_thread_exit+0x0/0x8)
---[ end trace 1b75b31a2719ed1c ]---
------------[ cut here ]------------
WARNING: at drivers/base/core.c:194
device_release+0x74/0x80()
Device 'samsung-keypad' does not have a release() function, it
is broken and must be fixed.
Modules linked in:
[] (unwind_backtrace+0x0/0xf8) from []
(warn_slowpath_common+0x4c/0x64)
[] (warn_slowpath_common+0x4c/0x64) from []
(warn_slowpath_fmt+0x30/0x40)
[] (warn_slowpath_fmt+0x30/0x40) from []
(device_release+0x74/0x80)
[] (device_release+0x74/0x80) from []
(kobject_release+0x44/0x78)
[] (kobject_release+0x44/0x78) from []
(platform_add_devices+0x54/0x68)
[] (platform_add_devices+0x54/0x68) from []
(customize_machine+0x20/0x30)
[] (customize_machine+0x20/0x30) from []
(do_one_initcall+0x11c/0x170)
[] (do_one_initcall+0x11c/0x170) from []
(kernel_init+0x84/0x128)
[] (kernel_init+0x84/0x128) from []
(kernel_thread_exit+0x0/0x8)
---[ end trace 1b75b31a2719ed1d ]---
------------[ cut here ]------------
WARNING: at drivers/base/core.c:194
device_release+0x74/0x80()
Device 'samsung-i2s.2' does not have a release() function, it is
broken and must be fixed.
Modules linked in:
[] (unwind_backtrace+0x0/0xf8) from []
(warn_slowpath_common+0x4c/0x64)
[] (warn_slowpath_common+0x4c/0x64) from []
(warn_slowpath_fmt+0x30/0x40)
[] (warn_slowpath_fmt+0x30/0x40) from []
(device_release+0x74/0x80)
[] (device_release+0x74/0x80) from []
(kobject_release+0x44/0x78)
[] (kobject_release+0x44/0x78) from []
(platform_add_devices+0x54/0x68)
[] (platform_add_devices+0x54/0x68) from []
(customize_machine+0x20/0x30)
[] (customize_machine+0x20/0x30) from []
(do_one_initcall+0x11c/0x170)
[] (do_one_initcall+0x11c/0x170) from []
(kernel_init+0x84/0x128)
[] (kernel_init+0x84/0x128) from []
(kernel_thread_exit+0x0/0x8)
---[ end trace 1b75b31a2719ed1e ]---
出现这个这个错误的原因根据提示可以知道那个玩意儿没有得到资源。
原来它在arch/arm/mach-s3c64xx/include/mach/map.h 被这样定义
#define S3C64XX_PA_XM0CSN1 ()
这个刚好我我们定义的DM9000的物理地址相同
所以就冲突了。解决方法很简单,就是把
static struct platform_device *my6410_devices[]
__initdata里面的
//&my6410_smsc911x,注释掉。
最后系统启动信息如下:
SMDK6410 # bootm c0008000
## Booting image at c0008000 ...
Image Name: Linux-3.3.5
8:00:27 UTC
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 1987128 Bytes = 1.9 MB
Load Address:
Entry Point:
Verifying Checksum ... OK
Starting kernel ...
Uncompressing Linux... done, booting the kernel.
Booting Linux on physical CPU 0
Linux version 3.3.5 (root@superzuo) (gcc version 4.2.2) #38 Thu
May 10 16:00:17 CST 2012
CPU: ARMv6-compatible processor [410fb766] revision 6 (ARMv7),
cr=00c5387d
CPU: PIPT / VIPT nonaliasing data cache, VIPT nonaliasing
instruction cache
Machine: my6410
Memory policy: ECC disabled, Data cache writeback
CPU S3C6410 (id 0x)
S3C24XX Clocks, Copyright 2004 Simtec Electronics
camera: no parent clock specified
S3C64XX: PLL settings, A=, M=, E=
S3C64XX: HCLK2=, HCLK=, PCLK=
mout_apll: source is fout_apll (1), rate is
mout_epll: source is epll (1), rate is
mout_mpll: source is mpll (1), rate is
usb-bus-host: source is clk_48m (0), rate is
audio-bus: source is mout_epll (0), rate is
audio-bus: source is mout_epll (0), rate is
audio-bus: source is mout_epll (0), rate is
irda-bus: source is mout_epll (0), rate is
camera: no parent clock specified
CPU: found DTCM0 8k @ , not enabled
CPU: moved DTCM0 8k to fffe8000, enabled
CPU: found DTCM1 8k @ , not enabled
CPU: moved DTCM1 8k to fffea000, enabled
CPU: found ITCM0 8k @ , not enabled
CPU: moved ITCM0 8k to fffe0000, enabled
CPU: found ITCM1 8k @ , not enabled
CPU: moved ITCM1 8k to fffe2000, enabled
Built 1 zonelists in Zone order, mobility grouping on. Total
pages: 65024
Kernel command line: noinitrd root=/dev/mtdblock3
rootfstype=yaffs2 console=ttySAC0 init=/linuxrc
video=fb:AT070TN83
PID hash table entries: 1024 (order: 0, 4096 bytes)
Dentry cache hash table entries: 32768 (order: 5, 131072
Inode-cache hash table entries: 16384 (order: 4, 65536
Memory: 256MB = 256MB total
Memory: 5740k available, 6404k reserved, 0K
Virtual kernel memory layout:
vector : 0xffff0000 - 0xffff1000 ( 4 kB)
DTCM : 0xfffe8000 - 0xfffec000 ( 16 kB)
ITCM : 0xfffe0000 - 0xfffe4000 ( 16 kB)
fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB)
vmalloc : 0xd0800000 - 0xff000000 ( 744 MB)
lowmem : 0xc0000000 - 0xd0000000 ( 256 MB)
modules : 0xbf000000 - 0xc0000000 ( 16 MB)
.text : 0xc0008000 - 0xc037e238 (3545 kB)
.init : 0xc037f000 - 0xc03a0000 ( 132 kB)
.data : 0xc03a0000 - 0xc03c8440 ( 162 kB)
.bss : 0xc03c9024 - 0xc03fe3eb ( 213 kB)
SLUB: Genslabs=13, HWalign=32, Order=0-3, MinObjects=0, CPUs=1,
NR_IRQS:246
VIC @f6000000: id 0x, vendor 0x41
VIC @f6010000: id 0x, vendor 0x41
Console: colour dummy device 80x30
Calibrating delay loop... 528.79 BogoMIPS (lpj=2643968)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
Setting up static identity map for 0x - 0x
gpiochip_add: registered GPIOs 38 to 53 on device: GPF
gpiochip_add: registered GPIOs 74 to 89 on device: GPI
gpiochip_add: registered GPIOs 91 to 102 on device: GPJ
gpiochip_add: registered GPIOs 161 to 176 on device: GPO
gpiochip_add: registered GPIOs 178 to 192 on device: GPP
gpiochip_add: registered GPIOs 194 to 202 on device: GPQ
gpiochip_add: registered GPIOs 144 to 159 on device: GPN
gpiochip_add: registered GPIOs 0 to 7 on device: GPA
gpiochip_add: registered GPIOs 9 to 15 on device: GPB
gpiochip_add: registered GPIOs 17 to 24 on device: GPC
gpiochip_add: registered GPIOs 26 to 30 on device: GPD
gpiochip_add: registered GPIOs 32 to 36 on device: GPE
gpiochip_add: registered GPIOs 55 to 61 on device: GPG
gpiochip_add: registered GPIOs 137 to 142 on device: GPM
gpiochip_add: registered GPIOs 63 to 72 on device: GPH
gpiochip_add: registered GPIOs 104 to 119 on device: GPK
gpiochip_add: registered GPIOs 121 to 135 on device: GPL
NET: Registered protocol family 16
fb frame buffer device
s3c64xx_dma_init: Registering DMA channels
PL080: IRQ 73, at d0804000, channels 0..8
PL080: IRQ 74, at d0806000, channels 8..16
S3C6410: Initialising architecture
bio: create slab at 0
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
s3c-i2c s3c: slave address 0x10
s3c-i2c s3c: bus frequency set to 64 KHz
s3c-i2c s3c: i2c-0: S3C I2C adapter
cfg80211: Calling CRDA to update world
regulatory domain
ROMFS MTD (C) 2007 Red Hat, Inc.
io scheduler noop registered
io scheduler deadline registered
io scheduler cfq registered (default)
start plist test
end plist test
S3C_LCD clock got enabled :: 133.000
Mhz(LCD驱动是OK的)
LCD TYPE :: LTE480WV will be
initialized
Window[0] - FB1: map_video_memory:
clear ffdf800
FB1: map_video_memory: dma=5f900000
cpu=ffd80000 size=
Window[0] - FB2: map_video_memory:
clear ffdbfc00:0003fc00
FB2: map_video_memory: dma=5f93fc00
cpu=ffdbfc00 size=0003fc00
Console: switching to colour frame
buffer device 60x34
fb0: s3cfb frame buffer
Window[1] - FB1: map_video_memory:
clear ffdf800
FB1: map_video_memory: dma=5f980000
cpu=ffd00000 size=
Window[1] - FB2: map_video_memory:
clear ffd3fc00:0003fc00
FB2: map_video_memory: dma=5f9bfc00
cpu=ffd3fc00 size=0003fc00
fb1: s3cfb frame buffer
Window[2] - FB1: map_video_memory:
clear ffccfc00
FB1: map_video_memory: dma=5fa00000
cpu=ffcc0000 size=0003fc00
fb2: s3cfb frame buffer
Window[3] - FB1: map_video_memory:
clear ffcfc00
FB1: map_video_memory: dma=5fa40000
cpu=ffc80000 size=0003fc00
fb3: s3cfb frame buffer
jkq debug VIDCON0 is 353
driver, 4 ports, IRQ sharing disabled
s3c6400-uart.0: ttySAC0 at MMIO 0x7f005000 (irq = 69) is a
S3C6400/10
console [ttySAC0] enabled
s3c6400-uart.1: ttySAC1 at MMIO 0x7f005400 (irq = 70) is a
S3C6400/10
s3c6400-uart.2: ttySAC2 at MMIO 0x7f005800 (irq = 71) is a
S3C6400/10
s3c6400-uart.3: ttySAC3 at MMIO 0x7f005c00 (irq = 72) is a
S3C6400/10
brd: module loaded
loop: module loaded
at24 0- byte 24c08 EEPROM, writable, 1 bytes/write
S3C24XX NAND Driver, (c) 2004 Simtec Electronics
dm9000 Ethernet Driver,
V1.31(DM9000网卡驱动是OK的)
eth0: dm9000a at da00004 IRQ
108 MAC: 08:90:00:a0:90:90 (platform data)
PPP generic driver version
PPP BSD Compression module
registered
PPP Deflate Compression module
registered
PPP MPPE Compression module
registered
NET: Registered protocol family 24
libertas_sdio: Libertas SDIO driver
libertas_sdio: Copyright Pierre Ossman
usbcore: registered new interface driver rt73usb
ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
s3c2410-ohci s3c2410-ohci: S3C24XX OHCI
s3c2410-ohci s3c2410-ohci: new USB bus registered, assigned bus
s3c2410-ohci s3c2410-ohci: irq 79, io mem 0x
s3c2410-ohci s3c2410-ohci: init err (0)
ohci_hcd: can't start s3c24xx
s3c2410-ohci s3c2410-ohci: startup error -75
s3c2410-ohci s3c2410-ohci: USB bus 1 deregistered
s3c2410-ohci: probe of s3c2410-ohci failed with error -75
mousedev: PS/2 mouse device common for all mice
s3c-rtc s3c64xx-rtc: rtc disabled, re-enabling
s3c-rtc s3c64xx-rtc: rtc core: registered s3c as rtc0
i2c /dev entries driver
sdhci: Secure Digital Host Controller Interface driver
sdhci: Copyright(c) Pierre Ossman
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
lib80211: common routines for IEEE802.11 drivers
VFP support v0.3: implementor 41 architecture 1 part 20 variant
input: gpio-keys as /devices/platform/gpio-keys/input/input0
s3c-rtc s3c64xx-rtc: setting system clock to
VFS: Cannot open root device "mtdblock3" or
unknown-block(0,0)
Please append a correct "root=" here are the
available partitions:
Kernel panic - not syncing: VFS: Unable to mount root fs on
unknown-block(0,0)
[] (unwind_backtrace+0x0/0xf8) from [] (panic+0x8c/0x200)
[] (panic+0x8c/0x200) from [] (mount_block_root+0x10c/0x2b0)
[] (mount_block_root+0x10c/0x2b0) from []
(prepare_namespace+0x14c/0x1dc)
[] (prepare_namespace+0x14c/0x1dc) from []
(kernel_init+0xe8/0x128)
[] (kernel_init+0xe8/0x128) from []
(kernel_thread_exit+0x0/0x8)
搭建NFS网络文件系统
制作文件系统的工具就是传说中的瑞士军刀busybox在他的官网
下载最新的版本为busybox-1.20.0
修改busybox的makefile:
CROSS_COMPILE ?= arm-linux-
ARCH ?= arm
Make menuconfig配置busybox
Busybox Settings ---&
Build Options ---&
Installation Options ("make install" behavior) ---&
Busybox Library Tuning ---&
编译busybox执行
Make install
这时候会提示一个错误提示说:
miscutils/ubi_tools.c:63:26: error: mtd/ubi-user.h: No such file
or directory
miscutils/ubi_tools.c: In function 'ubi_tools_main':
miscutils/ubi_tools.c:133: error: 'UBI_DEV_NUM_AUTO' undeclared
(first use in this function)
miscutils/ubi_tools.c:133: error: (Each undeclared identifier is
reported only once
miscutils/ubi_tools.c:133: error: for each function it appears
miscutils/ubi_tools.c:134: error: 'UBI_VOL_NUM_AUTO' undeclared
(first use in this function)
miscutils/ubi_tools.c:153: error: storage size of 'req' isn't
miscutils/ubi_tools.c:161: error: 'UBI_IOCATT' undeclared (first
use in this function)
miscutils/ubi_tools.c:153: warning: unused variable 'req'
make[1]: *** [miscutils/ubi_tools.o] 错误 1
make: *** [miscutils] 错误 2
出现这么多的错误,核心问题就是出现在miscutils/ubi_tools.c:63:26: error:
mtd/ubi-user.h: No such file or
directory这个上面,无法找到mtd/ubi-user.h头文件,查阅了相关资料后,原来这是一个Linux下新支持的UBI文件系统,需要手
工加入。从Linux3.3.5的include\mtd\ubi-user.h拷贝到busybox下的include\mtd下,如果
busybox下的include没有mtd文件夹,那就先建立一个mtd文件夹,然后复制了。这样做了之后,编译就OK了。出现下面的信息就说明编译成
建立根目录,这里我们直接写一个脚本程序运create_rootfs.sh行就可以了,脚本的内容如下:
echo "------Create rootfs directons start...--------"
mkdir rootfs
echo "--------Create root,dev....----------"
mkdir root dev etc boot tmp var sys proc lib mnt home usr
mkdir etc/init.d etc/rc.d etc/sysconfig
mkdir usr/sbin usr/bin usr/lib usr/modules
echo "make node in dev/console dev/null"
mknod -m 600 dev/console c 5 1
mknod -m 600 dev/null c 1 3
mkdir mnt/etc mnt/jffs2 mnt/yaffs mnt/data mnt/temp
mkdir var/lib var/lock var/run var/tmp
chmod 777 tmp
chmod 777 var/tmp
echo "-------make direction done---------"
运行脚本执行:
./ create_rootfs.sh
boot dev etc home lib mnt proc root sys tmp usr var
etc/inittab 系统init进程配置文件,并更改权限
chmod +x inittab
::sysinit:/etc/init.d/rcS
::askfirst:-/bin/sh #没有这就不行,就不能打开console控制台。
::restart:/sbin/init
::ctrlaltdel:/sbin/reboot
::shutdown:/bin/umount -a -r
::shutdown:/sbin/swapoff &a
etc/init.d/rcS系统启动加载项文件,并更改权限chmod
+x etc/init.d/rcS
PATH=/sbin:/bin:/usr/sbin:/usr/bin
runlevel=S
prevlevel=N
export PATH runlevel prevlevel
mkdir /dev/pts
mount -t devpts devpts /dev/pts #用于telnet登录时使用
echo /sbin/mdev & /proc/sys/kernel/hotplug
mkdir -p /var/lock
/bin/hostname -F /etc/sysconfig/HOSTNAME
etc/fstab 系统挂载文件系统列表文件
#device mount-point type option dump fsck order
proc /proc proc defaults 0 0
sysfs /sys sysfs defaults 0 0
mdev /dev ramfs defaults 0 0
none /var ramfs defaults 0 0
none /tmp ramfs defaults 0 0
etc/profile用户环境配置文件
# Ash profile
# vim: syntax= sh
# No core file by defaults
# ulimit - S - c 0& / dev/ null 2& & 1
USER="id -un"
LOGNAME=$USER
PS1="[\u@\h \w]#" #\w 目录将显示全路径
PATH=$PATH
HOSTNAME= '/bin/hostname'
alias cls="clear"
export USER LOGNAME PS1 PATH
/etc/passwd shadow 用户文件以及密码
把主机的passwd shadow 文件拷贝到/etc下
# cp /etc/passwd rootfs/etc
# cp /etc/group rootfs/etc
# cp /etc/shadow rootfs/etc
etc/sysconfig/HOSTNAME的内容为你自己的名字即可,内容为"Pillar"
gedit /etc/sysconfig/HOSTNAME 然后键入 Pillar
在busybox目录下会看见 _install目录,里面有/bin
/sbin l inuxr三个文件
将这三个目录或文件拷到第一步所建的rootfs文件夹下。
#cp bin/ sbin/ linuxrc /home/rootfs -ra
在把_install目录的usr里面的bin,sbin也按照刚才的方法拷贝到rootfs目录下
切记一定要带上-a的参数,因为bin目录里大部分都是链接,如果不带-a的参数,拷过去之后会做相应的复制,不再是链接的形式
将交叉编译器下的lib下的库拷贝到lib文件夹下
cp /usr/local/arm/4.2.2-eabi/lib
//#ifdef CONFIG_PLAT_S3C24XX
在arch/arm/
plat-samsung/include/plat/regs-adc.h的后面添加以下代码:
#define S3C_ADCREG(x) (x)
#define S3C_ADCCON S3C_ADCREG(0x00)
#define S3C_ADCTSC S3C_ADCREG(0x04)
#define S3C_ADCDLY S3C_ADCREG(0x08)
#define S3C_ADCDAT0 S3C_ADCREG(0x0C)
#define S3C_ADCDAT1 S3C_ADCREG(0x10)
#define S3C_ADCUPDN S3C_ADCREG(0x14)
#define S3C_ADCCLRINT S3C_ADCREG(0x18)
#define S3C_ADCMUX S3C_ADCREG(0x1C)
#define S3C_ADCCLRWK S3C_ADCREG(0x20)
#define S3C_ADCCON_RESSEL_10BIT (0x0&&16)
#define S3C_ADCCON_RESSEL_12BIT (0x1&&16)
#define S3C_ADCCON_ECFLG (1&&15)
#define S3C_ADCCON_PRSCEN (1&&14)
#define S3C_ADCCON_PRSCVL(x) (((x)&0xFF)&&6)
#define S3C_ADCCON_PRSCVLMASK (0xFF&&6)
#define S3C_ADCCON_SELMUX(x) (((x)&0x7)&&3)
#define S3C_ADCCON_SELMUX_1(x) (((x)&0xF)&&0)
#define S3C_ADCCON_MUXMASK (0x7&&3)
#define S3C_ADCCON_RESSEL_10BIT_1 (0x0&&3)
#define S3C_ADCCON_RESSEL_12BIT_1 (0x1&&3)
#define S3C_ADCCON_STDBM (1&&2)
#define S3C_ADCCON_READ_START (1&&1)
#define S3C_ADCCON_ENABLE_START (1&&0)
#define S3C_ADCCON_STARTMASK (0x3&&0)
#define S3C_ADCTSC_UD_SEN (1&&8)
#define S3C_ADCTSC_YM_SEN (1&&7)
#define S3C_ADCTSC_YP_SEN (1&&6)
#define S3C_ADCTSC_XM_SEN (1&&5)
#define S3C_ADCTSC_XP_SEN (1&&4)
#define S3C_ADCTSC_PULL_UP_DISABLE (1&&3)
#define S3C_ADCTSC_AUTO_PST (1&&2)
#define S3C_ADCTSC_XY_PST(x) (((x)&0x3)&&0)
#define S3C_ADCDAT0_UPDOWN (1&&15)
#define S3C_ADCDAT0_AUTO_PST (1&&14)
#define S3C_ADCDAT0_XY_PST (0x3&&12)
#define S3C_ADCDAT0_XPDATA_MASK (0x03FF)
#define S3C_ADCDAT0_XPDATA_MASK_12BIT (0x0FFF)
#define S3C_ADCDAT1_UPDOWN (1&&15)
#define S3C_ADCDAT1_AUTO_PST (1&&14)
#define S3C_ADCDAT1_XY_PST (0x3&&12)
#define S3C_ADCDAT1_YPDATA_MASK (0x03FF)
#define S3C_ADCDAT1_YPDATA_MASK_12BIT (0x0FFF)
配置内核:
System Type ---&
[*] ADC common driver support
Device Drivers ---&
Input device support ---&
[*] Touchscreens ---&
&*& S3C touchscreen driver
(只选这一个,其他的不要选)
&*& Event interface
如果触摸屏驱动没有问题的会就会出现以下驱动信息:
S3C Touchscreen driver, (c) 2008 Samsung Electronics
S3C TouchScreen got loaded
successfully : 12 bits
input: S3C TouchScreen as
/devices/virtual/input/input0
移植Qt4.8.1
tslib移植及测试
在采用触摸屏的移动终端中,触摸屏性能的调试是个重要问题之一,因为电磁噪声的缘故,触摸屏容易存在点击不准确、有抖动等问题。
  Tslib是一个开源的程序,能够为触摸屏驱动获得的采样提供诸如滤波、去抖、校准等功能,通常作为触摸屏驱动的适配层,为上层的应用提供了一个统一的接口。
在下载了最新的tslib
为虚拟机里的Linux系统安装工具:
apt-get install autoconf
apt-get install automake
apt-get install libtool
解压后编译
mv xxx(解压后名字) tslib //名字改为tslib
./autogen.sh
"ac_cv_func_malloc_0_nonnull=yes"&arm-linux.cache
./configure
--host=arm-linux --cache-file=arm-linux.cache --prefix=$(pwd)/tmp
打开tmp目录,里面有四个文件夹,分别是bin、etc、include、lib。将etc目录下的ts.conf里的第2行去掉注释。即:
# module_raw
module_raw
将bin/etc/lib目录下的文件及连接拷贝到文件系统下对应同名目录。include目录估计是编译应用程序时用的,在此可以不使用
在文件系统的/etc/profile后面添加以下环节变量:
export USER LOGNAME PS1
TSLIB_TSDEVICE=/dev/event0
TSLIB_CALIBFILE=/etc/pointercal
TSLIB_CONFFILE=/etc/ts.conf
TSLIB_PLUGINDIR=/lib/ts
TSLIB_CONSOLEDEVICE=none
TSLIB_FBDEVICE=/dev/fb0
重启开发板执行env命令,查看是否有以下环境变量:
TSLIB_TSDEVICE=/dev/event0
USER=id -un
TSLIB_FBDEVICE=/dev/fb0
PS1=[\u@\h \w]#
TSLIB_PLUGINDIR=/lib/ts
TSLIB_CONSOLEDEVICE=none
LOGNAME=id -un
TERM=vt102
PATH=/sbin:/usr/sbin:/bin:/usr/bin
TSLIB_CONFFILE=/etc/ts.conf
SHELL=/bin/sh
TSLIB_CALIBFILE=/etc/pointercal
这个TSLIB_TSDEVICE=/dev/event0环境变量所指的位置很重要,错了就会出现
ts_open:ts_open no such file or directory这样的错误
执行ts_test命令,就会出现以下画面:
如果出现-/bin/sh: ts_test: not
found这样的错误,说明交叉编译器里面的库没有拷贝进来,对于交叉编译器4.3.2是arm-none-linux-gnueabi/libc/lib
执行ts_calibrate命令就会出现以下画面:
移植qt-everywhere-opensource-src-4.8.1
解压qt-everywhere-opensource-src-4.8.1,在解压目录下我们自己先写一个autu.sh的脚本,脚本内容如下:
./configure -prefix
/usr/local/Qt \
& -no-qt3support \
& -qt-zlib \
& -qt-libtiff \
& -qt-libpng \
& -qt-libmng \
& -qt-libjpeg \
& -make libs \
& -nomake examples \
(因为这个是arm版本,所以编译出来的程序只能在arm开发板上运行,编译时把这些给去掉,加快编译过程)
& -nomake demos \
& -nomake docs \
& -no-nis \
& -no-cups \
& -no-iconv \
& -xplatform qws/linux-arm-g++ \
& -embedded arm \
& -little-endian \
& -qt-freetype \
& -depths 8,16,24,32 \
& -qt-gfx-linuxfb \
& -no-gfx-transformed \
& -no-gfx-qvfb \
& -no-gfx-vnc \
& -no-gfx-multiscreen \
& -qt-kbd-usb \
& -qt-kbd-tty \
& -qt-mouse-pc \
& -no-glib \
& -qt-mouse-tslib
-I /usr/local/Tslib/include
-L /usr/local/tslib/lib
make install
至于这些选项的含义搭建可以直接到Qt官网上去查。
如果最后出现这个错误:
./autoconfig.sh: 行 37: -I/usr/local/tslib/include:
没有那个文件或目录最后直接用
export QMAKE_INCDIR=/usr/local/tslib/include/
export QMAKE_LIBDIR=/usr/local/tslib/lib/
这样的设置经验证好像只有在arm-linux-gcc-4.4.1的版本中可行
在rootfs/usr/下新建一个文件为qtlib,将/usr/local/Qt/lib下的所有文件复制到qtlib目录下
设置环境变量:将rootfs/etc/profile里面添加一下环境变量:
export QTDIR=/usr/qilib
export QPEDIR=$QTDIR
export QT_PLUGIN_PATH=/usr/qilib
export T_ROOT=/usr/tslib
export PATH=$QTDIR/:$PATH
export QWS_MOUSE_PROTO=Tslib:/dev/event0
export LD_LIBRARY_PATH=$T_ROOT/lib:$QTDIR
export QT_QWS_FONTDIR=/usr/qilib/fonts
修改启动设置,修改rootfs/etc/init.d/rcS,添加一下内容:
source /etc/profile
echo "" & /dev/tty1
echo "" & /dev/tty1
echo "Designer is Pillar !" & /dev/tty1
echo "Staring touch calibrate..." & /dev/tty1
echo "" & /etc/tty1
/bin/ts_calibrate & #开机运行ts_calibrate
到这里qt-everywhere-opensource-src-4.8.1就移植完了
嵌入式Qt开发环境搭建
下载Qt集成开发环境
执行一下命令安装:
chmod u+x Qt_SDK_Lin32_offline_v1_2_en.run
./Qt_SDK_Lin32_offline_v1_2_en.run
新建工程,然后:
最后可以用file 命令查看文件属性
将文件拷贝到rootfs目录下:
执行:./books
就可以运行。
修改启动文件让开机就运行改文件,在rootf/etc/init.d/rcS文件中添加以下内容:
if [ -f "$TSLIB_CALIBFILE" ];
books -qws&
ts_calibrate
运行应用程序常见文件及错误分析:
Cannot create semaphore
/tmp/qtembedded-root/QtEmbedded-0
这是说明系统禁止了锁,可以在内核配置的第一个 generated配置里面找到:
[*] System V IPC
选上它,重新编译,再次烧入内核
Illegal instruction
库添加错误,一定要正确的添加交叉编译器的库和qt-everywhere-opensource-src-4.8.1编译生成的库
Segmentation fault
编译应用程序的编译器不对,推荐从内核到文件系统都用同一个交叉编译器,经验证
arm-linux-gcc-4.4.1这个编译器稳定性不错
这两天就搞了和Qt相关的这些事,错不多所有的的东西都是在5天的时间内搞定的,今天早上是6点钟起来写文档,不知道什么时候,我自己变得这么疯狂。
还有很多问题没有解决:
本来想搞个opia的,比如Qt
Extended,其实就是Qtopia.我搞的时候才发现:
Qt Extended是由的子公司(前称Trolltech)所开发。日,Qt Software宣布Qt
Extended不再继续作为独立产品而开发,部份功能整合进Qt
Framework。别人都终止了,所以就不提供源码了,网上有很多源码可以都可以下载,但是大多数都是别人改过的。飞凌的提供的源码也被他改的乱七八糟,我死都编译不过去,既然连源码都找不到,我移植就没有办法下手了。
还有一个交叉编译器的库的问题。仔细一点你会发现我用的arm-linux-gcc-4.4.1里面有好的的lib还有好的名字是重复的。大家可以看看这篇文章对交叉编译器的理解
已投稿到:
以上网友发言只代表其个人观点,不代表新浪网的观点或立场。}

我要回帖

更多关于 vm虚拟机 二进制 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信