[Edited to make my question clearer - HTH :) ]
Hi,
I started on the m6811 gcc compiler and created new files in plugins\compilergcc and edited compilergcc.h accordingly, created a little wizard script. Amazingly enough, it builds and runs! I can start a project but I run into problems with the options.
What I am trying to do is make sure that the option -mshort (16 bit int) is selected by default when I select a particular architecture in the project wizard (new file: <C::B>\src\plugins\scriptedwizard\resources\m6811\wizard.script). Initially, I had it in the script as well as in compiler options and the "-mshort" appeared twice in the gcc command line.
In void CompilerGNUm6811::Reset() , for the defaults, I have option -mshort (16 bit int by default):
m_Options.AddOption(_("Type int is 16 bits wide, like short int"), _T("-mshort"), category);
How do I get the option to come up checked by default in my project, in the Project > Build Options > Compiler settings?
Thanks
--Louis
[Edit to add bug ID]
Hi again,
I just checked the behaviour of the GNU AVR compiler plugin and project script. It seems it's the same as what I have observed in my m6811 plugin so far.
- Start a project and pick a CPU in the project wizard. I chose ATmega16 [-mmcu=atmega16].
- In the project, go to Project > Build Options... > Compiler and, in the Compiler settings / Compiler flags, select the AVR CPU specific options. You will see that ATmega16 [-mmcu=atmega16] is NOT checked.
Furthermore, if you check a different MCU, for example ATmega32 [-mmcu=atmega32], the ATmega16 option stays even though it is not shown.
The resulting .CBP file looks like this:
Build options:
<Target title="Debug">
<Option output="bin\Debug\blahblahavr.elf" prefix_auto="1" extension_auto="0" />
<Option working_dir="" />
<Option object_output="obj\Debug\" />
<Option type="5" />
<Option compiler="avrgcc" />
<Compiler>
<Add option="-mmcu=atmega16" />
<Add option="-g" />
</Compiler>
</Target>
Compiler options:
<Compiler>
<Add option="-mmcu=atmega32" />
<Add option="-Wall" />
<Add option="-DF_CPU=16000000UL" />
</Compiler>
Linker options:
<Linker>
<Add option="-mmcu=atmega16" />
<Add option="-Wl,-Map=$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).map,--cref" />
</Linker>
And the gcc command line uses both CPU settings:
avr-gcc.exe -mmcu=atmega32 -mmcu=atmega16 -Wall -DF_CPU=16000000UL -Os -c main.c -o obj\Release\main.o
What's even more confusing is that if you close and re-open the project, the build options seem to be ignored (atmega16) and only the compiler options are used (atmega32 comes up checked, and the command line uses atmega32 only).
Being able to unknowingly set conflicting CPU types seems a bit dangerous to me. I created bug report 018659 (Conflicting compiler options for CPU type) against application::interface for this.
Thanks
--Louis