📄 vxworks faq.txt
字号:
如果采用-fvolatile 开关你会得到:
movel a0@(8),d0
addql #1,d0
movel d0,a0@(8)
movel a0@(8),d0
You can imagine what a C++ application using the "this" pointer everywhere gets compiled into!
(From: Chris Varlese, cv@no.mail.net)
2.1.10 我链接了许多档案文件,现在链接器在解析文件之间的交叉参考时出现了问题?
A: 试试下面的方法
1、把$(LIBS)替换成$(LD_PARTIAL) -o vxWorks.tmp $(MACH_DEP) usrConfig.o version.o
$(LIBS) (在target/h/rules.bsp文件中)。 Now LD_PARTIAL is ccxxx, so you need to specify -Wl,
--group-start to get cc to pass the argument to ld.
2、Try adding a -Usymbol for each symbol that has to be pulled in early.
3、如果办法2 make ld行太笨拙,生成一个.s文件,包含每个没定义的符号和加到链接里的。
4、如果你工作UNIX下,它应该可能得到ld生成没有定义的所要求的列表。你需要加一个循环,就象下面一
样:
/*这是原文,我翻译不好。
1、$(LIBS) is substituted into: $(LD_PARTIAL) -o vxWorks.tmp $(MACH_DEP) usrConfig.o version.o
$(LIBS) (in target/h/rules.bsp for a non-project build). Now LD_PARTIAL is ccxxx, so you need
to specify -Wl,--group-start to get cc to pass the argument to ld.
2、Try adding a -Usymbol for each symbol that has to be pulled in early.
3、If (2) make the ld line too unwieldy, generate a .s file that contains: .extern symbol for
each undefined symbol and include that into the link before the libraries
4、If your building on unix, it ought to be possible get ld to generate the required list of
undefines! You need to add a loop! Something like this might work:
*/
[ ! -f undefs.s ] && echo "#" >undefs.s
while
$(CC) -c $(CFLAGS) undefs.s
$(LD_PARTIAL) -o vxWorks.tmp $(MACH_DEP) usrConfig.o version.o \
undefs.o $(LIBS)
$(NM) vxWorks.tmp | grep ' __' | $(MUNCH) > ctdt.c
$(MAKE) CC_COMPILER="-fdollars-in-identifiers" ctdt.o
do
$(LD) $(LDFLAGS) -e $(SYS_ENTRY) $(LD_LOW_FLAGS) -o vxWorks \
dataSegPad.o vxWorks.tmp ctdt.o tad_hook_list.o 2>&1 | tee ld.errs |
while read file undef ref to symbol
do
[ "$undef" = "undefined" ] || continue
[ "$ref" = "reference" ] || continue
[ "$to" = "to" ] || continue
oifs="$IFS"
IFS="'/`"
symbol="`echo $symbol`"
IFS="$oifs"
echo "\t.extern\t$symbol"
done | sort -u - undefs.s >undefs.new
cmp -s undefs.s undefs.new && break
mv undefs.new undefs.s
done
cat ld.errs
当然它需要另一系列的ESC和; \在每一行,以使得可以在make下运行。
(我也重新构造了原始的rules.bsp内容,我的可能与vxWorks原来的有些不同。)
(From: David Laight, dsl@tadpole.co.uk)
2.1.11 警告"trigraphs occured"是什么意思?
A: 对Tornado或Vxoworks没什么要做的。
你可能在你代码(也可能在注释里)中有三字符序列--参看K&R (Kernighan & Ritchie; A12.1 - 这是
ANSI 新引进的。-- 但是GNU手册里提示"You don't want to know about this brain-damage..."
使用-ansi或-trigraphs开关,或更好的办法消除任何包含三字符序列'??X'的注释。 (参看K&R书中对X
的定义)。
(From: Michael.Ben-Ari@ecitele.com)
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 ^ 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"的文件。
2.5.2 在我安装完Tornado或它的补丁后,我所有的C文件类型都被移除了,而使用Tornado作为打开该文件
的工具。我怎样能恢复到原来的编辑器?
A:Tornado覆盖注册表中的实体。你可以用下面的.reg恢复。
警告:在使用这个文件前必须小心!首先读一下该文件,如果你不理解它就不要使用它。
警告:我在windows95和NT下测试过,如果有时间我会在别的的平台测试的。如果你在98、2000下使用后可
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -