avr-gcc-list
[Top][All Lists]
Advanced

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

[avr-gcc-list] inline assembler problem


From: Matte
Subject: [avr-gcc-list] inline assembler problem
Date: Sun, 18 Jan 2004 22:55:31 +0100

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'

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. 

Best Regards
Mattias


-- 
Mattias

address@hidden

reply via email to

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