[En-Nut-Discussion] AVR: Use of _delay_loop_2 versus nut_delay_loops

Harald Kipp harald.kipp at egnite.de
Tue Sep 25 18:14:23 CEST 2012

Hi Uwe,

On 24.09.2012 14:17, Uwe Bonnes wrote:

> in SVN Head for NutMicroDelay for AVR, I replaces the usage of
> nut_delay_loops with all it's magic constants with a call to the avr-libc
> supplied _delay_loop_2() Funktion. Beside setup, the functions eats 4 cycle
> for each pass. This change made the BitBanging One-Wire example work with
> AVR too.

I'm currently busy on another "Baustelle" and won't have the time to
check this soon. But in general I appreciate this. NutMicroDelay() never
reached any reliable state.

Not sure, which version of avr-libc started to support this. We may have
to add a note in the NEWS file about the minimum avr-libc version
number, that is required. Many Nut/OS developers experience problems
with their own code when upgrading the toolchain. So they try to compile
Nut/OS with an older toolchain version and may unexpectedly run into new

Developers often criticize, that we do not exactly specify, which
toolchain is required. Personally, I hate to be forced to install a
specific toolchain for a specific software. Since now, the following
answer was correct:

* If you upgrade the toolchain, you typically need to upgrade Nut/OS.
* If you upgrade Nut/OS, you can keep your old toolchain, if you like.

But, of course, we cannot keep this status forever. Specifically the
runtime libs are changing, offering new functions and removing others
(like SIG_* recently). Sooner or later we have to draw a line and adapt
our source code to recent library revisions.



More information about the En-Nut-Discussion mailing list