Trouble compiling firmware

Get help and show off your TV-B-Gone kit!

Moderators: adafruit_support_bill, adafruit

Trouble compiling firmware

Postby zimmerleut » Sat Apr 14, 2012 12:49 pm

Hi, I tried to compile firmware 1.2 on my system (set up according to instructions here: http://www.nongnu.org/avr-libc/user-manual/install_tools.html, with gcc 4.6.3 (also tested: 4.7.0), avr-libc 1.8.0, binutils 2.22).
Running make, I get this error message:
Code: Select all
avr-gcc (GCC) 4.6.3
Compiling: main.c
avr-gcc -c -mmcu=attiny85 -I. -g -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -DF_CPU=8000000 -Wa,-adhlns=main.lst  -std=gnu99 -DEU_CODES -DNA_CODES main.c -o main.o
main.c:82:21: error: variable 'NApowerCodes' must be const in order to be put into read-only section by means of '__attribute__((progmem))'
main.c:83:21: error: variable 'EUpowerCodes' must be const in order to be put into read-only section by means of '__attribute__((progmem))'
main.c: In function 'main':
main.c:271:7: warning: passing argument 1 of 'putnum_uh' makes integer from pointer without a cast [enabled by default]
util.h:11:6: note: expected 'uint16_t' but argument is of type 'const char *'
make: *** [main.o] Error 1


What configuration did you use to compile the firmware, and do you have hints how to fix this?
Thanks,
Jonas
zimmerleut
 
Posts: 2
Joined: Sat Apr 14, 2012 12:42 pm

Re: Trouble compiling firmware

Postby zimmerleut » Fri Apr 20, 2012 3:44 am

So .. Can anyone confirm a set up under which the firmware will compile?
zimmerleut
 
Posts: 2
Joined: Sat Apr 14, 2012 12:42 pm

Re: Trouble compiling firmware

Postby adafruit_support_bill » Fri Apr 20, 2012 5:07 am

I don't know the configuration under which it was originally built, but from the error messages, it appears that your environment is applying more strict rules with respect to const variables in read-only memeory. You could figure out what compiler option is controlling that, or just add the const attribute to the places it is complaining about.
User avatar
adafruit_support_bill
 
Posts: 16078
Joined: Sat Feb 07, 2009 9:11 am

Re: Trouble compiling firmware

Postby kscharf » Sat Dec 29, 2012 1:16 pm

Just saw this, same problem I'm having.

OK it now works.
I am running Linux Mint version 13 with KDE.
I had installed the avr toolset from Atmel, and had compile issues.
I unzipped a fresh copy of the TVBGone firmware and installed the version(s) of avr-tools from the Mint package repository with GCC version 4.6.2.
I then ran the makefile and the previous problems were gone.

If you are trying to compile on a 'buntu based Linux distro just get the latest versions of the avr tools from the repository with synatpic.
If you are on windows, try the 2010 version of Winavr. Ohterwise you are stuck with using either the toolset from arduino, or from Atmel. Those are the ones I have had issues with (but on Linux).
User avatar
kscharf
 
Posts: 136
Joined: Wed Sep 10, 2008 9:29 am

Re: Trouble compiling firmware

Postby Aleks » Tue Jan 15, 2013 2:56 pm

zimmerleut wrote:Hi, I tried to compile firmware 1.2 on my system (set up according to instructions here: http://www.nongnu.org/avr-libc/user-manual/install_tools.html, with gcc 4.6.3 (also tested: 4.7.0), avr-libc 1.8.0, binutils 2.22).


What configuration did you use to compile the firmware, and do you have hints how to fix this?
Thanks,
Jonas


This is cos' of the new way that GCC-4.6 (and later) interpret the PROGMEM variables, it's documented here : http://gcc.gnu.org/gcc-4.6/changes.html#avr

I made a small patch that fixes this *bug* on gcc-4.7.2, binutils-2.23 :

firmware_v1.2_gcc-4.7.2.patch :
Code: Select all

Regards,
Aleks
diff -Naur fw_v1.2-old/main.c fw_v1.2-new/main.c
--- fw_v1.2-old/main.c   2009-08-16 21:48:34.000000000 +0200
+++ fw_v1.2-new/main.c   2013-01-15 20:45:52.479525370 +0100
@@ -79,8 +79,8 @@



-extern const PGM_P *NApowerCodes[] PROGMEM;
-extern const PGM_P *EUpowerCodes[] PROGMEM;
+extern const PGM_P * const NApowerCodes[] PROGMEM;
+extern const PGM_P * const EUpowerCodes[] PROGMEM;
extern const uint8_t num_NAcodes, num_EUcodes;


diff -Naur fw_v1.2-old/WORLDcodes.c fw_v1.2-new/WORLDcodes.c
--- fw_v1.2-old/WORLDcodes.c   2009-08-16 21:50:24.000000000 +0200
+++ fw_v1.2-new/WORLDcodes.c   2013-01-15 20:47:04.919538679 +0100
@@ -8226,7 +8226,7 @@
////////////////////////////////////////////////////////////////


-const struct IrCode *NApowerCodes[] PROGMEM = {
+const struct IrCode * const NApowerCodes[] PROGMEM = {
#ifdef NA_CODES
   &code_na000Code,
   &code_na001Code,
@@ -8370,7 +8370,7 @@
#endif
};

-const struct IrCode *EUpowerCodes[] PROGMEM = {
+const struct IrCode * const EUpowerCodes[] PROGMEM = {
#ifdef EU_CODES
         &code_eu000Code,
   &code_eu001Code,


Regards,
Aleks
Aleks
 
Posts: 1
Joined: Tue Jan 15, 2013 2:46 pm


Return to TV-B-Gone Kit

Who is online

Users browsing this forum: No registered users and 1 guest

Stuff to buy from the Adafruit store and links to product documentation!


New Products [108]

Raspberry Pi[80]
 
FLORA[23]
 
Bunnie Studios[9]
 
FPGA[1]
 
mbed[11]
Arduino[60]
 
NETduino[14]
 
BeagleBone[24]
 
Android[6]
 
XBee[10]
More Dev Boards[31]


 
BoArduino[8]
 
SpokePOV[4]
 
TV-B-Gone[4]
 
MiniPOV[3]
 
SIM reader[3]
 
Microtouch[5]
 
Clocks & Watches[18]
 
Drawdio[4]
 
Brain Machine[1]
 
Game of Life[2]
 
MintyBoost[2]
More DIY Kits[16]


 
MaKey MaKey[3]
 
Tweet-a-Watt[5]
 
Young Engineers[33]
 
Discover Electronics[2]
 
Snap Circuits[4]
 
littleBits[3]
 
Project packs[8]


 
Breakout Boards[34]
LCDs & Displays[48]
Components & Parts[70]
Batteries & Power[49]
EL Wire/Tape/Panel[52]
LEDs[111]
 
Wireless[14]
Cables[62]
 
Lasers[6]
Sensors/Parts[145]
 
Enclosures/Cases[11]
 
Solar[11]
 
RFID / NFC[13]
Prototyping[70]
 
iDevices[13]
Tools[71]
 
Wearables[39]
 
CNC[37]
 
Robotics[29]
 
3D printing[1]
 
Materials[24]


 
Stickers[41]
 
Skill badges[55]
 
Books[25]
 
Circuit Playground[7]
 
Gift Certificates[4]