[Top][All Lists]

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

Re: [avr-gcc-list] __builtin_avr_delay_cycles expects an integer constan

From: Georg-Johann Lay
Subject: Re: [avr-gcc-list] __builtin_avr_delay_cycles expects an integer constant.
Date: Thu, 03 May 2012 09:18:52 +0200
User-agent: Mozilla Thunderbird 1.0.7 (Windows/20050923)

Victor Aprea schrieb:

I'm (at long last) trying to switch from using Windows to using Ubuntu for
my AVR development. I'm using AVR-GCC 4.5.3 on Ubuntu 12.04. I'm using the
Eclipse IDE with the AVR-GCC plugin. I'm getting the following error trace
from the compiler:

In file included from ../soft_uart.c:16:0:
/usr/lib/gcc/avr/4.5.3/../../../avr/include/util/delay.h: In function
/usr/lib/gcc/avr/4.5.3/../../../avr/include/util/delay.h:153:28: error:
__builtin_avr_delay_cycles expects an integer constant.
/usr/lib/gcc/avr/4.5.3/../../../avr/include/util/delay.h: In function
/usr/lib/gcc/avr/4.5.3/../../../avr/include/util/delay.h:230:28: error:
__builtin_avr_delay_cycles expects an integer constant.

line 16 of soft_uart.c is just the #include <util/delay.h> line.

I use _delay_ms and _delay_us in exactly six lines of code. The first two

_delay_ms(BIT_TIME_US * 2);

which both depend on the following definitions:

#define BAUD_RATE   2400
#define BIT_TIME_US (1000000.0 / BAUD_RATE)

and then also the following four lines:


I've read this 
avr-freaks and also this
but nothing jumps out at me as being relevant. Obviously, my arguments are
all well defined constants at compile-time. The same error message shows up
as long as at least one of those six lines is not commented out.

Every single avr-gcc call issued by Eclipse contains the argument
-DF_CPU=3686400UL so F_CPU is also a well defined constant. What the heck
is going on here?

Without more information it's not possible to tell.

Can you post a preprocessed code for a (minimal) example that still
triggers the error, together with the error message and compiler
output? You get both by adding -save-temps -v to compiler options.
The preprocessed code is a text file named *.i

As the error message requestst an /integer/ constant:
Does the error disappear if you avoid float constants?




reply via email to

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