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
Opened by _artem_ (_artem_) - Saturday, 16 July 2011, 01:11 GMT
Last edited by Jakob Gruber (schuay) - Monday, 19 March 2012, 19:05 GMT
|
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
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
Check the changelog http://gcc.gnu.org/gcc-4.6/changes.html
here: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49764
http://arduino.cc/forum/index.php/topic,66710.0.html
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."
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.
the problem was gcc and is fixed in svn.
p.s. you don't have to apply any patches, just use gcc-avr-svn
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
[1] https://bbs.archlinux.org/viewtopic.php?pid=981983#p981983
┌─_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