[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] Include ASM in C
From: |
Harald Kipp |
Subject: |
Re: [avr-gcc-list] Include ASM in C |
Date: |
Fri, 08 Jun 2001 20:40:40 +0100 (MEZ) |
Hi Elmar,
>but when I do the same but replacing the address of the port by its label
>like:
>
>asm volatile("sbi PORTB,0x07;");
>
>I get a compilation error: "Error: constant value required"
>
>This happens even if I define a constant like:
>#define MYPORTB 0x15
>asm volatile("sbi MYPORTB,0x07;");
You have to think in C, not ASM. The assembler
instructions are string constants and the C
preprocessor won't change them. So the string
"sbi MYPORTB,0x07;" is passed unmodified to
the assembler. But the assembler won't see
you C defines. Hope, that this wasn't explained
too complicated.
More hint could be found in my little Inline
Assembler Cookbook at
http://www.egnite.de/en/main1_1_3.htm
The name of the file is GCCAVRInlAsmCB.pdf.