Where are the board specific "define" statements such as "AVR_ATmega328P" defined in the core?
These statements seems to confuse eclipse a lot. For instance Hardwareserial.cpp starts wit the following line:
// this next line disables the entire HardwareSerial.cpp,
// this is so I can support Attiny series and any other chip without a uart
#if defined(UBRRH) || defined(UBRR0H) || defined(UBRR1H) || defined(UBRR2H) || defined(UBRR3H)
However these UBRRH macros are not defined anywhere on the core but rather in the /avr/include which is conditionally compiled based on the board type (e.g. AVR_ATmega328P) in io.h
That is why, eclipse code analyzer generates error everytime it sees anything related with HardwareSerial.h.
is it the avr-gcc that implicitly defines the board type based on -mmcu parameter? I could not find anywhere neither in the core nor in the avr/include where the board types (e.g. AVR_ATmega328P) are explicitly defined.
Not sure how the defines get folded into the compile process, however I think the source of the defines is the boards.txt file in the arduino core directory. Here is the first board entry of that file in version 22:
Not sure how the defines get folded into the compile process, however I think the source of the defines is the boards.txt file in the arduino core directory. Here is the first board entry of that file in version 22:
In the IDE, the use has to select the board type. Presumably, that information is included in the compiler command line, in some format.
It seems to me as if the avr-gcc internally defines the board type based on the "-mmcu" parameter and the conditionally compile the rest. However, unless these board specific statements are explicitly defined in the code itself, it becomes impossible to track the call hierarchy on the code. How may I know the outcome of the following code:
I need a way to understand whether UBRRH or USBCON is defined for my board
UBRRH and USBCON are register names. AVR Libc conveniently provides pseudo-variables of the same name if the processor has those registers. To find out more about what registers are available for your processor, Use the Datasheet, Luke.