Description
This is Issue 604 moved from a Google Code project.
Added by 2011-08-28T17:03:46.000Z by t...@prolectron.com.
Please review that bug for more context and additional comments, but update this bug.
Original labels: Type-Defect, Priority-Medium
Original description
I am debugging routines in the Linux avr-gcc compiler.
I found and corrected a bug in the avr-libc-1.7.1 delay.h file, but the solution caused a problem with the round() function in math.h. Here is the report to Savannah on the delay.h bug.
https://savannah.nongnu.org/bugs/?34047
Here is a section of a post to the Arduino forum, so I don't have to retype it. Bug #2 is the bug affecting the Arduino library. Past versions of avr-libc may need that round macro, but not 1.7.1. It generates an error with that version.
Bug #1
avrlibc-1.7.1/include/util/delay.h.in
At line 44, add this:
Code:
include <math.h>
This is required due to the calls to fabs() and ceil() in the delay.h file.
If you are using a precompiled version from a repository or download from Atmel, you can "retro" this fix by adding the same line to your current delay.h file.
/usr/../avr/include/util/delay.h
My repository installed it in "/usr/avr/include/util/delay.h", but that could vary by version of Linux and the repository. Some may be "/usr/local/".
Bug #2
arduino-0022/hardware/arduino/cores/arduino/wiring.h
Remark out line 79 (round macro). This causes a problem with the avr-gcc math.h library when you add the include to delay.h.
Code:
// #define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5))