Follow-up Comment #4, bug #36611 (project avr-libc):

I ran into this problem and just re-wrote the *__delay_loop_2_* assembly.

This should be equivalent for all AVRs. It should even take the same number of
clock cycles (since *_sbiw_* takes 2 clock cycles).

My initial tests suggest this is working. Since *___count_* is a 2 byte
number, *_%A0_* and *_%B0_* should always work as expected.


void
_delay_loop_2(uint16_t __count)
{
        __asm__ volatile (
                "1: subi %A0,1" "\n\t"
                "sbci %B0,0" "\n\t"
                "brne 1b"
                : "=d" (__count)
                : "0" (__count)
        );
}


    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?36611>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/


_______________________________________________
AVR-libc-dev mailing list
AVR-libc-dev@nongnu.org
https://lists.nongnu.org/mailman/listinfo/avr-libc-dev

Reply via email to