Problem in compiling ARM code in Visual GDB

Sysprogs forums Forums VisualGDB Problem in compiling ARM code in Visual GDB

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #776
    rocky234
    Participant

    Hi,

    I am new to visual GDB environment .
    I want to run arm code in android project in visual GDB, where my C-code call’s the arm function.
    I have created a normal android project as shown in visual GDB site.

    Problem:-
    1)The visual GDB is not recognizing the functions names(in .s file ) and nor the arm instructions.
    For instruction it is coming as BAD instruction .
    compiler i missed some compiler option or selection?

    2)Is their any mistake in make file ?

    3) Which tool chain should I use to compile ARM code 4.6/4.8/clang3.3

    kindly do the need full help…..

    #3031
    ket
    Participant

    Hi,

    1), 2) You may need additional flags or includes in the makefile. It is not clear what the exact issue here is, please post the build log from the Output window showing the errors and a screenshot of how you are calling the arm instructions.
    3) Either of these toolchains is available for ARM and hence will compile fine for ARM. If you wish to compile for ARM only, then change the ABI of the application to armeabi and/or armeabi-v7a. This way the app will not be built for other platforms.

    #3032
    rocky234
    Participant

    Hi ,
    i have pasted the .s file,error message and make file…kindly go through the same.
    ARM_ASM_CODE is a macro which switch’s between the c-code and arm code .

    and about the flags in make file…
    kindly check which all flags to be include in make file and let me know….

    plz do the need full help

    bac.s

    CODE32
    AREA IAREAC,CODE,READONLY

    Function_1 PROC
    STMFD sp!,{r4-r8,lr}

    LDR r4, [r1]
    LDRB r7, [r3]

    ;some code

    LDR lr, |Table1|
    MOV r5, r8, ASL r5 ;r5 = b
    RSB r8, r5, r4 ;a -= b

    ;some

    MOVHI r0, r7
    LDMFDHI sp!, {r4-r8, pc}

    LDRB r3, [r4, #0]
    LDRB r5, [r4, #1]
    LDRB lr, [r4, #2]
    ADD r4, r4, #3
    STR r4, [r2, #40]
    ADD lr, lr, r5, ASL #8
    ADD lr, lr, r3, ASL #16

    ;some code

    ADD lr, lr, r12, ASL #24
    STR lr, [r0,#0]

    MOV r0, r7
    LDMFD sp!,{r4-r8, pc}

    |Table1|
    DCD array1

    |Table2|
    DCD array2

    IMPORT array1
    IMPORT array2

    EXPORT Function_1

    END

    ERROR

    1> [armeabi-v7a] Compile thumb : jniplayer <= bac.s
    1> jni/jniplayer/bac.s: Assembler messages:
    1>C:folderProjectjnijniplayerbac.s(6): error : bad instruction `code32′
    1>C:folderProjectjnijniplayerbac.s(7): error : bad instruction `area IAREAC,CODE,READONLY’
    1>C:folderProjectjnijniplayerbac.s(9): error : bad instruction `Function_1 PROC’
    1> jni/jniplayer/bac.s:17: Warning: missing operand; zero assumed
    1> jni/jniplayer/bac.s:23: Warning: missing operand; zero assumed
    1>C:folderProjectjnijniplayerbac.s(25): error : bad instruction `a -=b’
    1>C:folderProjectjnijniplayerbac.s(42): error : bad instruction `ldmfdhi sp!,{r4-r8,pc}’
    1>C:folderProjectjnijniplayerbac.s(76): error : junk at end of line, first unrecognized character is `|’
    1>C:folderProjectjnijniplayerbac.s(77): error : bad instruction `dcd TabLE1′
    1>C:folderProjectjnijniplayerbac.s(79): error : junk at end of line, first unrecognized character is `|’
    1>C:folderProjectjnijniplayerbac.s(80): error : bad instruction `dcd TabLE2′
    1>C:folderProjectjnijniplayerbac.s(83): error : bad instruction `import TabLE1′
    1>C:folderProjectjnijniplayerbac.s(84): error : bad instruction `import TabLE2′
    1>C:folderProjectjnijniplayerbac.s(86): error : bad instruction `export Function_1′
    1> jni/jniplayer/bac.s.s:77: Warning: partial line at end of file ignored
    1> make.exe: *** [obj/local/armeabi-v7a/objs-debug/jniplayer/bac.s.o] Error 1

    make file

    LOCAL_PATH := $(call my-dir)

    #
    # jniplayer.so
    #
    include $(CLEAR_VARS)

    ifeq ($(TARGET_ARCH_ABI), armeabi-v7a)
    #staticlib: $(LIB)

    #CC := armcc
    #AR := ar
    #AS := as
    LENT_CFLAGS := -DARCH_ARM=1 -DHAVE_NEON=1 -DARM_ASM_CODE=1
    #OBJDIR_ASM := obj_asm
    endif
    ifeq ($(TARGET_ARCH_ABI), x86)
    LENT_CFLAGS := -DARCH_X86_32=1
    endif

    LOCAL_C_INCLUDES += $(LOCAL_PATH)/../lenthevcdec/ $(LOCAL_PATH)/../../../../../../ $(LOCAL_PATH)/../ffmpeg-2.0/ $(LOCAL_PATH)/../jniplayer/

    LOCAL_SRC_FILES := jniplayer.cpp jni_utils.cpp yuv2rgb565.cpp gl_renderer.cpp f1.c f2.c

    LOCAL_SRC_FILES := bac.s cas.s

    LOCAL_LDLIBS := -llog -lz -ljnigraphics -lGLESv2 #-larmar_lib

    OBJS_ASM := ${LOCAL_SRC_FILES:%.s=%.o}
    OBJS_ASM := ${OBJS_ASM:%=$(OBJDIR_ASM)/%}

    LOCAL_CFLAGS += $(LENT_CFLAGS)
    LOCAL_CFLAGS += -mfpu=neon
    #LOCAL_CFLAGS += CC := gcc
    #LOCAL_CFLAGS += AR = ar
    #LOCAL_CFLAGS += armcc

    LOCAL_SHARED_LIBRARIES := ffmpeg lenthevcdec

    LOCAL_MODULE := jniplayer

    include $(BUILD_SHARED_LIBRARY)

    #3030
    ket
    Participant

    Hi,

    The compiler does try to build your .s file as assembly code, so you should not need any additional flags.

    In your Android.mk file, you are overriding the LOCAL_SRC_FILES to contain only the .s files and not the .cpp and .c files because you are using := not +=. If you intend to build both assembly and c/c++ files for your app, then the second LOCAL_SRC_FILES definition should use += to append files instead.

    As for the errors in your assembly file bac.s, they seem to be pointing to actual problems with this file. You are using unknown instructions and unknown syntax in this file. You should be using gcc ARM assembly syntax here for gcc to be able to compile this file not just ARM assembly syntax.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.