avr-libc-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-libc-dev] [bug #18373] Bugs in Inline ASM documentacion


From: anonymous
Subject: [avr-libc-dev] [bug #18373] Bugs in Inline ASM documentacion
Date: Sat, 25 Nov 2006 14:45:33 +0000
User-agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; Maxthon)

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: address@hidden
             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/





reply via email to

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