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

Importing assembler code

Hello, everybody

I make a program for LPC1754 and trying to include helix mp3 codec - library. The compilers gives me errors with one of the files (assembly.h) that inline assembler is not permitted when generating thumb codes.

 static __inline int MULSHIFT32(int x, int y)
{
    /* important rules for smull RdLo, RdHi, Rm, Rs:
     *     RdHi and Rm can't be the same register
     *     RdLo and Rm can't be the same register
     *     RdHi and RdLo can't be the same register
     * Note: Rs determines early termination (leading sign bits) so if you want to specify
     *   which operand is Rs, put it in the SECOND argument (y)
         * For inline assembly, x and y are not assumed to be R0, R1 so it shouldn't matter
         *   which one is returned. (If this were a function call, returning y (R1) would
         *   require an extra "mov r0, r1")
     */

        int zlow;
    __asm {

        smull zlow,y,x,y

        }


    return y;
}

 static __inline int FASTABS(int x)
{
        int t=0; /*Really is not necessary to initialiaze only to avoid warning*/

        __asm {
                eor     t, x, x, asr #31
                sub     t, t, x, asr #31
        }

        return t;
}

static __inline int CLZ(int x)
{
        int numZeros;

        if (!x)
                return (sizeof(int) * 8);

        numZeros = 0;
        while (!(x & 0x80000000)) {
                numZeros++;
                x <<= 1;
        }

        return numZeros;
}


Since now I have never used C and Assembler in a same projects and the assembler project which I've done were with another IDE and processor. Please, can you show (or explain) me what exactly I have to do to make this code to work with uVision?

0