Patch #3400 2013-01-06 12:22

tomjnx

Scripted Wizard: MCS51: allow compiler choice
Download
3400-Scripted_Wizar.patch (20.7 KB)
Category
Plugin::Refinement
Status
Accepted
Close date
2013-01-13 12:40
Assigned to
alpha0010
diff --git a/src/plugins/scriptedwizard/resources/Makefile.am b/src/plugins/scriptedwizard/resources/Makefile.am
index b843860..f5344ed 100644
--- a/src/plugins/scriptedwizard/resources/Makefile.am
+++ b/src/plugins/scriptedwizard/resources/Makefile.am
@@ -1,4 +1,4 @@
-SUBDIRS = arm avr c_file console d directx dll empty empty_file fltk fortran glfw glut gtk h_file irrlicht lf matlab_csf ogre opengl plugins ppc qt4 sdl sfml smartwin staticlib stlport sharedlib sys tricore win32gui wxwidgets
+SUBDIRS = arm avr c_file console d directx dll empty empty_file fltk fortran glfw glut gtk h_file irrlicht lf mcs51 matlab_csf ogre opengl plugins ppc qt4 sdl sfml smartwin staticlib stlport sharedlib sys tricore win32gui wxwidgets
 
 pkgdata_DATA = scriptedwizard.zip
 CLEANFILES = $(pkgdata_DATA)
diff --git a/src/plugins/scriptedwizard/resources/common_functions.script b/src/plugins/scriptedwizard/resources/common_functions.script
index 2bdb8e9..bed3dd0 100644
--- a/src/plugins/scriptedwizard/resources/common_functions.script
+++ b/src/plugins/scriptedwizard/resources/common_functions.script
@@ -59,6 +59,14 @@ function WarningsOn(base, compilerID)
         // with SDCC all warnings are enabled by default. You can only ask for less by using --less-pedantic or --disable-warning.
         // the (pseudo) compiler "No Compiler" takes no options
     }
+    else if (   GetCompilerFactory().CompilerInheritsFrom(compilerID, _T("keil*")))
+    {
+        base.AddCompilerOption(_T("WARNINGLEVEL(2)"));
+    }
+    else if (   GetCompilerFactory().CompilerInheritsFrom(compilerID, _T("iar*")))
+    {
+        base.AddCompilerOption(_T("--remarks"));
+    }
     else
     {
         ShowWarning(_T("This wizard doesn't know how to setup warning flags for this compiler.\n"));
@@ -113,7 +121,13 @@ function DebugSymbolsOn(base, compilerID)
     {
         base.AddCompilerOption(_T("-d2")); // full symbolic debugging information
     }
-    else if (GetCompilerFactory().CompilerInheritsFrom(compilerID, _T("sdcc")))
+    else if (GetCompilerFactory().CompilerInheritsFrom(compilerID, _T("keil*")))
+    {
+        base.AddCompilerOption(_T("DEBUG"));
+        base.AddCompilerOption(_T("OBJECTEXTEND"));
+    }
+    else if (   GetCompilerFactory().CompilerInheritsFrom(compilerID, _T("sdcc"))
+             || GetCompilerFactory().CompilerInheritsFrom(compilerID, _T("iar*")))
     {
         base.AddCompilerOption(_T("--debug"));
     }
@@ -188,6 +202,19 @@ function OptimizationsOn(base, compilerID)
         base.AddCompilerOption(_T("-ot")); // optimize for time
         base.AddCompilerOption(_T("-ox")); // Maximum optimization
     }
+    else if (   GetCompilerFactory().CompilerInheritsFrom(compilerID, _T("keilc51")))
+    {
+        base.AddCompilerOption(_T("OPTIMIZE(11,SIZE)"));
+    }
+    else if (   GetCompilerFactory().CompilerInheritsFrom(compilerID, _T("keilcx51")))
+    {
+        base.AddCompilerOption(_T("OPTIMIZE(11,SIZE)"));
+        base.AddCompilerOption(_T("OBJECTADVANCED"));
+    }
+    else if (GetCompilerFactory().CompilerInheritsFrom(compilerID, _T("iar*")))
+    {
+        base.AddCompilerOption(_T("-Oh"));
+    }
     else if (   GetCompilerFactory().CompilerInheritsFrom(compilerID, _T("sdcc")) )
     {
         base.AddCompilerOption(_T("--opt-code-size"));
diff --git a/src/plugins/scriptedwizard/resources/mcs51/Makefile.am b/src/plugins/scriptedwizard/resources/mcs51/Makefile.am
new file mode 100644
index 0000000..cb32de3
--- /dev/null
+++ b/src/plugins/scriptedwizard/resources/mcs51/Makefile.am
@@ -0,0 +1,10 @@
+pkgdatadir = $(datadir)/@PACKAGE@/templates/wizard/mcs51
+
+dist_pkgdata_DATA = logo.png \
+                    wizard.png \
+                    wizard.script \
+                    wizard.xrc
+
+filesdir    = $(pkgdatadir)/files
+
+dist_files_DATA    = files/main.c
diff --git a/src/plugins/scriptedwizard/resources/mcs51/files/main.c b/src/plugins/scriptedwizard/resources/mcs51/files/main.c
index e59c525..ece853c 100644
--- a/src/plugins/scriptedwizard/resources/mcs51/files/main.c
+++ b/src/plugins/scriptedwizard/resources/mcs51/files/main.c
@@ -1,7 +1,13 @@
 /*
  */
 
+#if defined SDCC
 #include <mcs51/8051.h>
+#elif defined __CX51__ || defined __C51__
+#include <reg51.h>
+#elif defined __ICC8051__
+#include <io80C52.h>
+#endif
 
 void main(void)
 {
diff --git a/src/plugins/scriptedwizard/resources/mcs51/wizard.script b/src/plugins/scriptedwizard/resources/mcs51/wizard.script
index 013d6e9..4acad9c 100644
--- a/src/plugins/scriptedwizard/resources/mcs51/wizard.script
+++ b/src/plugins/scriptedwizard/resources/mcs51/wizard.script
@@ -4,12 +4,17 @@
 //
 // Project: MCS51 project
 // Author:  H. Metin OZER
+// Keil/IAR: Thomas Sailer
 //
 ////////////////////////////////////////////////////////////////////////////////
 
 // Global Vars
 MemoryModel <- _T("");     // The chosen memory model
-IntelHex <- true;         // produce Intel Hex file?
+MemoryModelIndex <- 0;     // The memory model as integer
+Inte
download for full patch...
alpha0010 2013-01-09 02:54

Was it your intention to include multiple commented out "//project.AddLinkerOption(...)" lines in this patch?

tomjnx 2013-01-09 11:19

I've been considering making memory sizes configurable; so here is the version with configurable memory sizes, with the commented lines uncommented.

alpha0010 2013-01-13 12:40

In trunk (with modifications), let me know if I broke anything.

tomjnx 2013-01-14 12:30

Looks good, thanks!