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

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

Re: [avr-gcc-list] inline assembler problem


From: Ewout Boks
Subject: Re: [avr-gcc-list] inline assembler problem
Date: Tue, 20 Jan 2004 09:46:26 +0100
User-agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.5) Gecko/20031109



That is the inline asm problem I asked Joerg about yesterday. It is an unecessary warning since your code looks perfectly allright.

I believe that it has been solved in post 3.3.1 versions of avr-gcc, so update the compiler is your solution.

Ewout


Date: Mon, 19 Jan 2004 07:20:03 +0100
From: Matte <address@hidden>
To: address@hidden
Subject: Re: [avr-gcc-list] inline assembler problem
Message-ID: <address@hidden>
In-Reply-To: <address@hidden>
References: <address@hidden>
         <address@hidden>
Content-Type: text/plain
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Precedence: list
Message: 3

Hi
Since some of you wanted to view the whole testprogram in order to help
me track the error I've struggeling with, I post it here. The compiler
I'm using is still the avr-gcc-3.3.1. The functions in the code below I did implement in order to have some simple functions to learn from.

#include <inttypes.h>

#define PORT_A 0x1B
#define DDR_A 0x1A
#define PIN_A 0x19

uint8_t read(const uint8_t adr) {
  uint8_t p;
  asm volatile ("in %0, %1" : "=r" (p) : "I" (adr));
  return p;
}

uint8_t fastSBI(const uint8_t port, const uint8_t bit) {
  asm volatile("sbi %0, %1" : : "I" (port), "I" (bit));
}

int main(void) {
  uint8_t port_a = PORT_A;
  uint8_t ddr_a = DDR_A;
  uint8_t pin = 3;
  uint8_t data;
data = read(port_a);
  fastSBI(ddr_a, pin);
return 0;
}

When trying to compile this I get the following errors: inlasm.c: In function `read':
inlasm.c:11: warning: asm operand 1 probably doesn't match constraints
inlasm.c:11: error: impossible constraint in `asm'
inlasm.c: In function `fastSBI':
inlasm.c:17: warning: asm operand 0 probably doesn't match constraints
inlasm.c:17: warning: asm operand 1 probably doesn't match constraints




reply via email to

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