Reputation: 5038
I'm using AVR GCC compiler v5.4.0 under MPLAB X IDE v5.45.
I defined a symbol for the compiler in the avr-as-pre
section. It adds the following to the invoked command:
-DF_CPU=32000000UL
Inside the code I have some checks like this:
#ifndef F_CPU
// do something
and it actually does something. It looks like if it doesn't find the symbol. Am I wrong about how to define a symbol for the whole project in this way?
The IDE calls this stuff "defined symbols":
but it stores them as "preprocessor macros" actually:
<AVR-AS-PRE>
<property key="announce-version" value="false"/>
<property key="include-paths" value=""/>
<property key="preprocessor-macros" value="F_CPU=32000000UL"/>
<property key="preprocessor-macros-undefined" value=""/>
<property key="suppress-warnings" value="false"/>
</AVR-AS-PRE>
Unfortunately it seems it does not pass them to the compiler:
$ grep -nrw . -e F_CPU
./nbproject/configurations.xml:117: <property key="preprocessor-macros" value="F_CPU=32000000UL"/>
Upvotes: 1
Views: 454
Reputation: 5038
You have to define the compiler symbols under avr-gcc > Preprocessing and messages > Defined symbols
section:
Upvotes: 3