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

[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
‘soft_uart_init’:
/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
‘delay_bit_time’:
/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
are:

_delay_ms(BIT_TIME_US * 2);
_delay_us(BIT_TIME_US);

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:

_delay_ms(100);
_delay_ms(250);
_delay_ms(500);
_delay_ms(2000);

I've read this 
thread<http://www.avrfreaks.net/index.php?name=PNphpBB2&file=printview&t=105891&start=0>on
avr-freaks and also this
bug-report<http://old.nabble.com/-bug--34278--Seemingly-overzealous-%22__builtin_avr_delay_cycles-expects-an-integer-constant%22-td32451670.html>,
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?

Johann

Regards,

Vic



reply via email to

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