Chinaunix首页 | 论坛 | 博客
  • 博客访问: 162016
  • 博文数量: 63
  • 博客积分: 2961
  • 博客等级: 少校
  • 技术积分: 445
  • 用 户 组: 普通用户
  • 注册时间: 2010-01-21 10:44
文章分类

全部博文(63)

文章存档

2011年(17)

2010年(46)

我的朋友

分类: 嵌入式

2010-08-17 22:26:31

转载http://hi.baidu.com/angle3839/blog/item/d86f2ed168250087a0ec9c1d.html

遇到类似 xxx contains an invalid call from '~PRE8' to 'REQ8' function xxx的时候,找到了这篇好文章

 

本来想将ADS下边的工程直接拿到RealView下边去,但是出现了一些错误,貌似realview对函数类型检查更严格一些,又或许是我在ads里边设置的报错条件过于宽松了。

其它的问题都解决了,就剩一个我也不熟悉的问题了,呵呵。下边是解决方法:

原文转自:http://hi.baidu.com/wsn4u/blog/item/ecb30939294f2af63a87ced2.html

    想通过周立功的EasyARM2131开发板学习嵌入式,其提供的程序都是基于ADS1.2编写的,我在网上找了很久也没找到,只下到了ARM RVDS2.2。以为版本高应该更好,可是在编译时,总是对其提供的启动程序startup.s报错:
L6238:startup.o(vectors) contains an invalid call from '~PRE8' to 'REQ8' function FIO_Excetion;L6238:startup.o(vectoes) contains an invalid call from '~PRE8' to 'REQ8' function TargetResetInit;
        查了好久也不知道错在哪里,最后终于在ARM网站提供的ERROR Message 中找到的原因。
This linker error is given where a stack alignment conflict is detected in object code. The "ABI for the ARM Architecture" demands that code maintains 8-byte stack alignment at its interfaces. This allows efficient use of LDRD and STRD instructions (in ARM Architecture 5TE and later) to access 8-byte-aligned "double" and "long long" data types.Symbols like '~PRES8' and 'REQ8' are "Build Attributes" of the objects. PRES8 means the object PREServes 8-byte alignment of the stack. ~PRES8 means the object does NOT preserve 8-bytealignment of the stack (~ meaning NOT). REQ8 means the object REQuires 8-byte alignment of the stack.
      按照提示,可以将原来的代码作一些修改,主要是STMFD的寄存器个数改为偶数个,还要对代码段加上PRESERVE 8的限定。总算有点收获,没有让我辛苦找了这么多天。

----这是一篇旧文,重发在这里,说不定别人能用得着。

有朋友在询问,所以把ARM资料提供的更改方法列在下面:

There are two possible solutions to work-around this issue:

1) Rebuild all your objects/libraries using RVCT 2.x.
If you have any assembler files, you will need to:

i) check that all instructions preserve 8-byte stack alignment, and if necessary, correct them. (保留8字节堆栈对齐)
e.g. change: 将进栈寄存器数由奇数个改为偶数个
           STMFD sp!, {r0-r3, lr} ; push an odd number of registers
to

          
STMFD sp!, {r0-r3, r12, lr} ; push an even number of registers
and:

ii) add the PRESERVE8 directive to the top of each assembler file. 将PRESERVE8保留字加在每个汇编文件前
e.g. change:
         AREA Init, CODE, READONLY
to:
        
PRESERVE8
   
      AREA Init, CODE, READONLY

(the PRES8 attribute applies to the whole object, not just the code section).

阅读(1734) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~