Index: src/plugins/scriptedwizard/resources/avr/wizard.script
===================================================================
--- src/plugins/scriptedwizard/resources/avr/wizard.script	(revision 7521)
+++ src/plugins/scriptedwizard/resources/avr/wizard.script	(working copy)
@@ -4,6 +4,7 @@
 //
 // Project: Atmel AVR project
 // Author:  Brian Sidebotham
+// Modified: H. Metin OZER
 //
 ////////////////////////////////////////////////////////////////////////////////
 
@@ -12,14 +13,18 @@
 AvrHex <- false;         // produce Hex file from ELF output ?
 AvrSrec <- false;              // produce Motorola S-Record files?
 AvrBin <- false;               // produce Binary image files?
+AvrExt <- false;	 // produce extra files .fuse .lock .sig etc...
 AvrLss <- false;         // produce extended list file from ELF output?
 AvrMap <- false;         // produce Symbol Map file from ELF output?
 AvrExtMem <- false;      // Locate .data in on-board SRAM, or external SRAM
 AvrExtMemAddr <- ""      // The external memory address
-AvrSize <- false;        // Run avr-size after the build 
+AvrSize <- false;        // Run avr-size after the build
 AvrF_CPU <- false;       // Define F_CPU?
 AvrF_CPUValue <- _T(""); // F_CPU textual value
- 
+Programmer <- _T("");    // Avrdude 'programmer-id'
+Debugger <- _T("");      // Avarice debugger choice
+DebuggerCon <- _T("");   // Avarice debugger connection type
+
 function BeginWizard()
 {
     local wiz_type = Wizard.GetWizardType();
@@ -33,7 +38,8 @@
         Wizard.AddInfoPage(_T("AtmelAVRIntro"), intro_msg);
         Wizard.AddProjectPathPage();
         Wizard.AddCompilerPage(_T("GNU AVR GCC Compiler"), _T("avr*"), false, true);
-        Wizard.AddPage(_T("processorChoice"));        
+        Wizard.AddPage(_T("processorChoice"));
+        Wizard.AddPage(_T("programmerChoice"));
     }
     else
         print(wiz_type);
@@ -58,10 +64,11 @@
         AvrHex = Wizard.IsCheckboxChecked(_T("checkboxHex"));
         AvrSrec = Wizard.IsCheckboxChecked(_T("checkboxSrec"));
         AvrBin = Wizard.IsCheckboxChecked(_T("checkboxBin"));
+        AvrExt = Wizard.IsCheckboxChecked(_T("checkboxExt"));
         AvrMap = Wizard.IsCheckboxChecked(_T("checkboxMap"));
         AvrLss = Wizard.IsCheckboxChecked(_T("checkboxLss"));
         AvrExtMem = Wizard.IsCheckboxChecked(_T("checkboxExtMem"));
-        AvrExtMemAddr = Wizard.GetTextControlValue(_T("textctrlExtMem"));        
+        AvrExtMemAddr = Wizard.GetTextControlValue(_T("textctrlExtMem"));
         AvrSize = Wizard.IsCheckboxChecked(_T("checkboxAvrSize"));
         AvrF_CPU = Wizard.IsCheckboxChecked(_T("checkboxF_CPU"));
         AvrF_CPUValue = Wizard.GetTextControlValue(_T("textctrlF_CPU"));
@@ -69,37 +76,83 @@
     return true;
 }
 
+
+////////////////////////////////////////////////////////////////////////////////
+// Processor choice page
+////////////////////////////////////////////////////////////////////////////////
+
+function OnLeave_programmerChoice(fwd)
+{
+    if (fwd)
+    {
+        Programmer = Wizard.GetComboboxStringSelection(_T("comboboxProg"));
+        Debugger = Wizard.GetComboboxStringSelection(_T("comboboxDbgr"));
+        DebuggerCon = Wizard.GetComboboxStringSelection(_T("comboboxDbgrCon"));
+    }
+    return true;
+}
+
 function SetupProject(project)
-{   
-    // Linker options 
+{
+    // Linker options
         local lo_map = ::wxString();
         local lo_extmem = ::wxString();
-    
+
     // Post Build steps
     local pb_avrsize = ::wxString();
+
     local pb_eephex = ::wxString();
+    local pb_fusehex = ::wxString();
+    local pb_lockhex = ::wxString();
+    local pb_sighex = ::wxString();
     local pb_hex = ::wxString();
+    local pb_lfshex = ::wxString();
+    local pb_hfshex = ::wxString();
+    local pb_efshex = ::wxString();
+
     local pb_eepbin = ::wxString();
+    local pb_fusebin = ::wxString();
+    local pb_lockbin = ::wxString();
+    local pb_sigbin = ::wxString();
     local pb_bin = ::wxString();
+
     local pb_eepsrec = ::wxString();
-    local pb_srec = ::wxString();    
+    local pb_fusesrec = ::wxString();
+    local pb_locksrec = ::wxString();
+    local pb_sigsrec = ::wxString();
+    local pb_srec = ::wxString();
+
     local pb_lss = ::wxString();
 
         // Post build commands
-        pb_eephex = _T("avr-objcopy --no-change-warnings -j .eeprom --change-section-lma .eeprom=0 -O ihex $(TARGET_OUTPUT_FILE) $(TARGET_OUTPUT_FILE).eep.hex");
-        pb_hex = _T("avr-objcopy -O ihex -R .eeprom -R .eesafe $(TARGET_OUTPUT_FILE) $(TARGET_OUTPUT_FILE).hex");
-        pb_eepbin = _T("avr-objcopy --no-change-warnings -j .eeprom --change-section-lma .eeprom=0 -O binary $(TARGET_OUTPUT_FILE) $(TARGET_OUTPUT_FILE).eep.bin");
-        pb_bin = _T("avr-objcopy -O binary -R .eeprom -R .eesafe $(TARGET_OUTPUT_FILE) $(TARGET_OUTPUT_FILE).bin");
-        pb_eepsrec = _T("avr-objcopy --no-change-warnings -j .eeprom --change-section-lma .eeprom=0 -O srec $(TARGET_OUTPUT_FILE) $(TARGET_OUTPUT_FILE).eep.srec");
-        pb_srec = _T("avr-objcopy -O srec -R .eeprom -R .eesafe $(TARGET_OUTPUT_FILE) $(TARGET_OUTPUT_FILE).srec");
+        pb_eephex = _T("avr-objcopy --no-change-warnings -j .eeprom --change-section-lma .eeprom=0 -O ihex $(TARGET_OUTPUT_FILE) $(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).eep");
+        pb_fusehex = _T("avr-objcopy --no-change-warnings -j .fuse --change-section-lma .fuse=0 -O ihex $(TARGET_OUTPUT_FILE) $(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).fuse");
+        pb_lockhex = _T("avr-objcopy --no-change-warnings -j .lock --change-section-lma .lock=0 -O ihex $(TARGET_OUTPUT_FILE) $(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).lock");
+        pb_sighex = _T("avr-objcopy --no-change-warnings -j .signature --change-section-lma .signature=0 -O ihex $(TARGET_OUTPUT_FILE) $(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).sig");
+        pb_hex = _T("avr-objcopy -R .eeprom -R .fuse -R .lock -R .signature -O ihex $(TARGET_OUTPUT_FILE) $(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).hex");
+        pb_lfshex = _T("srec_cat $(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).fuse -Intel -crop 0x00 0x01 -offset  0x00 -O $(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).lfs -Intel ");
+        pb_hfshex = _T("srec_cat $(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).fuse -Intel -crop 0x01 0x02 -offset -0x01 -O $(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).hfs -Intel ");
+        pb_efshex = _T("srec_cat $(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).fuse -Intel -crop 0x02 0x03 -offset -0x02 -O $(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).efs -Intel ");
 
+        pb_eepbin = _T("avr-objcopy --no-change-warnings -j .eeprom --change-section-lma .eeprom=0 -O binary $(TARGET_OUTPUT_FILE) $(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).eep");
+        pb_fusebin = _T("avr-objcopy --no-change-warnings -j .fuse --change-section-lma .fuse=0 -O binary $(TARGET_OUTPUT_FILE) $(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).fuse");
+        pb_lockbin = _T("avr-objcopy --no-change-warnings -j .lock --change-section-lma .lock=0 -O binary $(TARGET_OUTPUT_FILE) $(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).lock");
+        pb_sigbin = _T("avr-objcopy --no-change-warnings -j .signature --change-section-lma .signature=0 -O binary $(TARGET_OUTPUT_FILE) $(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).sig");
+        pb_bin = _T("avr-objcopy -R .eeprom -R .fuse -R .lock -R .signature -O binary $(TARGET_OUTPUT_FILE) $(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).bin");
+
+        pb_eepsrec = _T("avr-objcopy --no-change-warnings -j .eeprom --change-section-lma .eeprom=0 -O srec $(TARGET_OUTPUT_FILE) $(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).eep");
+        pb_fusesrec = _T("avr-objcopy --no-change-warnings -j .fuse --change-section-lma .fuse=0 -O srec $(TARGET_OUTPUT_FILE) $(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).fuse");
+        pb_locksrec = _T("avr-objcopy --no-change-warnings -j .lock --change-section-lma .lock=0 -O srec $(TARGET_OUTPUT_FILE) $(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).lock");
+        pb_sigsrec = _T("avr-objcopy --no-change-warnings -j .signature --change-section-lma .signature=0 -O srec $(TARGET_OUTPUT_FILE) $(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).sig");
+        pb_srec = _T("avr-objcopy -R .eeprom -R .fuse -R .lock -R .signature -O srec $(TARGET_OUTPUT_FILE) $(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).srec");
+
         if ( PLATFORM == PLATFORM_MSW )
-            pb_lss = _T("cmd /c \"avr-objdump -h -S $(TARGET_OUTPUT_FILE) > $(TARGET_OUTPUT_FILE).lss\"");
+            pb_lss = _T("cmd /c \"avr-objdump -h -S $(TARGET_OUTPUT_FILE) > $(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).lss\"");
         else
-            pb_lss = _T("avr-objdump -h -S $(TARGET_OUTPUT_FILE) > $(TARGET_OUTPUT_FILE).lss");
+            pb_lss = _T("avr-objdump -h -S $(TARGET_OUTPUT_FILE) > $(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).lss");
 
         // avr-size is compiled with patches under winavr to produce a fancy output
-        // which displays the percentage of memory used by the application for the 
+        // which displays the percentage of memory used by the application for the
         // target mcu. However, this option is not available under standard binutils
         // avr-size.
         if (PLATFORM_MSW == PLATFORM)
@@ -108,58 +161,82 @@
             pb_avrsize = _T("avr-size $(TARGET_OUTPUT_FILE)");
 
         // Setup the linker options
-        lo_map = _T("-Wl,-Map=$(TARGET_OUTPUT_FILE).map,--cref");
-        
+        lo_map = _T("-Wl,-Map=$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).map,--cref");
+
         // Get external memory start address
         lo_extmem = _T("-Wl,--section-start=.data=") + AvrExtMemAddr;
-                
+
     // Project compiler options
     WarningsOn(project, Wizard.GetCompilerID());
         project.AddCompilerOption(_T("-mmcu=") + Processor);
-        
+
         if (AvrF_CPU)
             project.AddCompilerOption(_T("-DF_CPU=") + AvrF_CPUValue);
-            
+
         // Project linker options
         project.AddLinkerOption(_T("-mmcu=") + Processor);
-        
+
         if (AvrMap)
             project.AddLinkerOption(lo_map);
-        
+
         if (AvrExtMem)
             project.AddLinkerOption(lo_extmem);
-        
-        // Project post-build steps 
+
+        // Project post-build steps
         if (AvrSize)
             project.AddCommandsAfterBuild(pb_avrsize);
-                    
+
+        if (AvrLss)
+            project.AddCommandsAfterBuild(pb_lss);
+
         if (AvrHex)
         {
             project.AddCommandsAfterBuild(pb_hex);
             project.AddCommandsAfterBuild(pb_eephex);
+
+	        if (AvrExt)
+            {
+                project.AddCommandsAfterBuild(pb_fusehex);
+                project.AddCommandsAfterBuild(pb_lockhex);
+                project.AddCommandsAfterBuild(pb_sighex);
+                project.AddCommandsAfterBuild(pb_lfshex);
+                project.AddCommandsAfterBuild(pb_hfshex);
+                project.AddCommandsAfterBuild(pb_efshex);
+            }
         }
 
         if (AvrSrec)
         {
             project.AddCommandsAfterBuild(pb_srec);
             project.AddCommandsAfterBuild(pb_eepsrec);
+
+            if (AvrExt)
+            {
+                project.AddCommandsAfterBuild(pb_fusesrec);
+                project.AddCommandsAfterBuild(pb_locksrec);
+                project.AddCommandsAfterBuild(pb_sigsrec);
+            }
         }
 
         if (AvrBin)
         {
             project.AddCommandsAfterBuild(pb_bin);
             project.AddCommandsAfterBuild(pb_eepbin);
+
+            if (AvrExt)
+            {
+                project.AddCommandsAfterBuild(pb_fusebin);
+                project.AddCommandsAfterBuild(pb_lockbin);
+                project.AddCommandsAfterBuild(pb_sigbin);
+            }
         }
 
-        if ( AvrLss )
-            project.AddCommandsAfterBuild(pb_lss);
 
-
     // Debug build target
     local target = project.GetBuildTarget(Wizard.GetDebugName());
     if (!IsNull(target))
     {
-        target.SetTargetType(ttConsoleOnly);
+        target.SetTargetType(ttNative);
         target.SetTargetFilenameGenerationPolicy(tgfpPlatformDefault, tgfpNone);
         target.SetOutputFilename(Wizard.GetDebugOutputDir() + Wizard.GetProjectName() + _T(".elf"));
         DebugSymbolsOn(target, Wizard.GetCompilerID());
@@ -169,11 +246,16 @@
     target = project.GetBuildTarget(Wizard.GetReleaseName());
     if (!IsNull(target))
         {
-            target.SetTargetType(ttConsoleOnly);
+            target.SetTargetType(ttNative);
             target.SetTargetFilenameGenerationPolicy(tgfpPlatformDefault, tgfpNone);
             target.SetOutputFilename(Wizard.GetReleaseOutputDir() + Wizard.GetProjectName() + _T(".elf"));
             OptimizationsOn(target, Wizard.GetCompilerID());
         }
-        
+
+    project.SetVar(_T("MCU"), Processor, false);
+    project.SetVar(_T("PRG"), Programmer, false);
+    project.SetVar(_T("DBG"), Debugger, false);
+    project.SetVar(_T("DBGCON"), DebuggerCon, false);
+
     return true;
 }
Index: src/plugins/scriptedwizard/resources/avr/wizard.xrc
===================================================================
--- src/plugins/scriptedwizard/resources/avr/wizard.xrc	(revision 7521)
+++ src/plugins/scriptedwizard/resources/avr/wizard.xrc	(working copy)
@@ -137,6 +137,8 @@
 						<item>atxmega128a3</item>
 						<item>atxmega16a4</item>
 						<item>atxmega16d4</item>
+						<item>atxmega192a3</item>
+						<item>atxmega192d3</item>
 						<item>atxmega256a3</item>
 						<item>atxmega256a3b</item>
 						<item>atxmega32a4</item>
@@ -241,17 +243,22 @@
 				<option>1</option>
 			</object>
 			<object class="sizeritem">
-				<object class="wxCheckBox" name="checkboxLss">
-					<label>Create extended listing file (.lss)</label>
+				<object class="wxCheckBox" name="checkboxExt">
+					<label>Create Fuse, Lock, Signature files (.fuse .lock .sig)</label>
 					<checked>1</checked>
+					<tooltip>Create Fuse, Lock and Signature files from the .elf output file. &#x0A;Requires 'srec_cat' to be installed to extract the fuse bytes &#x0A;into seperate files. For hex output only.</tooltip>
 				</object>
 				<flag>wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL</flag>
 				<border>5</border>
 				<option>1</option>
 			</object>
 			<object class="sizeritem">
-				<object class="wxStaticLine" name="ID_STATICLINE1" />
-				<flag>wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL</flag>
+				<object class="wxCheckBox" name="checkboxLss">
+					<label>Create extended listing file (.lss)</label>
+					<checked>1</checked>
+				</object>
+				<flag>wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL</flag>
+				<border>5</border>
 				<option>1</option>
 			</object>
 			<object class="sizeritem">
@@ -265,4 +272,121 @@
 			</object>
 		</object>
 	</object>
+
+	<object class="wxPanel" name="programmerChoice">
+		<object class="wxBoxSizer">
+			<orient>wxVERTICAL</orient>
+			<object class="sizeritem">
+				<object class="wxStaticText" name="textChoice">
+					<label>Please choose the programmer and connection type for AVRDude...</label>
+				</object>
+				<flag>wxALL|wxEXPAND|wxALIGN_LEFT|wxALIGN_TOP</flag>
+				<border>3</border>
+			</object>
+			<object class="sizeritem">
+				<object class="wxComboBox" name="comboboxProg">
+					<content>
+						<item>abcmini</item>
+						<item>alf</item>
+						<item>arduino</item>
+						<item>atisp</item>
+						<item>avr109</item>
+						<item>avr910</item>
+						<item>avr911</item>
+						<item>avrisp</item>
+						<item>avrisp2</item>
+						<item>avrispmkII</item>
+						<item>avrispv2</item>
+						<item>bascom</item>
+						<item>blaster</item>
+						<item>bsd</item>
+						<item>buspirate</item>
+						<item>butterfly</item>
+						<item>c2n232i</item>
+						<item>dapa</item>
+						<item>dasa</item>
+						<item>dasa3</item>
+						<item>dragon_dw</item>
+						<item>dragon_hvsp</item>
+						<item>dragon_isp</item>
+						<item>dragon_jtag</item>
+						<item>dragon_pdi</item>
+						<item>dragon_pp</item>
+						<item>dt006</item>
+						<item>ere-isp-avr</item>
+						<item>frank-stk200</item>
+						<item>futurlec</item>
+						<item>jtag1</item>
+						<item>jtag1slow</item>
+						<item>jtag2</item>
+						<item>jtag2avr32</item>
+						<item>jtag2dw</item>
+						<item>jtag2fast</item>
+						<item>jtag2isp</item>
+						<item>jtag2pdi</item>
+						<item>jtag2slow</item>
+						<item>jtagmkI</item>
+						<item>jtagmkII</item>
+						<item>jtagmkII_avr32</item>
+						<item>mib510</item>
+						<item>pavr</item>
+						<item>picoweb</item>
+						<item>pony-stk200</item>
+						<item>ponyser</item>
+						<item>siprog</item>
+						<item>sp12</item>
+						<item>stk200</item>
+						<item>stk500</item>
+						<item>stk500hvsp</item>
+						<item>stk500pp</item>
+						<item>stk500v1</item>
+						<item>stk500v2</item>
+						<item>stk600</item>
+						<item>stk600hvsp</item>
+						<item>stk600pp</item>
+						<item>usbasp</item>
+						<item>usbtiny</item>
+						<item>xil</item>
+					</content>
+				</object>
+				<flag>wxALL|wxEXPAND|wxALIGN_LEFT|wxALIGN_TOP</flag>
+				<border>3</border>
+			</object>
+			<object class="sizeritem">
+				<object class="wxStaticText" name="textChoice">
+					<label>Please choose a debugger for Avarice...</label>
+				</object>
+				<flag>wxALL|wxEXPAND|wxALIGN_LEFT|wxALIGN_TOP</flag>
+				<border>3</border>
+			</object>
+			<object class="sizeritem">
+				<object class="wxComboBox" name="comboboxDbgr">
+					<content>
+						<item>--mkI</item>
+						<item>--mkII</item>
+						<item>--dragon</item>
+					</content>
+				</object>
+				<flag>wxALL|wxEXPAND|wxALIGN_LEFT|wxALIGN_TOP</flag>
+				<border>3</border>
+			</object>
+			<object class="sizeritem">
+				<object class="wxStaticText" name="textChoice">
+					<label>Please choose the connection type for Avarice...</label>
+				</object>
+				<flag>wxALL|wxEXPAND|wxALIGN_LEFT|wxALIGN_TOP</flag>
+				<border>3</border>
+			</object>
+			<object class="sizeritem">
+				<object class="wxComboBox" name="comboboxDbgrCon">
+					<content>
+						<item>--jtag usb</item>
+						<item>--debugwire</item>
+					</content>
+				</object>
+				<flag>wxALL|wxEXPAND|wxALIGN_LEFT|wxALIGN_TOP</flag>
+				<border>3</border>
+			</object>
+		</object>
+	</object>
 </resource>
