Community Packages

Please read this before reporting a bug:
http://wiki.archlinux.org/index.php/Reporting_Bug_Guidelines

Do NOT report bugs when a package is just outdated, or it is in Unsupported. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!
Tasklist

FS#25136 - [gcc-avr] Compiling for Arduino is not working

Attached to Project: Community Packages
Opened by _artem_ (_artem_) - Saturday, 16 July 2011, 01:11 GMT
Last edited by Jakob Gruber (schuay) - Monday, 19 March 2012, 19:05 GMT
Task Type Bug Report
Category Upstream Bugs
Status Closed
Assigned To Jelle van der Waa (jelly)
Jakob Gruber (schuay)
Architecture x86_64
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 4
Private No

Details

Description:
Compiling any of the examples in arduino (IDE) gives this:

In file included from /usr/share/arduino/hardware/arduino/cores/arduino/Tone.cpp:37:0:
/usr/share/arduino/hardware/arduino/cores/arduino/pins_arduino.h:66:48: error: variable 'port_to_mode_PGM' must be const in order to be put into read-only section by means of '__attribute__((progmem))'
/usr/share/arduino/hardware/arduino/cores/arduino/pins_arduino.h:67:49: error: variable 'port_to_input_PGM' must be const in order to be put into read-only section by means of '__attribute__((progmem))'
/usr/share/arduino/hardware/arduino/cores/arduino/pins_arduino.h:68:50: error: variable 'port_to_output_PGM' must be const in order to be put into read-only section by means of '__attribute__((progmem))'
/usr/share/arduino/hardware/arduino/cores/arduino/pins_arduino.h:70:54: error: variable 'digital_pin_to_port_PGM' must be const in order to be put into read-only section by means of '__attribute__((progmem))'
/usr/share/arduino/hardware/arduino/cores/arduino/pins_arduino.h:72:58: error: variable 'digital_pin_to_bit_mask_PGM' must be const in order to be put into read-only section by means of '__attribute__((progmem))'
/usr/share/arduino/hardware/arduino/cores/arduino/pins_arduino.h:73:55: error: variable 'digital_pin_to_timer_PGM' must be const in order to be put into read-only section by means of '__attribute__((progmem))'
/usr/share/arduino/hardware/arduino/cores/arduino/Tone.cpp:108:45: error: variable 'tone_pin_to_timer_PGM' must be const in order to be put into read-only section by means of '__attribute__((progmem))'


Additional info:
Occures only on gcc-avr-4.6.1-1, reinstalling previous (gcc-avr-4.6.0-3) gives successful compilation.
I checked the file files pins_arduino.h, pins_arduino.c and Tone.cpp on both gcc-avr-4.6.1-1 and gcc-avr-4.6.0-3 they are equal. So the issue is in the gcc-avr package.


Steps to reproduce:
1. Open arduino (IDE)
2. Select any example from File->Examples
3. Click on play icon (compile)

Step 2 can be left out, just clicking play icon (compile) on an empty sketch gives same error on gcc-avr-4.6.1-1
This task depends upon

Closed by  Jakob Gruber (schuay)
Monday, 19 March 2012, 19:05 GMT
Reason for closing:  Fixed
Additional comments about closing:  Supposedly fixed since gcc-avr 4.6.2 [1]. If you still experience the issue, request a reopen.

[1] http://arduino.cc/forum/index.php?PHPSES SID=6d475e8da8fcad97122adec1bd1ba049& ;topic=66710.15
Comment by jonas (jonaias) - Saturday, 16 July 2011, 07:09 GMT
Same error here.. I only tested with gcc-avr 4.6.1-1.
Comment by Jelle van der Waa (jelly) - Saturday, 16 July 2011, 10:12 GMT Comment by Brad Fanella (itsbrad212) - Saturday, 16 July 2011, 16:13 GMT
Jelly's right, I believe you should take this issue upstream, I don't think there's much that I can do about it at this point.
Comment by _artem_ (_artem_) - Saturday, 16 July 2011, 18:07 GMT
I reported it to gcc bugzilla... but the "devs" there told me that I should post that bug here.. and it's likely arduino IDE bug. But the only package that was updated is gcc-avr. I reinstalled it 10 times. 4.6.0 = works all except delay() function, 4.6.1 = doesn't compile anything, and again 4.6.0, 4.6.1, 4.6.0, 4.6.1

here: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49764
Comment by Jelle van der Waa (jelly) - Saturday, 16 July 2011, 22:18 GMT
You should report the bug at the ardiono devs instead
Comment by _artem_ (_artem_) - Saturday, 16 July 2011, 23:51 GMT Comment by Brad Fanella (itsbrad212) - Sunday, 17 July 2011, 06:58 GMT
This is certainly not an Arch issue, so whoever told you that...

In my opinion, you should probably pursue this (as you already have, I see) with the Arduino dev team. If it is a problem on the IDE end, it's most likely a compatibility issue with the new version of gcc.

I looked over the thread that you posted over on the Arduino boards, and I think that "stimmer" said it best:
"The error looks like it is to do with const correctness - maybe the new GCC has changed how it deals with progmem data. I'd say the gcc-avr people are probably right, the bug might be with the Arduino headers not being properly const correct."
Comment by Brad Fanella (itsbrad212) - Sunday, 17 July 2011, 07:01 GMT
Also, I think the easiest way to clear things up is to try to compile the file outside of the IDE. I know that you had mentioned (in the gcc bug discussion) that you don't know how to do this from the command line, but I suppose you could read just a few gcc manuals and be up-and-running there.
Comment by Duy Truong (jimreynold2nd) - Thursday, 04 August 2011, 00:19 GMT
Hi guys,

I don't think this is a problem with Arduino at all. I'm trying to compile some pure AVR code, and whatever uses PSTR() returned this error. avr-gcc 4.6.1.

command line:
avr-gcc -mmcu=atmega88 -DF_CPU=1000000UL -Wall -Wstrict-prototypes -Os -mcall-prologues -c test.c
test.c:
#include <avr/pgmspace.h>
int main() {
char* s = PSTR("test");
while(1);
return 0;
}

Edit: gcc guys confirmed the bug and it's been fixed upstream. Hopefully 4.7 or 4.6.2 will come out soon.
Comment by Melvin Meadlin (meadlin) - Friday, 12 August 2011, 05:43 GMT
The patch file in reply #9 @ the link _artem_ posted, works to solve the issue, at least for me it did.
Comment by Brad Fanella (itsbrad212) - Thursday, 18 August 2011, 05:47 GMT
If this has been confirmed upstream by the gcc guys, then I'd rather just wait until the next gcc release and not mess with arduino (unless anyone else feels compelled to, it's in the AUR).
Comment by _artem_ (_artem_) - Thursday, 18 August 2011, 12:17 GMT
install latest binutils-avr (2.21.1-1) from arch repos, then install gcc-avr-svn and everything will work just fine.
the problem was gcc and is fixed in svn.
p.s. you don't have to apply any patches, just use gcc-avr-svn
Comment by Brad Fanella (itsbrad212) - Thursday, 18 August 2011, 12:23 GMT
I meant patching arduino, not gcc. Thanks for the heads-up though, I hope to see an upstream release soon.
Comment by _artem_ (_artem_) - Thursday, 18 August 2011, 12:50 GMT
I ment it too :) you don't need to patch arduino headers, just install latest binutils-avr and gcc-avr-svn that's it :)
Comment by Brad Fanella (itsbrad212) - Friday, 19 August 2011, 23:01 GMT
Oh, I meant that I don't want to patch arduino using the one provided in the link you posted. :) Using svn should be able to hold everyone over until a new release, so thanks for pointing that out.
Comment by Axilleas Pipinellis (markelos) - Friday, 26 August 2011, 09:21 GMT
I just compiled latest gcc-avr-svn and error is still there. Am I doing sth wrong?.. Can anyone confirm this?
Comment by _artem_ (_artem_) - Sunday, 28 August 2011, 06:20 GMT
since todays arduino package update you don't need to use gcc-avr-svn anymore. there is a patch integrated that fixes pregmem issue on gcc-avr 4.6.1

but you still need to use binutils-avr-debian-2.20.1-1-x86_64.pkg.tar.xz (google for it it's 1,8mb). Otherwise on the latest binutils-avr 2.21 the delay() function is still bugged

gcc-avr:
pacman -Rdd gcc-avr-svn && pacman -S gcc-avr && pacman -S arduino # to remove gcc-avr-svn && install gcc-avr (4.6.1) and to reinstall/update arduino to new package version which fixes errors on gcc-avr 4.6.1
# advantage: you don't have to compile gcc-avr-svn because it takes more than 10 minutes (on my 4core i7 laptop at least)

binutils-avr:
pacman -Rdd binutils-avr && pacman -U ./binutils-avr-debian-2.20.1-1-x86_64.pkg.tar.xz

or you just read the latest comment here: http://aur.archlinux.org/packages.php?ID=39927
but don't touch gcc-avr only compile and install binutils-avr-debian for your architecture
Comment by Axilleas Pipinellis (markelos) - Sunday, 28 August 2011, 08:21 GMT
Yeap, I know. I was the one providing [1] the link to the patch :p I'm just saying :)

[1] https://bbs.archlinux.org/viewtopic.php?pid=981983#p981983
Comment by Jelle van der Waa (jelly) - Tuesday, 13 March 2012, 10:38 GMT
Any update?
Comment by _artem_ (_artem_) - Wednesday, 14 March 2012, 17:50 GMT
try to use this packages:

┌─_artem_ ─ /home/_artem_─┐
└──► yaourt -Qs avr
local/arduino 1:1.0-3
Arduino SDK (includes patched avrdude and librxtx)
community/avr-binutils 2.22-2
A set of programs to assemble and manipulate binary and object files for the avr architecture
community/avr-gcc 4.6.3-1
The GNU avr Compiler Collection
community/avr-libc 1.8.0-1
The C runtime library for the AVR family of microcontrollers

can't test it right now

Loading...