All pastes #564495 Raw Edit

Miscellany

public text v1 · immutable
#564495 ·published 2007-06-13 16:48 UTC
rendered paste body
Index: src/plugins/compilergcc/compilerGNUAVR.cpp
===================================================================
--- src/plugins/compilergcc/compilerGNUAVR.cpp	(Revision 4091)
+++ src/plugins/compilergcc/compilerGNUAVR.cpp	(Arbeitskopie)
@@ -98,46 +98,14 @@
     m_Options.AddOption(_("Optimize fully (for speed)"), _T("-O3"), category);
     m_Options.AddOption(_("Optimize generated code (for size)"), _T("-Os"), category);
     m_Options.AddOption(_("Expensive optimizations"), _T("-fexpensive-optimizations"), category);
+    // other
+    category = _("Other");
+    m_Options.AddOption(_("-funsigned-char"), _T("-funsigned-char"), category);
+    m_Options.AddOption(_("-funsigned-bitfields"), _T("-funsigned-bitfields"), category);
+    m_Options.AddOption(_("-fpack-struct"), _T("-fpack-struct"), category);
+    m_Options.AddOption(_("-fshort-enums"), _T("-fshort-enums"), category);
     // machine dependent options - cpu arch
     category = _("AVR CPU architecture specific");
-    m_Options.AddOption(_("avr1 (only assembler)"), _T("-mmcu=avr1"), category);
-    m_Options.AddOption(_("at90s1200 (only assembler)"), _T("-mmcu=at90s1200"), category);
-    m_Options.AddOption(_("attiny10 (only assembler)"), _T("-mmcu=attiny10"), category);
-    m_Options.AddOption(_("attiny11 (only assembler)"), _T("-mmcu=attiny11"), category);
-    m_Options.AddOption(_("attiny12 (only assembler)"), _T("-mmcu=attiny12"), category);
-    m_Options.AddOption(_("attiny15 (only assembler)"), _T("-mmcu=attiny15"), category);
-    m_Options.AddOption(_("attiny28 (only assembler)"), _T("-mmcu=attiny28"), category);
-    m_Options.AddOption(_("avr2"), _T("-mmcu=avr2"), category);
-    m_Options.AddOption(_("at90s2313"), _T("-mmcu=at90s2313"), category);
-    m_Options.AddOption(_("at90s2323"), _T("-mmcu=at90s2323"), category);
-    m_Options.AddOption(_("attiny22"), _T("-mmcu=attiny22"), category);
-    m_Options.AddOption(_("at90s2333"), _T("-mmcu=at90s2333"), category);
-    m_Options.AddOption(_("at90s2343"), _T("-mmcu=at90s2343"), category);
-    m_Options.AddOption(_("at90s4414"), _T("-mmcu=at90s4414"), category);
-    m_Options.AddOption(_("at90s4433"), _T("-mmcu=at90s4433"), category);
-    m_Options.AddOption(_("at90s4434"), _T("-mmcu=at90s4434"), category);
-    m_Options.AddOption(_("at90s8515"), _T("-mmcu=at90s8515"), category);
-    m_Options.AddOption(_("at90c8534"), _T("-mmcu=at90c8534"), category);
-    m_Options.AddOption(_("at90s8535"), _T("-mmcu=at90s8535"), category);
-    m_Options.AddOption(_("avr3"), _T("-mmcu=avr3"), category);
-    m_Options.AddOption(_("atmega103"), _T("-mmcu=atmega103"), category);
-    m_Options.AddOption(_("atmega603"), _T("-mmcu=atmega603"), category);
-    m_Options.AddOption(_("at43usb320"), _T("-mmcu=at43usb320"), category);
-    m_Options.AddOption(_("at76c711"), _T("-mmcu=at76c711"), category);
-    m_Options.AddOption(_("avr4"), _T("-mmcu=avr4"), category);
-    m_Options.AddOption(_("atmega8"), _T("-mmcu=atmega8"), category);
-    m_Options.AddOption(_("atmega83"), _T("-mmcu=atmega83"), category);
-    m_Options.AddOption(_("atmega85"), _T("-mmcu=atmega85"), category);
-    m_Options.AddOption(_("avr5"), _T("-mmcu=avr5"), category);
-    m_Options.AddOption(_("atmega16"), _T("-mmcu=atmega16"), category);
-    m_Options.AddOption(_("atmega161"), _T("-mmcu=atmega161"), category);
-    m_Options.AddOption(_("atmega163"), _T("-mmcu=atmega163"), category);
-    m_Options.AddOption(_("atmega32"), _T("-mmcu=atmega32"), category);
-    m_Options.AddOption(_("atmega323"), _T("-mmcu=atmega323"), category);
-    m_Options.AddOption(_("atmega64"), _T("-mmcu=atmega64"), category);
-    m_Options.AddOption(_("atmega128"), _T("-mmcu=atmega128"), category);
-    m_Options.AddOption(_("at43usb355"), _T("-mmcu=at43usb355"), category);
-    m_Options.AddOption(_("at94k"), _T("-mmcu=at94k"), category);
     m_Options.AddOption(_("Output instruction sizes to the asm file"), _T("-msize"), category);
     m_Options.AddOption(_("Initial stack address"), _T("-minit-stack=N"), category);
     m_Options.AddOption(_("Disable interrupts"), _T("-mno-interrupts"), category);
@@ -209,8 +177,8 @@
         }
         else
         {
-            AddIncludeDir(m_MasterPath + sep + _T("include"));
-            AddLibDir(m_MasterPath + sep + _T("lib"));
+            AddIncludeDir(m_MasterPath + sep + _T("avr/include"));
+            AddLibDir(m_MasterPath + sep + _T("avr/lib"));
         }
     }
     return ret;
Index: src/plugins/compilergcc/compilergcc.cpp
===================================================================
--- src/plugins/compilergcc/compilergcc.cpp	(Revision 4091)
+++ src/plugins/compilergcc/compilergcc.cpp	(Arbeitskopie)
@@ -1721,7 +1724,20 @@
         }
     }
 
-    if (target->GetTargetType() == ttDynamicLib ||
+    // if EXEC_CMD is set, us it instead of the normal run-command
+    wxString tmp = _T("$(EXEC_CMD)");
+    Manager::Get()->GetMacrosManager()->ReplaceMacros(tmp);
+    if(tmp.Cmp(_T("")) != 0)
+    {
+        Manager::Get()->GetMacrosManager()->ReplaceMacros(tmp);
+        command << tmp;
+        command << target->GetExecutionParameters();
+
+        // closing single-quote for xterm command line
+        if (target->GetTargetType() == ttConsoleOnly && !platform::windows)
+            command << _T("'");
+    }
+    else if (target->GetTargetType() == ttDynamicLib ||
         target->GetTargetType() == ttStaticLib)
     {
         // check for hostapp
Index: src/plugins/scriptedwizard/resources/common_functions.script
===================================================================
--- src/plugins/scriptedwizard/resources/common_functions.script	(Revision 4091)
+++ src/plugins/scriptedwizard/resources/common_functions.script	(Arbeitskopie)
@@ -13,7 +13,8 @@
              || GetCompilerFactory().CompilerInheritsFrom(compilerID, _T("gcc"))

              || GetCompilerFactory().CompilerInheritsFrom(compilerID, _T("gdc"))

              || GetCompilerFactory().CompilerInheritsFrom(compilerID, _T("icc"))

-             || GetCompilerFactory().CompilerInheritsFrom(compilerID, _T("tcc")) )

+             || GetCompilerFactory().CompilerInheritsFrom(compilerID, _T("tcc"))
+             || GetCompilerFactory().CompilerInheritsFrom(compilerID, _T("avr*")) )

     {

         base.AddCompilerOption(_T("-Wall"));

     }

@@ -46,7 +47,8 @@
              || GetCompilerFactory().CompilerInheritsFrom(compilerID, _T("dmd"))

              || GetCompilerFactory().CompilerInheritsFrom(compilerID, _T("gcc"))

              || GetCompilerFactory().CompilerInheritsFrom(compilerID, _T("gdc"))

-             || GetCompilerFactory().CompilerInheritsFrom(compilerID, _T("tcc")) )

+             || GetCompilerFactory().CompilerInheritsFrom(compilerID, _T("tcc"))
+             || GetCompilerFactory().CompilerInheritsFrom(compilerID, _T("avr*")) )

     {

         base.AddCompilerOption(_T("-g"));

 

@@ -90,7 +92,8 @@
     else if (   GetCompilerFactory().CompilerInheritsFrom(compilerID, _T("arm-elf-gcc"))

              || GetCompilerFactory().CompilerInheritsFrom(compilerID, _T("bcc*"))

              || GetCompilerFactory().CompilerInheritsFrom(compilerID, _T("gcc"))

-             || GetCompilerFactory().CompilerInheritsFrom(compilerID, _T("gdc")) )

+             || GetCompilerFactory().CompilerInheritsFrom(compilerID, _T("gdc"))
+             || GetCompilerFactory().CompilerInheritsFrom(compilerID, _T("avr*")) )

     {

         base.AddCompilerOption(_T("-O2"));

 

Index: src/plugins/scriptedwizard/resources/avr/wizard.script
===================================================================
--- src/plugins/scriptedwizard/resources/avr/wizard.script	(Revision 0)
+++ src/plugins/scriptedwizard/resources/avr/wizard.script	(Revision 0)
@@ -0,0 +1,113 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Code::Blocks new project wizard script
+//
+// Project: AVR project
+// Author:  Andre Freitag
+//
+//
+////////////////////////////////////////////////////////////////////////////////
+
+AVRSettings <- {
+    MCU = _T("")
+    F_CPU = _T("")
+    AD_PORT = _T("")
+    AD_PROGRAMMER = _T("")
+    FORMAT = _T("")
+}
+
+function BeginWizard()
+{
+    local intro_msg = _T("Welcome to the new avr project wizard!\n" +
+                        "This wizard will guide you to create a new empty project.\n\n" +
+                        "When you 're ready to proceed, please click \"Next\"...");
+
+    // intro
+    Wizard.AddInfoPage(_T("AVRProjectIntro"), intro_msg);
+
+    Wizard.AddProjectPathPage();
+    Wizard.AddCompilerPage(_T("0"), _T("avr*"), true, true);
+    Wizard.AddPage(_T("AVRSettings"));
+}
+
+function OnEnter_AVRSettings(fwd)
+{
+}
+
+function OnLeave_AVRSettings(fwd)
+{
+    if (fwd)
+    {
+        // read text values entered
+        AVRSettings.MCU = Wizard.GetComboboxStringSelection(_T("cmbMCU"));
+        AVRSettings.F_CPU = Wizard.GetTextControlValue(_T("txtF_CPU"));
+        AVRSettings.AD_PORT = Wizard.GetTextControlValue(_T("txtAD_PORT"));
+        AVRSettings.AD_PROGRAMMER = Wizard.GetComboboxStringSelection(_T("cmbAD_PROGRAMMER"));
+        AVRSettings.FORMAT = Wizard.GetTextControlValue(_T("txtFORMAT"));
+
+        // check that essentials were filled in
+        if (AVRSettings.MCU.IsEmpty() ||
+            AVRSettings.F_CPU.IsEmpty())
+        {
+            ShowWarning(_T("You have to fill the MCU and F_CPU fields before you can proceed..."));
+            return false;
+        }
+    }
+
+    return true;
+}
+
+
+function GetFilesDir()
+{
+    return _T("");
+}
+
+function SetupProject(project)
+{
+    // NOTE: Major compiler system drawback here.
+    // Until it is redesigned to allow easier compiler settings,
+    // we have to check the compiler's ID and set options for different compilers...
+
+    // enable compiler warnings (project-wide)
+    WarningsOn(project, Wizard.GetCompilerID());
+
+
+    // Debug build target
+    local target = project.GetBuildTarget(Wizard.GetDebugName());
+    if (!IsNull(target))
+    {
+        target.SetTargetType(ttConsoleOnly);
+        //local s = Wizard.GetDebugOutputDir() + Wizard.GetProjectName() + DOT_EXT_EXECUTABLE;
+        target.SetOutputFilename(Wizard.GetDebugOutputDir() + Wizard.GetProjectName() + DOT_EXT_EXECUTABLE);
+        // enable debugging symbols for this target
+        DebugSymbolsOn(target, Wizard.GetCompilerID());
+    }
+
+    // Release build target
+    target = project.GetBuildTarget(Wizard.GetReleaseName());
+    if (!IsNull(target))
+    {
+        target.SetTargetType(ttConsoleOnly);
+        target.SetOutputFilename(Wizard.GetReleaseOutputDir() + Wizard.GetProjectName() + DOT_EXT_EXECUTABLE);
+        // enable optimizations for this target
+        OptimizationsOn(target, Wizard.GetCompilerID());
+    }
+
+    project.SetVar(_T("MCU"), AVRSettings.MCU, false);
+    project.SetVar(_T("F_CPU"), AVRSettings.F_CPU, false);
+    project.SetVar(_T("AD_PORT"), AVRSettings.AD_PORT, false);
+    project.SetVar(_T("AD_PROGRAMMER"), AVRSettings.AD_PROGRAMMER, false);
+    project.SetVar(_T("FORMAT"), AVRSettings.FORMAT, false);
+
+    project.AddCompilerOption(_T("-mmcu=$(MCU)"));
+    project.AddCompilerOption(_T("-DF_CPU=$(F_CPU)UL"));
+
+    project.AddCommandsAfterBuild(_T("avr-objcopy -O $(FORMAT) -R .eeprom $(TARGET_OUTPUT_FILE) $(TARGET_OUTPUT_FILE).hex"));
+    project.AddCommandsAfterBuild(_T("avr-objcopy -j .eeprom --set-section-flags .eeprom=alloc,load --change-section-lma .eeprom=0 -O $(FORMAT) $(TARGET_OUTPUT_FILE) $(TARGET_OUTPUT_FILE).eep"));
+
+    project.SetVar(_T("EXEC_CMD"), _T("\"avrdude\" \"-p$(MCU)\" \"-P$(AD_PORT)\" \"-c$(AD_PROGRAMMER)\" \"-Uflash:w:$(TARGET_OUTPUT_FILE).hex\" \"-Ueeprom:w:$(TARGET_OUTPUT_FILE).eep\""), false);
+
+    return true;
+}
+
Index: src/plugins/scriptedwizard/resources/avr/wizard.xrc
===================================================================
--- src/plugins/scriptedwizard/resources/avr/wizard.xrc	(Revision 0)
+++ src/plugins/scriptedwizard/resources/avr/wizard.xrc	(Revision 0)
@@ -0,0 +1,147 @@
+<?xml version="1.0" encoding="utf-8"?>

+<resource>

+  <object class="wxPanel" name="AVRSettings">

+    <object class="wxBoxSizer">

+      <orient>wxVERTICAL</orient>

+      <object class="sizeritem">

+        <object class="wxStaticText">

+          <label>Please enter the needed information for the new avr project.</label>

+        </object>

+        <flag>wxALL|wxGROW</flag>

+        <border>8</border>

+      </object>

+      <object class="sizeritem">

+        <object class="wxFlexGridSizer">

+          <cols>2</cols>

+          <rows>7</rows>

+          <vgap>4</vgap>

+          <hgap>8</hgap>

+          <growablecols>1</growablecols>

+          <object class="sizeritem">

+            <object class="wxStaticText">

+              <label>MCU:</label>

+            </object>

+            <flag>wxTOP</flag>

+            <border>4</border>

+          </object>

+          <object class="sizeritem">

+	        <object class="wxComboBox" name="cmbMCU">
+	  	  <style>wxCB_DROPDOWN|wxCB_READONLY</style>
+		  <selection>29</selection>

+	          <content>

+			<item>avr1</item>
+			<item>at90s1200</item>
+			<item>attiny10</item>
+			<item>attiny11</item>
+			<item>attiny12</item>
+			<item>attiny15</item>
+			<item>attiny28</item>
+			<item>avr2</item>
+			<item>at90s2313</item>
+			<item>at90s2323</item>
+			<item>attiny22</item>
+			<item>at90s2333</item>
+			<item>at90s2343</item>
+			<item>at90s4414</item>
+			<item>at90s4433</item>
+			<item>at90s4434</item>
+			<item>at90s8515</item>
+			<item>at90c8534</item>
+			<item>at90s8535</item>
+			<item>avr3</item>
+			<item>atmega103</item>
+			<item>atmega603</item>
+			<item>at43usb320</item>
+			<item>at76c711</item>
+			<item>avr4</item>
+			<item>atmega8</item>
+			<item>atmega83</item>
+			<item>atmega85</item>
+			<item>avr5</item>
+			<item>atmega16</item>
+			<item>atmega161</item>
+			<item>atmega163</item>
+			<item>atmega32</item>
+			<item>atmega323</item>
+			<item>atmega64</item>
+			<item>atmega128</item>
+			<item>at43usb355</item>
+			<item>at94k</item>

+	          </content>

+	        </object>
+ 		<flag>wxEXPAND</flag>

+          </object>

+          <object class="sizeritem">

+            <object class="wxStaticText">

+              <label>F_CPU:</label>

+            </object>

+            <flag>wxTOP</flag>

+            <border>4</border>

+          </object>

+          <object class="sizeritem">

+            <object class="wxTextCtrl" name="txtF_CPU"><value>16000000</value></object>

+            <flag>wxEXPAND</flag>

+          </object>
+          <object class="sizeritem">

+            <object class="wxStaticText">

+              <label>avrdude-port:</label>

+            </object>

+            <flag>wxTOP</flag>

+            <border>4</border>

+          </object>

+          <object class="sizeritem">

+            <object class="wxTextCtrl" name="txtAD_PORT"><value>/dev/parport0</value></object>

+            <flag>wxEXPAND</flag>

+          </object>
+          <object class="sizeritem">

+            <object class="wxStaticText">

+              <label>avrdude-programmer:</label>

+            </object>

+            <flag>wxTOP</flag>

+            <border>4</border>

+          </object>

+          <object class="sizeritem">

+	        <object class="wxComboBox" name="cmbAD_PROGRAMMER">
+	  	  <style>wxCB_DROPDOWN|wxCB_READONLY</style>
+		  <selection>12</selection>

+	          <content>

+			<item>avrisp</item>
+			<item>avrispv2</item>
+			<item>avrispmkII</item>
+			<item>avrisp2</item>
+			<item>stk500</item>
+			<item>butterfly</item>
+			<item>jtagmkI</item>
+			<item>jtag1</item>
+			<item>jtagmkII</item>
+			<item>jtag2</item>
+			<item>dragon_jtag</item>
+			<item>dragon_isp</item>
+			<item>stk200</item>
+			<item>pony-stk200</item>
+			<item>bascom</item>
+			<item>frank-stk200</item>

+	          </content>

+	        </object>

+            <flag>wxEXPAND</flag>

+          </object>
+          <object class="sizeritem">

+            <object class="wxStaticText">

+              <label>format:</label>

+            </object>

+            <flag>wxTOP</flag>

+            <border>4</border>

+          </object>

+          <object class="sizeritem">

+            <object class="wxTextCtrl" name="txtFORMAT"><value>ihex</value></object>

+            <flag>wxEXPAND</flag>

+          </object>
+	  <growablerows>5</growablerows>

+        </object>

+        <option>1</option>

+        <flag>wxALL|wxEXPAND</flag>            

+        <border>8</border>     

+      </object>

+    </object>

+  </object>

+</resource>
Index: src/plugins/scriptedwizard/resources/config.script
===================================================================
--- src/plugins/scriptedwizard/resources/config.script	(Revision 4091)
+++ src/plugins/scriptedwizard/resources/config.script	(Arbeitskopie)
@@ -35,6 +35,7 @@
     if (PLATFORM == PLATFORM_MSW)

         RegisterWizard(wizProject, _T("win32gui"),     _T("Win32 GUI project"),     _T("GUI"));

     RegisterWizard(wizProject,     _T("wxwidgets"),    _T("wxWidgets project"),     _T("GUI"));

+    RegisterWizard(wizProject,     _T("avr"),          _T("AVR project"),           _T("Other"));

 
     //
     // build target wizards