Smartphones, Tablets, and Mobile Devices Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

How to debug an arm assembly in eclipse with adt & android-ndk in linux-64bit platform?

Hai... Iam new to android-ndk.

Iam trying to build pure c code by using android-ndk finally its working.

Now Iam trying to call assembly file from that c code but Iam getting errors.

Iam using Linux_GCC

/* This is my Android.mk file */

LOCAL_PATH := $(call-mydir)

include $(CLEAR_VARS)

LOCAL_MODULE := Sample

LOCAL_SRC_FILES := test.c assembly.S

LOCAL_ARM_MODE := arm

LOCAL_LD_LIBS := -llog

include $(BUILD SHARED_LIBS)

TARGET_ARCH_ABI == armabi-v7a

/* This is my application.mk file */

APP_OPTIM := debug

APP_ABI := armeabi armeabi-v7a x86

APP_STL := gnustl_static

/* This is my c file */

extern int assembly(int a);

int main(void)

{

   int a = 5, b = 10, c, d;

   c = a * b;

   d = assembly(c);

   printf(" d = %d", d);

   return(0);

}

/* my assembly file */

.text

.global assembly

assembly:

   stmfd sp!, {r4-r12, lr}

   add r4, r0, r1

   mul r3, r0, r2

   ldmfd sp!, {r4-r12, PC}

   bxlr

In order to build assembly I added following

Project --> Properties--> c/c++ build --> settings

GCC Assembler: added -arch i386 -g after as

GCC C Compiler: added -m32 after gcc

GCC C Linker: added -m32 after gcc

in debug configuration settings i have  select c/c++ application as default/Sample

while building project it is showig error as Sample/default/Sample is not found.

I reffered few sites in those i observed they select c/c++ application as project/obj/local/armeabi/app_process but i didn't found app_process in that path in my project.


Hope somebody will help me regarding this.

THANKS

0 Kudos
Message 1 of 2
(2,602 Views)

You definitely need to review what you did so far:

TARGET_ARCH_ABI=armabi-v7a

This indicates a fairly recent ARM CPU.

The assembly code also looks like ARM. Then -arch i386 and -m32 make no sense at all, although not sure -m32 would hurt but there is AFAIK definitely no -m64 target for armabi-v7a so far.

Rolf Kalbermatter
Averna BV
LabVIEW ArchitectLabVIEW ChampionLabVIEW Instructor
0 Kudos
Message 2 of 2
(1,541 Views)