Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: RoboMike on June 29, 2009, 03:50:32 am

Title: AVR XMEGA ?
Post by: RoboMike on June 29, 2009, 03:50:32 am
Hi All,

Great work with C::B.   

I'm trying to write code for an AVR XMEGA128A1 .

I didn't find it in the list - so I just added the proper .h file for the chip.

When I build, I get the following error:

 Compiling: main.c
cc1.exe: error: missing argument to "-mmcu="

Is there a way I can manually set this?  If so, where and to what?

Thanks!
Title: Re: AVR XMEGA ?
Post by: stahta01 on June 29, 2009, 04:29:13 am
Try under "Projects" -> "Build Options"
Tab Compiler Settings
Sub-tab Other Settings

Tim S
Title: Re: AVR XMEGA ?
Post by: RoboMike on June 29, 2009, 02:47:57 pm
Hi Tim,

Thanks for your help.

In that section I put:

-mmcu=atxmega128a1

and I still get

Compiling: main.c
cc1.exe: error: missing argument to "-mmcu="
Process terminated with status 1 (0 minutes, 0 seconds)
0 errors, 0 warnings
 

Anything else I can try?   :D
Title: Re: AVR XMEGA ?
Post by: Jenna on June 29, 2009, 02:59:23 pm
Anything else I can try?   :D
You can check the build log with full commandline support turned on: change "Settings -> Compiler and debugger... -> Global compiler settings -> [the compiler you use] -> Other settings(rightmost tab)" "Compiler logging" to "Full commandline".

And post the appropriate part of the build log, if you do not find the solution yourself.
Title: Re: AVR XMEGA ?
Post by: RoboMike on June 29, 2009, 03:11:26 pm
Hmmm ....

avr-gcc.exe -Wall -mmcu= -DF_CPU=16000000UL  -g "-mmcu=atxmega128a1"  -mmcu=atxmega128a1    -c main.c -o obj\Debug\main.o
cc1.exe: error: missing argument to "-mmcu="
Process terminated with status 1 (0 minutes, 0 seconds)
0 errors, 0 warnings
 

and when removing the duplicate setting:

avr-gcc.exe -Wall -mmcu= -DF_CPU=16000000UL  -g "-mmcu=atxmega128a1"     -c main.c -o obj\Debug\main.o
cc1.exe: error: missing argument to "-mmcu="

In both I can see that the first -mmcu is the argument avr-gcc is expecting.  My question is now, how I can set that one - instead of creating an "other setting" ?
Title: Re: AVR XMEGA ?
Post by: Jenna on June 29, 2009, 03:32:08 pm
Have a look inside the projects options, the target options and the global compiler options in "Settings -> Compiler and Debugger -> Global compiler settingss -> GNU AVR GCC Compiler (or however it is called on windows and only if you use this toolchain, what's recommended I think)" ,  to be absolutely sure that nothing resides there, that has accidently slipped in.
Title: Re: AVR XMEGA ?
Post by: RoboMike on June 29, 2009, 03:37:58 pm
There was one more in there:

avr-gcc.exe -Wall -mmcu= -DF_CPU=16000000UL  -g     -c main.c -o obj\Debug\main.o
cc1.exe: error: missing argument to "-mmcu="
Process terminated with status 1 (0 minutes, 0 seconds)
0 errors, 0 warnings
 

As you can see, however, the first -mmcu is not getting set.  I can't seem to find a way to set this via the UI - is there?

How are the other AVR settings built into C::B ?  Maybe I can copy / edit and create another one?
Title: Re: AVR XMEGA ?
Post by: RoboMike on June 29, 2009, 04:17:19 pm
Now this is interesting .

After looking for mmcu I found the settings in the MinGW\info\as.info where I found avr5 setting - and thought it might work.

So, I just selected that and also got:

avr-gcc.exe -Wall -mmcu= -DF_CPU=16000000UL  -mmcu=avr5 -g     -c main.c -o obj\Debug\main.o
cc1.exe: error: missing argument to "-mmcu="
Process terminated with status 1 (0 minutes, 0 seconds)
0 errors, 0 warnings
 
Am I doing something wrong, or have I found a bug? :?
Title: Re: AVR XMEGA ?
Post by: RoboMike on June 29, 2009, 04:42:53 pm
Ok.  So I created a new project , selected AVR5.

Now, I was able to change mmcu to atxmega128a1 in the build options -> linker settings page.

However, when I compile the application the settings that are passed to the compiler are:

avr-gcc.exe -mmcu=avr5 -Wall -DF_CPU=16000000UL  -g .....

 :(

Any ideas?
Title: Re: AVR XMEGA ?
Post by: Jenna on June 29, 2009, 05:34:31 pm
Have a look at the projects "Build options -> Compiler flags".
Title: Re: AVR XMEGA ?
Post by: RoboMike on June 29, 2009, 05:39:16 pm
You Rock!

unchecked the AVR5 flag in the options.

added -mmcu=atxmega128a1

to other options.

Works great!   :D