每次读128个字节 但是循环读了约有10的次样子
就显示以下信息,然后自动就退出了
大家帮忙分析一下啊
在网上搜了一下,有类似的错误,但是好象都没有一个完整的办法
[/code]
/**********************************************************/
not Ack
Internal error: Oops: 0
CPU: 0
pc : [
sp : c2569f04 ip : 20000013 fp : 00000001
r10: bffffa10 r9 : 7fffffff r8 : c252e114
r7 : c252e000 r6 : c2569f24 r5 : c01eb26c r4 : c252e000
r3 : 00000110 r2 : 00000401 r1 : e400a08c r0 : 40000013
IRQs off FIQs on Mode SVC_32 Segment user
Control: 5317F Table: C2E20000 DAC: 00000015
Process ttytest (pid: 56, stackpage=c2569000)
Stack: (0xc2569ef4 to 0xc256a000)
40000093 U
00000000 U
00000000 U
c25264a0 U
00000000 U
00008db8 U
bffffa10 U
000086ec U
00000004 U
invalid frame pointer 0x00000001U
(e7913602) U
Segmentation fault
[/code]
[ 本帖最后由 rambo0808 于 2007-9-9 12:27 编辑 ]
rambo0808 于 2007-09-09 12:32:31发表:
大哥们帮帮忙啊
有朋友说是 栈溢出
rambo0808 于 2007-09-09 12:28:56发表:
不好意思啊 让大家帮忙却没有把信息提供完全
CPU : Freescale i.MX21, ( ARM926EJ-S) 266MHz
OS : Linux version 2.4.20-mx2bsp
板子的详细资料是这个连接
http://www.hhcn.com/chinese/HHARMMX21-Integration-R1.htm
meminfo 如下
[/code]
# cat /proc/meminfo
total: used: free: shared: buffers: cached:
Mem: 47742976 13053952 34689024 0 1953792 3907584
Swap: 0 0 0
MemTotal: 46624 kB
MemFree: 33876 kB
MemShared: 0 kB
Buffers: 1908 kB
Cached: 3816 kB
SwapCached: 0 kB
Active: 2136 kB
Inactive: 6020 kB
HighTotal: 0 kB
HighFree: 0 kB
LowTotal: 46624 kB
LowFree: 33876 kB
SwapTotal: 0 kB
SwapFree: 0 kB
程序代码如下
#include
#include
#include
#include
#include
#include
#include
#include
#include
int main(void)
{
int fd;
int nwrite, nread, i=0 ,j=0,k;
char qq[256];
struct termios newtio, oldtio;
fd = open("/dev/ttyS1", O_RDWR, 0666);
if(fd == -1)
perror("open serial 1\n");
tcgetattr(fd, &oldtio);
bzero(&newtio, sizeof( newtio));
/********************************************/
newtio.c_cflag |= (CLOCAL | CREAD);
newtio.c_cflag &=~CSIZE;
newtio.c_cflag |= CS8;
newtio.c_cflag &=~PARENB;
cfsetispeed(&newtio, B28800);
cfsetospeed(&newtio, B28800);
newtio.c_cflag &=~CSTOPB;
newtio.c_cc[VTIME] = 0;
newtio.c_cc[VMIN] = 0;
tcflush(fd, TCIFLUSH);
if(tcsetattr(fd, TCSANOW, &newtio) != 0 )
{ perror("tcsetattr error");
return -1;
}
/********************************************/
printf("fd = %d \n",fd);
printf("ready for sending command-------\n");
for(i=0;i<128;i++)
{ qq[i] = '0';
printf("<'%c'",qq[i]) ;
}
sleep(1);
fflush(stdout);
nread = read(fd, qq, 128);
printf("nread = %d\n",nread) ;
for(i=0;i<100;i++)
{ printf("<'%c'",qq[i]) ;
}
printf("\n");
if(nread == -1)
{printf(" read error!\n");
}
fflush(stdout);
close(fd);
return 0;
}
[/code]