URL:
  <http://savannah.nongnu.org/bugs/?18373>

                 Summary: Bugs in Inline ASM documentacion
                 Project: AVR C Runtime Library
            Submitted by: None
            Submitted on: Saturday 11/25/2006 at 14:45 UTC
                Category: Documentation
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: None
                  Status: None
                 Privacy: Public
             Assigned to: None
        Percent Complete: 0%
        Originator Email: [EMAIL PROTECTED]
             Open/Closed: Open

    _______________________________________________________

Details:

1. In section about inline asm you write that compiler doesn't support
Read-Write operand. It isn't true. Checked.

2. There is simpler way to acces operands than by number. You can write sth
like this:

static inline void delayus8(uint8_t t)
{
        asm volatile(
                "delayus8_loop%=: \n\t"
                "nop \n\t"
                "dec %[ticks] \n\t"
                "brne delayus8_loop%= \n\t"
                :[ticks]"+r"(t)
                :
        );
}

There is no need to make the same register as input and output because of
"+r" - read-write operand. But if you want, you can make it this way:

asm volatile(
                "delayus8_loop%=: \n\t"
                "nop \n\t"
                "dec %[ticks] \n\t"
                "brne delayus8_loop%= \n\t"
                :[ticks]"=r"(t)
                :"ticks"(t)
        );

But I found that it doesent always work correctly. It is compiled like
compiler "think" it dont need to set register [ticks] before call asembler
section.



    _______________________________________________________

Carbon-Copy List:

CC Address                          | Comment
------------------------------------+-----------------------------
Available only the item webpage     | Originator Email




    _______________________________________________________

Reply to this item at:

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

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



_______________________________________________
AVR-libc-dev mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/avr-libc-dev

Reply via email to