AnsweredAssumed Answered

asm build errors (blackfin asm for speex)

Question asked by jake2011 on Aug 2, 2011
Latest reply on Sep 21, 2011 by vinodbableshwar

Could somebody please give me the general guidelines for how the following code should be changed so I can compile it in Visualdsp ??

 

static int lsp_quant(
   short *x,
   const signed char *cdbk,
   int                nbVec,
   int                nbDim
)
{
   int          j;
   signed long best_dist = 1 << 30;
   int          best_id = 0;

   __asm__ __volatile__
   (
      " %0 = 1 (X);\n\t"                       /* %0: best_dist */
      " %0 <<= 30;\n\t"
      " %1 = 0 (X);\n\t"                       /* %1: best_i         */
      "       P2 = %3\n\t"                           /* P2: ptr to cdbk    */
      "       R5 = 0;\n\t"                           /* R5: best cb entry  */
      "       R0 = %5;\n\t"                          /* set up circ addr   */
      "       R0 <<= 1;\n\t"
      "       L0 = R0;\n\t"
      "       I0 = %2;\n\t"                          /* %2: &x[0]          */
      "       B0 = %2;\n\t"
      "       R2.L = W [I0++];\n\t"
      " LSETUP (1f, 2f) LC0 = %4;\n\t"
      "1:   R3 = 0;\n\t"                         /* R3: dist           */
      "   LSETUP (3f, 4f) LC1 = %5;\n\t"
      "3:       R1 = B [P2++] (X);\n\t"
      "     R1 <<= 5;\n\t"
      "     R0.L = R2.L - R1.L || R2.L = W [I0++];\n\t"
      "     R0 = R0.L*R0.L;\n\t"
      "4:     R3 = R3 + R0;\n\t"
      "   cc =R3<%0;\n\t"
      "   if cc %0=R3;\n\t"
      "   if cc %1=R5;\n\t"
      "2:     R5 += 1;\n\t"
      "         L0 = 0;\n\t"
      : "=&d" (best_dist), "=&d" (best_id)
      : "a" (x), "b" (cdbk), "a" (nbVec), "a" (nbDim)
      : "I0", "P2", "R0", "R1", "R2", "R3", "R5", "L0", "B0", "A0"
   );

 

   for (j = 0; j < nbDim; j++)
   {
      x[j] = SUB16(x[j], SHL16((i16)cdbk[best_id * nbDim + j], 5));
   }

   return best_id;
}

 

 

 

This is what I get when I try to build it:

 

[Error ea5004] "C:\Users\coder\AppData\Local\Temp\acc1bbc15e9000\acc1bbc15e9001.s":122 Syntax Error in :
R5 = 0;
syntax error is at or near text 'R5'.
Attempting error recovery by ignoring text until the ';'

[Error ea5004] "C:\Users\coder\AppData\Local\Temp\acc1bbc15e9000\acc1bbc15e9001.s":129 Syntax Error in :
LSETUP (1f, 2f) LC0 = P0;
syntax error is at or near text 'f'.
Attempting error recovery by ignoring text until the ';'

[Error ea5007] "C:\Users\coder\AppData\Local\Temp\acc1bbc15e9000\acc1bbc15e9001.s":130 The label "1:" is illegal because it begins with a digit. If this is GNU assembly source, rewrite to a local temporary name of your choosing. If the GNU assembly code was generated from a macro, the VisualDSP++ preprocessing label auto-generation feature ("?") can be used to generate a unique local label.

[Error ea5004] "C:\Users\coder\AppData\Local\Temp\acc1bbc15e9000\acc1bbc15e9001.s":131 Syntax Error in :
LSETUP (3f, 4f) LC1 = P1;
syntax error is at or near text 'f'.
Attempting error recovery by ignoring text until the ';'

[Error ea5007] "C:\Users\coder\AppData\Local\Temp\acc1bbc15e9000\acc1bbc15e9001.s":132 The label "3:" is illegal because it begins with a digit. If this is GNU assembly source, rewrite to a local temporary name of your choosing. If the GNU assembly code was generated from a macro, the VisualDSP++ preprocessing label auto-generation feature ("?") can be used to generate a unique local label.

[Error ea5003] "C:\Users\coder\AppData\Local\Temp\acc1bbc15e9000\acc1bbc15e9001.s":134 Semantic Error in instruction :
R0.L = R2.L - R1.L || R2.L = W [I0++];
Operands don't fit instruction template 'REG ASSIGN REG MINUS REG'.
Check for an out of range immediate value or an illegal register.

[Error ea5007] "C:\Users\coder\AppData\Local\Temp\acc1bbc15e9000\acc1bbc15e9001.s":136 The label "4:" is illegal because it begins with a digit. If this is GNU assembly source, rewrite to a local temporary name of your choosing. If the GNU assembly code was generated from a macro, the VisualDSP++ preprocessing label auto-generation feature ("?") can be used to generate a unique local label.

[Error ea5007] "C:\Users\coder\AppData\Local\Temp\acc1bbc15e9000\acc1bbc15e9001.s":140 The label "2:" is illegal because it begins with a digit. If this is GNU assembly source, rewrite to a local temporary name of your choosing. If the GNU assembly code was generated from a macro, the VisualDSP++ preprocessing label auto-generation feature ("?") can be used to generate a unique local label.

Previous errors prevent assembly

Assembler totals: 8 error(s) and 0 warning(s)
cc3089: fatal error: Assembler failed
Tool failed with exit/exception code: 1.
Build was unsuccessful.


There are some obvious errors which I fixed (labels and missing semicolon):

 

 

When I make those corrections I get this error:

 

[Error ea5003] "C:\Users\coder\AppData\Local\Temp\acc1e201861000\acc1e201861001.s":134 Semantic Error in instruction :
R0.L = R2.L - R1.L || R2.L = W [I0++];
Operands don't fit instruction template 'REG ASSIGN REG MINUS REG'.
Check for an out of range immediate value or an illegal register.

Previous errors prevent assembly

Assembler totals: 1 error(s) and 0 warning(s)
cc3089: fatal error: Assembler failed
Tool failed with exit/exception code: 1.
Build was unsuccessful.

 

 

I have attached the files that I am trying to fix. Presumably it is possible to build these files if I used the GNU gcc toolchain for blackfin, but I am using visualdsp and the toolchain in visual dsp is not able to build these files...hope somebody can shed some light on this and give me some hints as to how I should fix it...

Attachments

Outcomes