[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