hexagon5un / AVR-Programming

Code examples for the book "Make: AVR Programming"
http://littlehacks.org/AVR-Programming
MIT License
725 stars 340 forks source link

Makefile not working xmega #27

Open JosiahCochran opened 6 years ago

JosiahCochran commented 6 years ago

I am trying to program the xmega128a1u with blink code. I made the changes form DDRB to PORTB.DIRSET and so on, but the makefile is having an error in compiling the code.

avr-gcc -Os -g -std=gnu99 -Wall -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -ffunction-sections -fdata-sections -DF_CPU=8000000UL -DBAUD=9600UL -I. -I../../xmegalibrary -mmcu=atxmega128a1u -c -o blinkLED.o blinkLED.c

:0:6: error: expected identifier or ‘(’ before numeric constant : recipe for target 'blinkLED.o' failed make: *** [blinkLED.o] Error 1
hexagon5un commented 6 years ago

The XMegas are an entirely different chip, with (as you noted) a completely different set of register macros and etc. If you're going to be porting any of my Mega code to the XMega chips, just know up front that it's going to be a big challenge, and that some decent prior low-level experience with at least one, and probably both of the chips is needed -- or else you'll acquire it along the way, the hard way. :)

Still, that looks like a deeper error. What's in line 6 of blinkLED.c? Did you accidentally create a name collision with a macro that's defined in the XMega headers? Unfortunately, without having all the code at hand, it's a very tough remote debug.