用过vxWorks的朋友来看下.

femalelover 2008-05-31 09:40:11
在vxWorks下用tornado编程, 问两个最初级的问题:
1, 默认情况下, tornado能编译C++代码, 但是在vim中装载.O文件时, 会失败, 怎么搞定?
2, 在windows下, tornado编出.O之后, 上载到到单板中, 单板运行vxWorks, 报错说 fit 24 bits ...., 怎么搞定?

THANK YOU!
...全文
103 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
femalelover 2008-06-01
  • 打赏
  • 举报
回复
maplewasp, 我的tornado是2.2, CPU是PPC.

顺便问你一下, 你上贴的帮助文档是哪里来的? 多谢.
chlaws 2008-06-01
  • 打赏
  • 举报
回复
UP
独孤过儿 2008-06-01
  • 打赏
  • 举报
回复
只听过,没用过的人飘过~~~
maplewasp 2008-06-01
  • 打赏
  • 举报
回复
先把你的Tornado 的版本和什么bsp说一下,要不然很难猜的。
对于问题
1: 可能你的vim中缺少C++的组建,加上相应的C++组建,然后重新编译一个vim并启动它(不用默认的vim),然后再下载你的.o
或者新建一个vim, 加上相应的C++组建的同时把你应用程序加到这个vim project中,如果能编译过去就OK啦!
2:

Dynamic loading of modules fails with 24-bit relocation error.

--------------------------------------------------------------------------------

SPR: N/A
Patch: N/A

--------------------------------------------------------------------------------

Host: N/A
Architecture: PowerPC
BSP: All
Product: VxWorks Version: N/A

--------------------------------------------------------------------------------

Problem Description
Dynamic loading of object modules fails with the following error:

Relocation value does not fit in 24 bits

--------------------------------------------------------------------------------

Problem Solution
PowerPC Embedded Application Binary Interface, Version 1.0 System V Application Binary Interface, PowerPC Processor Supplement (Sept. 1995)

Reproduced failure on mv1604 board 64MB of RAM while loading an object module with external function references.


The error message above is known to appear while loading modules with external function references on PowerPC targets having more than 32MB of RAM.

The limitation is due to how direct function calls are implemented for the EABI (Embedded Application Binary Interface). The EABI is a standard we follow for the PowerPC architecture and it may be downloaded from the IBM web page. The EABI is based upon the SVR4 ABI, which suggests that all direct function calls be made with the 'bl' instruction. Because the addressing range of the 'bl' instruction is /- 32MB, all direct function calls referencing functions defined more than 32MB away will fail with the above relocation error.

Calling functions indirectly (i.e. through a function pointer) removes the 32MB limitation as 32-bit absolute addressing is used in place of 26-bit PC relative addressing, thus giving you access to all routines in the 4GB address space. Asking people to rewrite their code to make all external function calls through pointers is not very practical and may not be necessary in all cases.


The following can be used to work around this problem.
1) Use the -mlongcall flag when compiling your code or use the "#pragma longcall" directive to suggest certain function calls be made through a function pointer.

If using versions of Tornado 1.0.x there is a patch to use this workaround. The patch is SPR 22767. Later versions of Tornado do not require any patch.

"#pragma longcall" gives a suggestion to the compiler to call a set of functions through a function pointer (using 32-bit absolute addresses). This should be used primarily for external functions, as local functions are less likely to reside far from your module.

2) If your code does not require constant loading and unloading of object modules at runtime, you can also set LOCAL_MEM_SIZE to 32MB and set aside the rest of memory as USER_RESERVED_MEM (i.e. user reserved memory) and use memAddToPool to add the rest after your object modules have been loaded. No further object modules should be loaded after the memAddToPool has been performed.

Note: Setting aside user reserved memory is outlined in detail in Wind Tech Note 41 (WTN41).


maplewasp 2008-06-01
  • 打赏
  • 举报
回复
http://www.windriver.com/support/resources/tornado22_bulletin.html
maplewasp 2008-06-01
  • 打赏
  • 举报
回复
我也是从网上找的,你这个问题以前看到过。不过我用的是for x86的,对ppc的不熟悉呀。
VxWorks 有一个SPR List,也就是官方出的关于Bugs和对应的解决方案(当然有的也可能是还没有解决的Bug)。
WindRiver主页上有得下!
Erorr 2008-05-31
  • 打赏
  • 举报
回复
下载前有没有选定目标服务器?

64,654

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧