| Author |
Message |
|
|
Posted: Mar 04, 2011 - 10:09 PM |
|


Joined: Apr 25, 2004
Posts: 3809
Location: Denmark
|
|
Quick hack for compiling the Atmel AS toolchain (afaik this isn't the one used in AS5).
But i cant seem to find those patches ...
See - http://distribute.atmel.no/tools/opensource/avr-gcc/
It uses avr-gcc-4.4.3 , but avr-libc-1.7.1.
And a newer gmp & mpfr ... (dont think gmp/mpfr versions makes much difference in the avr code).
You can skip get-patches.sh (they are already in the patches dir) , and just run getfiles.sh
Im skipping avr-libc support for the xmega32x1 & xmega128b1
I cant get the Atmel patches to work (build)
I also had to make a patch for binutils Makefile.in -
56-binutils-2.20.1-avrtiny10-makefile-in.patch
Wonder if "Atmel" ever tested the sources that is in the above url (on a build) ????
#
# Drop avr-libc patching for now , i cant get the Atmel sources to work
# We are skipping support for the xmega32x1 & xmega128b1
# See - avrlibc : http://distribute.atmel.no/tools/opensource/avr-gcc/
#
As usual there is no warranties , and i can not be held responsible for any damage caused by the use of this script , ot what it creates.
Quote:
There might be a slight error with delay.h complaining (See below).
And I just had a "hint" that the solution is to include <math.h> from within <util/delay.h">
/Bingo[/quote] |
Last edited by Bingo600 on Apr 29, 2011 - 07:25 AM; edited 2 times in total
|
| |
|
|
|
|
|
Posted: Mar 05, 2011 - 08:41 AM |
|


Joined: Apr 25, 2004
Posts: 3809
Location: Denmark
|
|
@Eric / Atmel
This isn't to "pollute" the Crosstool talk on the acr-gcc list.
It was mostly to try the patches , and to see some tiny10 support.
btw: Thanx for the patches , i suppose the new patchset for the AS5 toolchain will popup in the near future.
/Bingo |
|
|
| |
|
|
|
|
|
Posted: Mar 07, 2011 - 05:15 PM |
|


Joined: Feb 16, 2009
Posts: 32
|
|
Your Sir are a god!
It worked Now I can finally program my ATtiny4313...
I suggest to add these two things:
a) patch for avrdude.conf for ATtiny4313 as found here.
b) at least a note mentioning udev-rules
THANK YOU ! |
|
|
| |
|
|
|
|
|
Posted: Mar 07, 2011 - 06:28 PM |
|


Joined: Feb 16, 2009
Posts: 32
|
|
One issue I've had so far is this:
Everything I compile using my makefile works. It uses avr-gcc, no C++ stuff involved.
Now as I am on linux, I tried to fire up the Arduino IDE and compile some code there as well. It compiles, except the last few steps that involve avr-g++ for compiling C++ code.
It chokes on including <avr/delay.h>, which seems to want to use functions 'ceil()' and 'fabs()', which are defined in 'math.h', which doesn't get included in 'delay.h'.
Code:
avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega168 -DF_CPU=8000000L -DARDUINO=22 -I/xxx/arduino-0022/hardware/arduino/cores/arduino /xxx/arduino-0022/hardware/arduino/cores/arduino/HardwareSerial.cpp -o/tmp/build5414833210231722667.tmp/HardwareSerial.cpp.o
In file included from /usr/local/avr/lib/gcc/avr/4.4.3/../../../../avr/include/avr/delay.h:37,
from /xxx/arduino-0022/hardware/arduino/cores/arduino/wiring_private.h:30,
from /xxx/arduino-0022/hardware/arduino/cores/arduino/HardwareSerial.cpp:28:
/usr/local/avr/lib/gcc/avr/4.4.3/../../../../avr/include/util/delay.h: In function 'void _delay_ms(double)':
/usr/local/avr/lib/gcc/avr/4.4.3/../../../../avr/include/util/delay.h:149: error: 'fabs' was not declared in this scope
/usr/local/avr/lib/gcc/avr/4.4.3/../../../../avr/include/util/delay.h:149: error: 'ceil' was not declared in this scope
/usr/local/avr/lib/gcc/avr/4.4.3/../../../../avr/include/util/delay.h: In function 'void _delay_us(double)':
/usr/local/avr/lib/gcc/avr/4.4.3/../../../../avr/include/util/delay.h:226: error: 'fabs' was not declared in this scope
/usr/local/avr/lib/gcc/avr/4.4.3/../../../../avr/include/util/delay.h:226: error: 'ceil' was not declared in this scope
I can force this error to show up as well, when trying to compile my code (which compiles with avr-gcc) with avr-g++.
Then I inserted math.h into delay.h and it got a bit further, but was then complaining about missing stuff in math.h line 426.
Maybe something is not quite ok. |
|
|
| |
|
|
|
|
|
Posted: Mar 07, 2011 - 06:42 PM |
|


Joined: Feb 16, 2009
Posts: 32
|
|
Hmmm.
It seems that with this version, I need to explicitly include 'math.h' before including 'util/delay.h' - in every file of code (using avr-g++). Very odd. But now I know about it  |
|
|
| |
|
|
|
|
|
Posted: Mar 07, 2011 - 06:50 PM |
|

Joined: May 03, 2009
Posts: 564
Location: Dallas, TX USA
|
|
Ooooooo.
Well, I've been very active lately with <util/delay.h> and contributed to the latest version.
The latest version has some rounding capabilities and thats where those functions come in.
Normally, they are builtins for the compiler.
I'll have to go back and have a look (and a think) about how to deal with the additional
needs for the functions when using C++ in particular to see if it is a C++ thing or
just the Arduino IDE.
--- bill |
|
|
| |
|
|
|
|
|
Posted: Mar 07, 2011 - 07:38 PM |
|


Joined: Apr 25, 2004
Posts: 3809
Location: Denmark
|
|
@Bill
I use the new avr-libc-1.7.1 , could that be it ?
/Bingo |
|
|
| |
|
|
|
|
|
Posted: Mar 07, 2011 - 07:45 PM |
|


Joined: Apr 25, 2004
Posts: 3809
Location: Denmark
|
|
|
madworm wrote:
I suggest to add these two things:
a) patch for avrdude.conf for ATtiny4313 as found here.
b) at least a note mentioning udev-rules
You will have to apply those patches your self.
I'm only using "General releases" , as in "plain" avrdude 5.10.
The "specialities" you have to add
/Bingo |
|
|
| |
|
|
|
|
|
Posted: Mar 07, 2011 - 08:09 PM |
|


Joined: Feb 16, 2009
Posts: 32
|
|
|
|
|
|
|
Posted: Mar 07, 2011 - 08:15 PM |
|


Joined: Apr 25, 2004
Posts: 3809
Location: Denmark
|
|
@madworm
But they have to get to this thread to download the script , and they'll see your comments
I will (hopefully soon) use my time updating the .deb packages on cliff's site , with new packages containing avr-libc-1.7.1.
Provided that Bill/Jörg can verify that the above math.h problem , isn't a problem ....
Edit: Just had a "hint" that the solution is to include <math.h> from within <util/delay.h">
/Bingo |
|
|
| |
|
|
|
|
|
Posted: Mar 07, 2011 - 09:07 PM |
|


Joined: Feb 16, 2009
Posts: 32
|
|
Almost.
Adding 'math.h' to the deprecated <avr/delay.h> doesn't solve the issue. It must be added to <util/delay.h> directly - at least on my system. Then it works  |
|
|
| |
|
|
|
|
|
Posted: Mar 07, 2011 - 09:09 PM |
|


Joined: Apr 25, 2004
Posts: 3809
Location: Denmark
|
|
@madworm
I think i corrected my prev. post from <avr/delay.h> to <util/delay.h> while you were writing the above.
/Bingo |
|
|
| |
|
|
|
|
|
Posted: Mar 07, 2011 - 10:26 PM |
|


Joined: Feb 16, 2009
Posts: 32
|
|
So it seems
BTW, as I've filed the lack of ATtiny4313 support as a bug on openSUSE, people over there are quite interested in getting this thing up and running again as well.
Avrdude has been updated in the 'CrossToolchain:/avr' repositories already  |
|
|
| |
|
|
|
|
|
Posted: Mar 08, 2011 - 02:47 AM |
|

Joined: May 03, 2009
Posts: 564
Location: Dallas, TX USA
|
|
|
Bingo600 wrote:
@Bill
I use the new avr-libc-1.7.1 , could that be it ?
/Bingo
Yes, I believe that the new delay code (which is actually much better BTW) is in 1.7.1
I haven't had time to look at this or test it yet
to see what the real issue is.
My assumption is that there is some missing C++ wrapper foo to get the compiler to recognize the builtin functions fabs() and ceil().
An interim solution is to disable the newer delay code and
revert back to the old delay code that used the delay loops.
To do that, turn on the define:
__DELAY_BACKWARD_COMPATIBLE__
--- bill |
|
|
| |
|
|
|
|
|
Posted: Apr 05, 2011 - 02:00 PM |
|

Joined: Aug 11, 2010
Posts: 12
|
|
Hi, I've built this on an OpenSuse x86_64 machine and I'm getting this error:
Quote:
In file included from globals.h:28,
from lcd.c:15:
/opt/avr/bin/../lib/gcc/avr/4.4.3/../../../../avr/include/util/delay.h: In function 'vfnInitLcd':
/opt/avr/bin/../lib/gcc/avr/4.4.3/../../../../avr/include/util/delay.h:229: error: __builtin_avr_delay_cycles expects an integer constant.
I've thought problems with delay.h should be fixed in this release or am I missing something? |
|
|
| |
|
|
|
|
|
Posted: Apr 05, 2011 - 02:39 PM |
|


Joined: Jul 18, 2005
Posts: 62314
Location: (using avr-gcc in) Finchingfield, Essex, England
|
|
| Are you building with optimization enabled? |
_________________
|
| |
|
|
|
|
|
Posted: Apr 05, 2011 - 02:46 PM |
|

Joined: Aug 11, 2010
Posts: 12
|
|
Yes, I'm using "-O2". To get rid of the warning I have to "#define __HAS_DELAY_CYCLES 0", which seems to use the old code. See delay.h:
Code:
#elif !__HAS_DELAY_CYCLES || (__HAS_DELAY_CYCLES && !defined(__OPTIMIZE__)) || defined (__DELAY_BACKWARD_COMPATIBLE__)
...
|
|
|
| |
|
|
|
|
|
Posted: Aug 11, 2011 - 06:37 PM |
|


Joined: Apr 25, 2004
Posts: 3809
Location: Denmark
|
|
|
|
|
|
|
Posted: Aug 11, 2011 - 07:02 PM |
|


Joined: Dec 21, 2006
Posts: 1483
Location: Saar-Lor-Lux
|
|
|
salixer wrote:
I'm getting this error:
Quote:
In file included from globals.h:28,
from lcd.c:15:
/opt/avr/bin/../lib/gcc/avr/4.4.3/../../../../avr/include/util/delay.h: In function 'vfnInitLcd':
/opt/avr/bin/../lib/gcc/avr/4.4.3/../../../../avr/include/util/delay.h:229: error: __builtin_avr_delay_cycles expects an integer constant.
I've thought problems with delay.h should be fixed in this release or am I missing something?
The error says that there is a problem in your code: You are using a function from delay.h (we don't see which as your code is secret) with a delay that is not a constant.
Note that by hacking around this by using older delay routines you might avoid the error but get completely unusable delay times and probably drag in float arithmetic. |
|
|
| |
|
|
|
|
|
Posted: Aug 12, 2011 - 08:27 AM |
|

Joined: Aug 11, 2010
Posts: 12
|
|
Hey, as you are saying this I've found the problem. In this function I'm using:
Code:
_delay_us(LCDSPI_DATA_DELAY);
while LCDSPI_DATA_DELAY in lcd.h is defined as:
Code:
#define LCDSPI_DATA_DELAY ((64 / (F_CPU / 1e6)) * 9)
|
|
|
| |
|
|
|
|
|