Pages: 1 [2] 3   Go Down
Author Topic: Incrementation bug? WTF? [BROKEN COMPILER - SOLVED]  (Read 8147 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Faraday Member
**
Karma: 8
Posts: 2526
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You might try avoiding the problem by applying good programming practice, and declare hue in the function where it's used (instead of using a global variable):
Code:
void loop()
{
   static int hue = 0;

   ...

-j
Logged

Cracow, PL
Offline Offline
Newbie
*
Karma: 1
Posts: 14
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I just would like to know if it's likely that installing avr-gcc from sources will solve the problem?

@kg4wsv

Thanks, I usually apply good programming practices. I just got my arduino today and was experimenting. It's not like it's some kind of a production code. Besides in a one-file, 50 liner it really doesn't matter if you use global variables.

And working around compiler bugs like this is way more evil than bad programming practices.
« Last Edit: February 03, 2011, 05:06:37 pm by dsh1 » Logged

Offline Offline
God Member
*****
Karma: 32
Posts: 507
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I don't know if compiling from source would help, if you've got the time and the patience you could try it. I couldn't get the compiler to compile on Ubuntu and I just gave up.

Logged


Cracow, PL
Offline Offline
Newbie
*
Karma: 1
Posts: 14
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

It could be gcc version or configure switches. I adapted PKGBUILDs from tinyos and compiled latest vanilla binutils (2.21) and gcc (4.5.2) and still the same problem.

If you know anything about compiling gcc-avr tell me if you see something suspicious here:

GCC:
Code:
 ../configure --disable-libssp \
               --disable-nls \
               --enable-languages=c,c++ \
               --infodir=/usr/share/info \
               --libdir=/usr/lib \
               --libexecdir=/usr/lib \
               --mandir=/usr/share/man \
               --prefix=/usr \
               --target=avr \
               --with-gnu-as \
               --with-gnu-ld \
               --with-as=/usr/bin/avr-as \
               --with-ld=/usr/bin/avr-ld


binutils:
Code:
   ../configure --build=$(../config.guess) \
                 --disable-nls \
                 --enable-install-libbfd \
                 --includedir=/usr/$(../config.guess)/include \
                 --infodir=/usr/share/info \
                 --libdir=/usr/lib \
                 --mandir=/usr/share/man \
                 --prefix=/usr \
                 --target=avr \
                 --disable-werror

Just compiled gcc 4.2.3 and it doesn't support atmega328p. One more try... This time 4.4.5.

--- EDIT --- No luck with 4.4.5 either. I suppose there are some patches or configure switches that fix this issue...

And I almost forgot: Thank you all for help, it's very appreciated.
« Last Edit: February 03, 2011, 06:35:15 pm by dsh1 » Logged

Offline Offline
God Member
*****
Karma: 32
Posts: 507
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'd suggest downgrading to version 4.3.5, and applying the set of patches that Debian currently uses. The patches are here (debian/bsdpatches directory):
http://ftp.de.debian.org/debian/pool/main/g/gcc-avr/gcc-avr_4.3.5-1.tar.gz
(this is just the patches, you'll need to download the GCC 4.3.5 source as well from gcc.gnu.org)

Binutils may also need Debian patches.
http://ftp.de.debian.org/debian/pool/main/b/binutils-avr/binutils-avr_2.20.1-1.tar.gz
Logged


Cracow, PL
Offline Offline
Newbie
*
Karma: 1
Posts: 14
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

GCC and BINUTILS with debian patchset work great.

I prepared arch i686 packages:
http://student.if.uj.edu.pl/Filip.Sobalski/binutils-avr-2.20.1-1-i686.pkg.tar.xz
http://student.if.uj.edu.pl/Filip.Sobalski/gcc-avr-4.3.5-1-i686.pkg.tar.xz

For those who use x86_64 here are the PKGBUILDS:
http://student.if.uj.edu.pl/Filip.Sobalski/binutils-avr-debian.tar.gz
http://student.if.uj.edu.pl/Filip.Sobalski/gcc-avr-debian.tar.gz

Thank you!
Logged

Offline Offline
God Member
*****
Karma: 32
Posts: 507
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Good work, let's see if this helps the people having trouble in the other thread.
Logged


Offline Offline
God Member
*****
Karma: 32
Posts: 507
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The x86_64 PKGBUILDS worked for me on my Virtualbox installation.

I force-installed the Binutils package first, and that was enough to get the linker to output correct code. This suggests the problem is with Binutils rather than GCC. Installing the downgraded GCC as well gave more efficient and shorter code, so it is worth doing both.
Logged


Brisbane, Australia
Offline Offline
Newbie
*
Karma: 6
Posts: 36
B.E.E. / B.Inf.Tech.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I tried the x86_64 packages. Binutils compiled fine, but gcc-avr spit the following error:

Code:
checking for suffix of object files... configure: error: cannot compute suffix of object files: cannot compile
See `config.log' for more details.
make[1]: *** [configure-target-libgcc] Error 1
make[1]: Leaving directory `/home/igor/Misc/ArchBuilds/gcc-avr-debian/src/gcc-4.3.5/build'
make: *** [all] Error 2
    Aborting...
┌─[igor]──[X201]
└─[~/Misc/ArchBuilds/gcc-avr-debian]$

I haven't come across this kind of error before (not really a programmer), but if someone knows what this means, please share!

Thanks for preparing the PKGBUILDS dsh1!
-Igor
Logged

Cracow, PL
Offline Offline
Newbie
*
Karma: 1
Posts: 14
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I tried the x86_64 packages. Binutils compiled fine, but gcc-avr spit the following error:

Code:
checking for suffix of object files... configure: error: cannot compute suffix of object files: cannot compile
See `config.log' for more details.
make[1]: *** [configure-target-libgcc] Error 1
make[1]: Leaving directory `/home/igor/Misc/ArchBuilds/gcc-avr-debian/src/gcc-4.3.5/build'
make: *** [all] Error 2
    Aborting...
┌─[igor]──[X201]
└─[~/Misc/ArchBuilds/gcc-avr-debian]$

I haven't come across this kind of error before (not really a programmer), but if someone knows what this means, please share!

Thanks for preparing the PKGBUILDS dsh1!
-Igor

Post your config.log please. It will be somewhere in src/gcc-4.3.5


I force-installed the Binutils package first, and that was enough to get the linker to output correct code. This suggests the problem is with Binutils rather than GCC. Installing the downgraded GCC as well gave more efficient and shorter code, so it is worth doing both.

I also had to use force installation. Original Arch packages leave some manpages even if uninstalled, but it shouldn't be a problem.
« Last Edit: February 04, 2011, 08:17:36 am by dsh1 » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for this (I've posted on the other thread started by Igor86 as I have the same problem)

Well I get the same compile error as Igor with the x86_64 debian patched gcc-avr  smiley-cry

Since Stimmer mentions the problem seems to be in the binutils-avr package I'm looking into whether I can patch my currently installed binutils-avr 2.21-1 rather than downgrade that and gcc-avr. BTW dsh's debian patched binutils for x86_64 compiles fine for me but I can't even force install it because of currently installed gcc-avr 4.5.2-1 dependencies... sigh.

So yeah, googling around with all the useful pointers from these threads... will post if I get anywhere with patching 2.21-1... maybe this is an upstream problem and I'm not sure how/whether to send a bug report to the relevant Arch package maintainers yet but thanks for all the help!

I'll attach the offending config.log too for the compile errors which was in src/gcc-4.3.5/build/avr/avrxmega2/libgcc/config.log (wierd problem config can't compute suffix of object files

* config.log (13.94 KB - downloaded 12 times.)
Logged

Offline Offline
God Member
*****
Karma: 32
Posts: 507
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

When I force-installed binutils I also had to tell it to ignore dependencies.

I can't understand why yours won't compile when mine compiled fine. It could be because my install is very fresh and minimal (I only installed the barest minimum to get the IDE running). Have you tried updating your installed packages to the latest versions? The only other difference was that I was compiling as root, which you shouldn't really do (I was running in a virtual machine so was safe).

If it's any help the package it generated is here:
https://docs.google.com/uc?id=0B5O7TidPmOdzNGYxMGRiNmUtYzFjNC00NGQyLTlhNDYtYmVmODJiMDk3OTlm&export=download&hl=en
(I probably won't keep that download around for long...)
« Last Edit: February 04, 2011, 10:34:51 pm by stimmer » Logged


Cracow, PL
Offline Offline
Newbie
*
Karma: 1
Posts: 14
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for this (I've posted on the other thread started by Igor86 as I have the same problem)

Well I get the same compile error as Igor with the x86_64 debian patched gcc-avr  smiley-cry

Since Stimmer mentions the problem seems to be in the binutils-avr package I'm looking into whether I can patch my currently installed binutils-avr 2.21-1 rather than downgrade that and gcc-avr. BTW dsh's debian patched binutils for x86_64 compiles fine for me but I can't even force install it because of currently installed gcc-avr 4.5.2-1 dependencies... sigh.

So yeah, googling around with all the useful pointers from these threads... will post if I get anywhere with patching 2.21-1... maybe this is an upstream problem and I'm not sure how/whether to send a bug report to the relevant Arch package maintainers yet but thanks for all the help!

I'll attach the offending config.log too for the compile errors which was in src/gcc-4.3.5/build/avr/avrxmega2/libgcc/config.log (wierd problem config can't compute suffix of object files

This is the problem "Fatal error: unknown MCU: avrxmega2"

I'll look into it further when I find some time.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yup, force ignore dependencies ie
Code:
pacman -Udf binutils-avr-2.20.1-1-x86_64.pkg.tar.xz
let me try binutils-avr from dsh with the patches applied  smiley-red

It works! I've compiled and uploaded the Blink sketch without any additional global var declared and the sketch runs fine now. So I guess I don't need the patched gcc-avr for the moment. The problem is narrowed down to the binutils package it seems.

(no luck of course finding patches for binutils-avr 2.21)
Logged

Brisbane, Australia
Offline Offline
Newbie
*
Karma: 6
Posts: 36
B.E.E. / B.Inf.Tech.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Awesome!

I pacman -Udf'ed binutils-avr and the blink sketch works fine now (at least on the Uno)! So, no need for gcc-avr (Arch package works fine), we just need these binutils-avr!

Thanks heaps to everyone who spent time to look into these problems. I'll send a message to the Arch User Repository for the arduino package (the package for x86_64).

-Igor
Logged

Pages: 1 [2] 3   Go Up
Jump to: