首页 | 新闻 | 新品 | 文库 | 方案 | 视频 | 下载 | 商城 | 开发板 | 数据中心 | 座谈新版 | 培训 | 工具 | 博客 | 论坛 | 百科 | GEC | 活动 | 主题月 | 电子展
返回列表 回复 发帖

嵌入式操作系统VxWorks中文FAQ 04

嵌入式操作系统VxWorks中文FAQ 04

2.1.12 为什么编译的最后步骤时间这么长?
生成.out步骤如下:
1) 链接应用程序和库到partialImage.o
2) 使用partialImage.o解析出所有静态类(munch)
3) 编译上面发现的(ctdt.o)
4) 用ctdt.o链接第一个obj文件partialImage.o
我们的应用程序.out文件有10M,但是多数是调试信息,size386返回只有1M。
我们的下载文件生成需要超过5分钟,Step #1-3正常需要35秒!但是step #4 需要很多时间,整个过程需
要5分30秒。

A: 我不知道为什么这样?但是我们在step #4不重新使用partialImage.o 而是重新生成它,整个过程45s.

(是ld386没有对符号过滤进行优化的原因吗?)
我只是修改了tornado\target\h\make\rules.vxApp文件,它包含制作应用程序的规则。我修改了上面
提到的step $4代码如下:
把$(LD_PARTIAL) $(LD_PARTIAL_LAST_FLAGS) partialImage.o ctdt.o -o $@
替换成$(LD_PARTIAL) $(PRJ_OBJS_FOR_LD_PARTIAL) $(PRJ_LIBS) ctdt.o -o $@

(From: Ole Asbjorn Fadum, OleAsbjornF@scanmar.no)

Some more information.
For a variety of reasons I've had to do a few build on a slow system. One bit that seemed
exceptionally slow is the 'binToAsm' call (just after the 'deflate' generating vxWorks.Z.s).
This is done by

od -bv $infile |
sed -e "s/^[0-9]*[ ]*//;
s/ /, 0/g;
/^[0-9a-fA-F][0-9a-fA-F]/s/^/ .byte 0/"

(ie use od to generate a list of octal bytes, remove the offset, change the spaces to comma,
add the directive - an extra 0 is added to each number to ensure they are octal).
The above is terribly slow... Slightly faster (under solaris) is:

od -An -v -tu1 $infile | tr ' ' ',' |
sed -e 's/,00*\([0-9]\)/,\1/g;s/^,/ .byte /'

However it is clear that a C program would be even faster... It was still sluggish using
printf, so...

char map[256][4];
for (count = 0; count <= 256; count++)
sprintf( map[ count ], "%d", count );

for (;;) {
count = read( input_fd, buf, BLK_SZ );
if (count <= 0)
break;
for (off = 0; off < count; off++) {
if (off & 15)
putchar( ',' );
else
fputs( "\n .byte ", stdout );
fputs( map[ buf[ off ] ], stdout );
}
}

now the system is spending very little of its time doing this bit (it was a lot slower
than the deflate!). If you are using gcc/gas you can pipe EXTRACT_BIN, COMPRESS, BINTOASM
directly into AS - saving that massive intermediate file...
Build (compiling one small object) just took 6m50 - was over 10 minutes before I played
with binToAsm!

Ages ago I sped up 'munch' - by grepping out most of the symbols it isn't interested in...

nmarm vxWorks.tmp | tee vxWorks.nm | grep " __" | munch > ctdt.c

(I use the symbol table from this stage for a variety of things...)
(From: David Laight, David.Laight@btinternet.com)





2.1.13 怎样把一个段装载到特定的绝对地址?
A: 我曾包含一个脚本做这些工作,最方便得到这个脚本的方法是使用--verbose开关运行你的链接器,例如:
"ldarm --verbose". 编辑这个文件加入类似如下的段落,
.text 0x8000 : {
[omit]
. = ALIGN(0x8000);
/* Create a 8k section of all 0xffff, first value is jump. */
FILL(0xffff);
LONG(0xeb000004);
. = ALIGN(0x2000);
[...]
这将把数据放到任何你想放的地方,在程序被链接时新的链接器脚本必须使用-T参数。
(From: Bill Pringlemeir, bpringlemeir@yahoo.com)

2.1.14 我在使用C++类型的注释时,出现错误,怎样改变它?
A: 一种方法是移除-ansi开关。然而,你可能希望保留你的源代码与ANSI兼容;所以我更喜欢代码能在每个
地方都能编译。传递"-Wp,-lang-c"参数只能使CPP的注释方法可以使用。下面来自预编译器文档
`-lang-c', `-lang-c89', `-lang-c++'
`-lang-objc', `-lang-objc++'
Specify the source language. `-lang-c' is the default; it allows recognition of C++
comments (comments that begin with `//' and end at end of line), since this is a common
feature and it will most likely be in the next C standard. `-lang-c89' disables recognition
of C++ comments. `-lang-c++' handles C++ comment syntax and includes extra default include
directories for C++. `-lang-objc' enables the Objective C `#import' directive. `-lang-objc++'
enables both C++ and Objective C extensions. These options are generated by the compiler
driver gcc, but not passed from the `gcc' command line unless you use the driver's `-Wp'
option .

(From: Bill Pringlemeir, bpringlemeir@yahoo.com)

2.1.15 我在编译时碰到了关于cc1参数/选项的错误?
A: 这个可能是由于安装了Cygwin 或DJGPP引起的。当该版本的编译器在路径里先于Tornado版本Cygwin的
GCC被调用时,这个版本不知道这些参数或选项。这个问题可以通过卸载该软件或确定Tornado版本的编译器
在路径环境变量里是头一个后解决。

2.2 调试器
2.2.1 我怎么使用GDB的plain版本去调试我的目标机,而不用Tornado?
A:gdb compiles 'out of the box' for vxworks.
去cygnus(sourceware.cygnus.com)下载最新的'insight'软件,该软件是gdb + cygnus的UI(译者:可能是用户接口)
运行 "configure --target=mips-wrs-vxworks". 把mips改成你的处理器,然后运行make.
这样就可以在安装了cygwin的win32平台上运行了,在UNIX系统平台上也类似。
RDB是windriver以前的调试协议,现在变成WDB了。好象没公布wdb的比特,尽管Tornado使用了gdb。你可能
不得不配置RDB。包含RDB组件(INCLUDE_RDB) ,并移除WDB组件(remove INCLUDE_WDB),以使得调试可以进行。
(From: Don Bowman, don@pixstream.com)

2.2.2 我怎么在创建一个任务后停止它,以使得我能从开始对它进行调试?
A: 菜单tools->options,选择debugger页,选择always halt after attaching a task和Auto Attach to task -> Always
现在输入一个全局断点(Shift F9),在它碰到断点后,它将从mainTask中分离。
(From: Chacha Hindustani, Gurudev@mediaone.net)

2.2.3 为什么当我使用SHELL检查内存时,看不到断点?
A: shell是一个不可中断的任务,所以任何时间它都在运行在无断点的环境。当任务切换引起一个中断的任务
运行时,断点将被重新安装。所以如果查看内存中的断点,只是简单使用d()或l()命令,它在一个中断任务中
可以运行,你将看到一个magic code插入并引起异常。
The shell is an unbreakable task, so all the time it is running the breakpoints are not
installed. When a context switch causes a breakable task to run, the breakpoints will be
resinstated.
So, to see the breakpoint in memory simply spawn the d() command or l() command. That will
then run in a breakable task, and you should see the magic code inserted to cause
an exception.
(From: John, john_94501@yahoo.com)

2.3 FTP
参看5.4

2.4 主机工具
2.4.1 我制作了一个基于rom的VxWorks(vxWorks_rom),但是当我试图用elftobin把它转换成bin格式的
(vxworks_rom.bin),得到了如下错误:
C:\project\Project3\default\elftobin <vxWorks_rom> vxWorks_rom.bin
seg1 : Expected load address 0xfff00100 but file address is 0x00111670
我怎样才能把这个文件转成二进制格式?
A: 这个问题只在PPC版本中出现过,问题编号为SPR#8845. 已经有个更新版本的elftobin解决了这个问题。
请联系你的销售代理或服务工程师。

2.4.2 我怎样写一个WTX工具?
A: 我曾经在Tornado 1.0.1 和Windows NT 4.0环境下写过一个WTX工具,按下面的例子和Tornado API参考
开始,甚至不用关闭build.让它独自按我的步骤工作。就是我使用VC++6编译,但仍有许多东西丢掉了,不论
编译器是什么版本。我知道我能更熟练的使用路径里的环境变量。但有时你只需要它工作,所以下面澄清一
下:
原代码放在$(WIND_BASE)\host\src\wtxtest下,我的安装目录或任何其它人的安装目录里没有例子源码。按
手册源代码按如下修改(大多是信号处理代码修改和增加includes,其它修改在我的程序里说明)
把下面的设置加到工程设置、 C/C++, Preprocessor:
include目录(路径按实际情况修改):
C:\Tornado_03\share\src\wtx,C:\Tornado_03\host\include
预处理定义:HOST
把下面的设置加到工程设置,Link,General:
C:\Tornado_03\host\x86-win32\lib\wtxapidll-d.lib
增加环境变量WIND_REGISTRY,设为我的注册位置。
许多痛苦就在发现这个。手册里参考wtxEnvironSet()调用,Windsurf说它是不存在的,但手册为这个不存
在的函数使用提供了许多参考。我的机器上没设置WIND_REGISTRY,所有的Tornado工具都可以不使用它而正
常工作。我的工具不能发现注册,设置它并关闭它(Set it and poof)!注册发现了,工具可以工作。
确信起调用了wtxProbe()去检查注册(并且变量被设置),它可以避免许多痛苦。
我也修改那个工具例子代码。代码在此#代码连接#http://www.xs4all.nl/~borkhuis/vxworks/wtxSample.c

(From: Christopher A Leddy, caleddy@west.raytheon.com)


2.4.3 当我执行wtxwish时,碰到了一个关于init.tcl文件的错误?
A: 不要忘记把TCL_LIBRARY和TK_LIBRARY环境变量设置为 $(WIND_BASE)/host/tcl/tcl and $(WIND_BASE)/host/tcl/tk. init.tcl文件位于TCL_LIBRARY路径。tk.tcl文件位于目录。
不要使用 $(WIND_BASE) 变量,而是实际路径。然后从你的TCL/TK目录执行:
wtxwish <yourTclFile>
(From: DrDiags, drdiags@flashcom.net)

2.4.4 我试图在windows NT4.0 SP5环境下运行Tornado2.0带的vxsys程序,碰到一个错误: "the system
try to access directly to the disk, this is not possible ....."
A: vxsys是DOS程序,不能工作windows环境下,你应该从DOS窗口下运行它。
(From: Andray Kaganovsky, andreyk@home.com)

2.4.5 怎样创建加密密码?
A: 你可以使用Tornado自带的创建密码程序vxencrypt,但是它功能很弱。
sum( p * i ^ i )) * 0x1e3a1d5将HEX字符集转化成ASCII(假定认为你有超过2^32加密密码)。我能用
钢笔和纸来把它做反变换。
你也可以使用loginEncryptInstall()安装自己的加密算法,对一个强密码[1],加密知道使用密码作为KEY。
UNIX传统使用DES,但需要适当的代码。我使用TEA参看http://vader.brad.ac.uk,因为它是不受翻盖妨碍的。

[1] problematical since you have difficulty protecting the password file as none of the vxWorks filesystems support user-ids.
(From: David Laight)



2.5 安装

2.5.1 当我试图安装GNU源光盘时,出现了一个关于文件aux.h的错误:permission denied。但该文件并不
存在,是怎么回事?
A: 在微软SW环境下存在这个问题,"AUX"是保留字,所以任何以"AUX."开头的都不能存在。任何以设备名
开始的文件名也是不能存在的,例如你不能打开一个叫"LPT1.TXT"的文件。
返回列表