~ubuntu-branches/ubuntu/raring/codeblocks/raring-proposed

« back to all changes in this revision

Viewing changes to src/plugins/scriptedwizard/resources/avr/wizard.script

  • Committer: Bazaar Package Importer
  • Author(s): Cosme Domínguez Díaz
  • Date: 2010-08-09 04:38:38 UTC
  • mfrom: (1.1.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 4.
  • Revision ID: james.westby@ubuntu.com-20100809043838-a59ygguym4eg0jgw
Tags: 10.05-0ubuntu1
* New upstream release. Closes (LP: #322350)
 - Switch to dpkg-source 3.0 (quilt) format
 - Remove unneeded README.source
 - Add debian/get-source-orig script that removes all
   Windows prebuilt binaries
* Bump Standards-Version to 3.9.1
 - Stop shipping *.la files
* debian/control
 - Add cdbs package as Build-Depend
 - Add libbz2-dev and zlib1g-dev packages as
   Build-Depends (needed by libhelp_plugin.so)
 - Remove dpatch package of Build-Depends
 - Add codeblocks-contrib-debug package
 - Split architecture-independent files of codeblocks
   package in codeblocks-common package
* debian/rules
 - Switch to CDBS rules system
 - Add parallel build support
 - Add a call to debian/get-source-orig script
 - Use lzma compression (saves 23,5 MB of free space)
* debian/patches
 - Refresh 01_codeblocks_plugin_path
 - Add 02_no_Makefiles_in_debian_dir to remove any link
   in codeblocks build system to deleted Makefiles of debian directory
 - Drop 02_ftbfs_gcc44 and 03_ftbfs_glib221 (merged in upstream)
* debian/watch
 - Update to use the new host (berlios.de)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
////////////////////////////////////////////////////////////////////////////////
2
 
//
3
 
// Code::Blocks new project wizard script
4
 
//
5
 
// Project: Atmel AVR project
6
 
// Author:  Brian Sidebotham
7
 
//
8
 
////////////////////////////////////////////////////////////////////////////////
9
 
 
10
 
// Global Vars
11
 
Processor <- _T("");     // The chosen processor
12
 
AvrHex <- false;         // produce Hex file from ELF output ?
13
 
AvrSrec <- false;                          // produce Motorola S-Record files?
14
 
AvrBin <- false;                           // produce Binary image files?
15
 
AvrLss <- false;         // produce extended list file from ELF output?
16
 
AvrMap <- false;         // produce Symbol Map file from ELF output?
17
 
AvrExtMem <- false;      // Locate .data in on-board SRAM, or external SRAM
18
 
AvrExtMemAddr <- ""      // The external memory address
19
 
AvrSize <- false;        // Run avr-size after the build 
20
 
AvrF_CPU <- false;           // Define F_CPU?
21
 
AvrF_CPUValue <- _T(""); // F_CPU textual value
22
 
 
23
 
function BeginWizard()
24
 
{
25
 
    local wiz_type = Wizard.GetWizardType();
26
 
 
27
 
    if (wiz_type == wizProject)
28
 
    {
29
 
        local intro_msg = _T("Welcome to the new Atmel AVR project wizard!\n" +
30
 
                             "This wizard will guide you to create a new Atmel AVR project.\n\n" +
31
 
                             "When you 're ready to proceed, please click \"Next\"...");
32
 
 
33
 
        Wizard.AddInfoPage(_T("AtmelAVRIntro"), intro_msg);
34
 
        Wizard.AddProjectPathPage();
35
 
        Wizard.AddCompilerPage(_T("GNU AVR GCC Compiler"), _T("avr*"), false, true);
36
 
        Wizard.AddPage(_T("processorChoice"));        
37
 
    }
38
 
    else
39
 
        print(wiz_type);
40
 
}
41
 
 
42
 
function GetFilesDir()
43
 
{
44
 
    local result = _T("avr/files");
45
 
    return result;
46
 
}
47
 
 
48
 
////////////////////////////////////////////////////////////////////////////////
49
 
// Processor choice page
50
 
////////////////////////////////////////////////////////////////////////////////
51
 
 
52
 
 
53
 
function OnLeave_processorChoice(fwd)
54
 
{
55
 
    if (fwd)
56
 
    {
57
 
        Processor = Wizard.GetComboboxStringSelection(_T("comboboxProc"));
58
 
        AvrHex = Wizard.IsCheckboxChecked(_T("checkboxHex"));
59
 
        AvrSrec = Wizard.IsCheckboxChecked(_T("checkboxSrec"));
60
 
        AvrBin = Wizard.IsCheckboxChecked(_T("checkboxBin"));
61
 
        AvrMap = Wizard.IsCheckboxChecked(_T("checkboxMap"));
62
 
        AvrLss = Wizard.IsCheckboxChecked(_T("checkboxLss"));
63
 
        AvrExtMem = Wizard.IsCheckboxChecked(_T("checkboxExtMem"));
64
 
        AvrExtMemAddr = Wizard.GetTextControlValue(_T("textctrlExtMem"));        
65
 
        AvrSize = Wizard.IsCheckboxChecked(_T("checkboxAvrSize"));
66
 
        AvrF_CPU = Wizard.IsCheckboxChecked(_T("checkboxF_CPU"));
67
 
        AvrF_CPUValue = Wizard.GetTextControlValue(_T("textctrlF_CPU"));
68
 
    }
69
 
    return true;
70
 
}
71
 
 
72
 
function SetupProject(project)
73
 
{   
74
 
    // Linker options 
75
 
                local lo_map = ::wxString();
76
 
                local lo_extmem = ::wxString();
77
 
    
78
 
    // Post Build steps
79
 
    local pb_avrsize = ::wxString();
80
 
    local pb_eephex = ::wxString();
81
 
    local pb_hex = ::wxString();
82
 
    local pb_eepbin = ::wxString();
83
 
    local pb_bin = ::wxString();
84
 
    local pb_eepsrec = ::wxString();
85
 
    local pb_srec = ::wxString();    
86
 
        
87
 
                // Post build commands  
88
 
                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");
89
 
                pb_hex = _T("avr-objcopy -O ihex -R .eeprom -R .eesafe $(TARGET_OUTPUT_FILE) $(TARGET_OUTPUT_FILE).hex");
90
 
                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");
91
 
                pb_bin = _T("avr-objcopy -O binary -R .eeprom -R .eesafe $(TARGET_OUTPUT_FILE) $(TARGET_OUTPUT_FILE).bin");
92
 
                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");
93
 
                pb_srec = _T("avr-objcopy -O srec -R .eeprom -R .eesafe $(TARGET_OUTPUT_FILE) $(TARGET_OUTPUT_FILE).srec");
94
 
 
95
 
                // avr-size is compiled with patches under winavr to produce a fancy output
96
 
                // which displays the percentage of memory used by the application for the 
97
 
                // target mcu. However, this option is not available under standard binutils
98
 
                // avr-size.
99
 
                if (PLATFORM_MSW == PLATFORM)
100
 
                        pb_avrsize = _T("avr-size --mcu=") + Processor + _T(" --format=avr $(TARGET_OUTPUT_FILE)");
101
 
                else
102
 
                        pb_avrsize = _T("avr-size $(TARGET_OUTPUT_FILE)");
103
 
 
104
 
                // Setup the linker options
105
 
                lo_map = _T("-Wl,-Map=$(TARGET_OUTPUT_FILE).map,--cref");
106
 
                
107
 
                // Get external memory start address
108
 
                lo_extmem = _T("-Wl,--section-start=.data=") + AvrExtMemAddr;
109
 
                                
110
 
    // Project compiler options
111
 
    WarningsOn(project, Wizard.GetCompilerID());
112
 
                project.AddCompilerOption(_T("-mmcu=") + Processor);
113
 
                
114
 
                if (AvrF_CPU)
115
 
                        project.AddCompilerOption(_T("-DF_CPU=") + AvrF_CPUValue);
116
 
                        
117
 
                // Project linker options
118
 
                project.AddLinkerOption(_T("-mmcu=") + Processor);
119
 
                
120
 
                if (AvrMap)
121
 
                        project.AddLinkerOption(lo_map);
122
 
                
123
 
                if (AvrExtMem)
124
 
                        project.AddLinkerOption(lo_extmem);
125
 
                
126
 
                // Project post-build steps 
127
 
                if (AvrSize)
128
 
                        project.AddCommandsAfterBuild(pb_avrsize);
129
 
                                        
130
 
                if (AvrHex)
131
 
                {
132
 
                        project.AddCommandsAfterBuild(pb_hex);
133
 
                        project.AddCommandsAfterBuild(pb_eephex);
134
 
                }
135
 
 
136
 
                if (AvrSrec)
137
 
                {
138
 
                        project.AddCommandsAfterBuild(pb_srec);
139
 
                        project.AddCommandsAfterBuild(pb_eepsrec);
140
 
                }
141
 
 
142
 
                if (AvrBin)
143
 
                {
144
 
                        project.AddCommandsAfterBuild(pb_bin);
145
 
                        project.AddCommandsAfterBuild(pb_eepbin);
146
 
                }
147
 
 
148
 
                                        
149
 
    // Debug build target
150
 
    local target = project.GetBuildTarget(Wizard.GetDebugName());
151
 
    if (!IsNull(target))
152
 
    {
153
 
        target.SetTargetType(ttConsoleOnly);
154
 
        target.SetTargetFilenameGenerationPolicy(tgfpPlatformDefault, tgfpNone);
155
 
        target.SetOutputFilename(Wizard.GetDebugOutputDir() + Wizard.GetProjectName() + _T(".elf"));
156
 
        DebugSymbolsOn(target, Wizard.GetCompilerID());
157
 
    }
158
 
 
159
 
    // Release build target
160
 
    target = project.GetBuildTarget(Wizard.GetReleaseName());
161
 
    if (!IsNull(target))
162
 
                {
163
 
                        target.SetTargetType(ttConsoleOnly);
164
 
                        target.SetTargetFilenameGenerationPolicy(tgfpPlatformDefault, tgfpNone);
165
 
                        target.SetOutputFilename(Wizard.GetReleaseOutputDir() + Wizard.GetProjectName() + _T(".elf"));
166
 
                        OptimizationsOn(target, Wizard.GetCompilerID());
167
 
                }
168
 
                
169
 
    return true;
170
 
}
 
1
////////////////////////////////////////////////////////////////////////////////
 
2
//
 
3
// Code::Blocks new project wizard script
 
4
//
 
5
// Project: Atmel AVR project
 
6
// Author:  Brian Sidebotham
 
7
//
 
8
////////////////////////////////////////////////////////////////////////////////
 
9
 
 
10
// Global Vars
 
11
Processor <- _T("");     // The chosen processor
 
12
AvrHex <- false;         // produce Hex file from ELF output ?
 
13
AvrSrec <- false;              // produce Motorola S-Record files?
 
14
AvrBin <- false;               // produce Binary image files?
 
15
AvrLss <- false;         // produce extended list file from ELF output?
 
16
AvrMap <- false;         // produce Symbol Map file from ELF output?
 
17
AvrExtMem <- false;      // Locate .data in on-board SRAM, or external SRAM
 
18
AvrExtMemAddr <- ""      // The external memory address
 
19
AvrSize <- false;        // Run avr-size after the build 
 
20
AvrF_CPU <- false;       // Define F_CPU?
 
21
AvrF_CPUValue <- _T(""); // F_CPU textual value
 
22
 
 
23
function BeginWizard()
 
24
{
 
25
    local wiz_type = Wizard.GetWizardType();
 
26
 
 
27
    if (wiz_type == wizProject)
 
28
    {
 
29
        local intro_msg = _T("Welcome to the new Atmel AVR project wizard!\n" +
 
30
                             "This wizard will guide you to create a new Atmel AVR project.\n\n" +
 
31
                             "When you 're ready to proceed, please click \"Next\"...");
 
32
 
 
33
        Wizard.AddInfoPage(_T("AtmelAVRIntro"), intro_msg);
 
34
        Wizard.AddProjectPathPage();
 
35
        Wizard.AddCompilerPage(_T("GNU AVR GCC Compiler"), _T("avr*"), false, true);
 
36
        Wizard.AddPage(_T("processorChoice"));        
 
37
    }
 
38
    else
 
39
        print(wiz_type);
 
40
}
 
41
 
 
42
function GetFilesDir()
 
43
{
 
44
    local result = _T("avr/files");
 
45
    return result;
 
46
}
 
47
 
 
48
////////////////////////////////////////////////////////////////////////////////
 
49
// Processor choice page
 
50
////////////////////////////////////////////////////////////////////////////////
 
51
 
 
52
 
 
53
function OnLeave_processorChoice(fwd)
 
54
{
 
55
    if (fwd)
 
56
    {
 
57
        Processor = Wizard.GetComboboxStringSelection(_T("comboboxProc"));
 
58
        AvrHex = Wizard.IsCheckboxChecked(_T("checkboxHex"));
 
59
        AvrSrec = Wizard.IsCheckboxChecked(_T("checkboxSrec"));
 
60
        AvrBin = Wizard.IsCheckboxChecked(_T("checkboxBin"));
 
61
        AvrMap = Wizard.IsCheckboxChecked(_T("checkboxMap"));
 
62
        AvrLss = Wizard.IsCheckboxChecked(_T("checkboxLss"));
 
63
        AvrExtMem = Wizard.IsCheckboxChecked(_T("checkboxExtMem"));
 
64
        AvrExtMemAddr = Wizard.GetTextControlValue(_T("textctrlExtMem"));        
 
65
        AvrSize = Wizard.IsCheckboxChecked(_T("checkboxAvrSize"));
 
66
        AvrF_CPU = Wizard.IsCheckboxChecked(_T("checkboxF_CPU"));
 
67
        AvrF_CPUValue = Wizard.GetTextControlValue(_T("textctrlF_CPU"));
 
68
    }
 
69
    return true;
 
70
}
 
71
 
 
72
function SetupProject(project)
 
73
{   
 
74
    // Linker options 
 
75
        local lo_map = ::wxString();
 
76
        local lo_extmem = ::wxString();
 
77
    
 
78
    // Post Build steps
 
79
    local pb_avrsize = ::wxString();
 
80
    local pb_eephex = ::wxString();
 
81
    local pb_hex = ::wxString();
 
82
    local pb_eepbin = ::wxString();
 
83
    local pb_bin = ::wxString();
 
84
    local pb_eepsrec = ::wxString();
 
85
    local pb_srec = ::wxString();    
 
86
    local pb_lss = ::wxString();
 
87
 
 
88
        // Post build commands
 
89
        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");
 
90
        pb_hex = _T("avr-objcopy -O ihex -R .eeprom -R .eesafe $(TARGET_OUTPUT_FILE) $(TARGET_OUTPUT_FILE).hex");
 
91
        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");
 
92
        pb_bin = _T("avr-objcopy -O binary -R .eeprom -R .eesafe $(TARGET_OUTPUT_FILE) $(TARGET_OUTPUT_FILE).bin");
 
93
        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");
 
94
        pb_srec = _T("avr-objcopy -O srec -R .eeprom -R .eesafe $(TARGET_OUTPUT_FILE) $(TARGET_OUTPUT_FILE).srec");
 
95
 
 
96
        if ( PLATFORM == PLATFORM_MSW )
 
97
            pb_lss = _T("cmd /c \"avr-objdump -h -S $(TARGET_OUTPUT_FILE) > $(TARGET_OUTPUT_FILE).lss\"");
 
98
        else
 
99
            pb_lss = _T("avr-objdump -h -S $(TARGET_OUTPUT_FILE) > $(TARGET_OUTPUT_FILE).lss");
 
100
 
 
101
        // avr-size is compiled with patches under winavr to produce a fancy output
 
102
        // which displays the percentage of memory used by the application for the 
 
103
        // target mcu. However, this option is not available under standard binutils
 
104
        // avr-size.
 
105
        if (PLATFORM_MSW == PLATFORM)
 
106
            pb_avrsize = _T("avr-size --mcu=") + Processor + _T(" --format=avr $(TARGET_OUTPUT_FILE)");
 
107
        else
 
108
            pb_avrsize = _T("avr-size $(TARGET_OUTPUT_FILE)");
 
109
 
 
110
        // Setup the linker options
 
111
        lo_map = _T("-Wl,-Map=$(TARGET_OUTPUT_FILE).map,--cref");
 
112
        
 
113
        // Get external memory start address
 
114
        lo_extmem = _T("-Wl,--section-start=.data=") + AvrExtMemAddr;
 
115
                
 
116
    // Project compiler options
 
117
    WarningsOn(project, Wizard.GetCompilerID());
 
118
        project.AddCompilerOption(_T("-mmcu=") + Processor);
 
119
        
 
120
        if (AvrF_CPU)
 
121
            project.AddCompilerOption(_T("-DF_CPU=") + AvrF_CPUValue);
 
122
            
 
123
        // Project linker options
 
124
        project.AddLinkerOption(_T("-mmcu=") + Processor);
 
125
        
 
126
        if (AvrMap)
 
127
            project.AddLinkerOption(lo_map);
 
128
        
 
129
        if (AvrExtMem)
 
130
            project.AddLinkerOption(lo_extmem);
 
131
        
 
132
        // Project post-build steps 
 
133
        if (AvrSize)
 
134
            project.AddCommandsAfterBuild(pb_avrsize);
 
135
                    
 
136
        if (AvrHex)
 
137
        {
 
138
            project.AddCommandsAfterBuild(pb_hex);
 
139
            project.AddCommandsAfterBuild(pb_eephex);
 
140
        }
 
141
 
 
142
        if (AvrSrec)
 
143
        {
 
144
            project.AddCommandsAfterBuild(pb_srec);
 
145
            project.AddCommandsAfterBuild(pb_eepsrec);
 
146
        }
 
147
 
 
148
        if (AvrBin)
 
149
        {
 
150
            project.AddCommandsAfterBuild(pb_bin);
 
151
            project.AddCommandsAfterBuild(pb_eepbin);
 
152
        }
 
153
 
 
154
        if ( AvrLss )
 
155
            project.AddCommandsAfterBuild(pb_lss);
 
156
 
 
157
 
 
158
    // Debug build target
 
159
    local target = project.GetBuildTarget(Wizard.GetDebugName());
 
160
    if (!IsNull(target))
 
161
    {
 
162
        target.SetTargetType(ttConsoleOnly);
 
163
        target.SetTargetFilenameGenerationPolicy(tgfpPlatformDefault, tgfpNone);
 
164
        target.SetOutputFilename(Wizard.GetDebugOutputDir() + Wizard.GetProjectName() + _T(".elf"));
 
165
        DebugSymbolsOn(target, Wizard.GetCompilerID());
 
166
    }
 
167
 
 
168
    // Release build target
 
169
    target = project.GetBuildTarget(Wizard.GetReleaseName());
 
170
    if (!IsNull(target))
 
171
        {
 
172
            target.SetTargetType(ttConsoleOnly);
 
173
            target.SetTargetFilenameGenerationPolicy(tgfpPlatformDefault, tgfpNone);
 
174
            target.SetOutputFilename(Wizard.GetReleaseOutputDir() + Wizard.GetProjectName() + _T(".elf"));
 
175
            OptimizationsOn(target, Wizard.GetCompilerID());
 
176
        }
 
177
        
 
178
    return true;
 
179
}