"MyProj.axf uses VFP register arguments, MyLib/libmy.a(my_file.o) does not"; both set to hard FP ABI

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

"MyProj.axf uses VFP register arguments, MyLib/libmy.a(my_file.o) does not"; both set to hard FP ABI

跳至解决方案
6,528 次查看
Slaymaker
Contributor III

Context

  • MyProj targets the RT1040 MCU compiles and runs successfully
  • MyLib is a Static C Library configured to build for the RT1040, and is configured to use hard FP
    • This is lua-5.4.4, for reference (just building liblua.a, not the two executables)
  • Both are set (by default) to Cortex-M7 and FPv5-FP-D16 (Hard ABI).

Error

After adding MyLib as a reference for MyProj and configuring the include dirs, linker search path, and adding lua as a library to link, building MyProj results in:

c:/nxp/mcuxpressoide_11.7.0_9198/ide/plugins/com.nxp.mcuxpresso.tools.win32_11.7.0.202209140929/tools/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.exe: error: MyProj.axf uses VFP register arguments, ../../lua-test/src/\liblua.a(lauxlib.o) does not
...

Both projects' compiler command lines include the options -mcpu=cortex-m7 -mfpu=fpv5-sp-d16 -mfloat-abi=hard -mthumb

Is there anything else I need to configure, or check? Is there a better way to proceed?

Many thanks,

Barrie

0 项奖励
回复
1 解答
6,379 次查看
Slaymaker
Contributor III

I checked MyLib's "MCU C Compiler" -> "Preprocessor" -> "Defined symbols" and found that the IDE had defined __REDLIB__ (IIRC) when creating this project.

Even though MyLib is a library project properly configured to use hard floating point (full 32 bit, no less!) and not linked against RedLib, this prevented the use of the VFP floating point parameter passing ABI.

No idea why, but replacing that preprocessor macro with __NEWLIB__ fixed MyProj's link errors.

在原帖中查看解决方案

0 项奖励
回复
7 回复数
6,380 次查看
Slaymaker
Contributor III

I checked MyLib's "MCU C Compiler" -> "Preprocessor" -> "Defined symbols" and found that the IDE had defined __REDLIB__ (IIRC) when creating this project.

Even though MyLib is a library project properly configured to use hard floating point (full 32 bit, no less!) and not linked against RedLib, this prevented the use of the VFP floating point parameter passing ABI.

No idea why, but replacing that preprocessor macro with __NEWLIB__ fixed MyProj's link errors.

0 项奖励
回复
6,492 次查看
Slaymaker
Contributor III

Alice, many thanks for the suggestion. I'm missing something (trying to learn this so I understand how to debug and configure these things)... how, precisely, would the Redlib library headers that MyLib #includes prevent MyLib from using the VFP register parameter ABI?

Shouldn't the header files be ABI neutral?

I appreciate your help on this, I really want to understand how these things interact.

0 项奖励
回复
6,385 次查看
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello @Slaymaker 

Sorry I'm not very clearly this, while I can share your some material, you can have a look at:

<MCUXpresso IDE User Guide> ->  "19.4 Hardware Floating Point Support ".

 

BR

Alice

0 项奖励
回复
6,368 次查看
Slaymaker
Contributor III

Alice,

Yes, I've read that, and many other things too.

None of that explains why the RedLib header files would prevent a library (MyLib) that is configured for hard FP from using the VFP (hard FP) parameter passing ABI. I could understand if it were not a library, i.e. if it linked against RedLib, but it doesn't.

If you ever find out, I'd love to know, thanks.

- Barrie

0 项奖励
回复
6,429 次查看
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello @Slaymaker 

 

You can share your projects, I can help to check on my side.

 

BR

Alice

6,414 次查看
Slaymaker
Contributor III
Thanks, Alice!

I'm trying to learn here, so I'm asking for the technical details so I can understand how the choice of library headers (in MyLib) causes non-VFP parameter passing?

Where can I look for details on this? As you can see above, the compiler is being called with hard FP in both projects, so something more subtle is going on...
0 项奖励
回复
6,488 次查看
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello @Slaymaker 

 

How about try to change C library ?

 

BR

Alice