__AVR_ARCH__ preprocessor symbol definition

With Arduino 1.8.8 Hourly Build 2018/11/30 12:33 on a Windows 10 box, my Windows file content searches have not revealed where AVR_ARCH is defined, nor what its expected values would be. It does not appear on any command lines in the verbose output from the build process either.

When I compile, I can see the value is 5. I don’t know how the IDE would know what hardware platform I purchased (which happens to be an OSEPP UNO R3 Plus) without me putting something in the likes of platform.local.text. A couple hours of web searching has thus far turned up nothing relevant.

I thought it might somehow be ‘manufactured’ through token pasting, but that theory has not panned out either.

Thanks in advance for your thoughts.

It's from the libraries supplied with the compiler:


It is determined from the part specified in boards.txt for the board you have selected, which gets passed as an argument to the compiler (that is, the IDE isn't determining anything about your board - it's based off what board you tell it you have). It is very rarely relevant in an arduino sketch - I think it's more relevant if writing assembler and probably for internal use by the compiler.

Thanks. The hyperlinked material answered quite a bit. Too bad my goooogling couldn't have found that page a few hours ago.

Thanks again.

Were you just curious about this, or is there something specific you're trying to accomplish?

There is a board identifier macro defined by the build.board property in boards.txt and platform.txt. For example: ARDUINO_AVR_UNO. Typically I would prefer to use the more low level AVR_ATmega328P unless I really did need to know exactly which ATmega328P board was being compiled for.