[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] inline assembler problem
From: |
Theodore A. Roth |
Subject: |
Re: [avr-gcc-list] inline assembler problem |
Date: |
Sun, 18 Jan 2004 14:09:42 -0800 (PST) |
On Sun, 18 Jan 2004, Matte wrote:
> Hi
>
> I'm struggeling with the avr-gcc inline assembler. I want to use the
> inline assembler to optimize code, where I see that the gcc compiler
> does not gives as good code as I want.
>
> I'm currently using the avr-gcc version 3.3.1, with the ATmega16
> microcontroller.
>
> I try to use the following statements (that I found as an example):
>
> uint8_t read(const uint8_t adr) {
> uint8_t p;
> asm volatile ("in %0, %1" : "=r"(p) : "I"(adr));
> return p;
> }
>
> This gives me the follwing error while compiling:
>
> displaytest.c: In function `read':
> displaytest.c:45: warning: asm operand 1 probably doesn't match
> constraints
> displaytest.c:45: error: impossible constraint in `asm'
Have a look at this:
http://jubal.westnet.com/AVR/doc/avr-libc-user-manual/FAQ.html#faq_port_pass
>
> I also tried to do the following:
>
> void fastSBI(const uint8_t port, const uint8_t bit) {
> asm volatile ("sbi %0, %1" : : "I"(port), "I"(bit));
> }
>
> This gives the errors:
> displaytest.c: In function `fastSBI':
> displaytest.c:50: warning: asm operand 0 probably doesn't match
> constraints
> displaytest.c:50: warning: asm operand 1 probably doesn't match
> constraints
> displaytest.c:50: error: impossible constraint in `asm'
>
> Since there clearly is something that I don't understand regarding the
> inline assembler I would like some help on this matter. If there is so
> that the above is correct, there might be some error in the
> configuration of the compilor or the develpoment environmant, then I
> could use some help to solve that problem as well.
You might also want to look this over if you haven't already:
http://jubal.westnet.com/AVR/doc/avr-libc-user-manual/inline_asm.html
Ted Roth