Author Topic: Help needed for adding AVR-GCC compiler!  (Read 13291 times)

cemox

  • Guest
Help needed for adding AVR-GCC compiler!
« on: May 20, 2006, 09:18:13 am »
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

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5495
Re: Help needed for adding AVR-GCC compiler!
« Reply #1 on: May 20, 2006, 10:08:11 am »
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).

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5495
Re: Help needed for adding AVR-GCC compiler!
« Reply #2 on: May 20, 2006, 06:22:56 pm »
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

  • Guest
Re: Help needed for adding AVR-GCC compiler! [temporarily solved!]
« Reply #3 on: May 21, 2006, 01:16:25 am »
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]
« Last Edit: May 25, 2006, 09:04:10 am by cemox »

delux

  • Guest
Re: Help needed for adding AVR-GCC compiler!
« Reply #4 on: June 14, 2006, 10:36:52 am »
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.

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Help needed for adding AVR-GCC compiler!
« Reply #5 on: June 14, 2006, 11:21:19 am »
Can 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."

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Help needed for adding AVR-GCC compiler!
« Reply #6 on: June 14, 2006, 01:26:16 pm »
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: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline Keyla

  • Multiple posting newcomer
  • *
  • Posts: 48
Re: Help needed for adding AVR-GCC compiler!
« Reply #7 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.

Offline byo

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 837
Re: Help needed for adding AVR-GCC compiler!
« Reply #8 on: May 23, 2007, 11:41:25 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

Offline Deschamps

  • Multiple posting newcomer
  • *
  • Posts: 120
Re: Help needed for adding AVR-GCC compiler!
« Reply #9 on: May 24, 2007, 12:51:08 am »
Quote from: delux
Can 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.

« Last Edit: May 24, 2007, 12:58:43 am by Deschamps »
Those who were seen dancing were thought to be insane by those who could not hear the music