Advertisement

Running on Android with MIPS

Started by August 23, 2012 12:13 PM
4 comments, last by WitchLord 9 years, 5 months ago
My project works like a charm on Android now. With 2.24.0 it is now fully working on Android ARM. However my MIPS based tablet is not so lucky. If I just compile the project with MIPS abi and run, the application will not be able to register a thing, every call to registering application interface fails.

I noticed from as_config.h that AS_MIPS will only get detected with the snsystems compiler or PSP. I could add AS_MIPS manually but I'm not sure about the other configuration macros like CDECL_RETURN_SIMPLE_IN_MEMORY and stuff.

Is there any experience about setting AS up for Android on MIPS?
You're the first one to mention this. I didn't even know that there were MIPS machines running Android. :)

It will require a bit of experimenting to find the correct configurations for Android + MIPS platforms. In the test/test_feature program I have designed a series of tests to confirm the correct configuration. If you can run those and let me know which works or do not work I'll help you determine what configurations should be set.

The relevant tests are the following from the main.cpp file:


// The following tests are designed specifically to test the native calling conventions.
// These are grouped by calling convention and ordered in increasing complexity.
{
// cdecl
if( TestExecute() ) goto failed; else printf("-- TestExecute passed\n");
if( TestCDeclReturn::Test() ) goto failed; else printf("-- TestCDeclReturn passed\n");
if( TestExecute1Arg() ) goto failed; else printf("-- TestExecute1Arg passed\n");
if( TestExecute2Args() ) goto failed; else printf("-- TestExecute2Args passed\n");
if( TestExecute4Args() ) goto failed; else printf("-- TestExecute4Args passed\n");
if( TestExecute4Argsf() ) goto failed; else printf("-- TestExecute4Argsf passed\n");
if( TestExecuteMixedArgs() ) goto failed; else printf("-- TestExecuteMixedArgs passed\n");
if( TestExecute32Args() ) goto failed; else printf("-- TestExecute32Args passed\n");
if( TestExecute32MixedArgs() ) goto failed; else printf("-- TestExecute32MixedArgs passed\n");
if( TestCDecl_Class() ) goto failed; else printf("-- TestCDecl_Class passed\n");
if( TestCDecl_ClassA() ) goto failed; else printf("-- TestCDecl_ClassA passed\n");
if( TestCDecl_ClassC() ) goto failed; else printf("-- TestCDecl_ClassC passed\n");
if( TestCDecl_ClassD() ) goto failed; else printf("-- TestCDecl_ClassD passed\n");
if( TestCDecl_ClassK() ) goto failed; else printf("-- TestCDecl_ClassK passed\n");
// cdecl_objlast and cdecl_objfirst
if( TestCDeclObjLast::Test() ) goto failed; else printf("-- TestCDeclObjLast passed\n");
if( TestReturnWithCDeclObjFirst() ) goto failed; else printf("-- TestReturnWithCDeclObjFirst passed\n");
// thiscall
if( TestExecuteThis32MixedArgs() ) goto failed; else printf("-- TestExecuteThis32MixedArgs passed\n");
if( TestNotComplexThisCall() ) goto failed; else printf("-- TestNotComplexThisCall passed\n");
if( TestVirtualMethod() ) goto failed; else printf("-- TestVirtualMethod passed\n");
if( TestMultipleInheritance() ) goto failed; else printf("-- TestMultipleInheritance passed\n");
if( TestVirtualInheritance() ) goto failed; else printf("-- TestVirtualInheritance passed\n");
// stdcall
if( TestStdcall4Args() ) goto failed; else printf("-- TestStdcall4Args passed\n");
if( TestNotComplexStdcall() ) goto failed; else printf("-- TestNotComplexStdcall passed\n");
}


Comment out all other tests above these, until these ones work properly.

The MIPS code in as_callfunc_mips.cpp was written a long time back for the PSP. Hopefully the code will work with Android/MIPS too, but it is quite likely it will require a bit of adjusting to work perfectly.

Alternatively you should be able to use the AS_MAX_PORTABILITY mode, and use the autowrappers to register the application interface instead of registering the native functions.

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

Advertisement
After 4 hours I still can't runt the test on android. I've managed to make it compile, but upon start, it crashes before the first line of main. So far I wasn't able to use the debugger for the MIPS device (not even for my own project) so I'm stuck.
I'm using generic calls for now :(
I'm willing to try it again. If someone makes an eclipse project that is working on ARM android and can be built by the android toolchain on windows, then I'll try it again.
I'm pinning this topic on the forum so it can get a little more attention. Hopefully someone can lend a helping hand in getting AngelScript to work with native calling conventions on Android with MIPS.

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

I've just implemented support for native calling conventions for Linux with MIPS (see latest revision in the SVN). I'm hopeful that this will make it fairly easy to also add support for Android with MIPS.

I've yet to learn how to compile and test the library against Android though, so if anyone else has experience in this area and has an Android system with MIPS processor I'll gladly accept aid in this department. :)

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

I managed to find the time to learn how to use tools for working with Android (Android Studio, Android NDK, etc), and I'm happy to announce that AngelScript now supports native calling conventions on Android with MIPS CPUs too. :D

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

This topic is closed to new replies.

Advertisement