News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

Help needed for adding AVR-GCC compiler!

Started by cemox, May 20, 2006, 09:18:13 AM

Previous topic - Next topic

cemox

Hi,

I am trying to configure code::blocks for AVR-GCC compiler, but I could not succeed so far. Could anyone tell me how to configure it?

My OS is Windows XP and I use Winavr version of AVR-GCC. This is a great IDE,  many thanks to all who contributed to the project.

Regards,

Cem

killerbot

I'll try to help you this week, I think it is very simple.

First try this : in the compiler and debugger settings, "copy" for example the gnu compiler and this copy : how about : avr-gcc ;-)
Then on the program tabs : set the directory and then adjust the programs, do the same thing for the include directories for compiler/linker/resource compiler. From this point on you can create projects where you can select this "user added" compiler.
I will give it a try myself ( I will try to build a simple library).

killerbot

I was able to use this within CB. I let CB create a simple static library (so very simple source file ;-) ) and it works.

Just install WinAvr (I only ticked the first box, I certainly didn't allow it to clutter my PATH, nobody is allowed to do that ;-) ).

The as already mentioned : compiler and debugger settings, copy the GCC, rename, and then on the programs tab :
Compilers installation dir : C:\WinAVR
and the programs :
avr-gcc.exe
avr-g++.exe
avr-g++.exe
avr-ar.exe
avr-gdb.exe
and I didn't change the last 2. Note I just test compiler, not debugger !!!

Then directories tab :
Compiler : C:\WinAVR\avr\include
Linker : C:\WinAVR\avr\lib
Resource compiler : C:\WinAVR\avr\include


I also tried it out on a "platform independent" C++ project of mine, but there I ran in to problem, it seems avr does not provide the new style headers (well : new: there nearly 8 years old !!!) like
#include <cstring> and so on. So it seems one still has to use the old style #include "string.h" and no namespaces (yuk yuk yuk). I say it seems, since I did not investigate any further.

Bounty to the community, if you can test a bit more, we might add support for this compiler as built-in. But someone needs to check the compiler settings from the regular gcc to the avr-port.

Cheers,
Lieven

cemox

Thanks for quick response Lieven. I followed the steps you wrote, but i had some problems as I am using 'makefile'. It is almost inevitable by Avr-Gcc because Microcontrollers have many parameters, like type, clock frequency, etc. and makefiles make life a lot easier. Good news: Code::Blocks *NIGHTLY BUILD* worked with makefiles smoothly. Here's how:

* Make a copy of GCC and rename it as Avr-Gcc and set it as default
* Compilers installation directory: c:\winavr
* change mingw32-gcc.exe to avr-gcc.exe
* change mingw32-c++.exe to avr-c++.exe
* change mingw32-g++.exe to avr-g++.exe
* change ar.exe to avr-ar.exe
* change gdb.exe to avr-gdb.exe
* leave windres.exe
now as the make.exe select the make.exe under c:\winavr\util\bin directory


Create a new empty project, add the attached main.c and makefile, this is a simple flashing Led Demo. The makefile is a general purpose make file, it compiles the project for Atmega32 @ 16Mhz. User might change it freely, quite flexible.

Now, in project properties select the option 'This is a custom make file'.

Move to targets tab, rename the target 'default' as 'main'. (* if this tab is deactivated, click ok, exit and come back - a simple refresh bug- 8))

Enter "build options" of this target. Move to "Make Commands" tab.

Build Project / Target shoul be : $make -f $makefile  all
Clean Project / Target should be : $make -f $makefile clean

And, we have a nice IDE for Avr-Gcc, Avrfreaks will love this  :D
---------------------------------------------------------------------------------------

Ok, I am not a Linux guy, above solution is only a temporary one until you add Avr-Gcc as built-in compiler.. :lol:

Cheers,

Cem






[attachment deleted by admin]

delux

Can anyone point some tools that would make xrc file modifications easier?
I would like to make an AVR template for code blocks and/or full support for avr-gcc (maybe someone have it already?)

thanks.

thomas

Quote from: delux on June 14, 2006, 10:36:52 AMCan anyone point some tools that would make xrc file modifications easier?
Code::Blocks... :)

(more specifically: wxSmith)
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

MortenMacFly

Quote from: delux on June 14, 2006, 10:36:52 AM
Can anyone point some tools that would make xrc file modifications easier?
XRCed (http://xrced.sourceforge.net). Anyway: Since wxSmith is available I personally prefer using this plugin, too.
With regards, Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

Keyla

There is a patch by pauliusz that add's the WinAVR suite with the avr-gcc compiler set natively into CB: http://developer.berlios.de/feature/?func=detailfeature&feature_id=3413&group_id=5358
ATM it's not part of the nightly build but I think this will come within the next few day's.

byo

Quote from: Keyla on May 23, 2007, 08:39:06 PM
There is a patch by pauliusz that add's the WinAVR suite with the avr-gcc compiler set natively into CB: http://developer.berlios.de/feature/?func=detailfeature&feature_id=3413&group_id=5358
ATM it's not part of the nightly build but I think this will come within the next few day's.

That's a feature request. The proper link is: http://developer.berlios.de/patch/?func=detailpatch&patch_id=2016&group_id=5358

BTW  That's the right thing I need now :D I'll have to use AVR-GCC soon :D

BYO

Deschamps

#9
Quote from: deluxCan anyone point some tools that would make xrc file modifications easier?

wxSmith and XRCed have just been mentioned, but i would also point you to wxFormBuilder, a wonderful open-source wxWidgets GUI builder (can import existing XRC files, too). BTW, try to download the latest svn source and build it into C::B, or download the latest nightly build. It's by far better than the previous released versions and i'm sure you'll love it.

Regards.

Those who were seen dancing were thought to be insane by those who could not hear the music