[Bug target/49764] New: [gcc-avr] Compiling for Arduino is not working

2011-07-16 Thread artemeas at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49764

   Summary: [gcc-avr] Compiling for Arduino is not working
   Product: gcc
   Version: 4.6.1
Status: UNCONFIRMED
  Severity: critical
  Priority: P3
 Component: target
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: artem...@gmail.com


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


[Bug target/49764] [gcc-avr] Compiling for Arduino is not working

2011-07-16 Thread artemeas at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49764

--- Comment #1 from _artem_  2011-07-16 16:47:01 UTC 
---
p.s. I'm using ArchLinux x86_64


[Bug target/49764] [gcc-avr] Compiling for Arduino is not working

2011-07-16 Thread artemeas at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49764

--- Comment #4 from _artem_  2011-07-16 17:57:28 UTC 
---
thank YOU master clearness!

I did that before I posted the bug here. PROOF:
https://bugs.archlinux.org/task/25136

Please don't be stupid, OK?

And please do this on your machine:
1. go to arduino.cc
2. download the ide (EVEN IF YOU DON'T HAVE AN ARDUINO BOARD, just download it
TO SEE and TO REALIZE that's a gcc-avr/avr-gcc (call it what you want) bug.
3. start the ide (you even don't need to install it, just extract and run)
4. CLICK ON THE COMPILE ICON (without loading any examples, you don't even need
a line of code to reproduce the bug)

please do this on gcc-avr 4.6.0 and then on gcc-avr 4.6.1 and then again on
gcc-avr-4.6.1 to realize that you're a stupid moron.

Second proof that you're a stupid and INCOMPETENT person: since gcc/gcc-avr
4.5.2 when you compile a arduino code and upload it to the microcontroller
everything goes well, NO ERRORS, but the biggest fail is that on the board ANY
delay() function freezes the board. When you upload the SAME (THE SAME) code
from a windows (OS) machine the delay() function works as expected.

So don't troll that's not a gcc issue, BECAUSE IT IS GCC bug.

p.s. you won't die if you just download and run the above listed program to see
that's a gcc bug and not ide bug. I repeat, everything works except delay()
function on 4.6.0 but not on 4.6.1


[Bug target/49764] [gcc-avr] Compiling for Arduino is not working

2011-07-16 Thread artemeas at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49764

--- Comment #7 from _artem_  2011-07-16 19:05:46 UTC 
---
I don't understand what you want from me.
I read that "How to report, what we need and what we don't" SO?
What info you want from me in addition to the text I posted in the bug report?

I don't know 
"the complete command line that triggers the bug;"

because I don't know how to compile that code outside of IDE.
I upgraded gcc (GCC not gcc-avr) from 4.6.0 to 4.6.1 couple of days ago,
gcc-avr was still 4.6.0. I was able to compile for arduino (ATmega328P-PU). I
installed 4.6.1 of gcc-avr and I'm unable to compile for ATmega328 from IDE. I
downgraded ONLY gcc-avr to 4.6.0 result: IDE compiles code. upgraded to 4.6.1
again and I can't compile again.

You would ONLY need 3 minutes to download and to run that IDE on both versions
of gcc-avr. and You would know what's the reason is. I don't what is causing
this errors, the only thing that was changed on my machine is the GCC-AVR
version, from 4.6.0->4.6.1

lines 66-.. that are in the error:
66 extern const uint16_t PROGMEM port_to_mode_PGM[];
 67 extern const uint16_t PROGMEM port_to_input_PGM[];
 68 extern const uint16_t PROGMEM port_to_output_PGM[];
 69 
 70 extern const uint8_t PROGMEM digital_pin_to_port_PGM[];
 71 // extern const uint8_t PROGMEM digital_pin_to_bit_PGM[];
 72 extern const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[];
 73 extern const uint8_t PROGMEM digital_pin_to_timer_PGM[];

on gcc-avr 4.6.0 I get no errors on that code, on gcc-avr 4.6.1 I get error
listed in the first message.

"variable 'port_to_mode_PGM' must be const in order to be put into read-only"
produced from this:
extern const uint16_t PROGMEM port_to_mode_PGM[];

was there something changed in gcc-avr that would give such an error?


[Bug target/49764] [gcc-avr] Compiling for Arduino is not working

2011-07-16 Thread artemeas at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49764

--- Comment #9 from _artem_  2011-07-16 19:54:28 UTC 
---
[_artem_@linux-void ~]$ avr-gcc -v
Using built-in specs.
COLLECT_GCC=avr-gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/avr/4.6.1/lto-wrapper
Target: avr
Configured with: ../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
Thread model: single
gcc version 4.6.1 (GCC) 
[_artem_@linux-void ~]$ 

I don't know how to compile that code with avr-gcc. I only compiled with gcc,
but never with avr-gcc.

[_artem_@linux-void ~]$ avr-gcc 1.c -o 2

[_artem_@linux-void ~]$ cat 2
��6�������6���=d(�D�D�D�D�D�D�
D�
   D�D�D�D�D�d(�D�DDDD D"D$&{standard
input}../../../libgcc/../gcc/config/avr/libgcc.S.symtab.strtab.shstrtab.text.stab.stabstrT(!|,
'�=�00�
   H"
(��,?��5>��>=��G��S��`t({(����(����`�����`���   
`�#/`�6`�;`�.do_clear_bss_start.do_clear_bss_loop1.c__SREGSP_HSP_Ltmp_regzero_regtrampolines_start_etext__data_load_end__trampolines_end__data_load_start__dtors_end__bss_end__do_clear_bss__eeprom_end__data_end__ctors_start__do_copy_data__bss_start__dtors_start__ctors_end_edata_end__data_start[_artem_@linux-void
~]$ 

So I don't know why I can't compile and upload to the microcontroller. 
p.s. when you don't have gcc-avr why are you then answering to my bug report?


[Bug target/49764] [gcc-avr] Compiling for Arduino is not working

2011-07-16 Thread artemeas at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49764

--- Comment #11 from _artem_  2011-07-17 00:30:11 
UTC ---
ok... sorry.

it seams to be a avr-g++ bug or arduino bug. 

Or avr-g++ has changed something in 4.6.1 so const declarations changed. (Then
it's arduino teams job to fix the headers)

Ok now I know that the command line is:

avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections
-mmcu=atmega328p -DF_CPU=1600L -DARDUINO=22 1.cpp

1.cpp (as you asked):
extern const int __attribute__((progmem)) p[];

it gives:
1.cpp:1:45: error: variable 'p' must be const in order to be put into read-only
section by means of '__attribute__((progmem))'

when I add before the "extern ..." something like:
const int p[];

it gives me:
1.cpp:1:11: error: uninitialized const 'p' [-fpermissive]
1.cpp:1:13: error: storage size of 'p' isn't known
1.cpp:2:45: error: variable 'p' must be const in order to be put into read-only
section by means of '__attribute__((progmem))'

So I have now no idea if it's arduino's headers, or avr-g++ is guilty.

p.s. here is the thread I started on arduino forum (maybe it'll be usefull for
you...): http://arduino.cc/forum/index.php/topic,66710.0.html


[Bug target/49764] [avr-g++] Rejects attribute progmem

2011-07-26 Thread artemeas at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49764

--- Comment #18 from _artem_  2011-07-26 19:34:13 
UTC ---
I've compiled gcc-avr from trunk and Arduino IDE stoped complaining about
PROGMEM. I downgraded binutils-avr from 2.21 to 2.20 patched and now delay()
function works as it should on arduino. Thank you guys. You can close that bug
report. I'm hoping that gcc 4.7 will be released soon (so I don't have to
compile it myself)