assembly preprocessing

02 Dec 2010

Hi,

I am testing an assembly program which has a couple of #define directives in it. Is there a directive that I can give to the main program so that the assembly file can be passed through the preprocessor.

I read the manuals on the ARM site and it states that it can be achieved with -cpreproc if I remember correctly. The problem is I have no idea how to pass that to the compiler.

D

02 Dec 2010

I am actually trying to port part of the DSP lib to mbed. I manged to put together a comletely functional program for a FIR filter. The thing is the assembly file used C style defines.

I changed a couple of things

 

py EQU r0       
px EQU r1           
pcoeff RN r2        
nSamples RN r3
nTaps RN r4
c1 EQU r5
Acc0 RN r6
Acc1 RN r7
Acc2 RN r8
Acc3 RN r9
x0 RN r10
x1 RN r11
x2 RN r12
x3 RN r14

;Overloaded
c0 EQU r3           
pS_Coeff EQU r2

and there are significantly less errors. The only thing that remains is that c1 and c0  and pS_Coeff give a multiply defined error. I'm pretty sure that if I managed to get around this it can work.

 

 

09 Mar 2011

Probably far too old a message for this to be useful, but c0 and c1 have already been defined by the assembler as coprocessor register numbers, hence they cannot be redefined in user source code: http://infocenter.arm.com/help/topic/com.arm.doc.dui0473c/CJAECHGB.html

11 Jun 2011

The compiler doesn't appear to parse #define despite coloring it as a directive.

Thus this simple code sample in a separate *.s file compiles without problem:

AREA asm_func, CODE, READONLY EXPORT my_asm_func my_asm_func ADD R0, R1 BX LR END

but adding #define:

  1. define junk r0

AREA asm_func, CODE, READONLY EXPORT my_asm_func my_asm_func ADD R0, R1 BX LR END

throws error "unknown opcode junk, expecting opcode or Macro". Adding "comment" throws a similar error.

11 Jun 2011

In my previous post the edit box messed up my code by translating the hash symbol into a number (?) - trust me, the original code had the hash symbol before define !