RTEMS 在 Linux环境开发的小技巧

1. 如果我的autoconf或者automake版本过低怎么解决

原创文章,请您注明出处 (rickleaf)

用find命令配合sed就可以解决,这个是Linux开发中常用的方法

 

比如我现在的桌面Linux是ubuntu 10.04 AMD64

系统默认的autoconf是2.65,但是RTEMS 4.10以后需要autoconf 2.68,怎么办呢?

 

大家可以知道AC_PREREQ([2.68]) 这个就是autoconf的版本

ricky@ricky-laptop:rtems$ cat configure.ac
## Process this file with autoconf to produce a configure script.
##
## $Id: configure.ac,v 1.35 2011/03/04 18:32:15 ralf Exp $

AC_PREREQ([2.68])
AC_INIT([rtems],[_RTEMS_VERSION],[http://www.rtems.org/bugzilla])
AC_CONFIG_SRCDIR([c])
RTEMS_TOP([.])

系统有很多.ac的文件

ricky@ricky-laptop:rtems$ find . -name "*.ac"
./doc/tools/configure.ac
./doc/configure.ac
./testsuites/mptests/configure.ac
./testsuites/psxtmtests/configure.ac
./testsuites/sptests/configure.ac
./testsuites/samples/configure.ac
./testsuites/psxtests/configure.ac
......

我们批量来修改

ricky@ricky-laptop:rtems$ find . -name "*.ac" -exec sed -i  's/2.68/2.65/g' {} \; -print
./doc/tools/configure.ac
./doc/configure.ac
./testsuites/mptests/configure.ac
./testsuites/psxtmtests/configure.ac
./testsuites/sptests/configure.ac
./testsuites/samples/configure.ac
./testsuites/psxtests/configure.ac
./testsuites/tools/generic/configure.ac
./testsuites/tools/configure.ac
./testsuites/configure.ac
./testsuites/tmtests/configure.ac
./testsuites/libtests/configure.ac
./cpukit/configure.ac
再看看

ricky@ricky-laptop:rtems$ cat configure.ac
## Process this file with autoconf to produce a configure script.
##
## $Id: configure.ac,v 1.35 2011/03/04 18:32:15 ralf Exp $

AC_PREREQ([2.65])
AC_INIT([rtems],[_RTEMS_VERSION],[http://www.rtems.org/bugzilla])
AC_CONFIG_SRCDIR([c])
RTEMS_TOP([.])

# Abort if trying to build inside of the source tree.
AS_IF([test -f aclocal/version.m4],[
  rm -f config.cache config.log confdefs.h
  AC_MSG_ERROR([***]
    [Attempt to build inside of the source tree]
    [Please use a separate build directory, instead] )
])

 

稍微解释一下

find . -name "*.ac" -exec sed -i  's/2.68/2.65/g' {} \; -print

 

find . -name "*.ac" 表示在当前目录寻找*.ac的文件。

 

{} /;表示找到的结果

 

-exec sed表示我要执行 sed命令

 

-i  's/2.68/2.65/g' 其实是sed的命令参数,就是把找到的文件中的2.68替换成2.65

 

-print表示把操作的情况打印出来,:-)当然可以不打印。

 

类似的应用有很多比如find 配合 grep命令

我们现在在找到的.ac文件中查找AC_PREREQ这个字符串,并且把行号打印出来。

ricky@ricky-laptop:rtems$ find . -name "*.ac" -exec grep -n "AC_PREREQ" {} \; -print


3:AC_PREREQ([2.65])
./doc/tools/configure.ac
3:AC_PREREQ([2.65])
./doc/configure.ac
5:AC_PREREQ([2.65])
./testsuites/mptests/configure.ac
5:AC_PREREQ([2.65])
./testsuites/psxtmtests/configure.ac
5:AC_PREREQ([2.65])
./testsuites/sptests/configure.ac
5:AC_PREREQ([2.65])
./testsuites/samples/configure.ac
5:AC_PREREQ([2.65])

很方便吧。

 

2. ubuntu 默认没有加入insight,有没有图形方式调试RTEMS的方法啊

您考虑的问题,Linux桌面发布者肯定也考虑到了,至于为什么没有把insight放入ubuntu肯定有些特别的原因的。

姑且不理他,看看我们用系统内部的资源能不能解决图形调试的问题。

怎么样用insight来调试RTEMS请参考雪松的博客

 

首先安装ddd

 

sudo apt-get install ddd

 

然后

 

ddd --debugger arm-rtems4.9-gdb hello.exe

就进入了ddd的图形界面了,呵呵挺另类的吧。

 

你可以继续用gdb的命令,或者用ddd的图形方式的操作菜单和快捷键。

 

RTEMS 在 Linux环境开发的小技巧_第1张图片

 

 

3. Linux 下有没有类似Source Insight的东西啊,我不想用kscope这样东西,速度慢不说语法解析也不好。

如果在两个月前回答这个问题,我要考虑下。

 

因为我推荐的代码浏览工具比较另类速度一般,但是功能强大,不过最近在自由软件的努力下。

Source Navigator NG升级到4.3啦,速度比以前有了指数的提升(有点夸张,:-))

下载源代码

svn checkout http://svn.berlios.de/svnroot/repos/sourcenav/trunk  sourcenavigator-NG

编译

 

./configure

make

sudo make install

 

上下文分析

RTEMS 在 Linux环境开发的小技巧_第2张图片

 

grep 功能

RTEMS 在 Linux环境开发的小技巧_第3张图片

 

 

 

你可能感兴趣的:(linux,ubuntu,tree,File,Build,图形)