RTEMS 在 Linux环境开发的小技巧


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

用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请参考雪松的http://www.bkjia.com/search.aspx?Where=Nkey&Keyword=RTEMS

首先安装ddd

sudo apt-get install ddd

然后

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

  • 1
  • 2
  • 下一页

相关内容