Compiling and running on armv7

Started by
21 comments, last by WitchLord 10 years, 4 months ago

use these flag "-mfloat-abi=hard -mfpu=vfpv3-d16 -marm"

angelscript arm calling convention is only suitable for vpfv3-d16.

Advertisement

I run library in debugging mode and found where exactly crashes when try to execute .

In as_callfunc_arm.cpp when execute armFuncR0


case ICC_VIRTUAL_THISCALL:
  // Get virtual function table from the object pointer
  vftable = *(asFUNCTION_t**)obj;
  retQW = armFuncR0(args, paramSize<<2, vftable[FuncPtrToUInt(func)>>2], (asDWORD)obj);
  break;

And then stackargsarmFuncR0->nomoreargsarmFuncR0 and on "blx r4" magic happens.

oh amazing. I compiled library with "-mfloat-abi=hard -mfpu=vfpv3-d16 -marm" and also my program then its runs without problems so far. Thanks loboWu.

@loboWU: Thanks a lot for taking the time to respond. You saved us a lot of head-ache. :)

@MarisA: Can you provide the list of the pre-defined macros that the g++ compiler uses with these settings? I'll like to check the differences to see if I can detect this in as_config.h and show some helpful error message to anyone else that may face the same problem.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Dear Andreas:

Actually, your excellent angelscript work saved us a lot.

We could compile once, execute bytecodes in ARM and PC simultaneously.

I did some comparing and get only 3 differences.

-mfloat-abi=hard -mfpu=neon -ffast-math -marm -mfloat-abi=hard -mfpu=vfpv3-d16 -marm

#define __FINITE_MATH_ONLY__ 1 #define __FINITE_MATH_ONLY__ 0

#define __ARM_NEON__ 1 -------------------------

#define __FAST_MATH__ 1 ------------------------

Maybe it is just the -ffast-math that caused the problem.

neon is the SIMD instruction set for ARM, isn't it? I wonder if that changes the ABI.

Could you try the following combinations?

-mfloat-abi=hard -mfpu=neon -marm (maybe this one works)

-mfloat-abi=hard -mfpu=vfpv3-d16 -ffast-math -marm (maybe this one fails)

I think the flags __FINITE_MATH__ and __FAST_MATH__ both belong to the flag -ffast-math. So depending on the result of the tests with the combinations above I can use either the existence of __FAST_MATH__ or __ARM_NEON__ to catch the incompatible configuration and give an error.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Yes Andreas, seems like -ffast-math is crashing reason. I tried to compile with -mfloat-abi=hard -mfpu=neon -marm flags and that runs also without problems.

Thanks a lot for the confirmation. I've added the following condition in as_config to give a compilation error when the library is compiled with -ffast_math

#if defined(__FAST_MATH__) && __FAST_MATH__ == 1 && !defined(AS_MAX_PORTABILITY)
#error -ffast-math is not supported with native calling conventions
#endif
This condition is available in revision 1786.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Andreas,

If you have any interest in Beaglebone Black I have a spare one that I can give you. This might help out with some ARM testing in the future. I've noticed a few people including myself that are using Angelscript on microcontrollers recently. I compiled and ran Angelscript on the Udoo board and had some issues with native calling convention. I haven't had the time to go back and try it again though.

Cheers,

Tony

This topic is closed to new replies.

Advertisement