天嵌_support1 发表于 2013-4-7 10:48:41

TQ3358 Linux CAN测试程序的编译

本帖最后由 天嵌_support1 于 2015-3-24 10:36 编辑

    首先感谢大家一直以来对天嵌科技的支持和鼓励,希望大家一如既往的支持天嵌,天嵌的发展离不开广大的朋友!
    公司的TQ3358开发板支持CAN通信功能,而且最近很多朋友也有提到关于CAN测试程序 canutils 源码的编译的问题。现放出canutils 的源码和编译教程,以方便大家测试使用。

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.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: *** 错误 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
解决方法:
将src/canecho.c的第163行:
       write(s, &frame, sizeof(frame));
改为:
      int ret;
      ret = write(s, &frame, sizeof(frame));
重新make。

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

wangdapengxp 发表于 2013-4-28 10:56:56

本帖最后由 wangdapengxp 于 2013-4-28 10:58 编辑

版主:我是用android系统的
按照这个说明编译后,有5个文件夹,bin include lib sbin share我分别把这个5个文件放到了android文件系统中同名的地方,即:system/bin system/lib system/usr/share 和sbin下,只有include我没有在文件系统里找到,也就没有放到文件系统中。
之后我从新制作了文件系统,下载到开发板中。
使用canconfig 设置can总线的波特率 提示/system/bin/sh: canconfig: No such file or directory

是我放的位置不对么,还是别的哪里做错了么?

机油战士 发表于 2013-5-21 20:21:54

终于能回复了,不容易啊

vcip 发表于 2013-5-22 13:34:48

谢谢分享~~

bigice 发表于 2013-5-23 16:08:08

看看,我也要用到CAN

zhengxi 发表于 2013-5-26 05:51:49

:'呵呵,太好了,是什么样的测试程序啊

∑尘あ路◆ 发表于 2013-5-28 09:09:53

aejfeakjfelsk dsf ded

卞小宝爸 发表于 2013-5-29 22:41:11

我的应用需要这个

hyz2410 发表于 2013-6-1 15:57:06

xiexei LZ

moon0213 发表于 2013-6-6 10:02:56

参考参考,多谢!!!

huxh5837 发表于 2013-6-6 10:49:25

支持,谢谢分享

最后之星 发表于 2013-6-24 14:25:34

看看,正需要,不知道能不能正常使用。

soloo001 发表于 2013-6-26 12:46:51

终于能回复了,不容易啊

axlrose 发表于 2013-6-26 15:02:17

支持,顶一个

axlrose 发表于 2013-6-26 15:06:06

http://www.embedu.org/Column/Column596.htm基于MCP2515的Linux CAN总线驱动程序设计(一)
页: [1] 2 3 4
查看完整版本: TQ3358 Linux CAN测试程序的编译