shirriff / Arduino-TV-B-Gone

The TV-B-Gone software ported to the Arduino platform
http://www.arcfn.com/2010/11/improved-arduino-tv-b-gone.html
175 stars 54 forks source link

Doesn't compile on recent versions of avr-g++ #1

Closed Peetz0r closed 8 years ago

Peetz0r commented 10 years ago

Hi! First, this is great. Thanks for porting this code :) But there is an issue. When I try to compile this using either avr-g++ 4.7.3 on ubuntu 13.10 or avr-g++ 4.8.something on fedora 20, I get the following error:

In file included from main.h:1:0,
             from WORLDcodes.cpp:12:
WORLDcodes.cpp:8506:37: error: variable 'NApowerCodes' must be const in order to be put into read-only section by means of '__attribute__((progmem))'
 const struct IrCode *NApowerCodes[] PROGMEM = {
                                 ^
WORLDcodes.cpp:8646:37: error: variable 'EUpowerCodes' must be const in order to be put into read-only section by means of '__attribute__((progmem))'
 const struct IrCode *EUpowerCodes[] PROGMEM = {
                                 ^

It works flawlessly when I downgrade to avr-g++ 4.5.3.

yoshadow commented 9 years ago

Hi Peetz0r I have a question, how could you downgrade to avr-g++ 4.5.3, I coludn't find it on Internet.

Please!! =D

Peetz0r commented 9 years ago

I don't remember exactly, and haven't seen this issue for almost a year. But it's possible that I used a package for an older version of my distribution: http://packages.ubuntu.com/search?keywords=gcc-avr&searchon=names Possibly the 12.04 package, which is 4.5.3

ElectricRCAircraftGuy commented 9 years ago

It sounds like when you install the Arduino IDE on a Linux machine it does not come with gcc attached? I'm only a light Linux user, so I didn't know that.

In Windows, the Arduino IDE does come with gcc attached. So, in Windows, if you try to use Arduino IDE 1.5.7 or later, the TVBGone code will NOT compile due to changes in how PROGMEM works. However, if you use Arduino IDE 1.5.6-r2 Beta, or earlier, this code compiles just fine! If running Windows, simply download the 1.5.6-r2 Beta installer here, and it will compile for you: http://arduino.cc/en/Main/OldSoftwareReleases

Notes: According to the release notes (http://arduino.cc/en/Main/ReleaseNotes), 1.5.7 Beta uses gcc 4.8.1, which we know is NOT compatible with the current TVBGone code. The Arduino versions just prior to that used perhaps gcc 4.5.1 or something like that--not entirely sure.

--Also, I plan on fixing the TVBGone code here when I get the chance, to make it compatible with the latest Arduino IDE version, and the newer gcc, but I have not had the chance yet. Life is busy, and I'm working on many projects at once as well.

Peetz0r commented 9 years ago

On Windows, everything comes with everything because there is no package management. On Linux (most distro's anyway), the arduino ide package doesn't come with everything, but instead says "Hey, I need avr-gcc (and a bunch of other things)". There are pros and cons for both systems. But on most linuxes it's the distributions package management which dictates which version of gcc is used, not the arduino package (unless the arduino package specifies a minimum and/or maximum or even an exact version in it's dependencies. But it doesn't).

Anyway, on Ubuntu, in some cases it's entirely possible to install older or newer versions of packages from other Ubuntu versions without everything going weird so that can fix problems sometimes. Warning: sometimes this makes things worse, trough dependencies on specific versions of many libraries. So be careful when installing packages that are packaged for a different version of your distro.

Also, the last time I did this has been almost a year ago so I wouldn't know if and what issues I may have had and if so, how I fixed those.

yoshadow commented 9 years ago

Hi again =) Thanks for the info, I'll try install Arduino 1.5.6-r2 on Windows XP in a virtual machine and compile de TVBGone, I'll tell you if that works.

yoshadow commented 9 years ago

Well... it didn't work =( I'm still looking for this issue, thanks again and if I know something I'll post it here.

Peetz0r commented 9 years ago

You could try an VM with Ubuntu 12.04 instead. Should come with gcc-avr 4.5.3.

yoshadow commented 9 years ago

Hi!! Me again. This is what I did. I installed ubuntu 12.04 in a virtual machine but I don't know why ubuntu didn't start... So looking for something else I found a guy who was able to make his TVBGone succesfully four months ago, in this video https://www.youtube.com/watch?v=Aeg00SNtTVI he is using Arduino 1.0.6 version, I didn't notice that I was using the 1.0.5 version in ubuntu 14.04 (I think that's the version default) I just downloaded the 1.0.6 version and everything compiled, now my question is, has Arduino diferent versions of avr-gcc on their own versions?

Thanks a lot for your support. =D

sbf- commented 8 years ago

Well, maybe a little late, but it might be helpful for others. Had the same issue with Atmel Studio 7 (Windows)

variable 'NApowerCodes' must be const in order to be put into read-only section by means of '__attribute__((progmem))'
variable 'EUpowerCodes' must be const in order to be put into read-only section by means of '__attribute__((progmem))'

Make following changes to main.c and WORLDcodes.c

extern const PGM_P* const NApowerCodes[] PROGMEM;
extern const PGM_P* const EUpowerCodes[] PROGMEM;
Hitechcomputergeek commented 8 years ago

I can't find what to change in WORLDcodes.cpp - could you give line numbers?

Trying to compile with the changes above put only in main.c gives the following error:

TVB:79: error: duplicate 'const'
 extern const PGM_P* const NApowerCodes[] PROGMEM;
              ^
TVB:80: error: duplicate 'const'
 extern const PGM_P* const EUpowerCodes[] PROGMEM;
              ^
exit status 1
duplicate 'const'
ElectricRCAircraftGuy commented 8 years ago

I have just merged a version 1.3 of the code, with improvements, including this PROGMEM fix. Should compile fine for everyone now.