bugSimulavr: an AVR simulator - Bugs: bug #38618, Improper use of _delay_ms in...


bug #38618: Improper use of _delay_ms in example/atmel_key

Submitted by:  Steve Kappel <skappel>
Submitted on:  Thu 28 Mar 2013 06:04:40 PM UTC  
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: Fixed
Privacy: PublicAssigned to: None
Open/Closed: ClosedComponent Version: simulavr

Add a New Comment (Rich MarkupRich Markup):

You are not logged in

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


Mon 20 May 2013 10:05:01 AM UTC, comment #1:

problem already fixed with commit 23ba1114d63ed51d10eae3814851ae8c428ba94b

Klaus Rudolph <zfrdh>
Project Administrator
Thu 28 Mar 2013 06:04:40 PM UTC, original submission:

GCC 4.7.2 and avr-libc 1.8.0 on OS X.

avr-gcc -mmcu=atmega128 -I. -DF_CPU=4000000UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -c -o StdDefs.o ../../../simulavr-1.0.0/examples/atmel_key/StdDefs.c
In file included from ../../../simulavr-1.0.0/examples/atmel_key/StdDefs.c:8:0:
/scratch/builds/ada/avrcross-run/lib/gcc/avr/4.7.2/../../../../avr/include/util/delay.h: In function 'msleep':
/scratch/builds/ada/avrcross-run/lib/gcc/avr/4.7.2/../../../../avr/include/util/delay.h:164:28: error: __builtin_avr_delay_cycles expects a compile time integer constant
make[2]: *** [StdDefs.o] Error 1

According to posts elsewhere, _delay_ms argument must be a constant.

See attached patch which eliminates function msleep and directly uses _delay_ms in main.c

Steve Kappel <skappel>


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

Attach File(s):

Attached Files
file #27705:  delay_ms.patch added by skappel (1kB - application/octet-stream)


Depends on the following items: None found

Items that depend on this one: None found


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

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.


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



    Follow 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 20 May 2013 10:05:01 AM UTCzfrdhStatusNone=>Fixed
    Thu 28 Mar 2013 06:04:40 PM UTCskappelAttached File-=>Added delay_ms.patch, #27705

    Back to the top

    Powered by Savane 3.1-cleanup