bugAVR C Runtime Library - Bugs: bug #36611, _delay_loop_2 must not use...

 
 

bug #36611: _delay_loop_2 must not use constraint "w" with all targets

Submitted by:  Georg-Johann Lay <gjlayde>
Submitted on:  Fri 08 Jun 2012 10:36:27 PM UTC  
 
Category: HeaderSeverity: 3 - Normal
Priority: 9 - ImmediateItem Group: Header files
Status: NonePercent Complete: 0%
Assigned to: NoneOpen/Closed: Open
Release: 1.8.0Fixed Release: None

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Fri 16 Nov 2012 09:17:17 PM UTC, comment #3:

We'll need to verify that __builtin_delay_cycles in gcc is still valid.

Eric Weddington <arcanum>
Project Administrator
Fri 16 Nov 2012 09:04:06 PM UTC, comment #2:

Factor out the ISA / architecture by means of #if / #ifdef _HAVE_ADIW_ or _HAVE_CONSTRAINT_W_ or _AVR_ARCH_ or whatever your tools provide and use 2-insn decrement alongside with "d".

If your tools have __builtin_delay_cycles you can use that, but make sure that respective insn constraint does not suffer from the same flaw (AFAIR this is the case with Atmel patches)

Georg-Johann Lay <gjlayde>
Fri 16 Nov 2012 06:13:05 PM UTC, comment #1:

Johann, what do you recommend to fix this?

Eric Weddington <arcanum>
Project Administrator
Fri 08 Jun 2012 10:36:27 PM UTC, original submission:

./include/util/delay_basic.h

implements:

void
_delay_loop_2(uint16_t __count)
{
_asm_ volatile (
"1: sbiw %0,1" "\n\t"
"brne 1b"
: "=w" (__count)
: "0" (__count)
);
}

This won't work for tiny tiny targets because

- they don't have SBIW
- compiler with suprt for these targets empty the register
class associated with "w". Thus, the compiler will throw
an error if it sees "w".

Georg-Johann Lay <gjlayde>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by arcanum (Posted a comment)
  • -unavailable- added by gjlayde (Submitted the item)
  •  

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follows 1 latest change.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 16 Nov 2012 06:13:05 PM UTCarcanumPriority5 - Normal=>9 - Immediate

    Back to the top


    Powered by Savane 3.1-cleanup