This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

armasm push unknown opcode error

Note: This was originally posted on 8th April 2008 at http://forums.arm.com

Hi,
I am trying to compile a .s file using armasm. But i am getting this error

"VectorTransform.s", line 8: Error: A1163E: Unknown opcode
    8 00000000  PUSH {r2-r12,lr}
"VectorTransform.s", line 9: Error: A1163E: Unknown opcode
    9 00000000  LDM r0!,{r2-r5}

Actual Code:-

..AREA TransPoint,CODE,READONLY
..CODE32
..ENTRY

start
..PUSH {r2-r12,lr}
..LDM r0!,{r2-r5}


(Please treat these dots as space)

Please do let know about any possible solution ASAP.
  • Note: This was originally posted on 9th April 2008 at http://forums.arm.com

    i tried with extern and rearranging the EXPORT directive....but still there the linker is giving undefined symbol error.... is there anything more that i need to specify for linking....or making the symbol visible to C files...????
  • Note: This was originally posted on 9th April 2008 at http://forums.arm.com

    thanks everyone....it solved the problem... :( now the code is compiling....

    But now I am getting linking errors....

    I have a function TransPoint,which i want to use in another C file. I have declared the function prototype in that C file. But it seems that the linker is not able to find the function defination.

    The function prototype is void TransPoint(void*,void*) .

    Here is the TransPoint function in asm.


    ..AREA VecTrans,CODE,READONLY
    ..CODE32
    ..ENTRY
    TransPoint FUNCTION
    ..EXPORT TransPoint
    ..STMFD   sp!, {r2-r12, lr};
    ..LDMFD r0!,{r2-r5}
    ;some more code

    Do I need to specify anything more so that the linker finds this defination. Please do let me know.
  • Note: This was originally posted on 9th April 2008 at http://forums.arm.com

    is there anything that i need to do in the make file...I am using RVCT 1.2....????
  • Note: This was originally posted on 9th April 2008 at http://forums.arm.com

    Hi,

    Below is the error message and link command:


    compiling asm

            C:\Progra~1\ARM\RVCT_BREWv1_2\bin\armasm -32 -cpu arm7tdmi -I. -I..\..\

    .\..\inc_3_1_2 -I"..\..\..\..\inc_3_1_2" -I"..\..\..\..\src_3_1_2" -I..\..\..\.

    \inc_3_1_2\gles -I..\BREWInc -I.\user -o VectorTransform.o ..\BREWSrc\VectorTra

    sform.s

    ---------------------------------------------------------------

    ---------------------------------------------------------------

    TARGET sample_app.elf

            C:\Progra~1\ARM\RVCT_BREWv1_2\bin\armlink -o sample_app.elf -ropi
    BREWFrameWork.o AEEModGen.o AEEMediaUtil.o  sample.o AEEAppGen.o
    VectorTransform.o -first AEEMod_Load

    Error: L6218E: Undefined symbol TransPoint(void*, void*) (referred from sample.o).

    Finished: 0 information, 0 warning and 1 error messages.

    NMAKE : fatal error U1077: 'C:\Progra~1\ARM\RVCT_BREWv1_2\bin\armlink' : return

    code '0x1'

    Stop.


    The TransPoint defination is in VectorTransform.s
  • Note: This was originally posted on 9th April 2008 at http://forums.arm.com

    I normally EXPORT the label before specifying it - not sure if that makes a difference:

            EXPORT  myFunc
    myFunc FUNCTION
            ; // Instructions go here

    Also, make sure you have marked the C header declaration of the function prototype "extern".
  • Note: This was originally posted on 9th April 2008 at http://forums.arm.com

    i tried with extern and rearranging the EXPORT directive....but still there the linker is giving undefined symbol error.... is there anything more that i need to specify for linking....or making the symbol visible to C files...????


    Can you post

    - the error message
    - the full link line (i.e. the actual command line, not the line from the Makefile)

    Cheers
    SD
  • Note: This was originally posted on 8th April 2008 at http://forums.arm.com

    The reason it doesn't assemble is that your PUSH is missing the base register, and your LDM is missing the direction and increment specifiers.

    PUSH is a macro instruction it is actually an STMFD (Store Multiple to Full Descending stack) under the hood. Remember when assembling an LDM or STM you need to specify the direction and type of the load (ascending or descending / increment base before or after).

    For example - for ARM EABI compliant push / pop stack operations you need a "full descending" stack so use the following pair as your PUSH and POP at the start and end of your functions.

    function_entry
    STMFD   sp!, {r4-r10, lr}; // Equivalent to STMDB

      ; // Useful function code in here

    LDMFD   sp!, {r4-r10, pc}; // Equivalent to LDMIA

    Cheers,

    I
  • Note: This was originally posted on 8th April 2008 at http://forums.arm.com

    AFAIK, PUSH and POP are only supported under legacy Thumb (CODE16) and newer UAL ARM/Thumb (ARM or THUMB) areas, not legacy ARM (CODE32) areas.

    [url="http://infocenter.arm.com/help/topic/com.arm.doc.qrc0001l/QRC0001_UAL.pdf"]http://infocenter.arm.com/help/topic/com.a...QRC0001_UAL.pdf[/url]
    might be of interest.

    hth
    s.
  • Note: This was originally posted on 8th April 2008 at http://forums.arm.com

    AFAIK, PUSH and POP are only supported under legacy Thumb (CODE16) and newer UAL ARM/Thumb (ARM or THUMB) areas, not legacy ARM (CODE32) areas.

    [url="http://infocenter.arm.com/help/topic/com.arm.doc.qrc0001l/QRC0001_UAL.pdf"]infocenter.arm.com/.../url]
    might be of interest.


    CODE16 and THUMB have a very different syntax, hence you need to rewrite the code - It just isn't possible to differentiate legacy Thumb syntax from unified Thumb syntax.  However, the legacy ARM and unified ARM syntax is very similar, so you may find that CODE32 will accept unified syntax too.

    Back to the original problem: armasm only supports the UAL syntax from RVCT 2.2 onwards.  For earlier versions of armasm you will need to define macros for the missing instructions, or rewrite the code using the legacy syntax.
  • Note: This was originally posted on 9th April 2008 at http://forums.arm.com

    Error: L6218E: Undefined symbol TransPoint(void*, void*) (referred from sample.o).


    The fact that the linker has used the symbol name "TransPoint(void*, void*)" suggests that sample.o was C++ source code, or compiled using --cpp.  When declaring the function in the C++ source code or header file you will need to use extern "C".  e.g.

    extern "C" void TransPoint(void*, void*);