[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-libc-dev] Re: [avr-libc-commit] [2103] Probe the compiler for the a
From: |
Joerg Wunsch |
Subject: |
[avr-libc-dev] Re: [avr-libc-commit] [2103] Probe the compiler for the availability of the |
Date: |
Wed, 17 Mar 2010 06:20:46 +0100 |
User-agent: |
Mutt/1.5.20 (2009-06-14) |
For those who do not follow the avr-libc-commit list:
As Joerg Wunsch wrote:
> Revision: 2103
> http://svn.sv.gnu.org/viewvc/?view=rev&root=avr-libc&revision=2103
> Author: joerg_wunsch
> Date: 2010-03-17 05:16:10 +0000 (Wed, 17 Mar 2010)
> Log Message:
> -----------
> Probe the compiler for the availability of the
> __builtin_avr_delay_cycles() function, and modify the header files
> <util/delay.h> and <avr/builtins.h> appropriately. Note that the
> modification is done by setting __HAS_DELAY_CYCLES on top of those
> files, which has been left overridable from the compiler environment
> (i.e., commandline -D option) on purpose. Note also that _delay_us()
> and _delay_ms() can only use __builtin_avr_delay_cycles() if
> optimization is enabled as they'd otherwise try to pass a
> floating-point argument to it which is not allowed. (The compiler
> does not seem to be able to convert it into an unsigned long
> internally, not even with a type cast.) However, not enabling
> optimization for them yields garbage timing anyway, due to moving the
> compile-time constant floating-point calculations from the compiler
> into the AVR.
This moved the <util/delay.h> file to <util/delay.h.in>, from where
the configure script picks it up to modify it depending on the probe
result. I also committed a new <avr/builtins.h> that used to be one
of Eric's WinAVR patches.
If you've got a (patched) compiler that offers
__builtin_avr_delay_cycles(), your _delay_ms()/_delay_us()
implementations can benefit from it now. If you want to force the
previous implementation, you can do so by compiling your code with the
-D___HAS_DELAY_CYCLES=0 compiler option.
<avr/builtins.h> also documents some other builtins which I did not
really test so far. Documentation improvements for those are welcome.
--
cheers, J"org .-.-. --... ...-- -.. . DL8DTL
http://www.sax.de/~joerg/ NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)
- [avr-libc-dev] Re: [avr-libc-commit] [2103] Probe the compiler for the availability of the,
Joerg Wunsch <=