Patch #2016 2007-05-20 16:00

pauliusz

Add support for WinAVR compiler (Feature Request #3413)
Download
2016-Add_support_fo.patch (14.1 KB)
Category
 
Status
Closed
Close date
2007-06-01 01:15
Assigned to
 
Index: src/CodeBlocks.cbp
===================================================================
--- src/CodeBlocks.cbp    (revision 3975)
+++ src/CodeBlocks.cbp    (working copy)
@@ -1198,6 +1198,12 @@
         <Unit filename="plugins\compilergcc\compilerGNUARM.h">
             <Option target="Compiler" />
         </Unit>
+        <Unit filename="plugins\compilergcc\compilerGNUAVR.cpp">
+            <Option target="Compiler" />
+        </Unit>
+        <Unit filename="plugins\compilergcc\compilerGNUAVR.h">
+            <Option target="Compiler" />
+        </Unit>
         <Unit filename="plugins\compilergcc\compilerICC.cpp">
             <Option target="Compiler" />
         </Unit>
Index: src/plugins/compilergcc/compilergcc.cpp
===================================================================
--- src/plugins/compilergcc/compilergcc.cpp    (revision 3975)
+++ src/plugins/compilergcc/compilergcc.cpp    (working copy)
@@ -68,6 +68,7 @@
     #include "compilerGDC.h"
     #include "compilerDMD.h"
     #include "compilerGNUARM.h"
+    #include "compilerGNUAVR.h"
     #include "compilerCYGWIN.h"
 #endif
 #ifdef __WXMAC__
@@ -318,6 +319,7 @@
     CompilerFactory::RegisterCompiler(new CompilerDMC);
     CompilerFactory::RegisterCompiler(new CompilerOW);
     CompilerFactory::RegisterCompiler(new CompilerGNUARM);
+    CompilerFactory::RegisterCompiler(new CompilerGNUAVR);
     CompilerFactory::RegisterCompiler(new CompilerCYGWIN);
 #endif
     CompilerFactory::RegisterCompiler(new CompilerICC);
Index: src/plugins/compilergcc/compilerGNUAVR.cpp
===================================================================
--- src/plugins/compilergcc/compilerGNUAVR.cpp    (revision 0)
+++ src/plugins/compilergcc/compilerGNUAVR.cpp    (revision 0)
@@ -0,0 +1,213 @@
+#include <sdk.h>
+#include <wx/intl.h>
+#include <wx/regex.h>
+#include <wx/config.h>
+#include <wx/fileconf.h>
+#include <wx/msgdlg.h>
+#include <wx/log.h>
+#include "manager.h"
+#include "messagemanager.h"
+#include "configmanager.h"
+#include "compilerGNUAVR.h"
+
+CompilerGNUAVR::CompilerGNUAVR()
+    : Compiler(_("GNU AVR GCC Compiler"),_T("avr-gcc"))
+{
+    Reset();
+}
+
+CompilerGNUAVR::~CompilerGNUAVR()
+{
+    //dtor
+}
+
+Compiler * CompilerGNUAVR::CreateCopy()
+{
+    Compiler* c = new CompilerGNUAVR(*this);
+    c->SetExtraPaths(m_ExtraPaths); // wxArrayString doesn't seem to be copied with the default copy ctor...
+    return c;
+}
+
+void CompilerGNUAVR::Reset()
+{
+#ifdef __WXMSW__
+    m_Programs.C = _T("avr-gcc.exe");
+    m_Programs.CPP = _T("avr-g++.exe");
+    m_Programs.LD = _T("avr-g++.exe");
+    m_Programs.DBG = _T("avr-gdb.exe");
+    m_Programs.LIB = _T("avr-ar.exe");
+    m_Programs.WINDRES = _T("");
+    m_Programs.MAKE = _T("make.exe");
+#else
+    m_Programs.C = _T("avr-gcc");
+    m_Programs.CPP = _T("avr-g++");
+    m_Programs.LD = _T("avr-g++");
+    m_Programs.DBG = _T("avr-gdb");
+    m_Programs.LIB = _T("avr-ar");
+    m_Programs.WINDRES = _T("");
+    m_Programs.MAKE = _T("make");
+#endif
+    m_Switches.includeDirs = _T("-I");
+    m_Switches.libDirs = _T("-L");
+    m_Switches.linkLibs = _T("-l");
+    m_Switches.defines = _T("-D");
+    m_Switches.genericSwitch = _T("-");
+    m_Switches.objectExtension = _T("o");
+    m_Switches.needDependencies = true;
+    m_Switches.forceCompilerUseQuotes = false;
+    m_Switches.forceLinkerUseQuotes = false;
+    m_Switches.logging = clogSimple;
+    m_Switches.libPrefix = _T("lib");
+    m_Switches.libExtension = _T("a");
+    m_Switches.linkerNeedsLibPrefix = false;
+    m_Switches.linkerNeedsLibExtension = false;
+    m_Switches.buildMethod = cbmDirect;
+
+    // Summary of GCC options: http://gcc.gnu.org/onlinedocs/gcc/Option-Summary.html
+
+    m_Options.ClearOptions();
+    m_Options.AddOption(_("Produce debugging symbols"),
+                _T("-g"),
+                _("Debugging"),
+                _T(""),
+                true,
+                _T("-O -O1 -O2 -O3 -Os"),
+                _("You have optimizations enabled. This is Not A Good Thing(tm) when producing debugging symbols..."));
+#ifdef __WXMSW__
+    #define GPROF_LINK _T("-pg -lgmon")
+#else
+    #define GPROF_LINK _T("-pg")
+#endif
+    m_Options.AddOption(_("Profile code when executed"), _T("-pg"), _("Profiling"), GPROF_LINK);
+
+    wxString category = _("Warnings");
+
+    // warnings
+    m_Options.AddOption(_("In C mode, support all ISO C90 programs. In C++ mode, remove GNU extensions that conflict with ISO C++"), _T("-ansi"), category);
+    m_Options.AddOption(_("Enable all compiler warnings (overrides every other setting)"), _T("-Wall"), category);
+    m_Options.AddOption(_("Enable standard compiler warnings"), _T("-W"), category);
+    m_Options.AddOption(_("Stop compiling after first error"), _T("-Wfatal-errors"), category);
+    m_Options.AddOption(_("Inhibit all warning messages"), _T("-w"), category);
+    m_Options.AddOption(_("Enable warnings demanded by strict ISO C and ISO C++"), _T("-pedantic"), c
download for full patch...
mandrav 2007-05-22 09:33

Hmm, I am confused. Is it winavr or gnu avr in general?

pauliusz 2007-05-22 11:01

WinAVR is port of GCC AVR for windows.

I have named it after GNU AVR, because of GNU ARM naming... Also because in future it can support linux platform also...

pauliusz 2007-05-22 11:05

Forgot to mention that there are alternative projects to WinAVR... Don't remember now... If there will be need/request I will add support for them also.