am335x linux内核编译,AM335x(TQ335x)学习笔记——Linux CAN测试程序的编译

1.首先编译libsocketcan

从终端进入libsocketcan源码目录,输入命令

CC=arm-linux-gcc ./configure --prefix=(需绝对路径) --host=arm-linux --build=i386

make

make install

编译成功,在 /lib/pkgconfig/下有个libsocketcan.pc文件,将其拷贝到PC的/usr/lib/pkgconfig/目录下。

2.编译canutils-4.0.6

先确认系统已安装automake

apt-get install automake

配置

./configure --host=arm-linux --prefix= --enable-debug

(如出现

config.status: executing libtool commands

sed: can't read config/autoconf/ltmain.sh: No such file or directory

sed: can't read libtoolT: No such file or directory

则apt-get install libtool 安装

然后执行

终端输入命令:autoreconf

再重新

./configure --host=arm-linux --prefix= --enable-debug

)

在canutils-4.0.6源码中的src/GNUmakefile.in 中的

CFLAGS = @CFLAGS@ (大概在96/97行)改为

CFLAGS = -Wall -g -O2

make

1)错误1:

cc1: warnings being treated as errors

candump.c: In function 'main':

candump.c:190: error: ignoring return value of 'daemon', declared with attribute warn_unused_result

make[1]: *** [candump.o] 错误 1

解决方法:

根据错误提示,是candump.c 忽略了返回值。所以在

打开源码src/candump.c文件,找到190行,将

daemon(1, 0);

改为:

{

int ret =0 ;

ret = daemon(1,0);

}

保存退出,重新make。

2)错误2:

/bin/bash ../libtool --tag=CC --mode=link arm-linux-gcc -Wall -g -O2 -o candump candump.o

libtool: Version mismatch error. This is libtool 2.4.2 Debian-2.4.2-1ubuntu1, but the

libtool: definition of this LT_INIT comes from libtool 2.4.

libtool: You should recreate aclocal.m4 with macros from libtool 2.4.2 Debian-2.4.2-1ubuntu1

libtool: and run autoconf again.

make[1]: *** [candump] 错误 63

解决方法:

终端中执行命令:rm aclocal.m4 & aclocal & autoconf

然后执行:rpmbuild -bb *.spec

重新 make

3)错误3:

canecho.c: In function 'main':

canecho.c:163: error: ignoring return value of 'write', declared with attribute warn_unused_result

make[1]: *** [canecho.o] 错误 1

解决方法:

将src/canecho.c的第163行:

write(s[out], &frame, sizeof(frame));

改为:

int ret;

ret = write(s[out], &frame, sizeof(frame));

重新make。

http://processors.wiki.ti.com/index.php/AM335X_DCAN_Driver_Guide

http://www.embedsky.com/index.php?s=/Product/show/id/49.html

http://www.embedsky.com/index.php?s=/Product/show/id/86.html

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值