[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-gcc-list] assembler expressions

From: Jesper Hansen
Subject: [avr-gcc-list] assembler expressions
Date: Sat, 5 Mar 2005 12:50:28 +0100

I've been all over the (extremely sparse) gas documentation, searched the
net in vain, and tried all kinds of weird combinations to acheive the
following in an assembler file I'm processing with avr-gcc's assembler  :

avr-gcc -c -x assembler-with-cpp -mmcu=atmega128 -Wa,-a=file1.lst file1.s

I'm simply trying to calculate two 32-bit constants, the C-code for it would
be something like this :

#define F_CPU 18432000
#define F1 20000
#define F2 20001
#define LO_F (unsigned long) ( (float) F1 *  F_CPU / (15*16777216) )
#define HI_F (unsigned long) ( (float) F2 *  F_CPU / (15*16777216) )

Trying this in the assemler file obviously doesn't give the same result.

#define F_CPU 18432000
#define F1 20000
#define F2 20001

.equ LO_F,  F1 * F_CPU/(15*16777216)
.equ HI_F,  F2 * F_CPU/(15*16777216)

I need to use LO_F (and HI_F) later in the code like this :

 ldi  r21,lo8(LO_F)
 ldi  r22,hi8(LO_F)
 ldi  r23,hlo8(LO_F)

It seems no matter what I try, I get errors from the assember, or incorrect

Can anyone help me out, please ????


reply via email to

[Prev in Thread] Current Thread [Next in Thread]