Patch #3474 2013-06-02 14:29

bat

add support for IAR ARM compiler
Download
3474-add_support_fo.patch (19.5 KB)
Category
Plugin::FeatureAdd
Status
Accepted
Close date
2013-07-08 16:06
Assigned to
alpha0010
Index: compilergcc.cpp
===================================================================
--- compilergcc.cpp    (revision 9131)
+++ compilergcc.cpp    (working copy)
@@ -859,7 +859,8 @@
         CompilerFactory::RegisterCompiler(new CompilerLCC);
         CompilerFactory::RegisterCompiler(new CompilerKeilC51);
         CompilerFactory::RegisterCompiler(new CompilerKeilCX51);
-        CompilerFactory::RegisterCompiler(new CompilerIAR8051);
+        CompilerFactory::RegisterCompiler(new CompilerIAR(wxT("8051")));
+        CompilerFactory::RegisterCompiler(new CompilerIAR(wxT("ARM")));
     }
     CompilerFactory::RegisterCompiler(new CompilerICC);
     CompilerFactory::RegisterCompiler(new CompilerGDC);
Index: compilerIAR.cpp
===================================================================
--- compilerIAR.cpp    (revision 9131)
+++ compilerIAR.cpp    (working copy)
@@ -21,24 +21,25 @@
     #include <wx/msw/registry.h>
 #endif
 
-CompilerIAR8051::CompilerIAR8051()
-    : Compiler(_("IAR 8051 Compiler"), _T("iar8051"))
+CompilerIAR::CompilerIAR(wxString arch)
+    : Compiler(_("IAR ") + arch + _(" Compiler"), _T("iar") + arch)
 {
     m_Weight = 75;
+    m_Arch = arch;
     Reset();
 }
 
-CompilerIAR8051::~CompilerIAR8051()
+CompilerIAR::~CompilerIAR()
 {
     //dtor
 }
 
-Compiler * CompilerIAR8051::CreateCopy()
+Compiler * CompilerIAR::CreateCopy()
 {
-    return (new CompilerIAR8051(*this));
+    return (new CompilerIAR(*this));
 }
 
-AutoDetectResult CompilerIAR8051::AutoDetectInstallationDir()
+AutoDetectResult CompilerIAR::AutoDetectInstallationDir()
 {
     if (platform::windows)
     {
@@ -69,9 +70,10 @@
             }
         }
 #endif // __WXMSW__
+        wxString env_path = wxGetenv(_T("ProgramFiles(x86)"));
         if (m_MasterPath.IsEmpty())
         {
-            wxDir dir(wxT("C:\\Program Files\\IAR Systems"));
+            wxDir dir(env_path + wxT("\\IAR Systems"));
             if (wxDirExists(dir.GetName()) && dir.IsOpened())
             {
                 wxString filename;
@@ -81,11 +83,11 @@
                     if ( filename.StartsWith(wxT("Embedded Workbench")) )
                     {
                         wxFileName fn(dir.GetName() + wxFILE_SEP_PATH + filename + wxFILE_SEP_PATH +
-                                      wxT("8051") + wxFILE_SEP_PATH + wxT("bin") + wxFILE_SEP_PATH + m_Programs.C);
+                                      m_Arch + wxFILE_SEP_PATH + wxT("bin") + wxFILE_SEP_PATH + m_Programs.C);
                         if (   wxFileName::IsFileExecutable(fn.GetFullPath())
                             && (m_MasterPath.IsEmpty() || fn.GetPath() > m_MasterPath) )
                         {
-                            m_MasterPath = dir.GetName() + wxFILE_SEP_PATH + filename + wxFILE_SEP_PATH + wxT("8051");
+                            m_MasterPath = dir.GetName() + wxFILE_SEP_PATH + filename + wxFILE_SEP_PATH + m_Arch;
                         }
                     }
                     cont = dir.GetNext(&filename);
@@ -95,7 +97,7 @@
         if (m_MasterPath.IsEmpty())
         {
             // just a guess; the default installation dir
-            m_MasterPath = wxT("C:\\Program Files\\IAR Systems\\Embedded Workbench\\8051");
+            m_MasterPath = env_path + wxT("\\IAR Systems\\Embedded Workbench\\" + m_Arch);
         }
 
         if ( wxDirExists(m_MasterPath) )
@@ -109,9 +111,15 @@
     {
         m_MasterPath=_T("/usr/local"); // default
     }
-    AddLinkerOption(wxT("-f \"") + m_MasterPath + wxFILE_SEP_PATH + wxT("config") + wxFILE_SEP_PATH +
-                    wxT("devices") + wxFILE_SEP_PATH + wxT("_generic") + wxFILE_SEP_PATH +
-                    wxT("lnk51ew_plain.xcl\""));
-
+    if (m_Arch == wxT("8051"))
+    {
+        AddLinkerOption(wxT("-f \"") + m_MasterPath + wxFILE_SEP_PATH + wxT("config") + wxFILE_SEP_PATH +
+                        wxT("devices") + wxFILE_SEP_PATH + wxT("_generic") + wxFILE_SEP_PATH +
+                        wxT("lnk51ew_plain.xcl\""));
+    }
+    if (m_Arch == wxT("IAR"))
+    {
+        AddCompilerOption(wxT("--no_wrap_diagnostics"));
+    }
     return wxFileExists(m_MasterPath + wxFILE_SEP_PATH + wxT("bin") + wxFILE_SEP_PATH + m_Programs.C) ? adrDetected : adrGuessed;
 }
Index: compilerIAR.h
===================================================================
--- compilerIAR.h    (revision 9131)
+++ compilerIAR.h    (working copy)
@@ -8,14 +8,15 @@
 
 #include <compiler.h>
 
-class CompilerIAR8051 : public Compiler
+class CompilerIAR : public Compiler
 {
     public:
-        CompilerIAR8051();
-        virtual ~CompilerIAR8051();
+        CompilerIAR(wxString arch);
+        virtual ~CompilerIAR();
         virtual AutoDetectResult AutoDetectInstallationDir();
     protected:
         virtual Compiler* CreateCopy();
+        wxString m_Arch;
     private:
 };
 
Index: resources/compilers/options_iararm.xml
===================================================================
--- resources/compilers/option
download for full patch...
alpha0010 2013-07-08 16:06

Committed; thanks.