Problems compiling demo
Moderator: adafruit

Problems compiling demo

by jss on Wed Jan 21, 2009 1:55 pm

Hi everyone,

I'm getting compilation errors when trying to run make on the Fuzebox hello.c demo. Currently, I'm running Mac OS X 10.5 on an intel based macbook with AVR MacPack installed. I've modified the Makefile for the programmer to CC = avr-gcc instead of CC = avr-gc.exe. Aside from that, all files are stock.

Any help would be greatly appreciated.

Thanks!

Here is the terminal output:

Code: Select all | TOGGLE FULL SIZE
avr-gcc -I.. -mmcu=atmega644 -Wall -gdwarf-2 -std=gnu99 -DF_CPU=28636360UL -DVIDEO_MODE=1 -Os -fsigned-char -MD -MP -MT hello2.o -MF dep/hello2.o.d  -c  hello2.c
avr-gcc -I.. -mmcu=atmega644 -Wall -gdwarf-2 -std=gnu99 -DF_CPU=28636360UL -DVIDEO_MODE=1 -Os -fsigned-char -MD -MP -MT uzeboxCore.o -MF dep/uzeboxCore.o.d  -c  ../kernel/uzeboxCore.c
../kernel/uzeboxCore.c: In function `InitConsole':
../kernel/uzeboxCore.c:102: warning: passing arg 1 of `InitMusicPlayer' discards qualifiers from pointer target type
avr-gcc -I.. -mmcu=atmega644 -Wall -gdwarf-2 -std=gnu99 -DF_CPU=28636360UL -DVIDEO_MODE=1 -Os -fsigned-char -MD -MP -MT uzeboxSoundEngine.o -MF dep/uzeboxSoundEngine.o.d  -c  ../kernel/uzeboxSoundEngine.c
avr-gcc -I.. -mmcu=atmega644 -mmcu=atmega644 -Wall -gdwarf-2 -std=gnu99 -DF_CPU=28636360UL -DVIDEO_MODE=1 -Os -fsigned-char -MD -MP -MT uzeboxSoundEngineCore.o -MF dep/uzeboxSoundEngineCore.o.d  -x assembler-with-cpp -Wa,-gdwarf2 -c  ../kernel/uzeboxSoundEngineCore.s
/usr/local/AVRMacPack-20081213/lib/gcc/avr/3.4.6/../../../../avr/include/stdint.h: Assembler messages:
/usr/local/AVRMacPack-20081213/lib/gcc/avr/3.4.6/../../../../avr/include/stdint.h:121: Error: unknown opcode `typedef'
/usr/local/AVRMacPack-20081213/lib/gcc/avr/3.4.6/../../../../avr/include/stdint.h:122: Error: unknown opcode `typedef'
/usr/local/AVRMacPack-20081213/lib/gcc/avr/3.4.6/../../../../avr/include/stdint.h:123: Error: unknown opcode `typedef'
/usr/local/AVRMacPack-20081213/lib/gcc/avr/3.4.6/../../../../avr/include/stdint.h:124: Error: unknown opcode `typedef'
/usr/local/AVRMacPack-20081213/lib/gcc/avr/3.4.6/../../../../avr/include/stdint.h:125: Error: unknown opcode `typedef'
/usr/local/AVRMacPack-20081213/lib/gcc/avr/3.4.6/../../../../avr/include/stdint.h:126: Error: unknown opcode `typedef'
/usr/local/AVRMacPack-20081213/lib/gcc/avr/3.4.6/../../../../avr/include/stdint.h:128: Error: unknown opcode `typedef'
/usr/local/AVRMacPack-20081213/lib/gcc/avr/3.4.6/../../../../avr/include/stdint.h:129: Error: unknown opcode `typedef'
/usr/local/AVRMacPack-20081213/lib/gcc/avr/3.4.6/../../../../avr/include/stdint.h:142: Error: unknown opcode `typedef'
/usr/local/AVRMacPack-20081213/lib/gcc/avr/3.4.6/../../../../avr/include/stdint.h:147: Error: unknown opcode `typedef'
/usr/local/AVRMacPack-20081213/lib/gcc/avr/3.4.6/../../../../avr/include/stdint.h:159: Error: unknown opcode `typedef'
/usr/local/AVRMacPack-20081213/lib/gcc/avr/3.4.6/../../../../avr/include/stdint.h:164: Error: unknown opcode `typedef'
/usr/local/AVRMacPack-20081213/lib/gcc/avr/3.4.6/../../../../avr/include/stdint.h:169: Error: unknown opcode `typedef'
/usr/local/AVRMacPack-20081213/lib/gcc/avr/3.4.6/../../../../avr/include/stdint.h:174: Error: unknown opcode `typedef'
/usr/local/AVRMacPack-20081213/lib/gcc/avr/3.4.6/../../../../avr/include/stdint.h:179: Error: unknown opcode `typedef'
/usr/local/AVRMacPack-20081213/lib/gcc/avr/3.4.6/../../../../avr/include/stdint.h:184: Error: unknown opcode `typedef'
/usr/local/AVRMacPack-20081213/lib/gcc/avr/3.4.6/../../../../avr/include/stdint.h:192: Error: unknown opcode `typedef'
/usr/local/AVRMacPack-20081213/lib/gcc/avr/3.4.6/../../../../avr/include/stdint.h:199: Error: unknown opcode `typedef'
/usr/local/AVRMacPack-20081213/lib/gcc/avr/3.4.6/../../../../avr/include/stdint.h:213: Error: unknown opcode `typedef'
/usr/local/AVRMacPack-20081213/lib/gcc/avr/3.4.6/../../../../avr/include/stdint.h:218: Error: unknown opcode `typedef'
/usr/local/AVRMacPack-20081213/lib/gcc/avr/3.4.6/../../../../avr/include/stdint.h:223: Error: unknown opcode `typedef'
/usr/local/AVRMacPack-20081213/lib/gcc/avr/3.4.6/../../../../avr/include/stdint.h:228: Error: unknown opcode `typedef'
/usr/local/AVRMacPack-20081213/lib/gcc/avr/3.4.6/../../../../avr/include/stdint.h:233: Error: unknown opcode `typedef'
/usr/local/AVRMacPack-20081213/lib/gcc/avr/3.4.6/../../../../avr/include/stdint.h:238: Error: unknown opcode `typedef'
/usr/local/AVRMacPack-20081213/lib/gcc/avr/3.4.6/../../../../avr/include/stdint.h:246: Error: unknown opcode `typedef'
/usr/local/AVRMacPack-20081213/lib/gcc/avr/3.4.6/../../../../avr/include/stdint.h:253: Error: unknown opcode `typedef'
/usr/local/AVRMacPack-20081213/lib/gcc/avr/3.4.6/../../../../avr/include/stdint.h:273: Error: unknown opcode `typedef'
/usr/local/AVRMacPack-20081213/lib/gcc/avr/3.4.6/../../../../avr/include/stdint.h:278: Error: unknown opcode `typedef'
/usr/local/AVRMacPack-20081213/lib/gcc/avr/3.4.6/../../../../avr/include/inttypes.h:77: Error: unknown opcode `typedef'
/usr/local/AVRMacPack-20081213/lib/gcc/avr/3.4.6/../../../../avr/include/inttypes.h:81: Error: unknown opcode `typedef'
/usr/local/AVRMacPack-20081213/lib/gcc/avr/3.4.6/../../../../avr/include/avr/fuse.h:234: Error: unknown opcode `typedef'
/usr/local/AVRMacPack-20081213/lib/gcc/avr/3.4.6/../../../../avr/include/avr/fuse.h:235: Error: junk at end of line, first unrecognized character is `{'
/usr/local/AVRMacPack-20081213/lib/gcc/avr/3.4.6/../../../../avr/include/avr/fuse.h:236: Error: unknown opcode `unsigned'
/usr/local/AVRMacPack-20081213/lib/gcc/avr/3.4.6/../../../../avr/include/avr/fuse.h:237: Error: unknown opcode `unsigned'
/usr/local/AVRMacPack-20081213/lib/gcc/avr/3.4.6/../../../../avr/include/avr/fuse.h:238: Error: unknown opcode `unsigned'
/usr/local/AVRMacPack-20081213/lib/gcc/avr/3.4.6/../../../../avr/include/avr/fuse.h:239: Error: junk at end of line, first unrecognized character is `}'
../kernel/uzeboxSoundEngineCore.s:651: Error: bad expression
../kernel/uzeboxSoundEngineCore.s:651: Error: missing ')'
../kernel/uzeboxSoundEngineCore.s:651: Error: missing ')'
../kernel/uzeboxSoundEngineCore.s:651: Error: missing ')'
../kernel/uzeboxSoundEngineCore.s:651: Error: missing ')'
../kernel/uzeboxSoundEngineCore.s:651: Error: constant value required
../kernel/uzeboxSoundEngineCore.s:651: Error: `,' required
../kernel/uzeboxSoundEngineCore.s:651: Error: constant value required
../kernel/uzeboxSoundEngineCore.s:651: Error: garbage at end of line
../kernel/uzeboxSoundEngineCore.s:659: Error: bad expression
../kernel/uzeboxSoundEngineCore.s:659: Error: missing ')'
../kernel/uzeboxSoundEngineCore.s:659: Error: missing ')'
../kernel/uzeboxSoundEngineCore.s:659: Error: missing ')'
../kernel/uzeboxSoundEngineCore.s:659: Error: `,' required
../kernel/uzeboxSoundEngineCore.s:659: Error: constant value required
../kernel/uzeboxSoundEngineCore.s:659: Error: garbage at end of line
../kernel/uzeboxSoundEngineCore.s:719: Error: bad expression
../kernel/uzeboxSoundEngineCore.s:719: Error: missing ')'
../kernel/uzeboxSoundEngineCore.s:719: Error: missing ')'
../kernel/uzeboxSoundEngineCore.s:719: Error: missing ')'
../kernel/uzeboxSoundEngineCore.s:719: Error: missing ')'
../kernel/uzeboxSoundEngineCore.s:719: Error: constant value required
../kernel/uzeboxSoundEngineCore.s:719: Error: garbage at end of line
make: *** [uzeboxSoundEngineCore.o] Error 1
jss
 
Posts: 8
Joined: Wed Jan 21, 2009 1:33 pm

Re: Problems compiling demo

by jss on Thu Jan 22, 2009 11:47 pm

AVR MacPack (12/08) issues. Manually recompiling avr-gcc toolchain fixed the problem.
jss
 
Posts: 8
Joined: Wed Jan 21, 2009 1:33 pm

Re: Problems compiling demo

by mschmidt on Fri Jan 23, 2009 3:58 am

I get the same error message even with older version of the AVRMacPack.

How did you recompile the toolchain?

Cheers,

Maik
mschmidt
 
Posts: 17
Joined: Fri Jan 16, 2009 10:09 am

Re: Problems compiling demo

by mschmidt on Fri Jan 23, 2009 4:27 am

I've tried the following with the most recent version (20081213) of AVRMacPack now:

$ avr-gcc-select 4
$ avr-gcc --version
avr-gcc (GCC) 4.3.2

When I try to compile megatris now, the error described in your initial posting does not appear any longer, but I get the following one:

avr-size: invalid option -- C
Usage: avr-size [option(s)] [file(s)]
Displays the sizes of sections inside binary files
If no input file(s) are specified, a.out is assumed
The options are:
-A|-B --format={sysv|berkeley} Select output style (default is berkeley)
-o|-d|-x --radix={8|10|16} Display numbers in octal, decimal or hex
-t --totals Display the total sizes (Berkeley only)
--common Display total size for *COM* syms
--target=<bfdname> Set the binary file format
@<file> Read options from <file>
-h --help Display this information
-v --version Display the program's version

avr-size: supported targets: elf32-avr elf32-little elf32-big srec symbolsrec tekhex binary ihex
make: *** [size] Error 1

Probably I could simply remove the size step from the Makefile, but it'd be nicer, if everything would work.

Directory content looks as follows:

dynamic-dev-120-207:megatris mschmidt$ ls -lt
total 2512
-rwxr-xr-x 1 mschmidt mschmidt 2957 Jan 23 10:08 Makefile
-rw-r--r-- 1 mschmidt mschmidt 13 Jan 23 10:05 megatris.eep
-rwxr-xr-x 1 mschmidt mschmidt 117884 Jan 23 10:05 megatris.elf
-rw-r--r-- 1 mschmidt mschmidt 173063 Jan 23 10:05 megatris.hex
-rw-r--r-- 1 mschmidt mschmidt 691624 Jan 23 10:05 megatris.lss
-rw-r--r-- 1 mschmidt mschmidt 33553 Jan 23 10:05 megatris.map
-rw-r--r-- 1 mschmidt mschmidt 8264 Jan 23 10:05 uzeboxCore.o
-rw-r--r-- 1 mschmidt mschmidt 26352 Jan 23 10:05 uzeboxSoundEngine.o
-rw-r--r-- 1 mschmidt mschmidt 7736 Jan 23 10:05 uzeboxSoundEngineCore.o
-rw-r--r-- 1 mschmidt mschmidt 13260 Jan 23 10:05 uzeboxVideoEngine.o
-rw-r--r-- 1 mschmidt mschmidt 5348 Jan 23 10:05 uzeboxVideoEngineCore.o
-rw-r--r-- 1 mschmidt mschmidt 116052 Jan 23 10:05 megatris.o
drwxr-xr-x 8 mschmidt mschmidt 272 Jan 23 10:01 dep
-rwxr-xr-x@ 1 mschmidt mschmidt 269 Oct 1 23:52 megatris.aws
-rwxr-xr-x@ 1 mschmidt mschmidt 5824 Sep 28 23:09 megatris.aps
-rwxr-xr-x 1 mschmidt mschmidt 46110 Sep 28 22:01 megatris.c

So I guess that compiling the application went fine. Although I think that the file sizes are quite big.

When I run avr-size without options I get the following results:

$ avr-size megatris.elf
text data bss dec hex filename
61496 30 3476 65002 fdea megatris.elf

I guess only the text segment would be transfered to the fuzebox?

Cheers,

Maik
mschmidt
 
Posts: 17
Joined: Fri Jan 16, 2009 10:09 am

Re: Problems compiling demo

by mschmidt on Fri Jan 23, 2009 6:41 am

Sorry!

Because of many installations and de-installations there still was an avr-size in /usr/local/bin which came before /usr/local/AVRMacPack/bin/avr-size in the path.

Conclusion:

Everything works fine with the latest AVRMacPack release as long as you run

$ avr-gcc-select 4

Cheers,

Maik
mschmidt
 
Posts: 17
Joined: Fri Jan 16, 2009 10:09 am

Re: Problems compiling demo

by jss on Fri Jan 23, 2009 9:08 am

Nice to hear that you got it working.

When I tried compiling from AVR MacPack gcc 4, I got a cc1 error (which usually means, "time to recompile"). I also had the avr-size issue, since it appeared to be getting invalid options (-C --mcu).

To fix it, I used this line in the Makefile:
Code: Select all | TOGGLE FULL SIZE
@avr-size -A ${TARGET}


Instead of:
Code: Select all | TOGGLE FULL SIZE
@avr-size -C --mcu=${MCU} ${TARGET}


After switching gcc, does avr-size work for you as-is?

EDIT: I re-read your post and it appears that it does. Interesting.
jss
 
Posts: 8
Joined: Wed Jan 21, 2009 1:33 pm