User forums > Help
Help needed for adding AVR-GCC compiler!
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.
Navigation
[0] Message Index
[#] Next page
Go to full version