How to verify compiler settings for specific hardware in source code

I have several concurrent Arduino projects with different boards and processors including a Nano and Pro Micro. As the project does not save the board and processor settings, I have on occasion attempted to load code compiled for a Nano into a Pro Micro. I think I bricked a board this way. I would like to add code to verify that the compiler settings are correct. I used this code for a Pro Micro: (I think this should work...)

#if !defined(ARDUINO_AVR_PROMICRO) || (F_CPU != 16000000)
#error Pro Micro 16MHz required
#endif

Where do I search on my hard drive or the web for board and processor #define such as "ARDUINO_AVR_PROMICRO", "__AVR_ATmega32U4__", and also for #define for the Nano board and its processor settings such as "ATmega328P", "ATmega328P (old bootloader)", and "ATmega168"?

I have searched for, but haven't found "#define ARDUINO_AVR_PROMICRO" defined anywhere on the web, in this forum or on my hard drive, though did find a "#ifdef ARDUINO_AVR_PROMICRO" after going though a lot of source code. I would rather find a simpler way.

Thank you for your time! -Jim

The board.txt contributes to what gets defined for processor, etc.

1 Like

I post a comment at the top of my code telling me what I am using and what the code was written for. Since you probably have to load it, then compile and upload it, just look at the comments first.

gilshultz, I am usually distracted by other things. I have incorrectly set things in the past, so I would prefer an automated check. That's what compilers are supposed to be for (at least in my opinion). Thanks.

Thank you, that helped a lot. On CharlieHanson's post, I did find where the SparkFun folder was. Set the compiler output to verbose and lo and behold: (I already had the compiler set to verbose, just had to read the output!)

  • Using board 'promicro' from platform in folder: C:\Users...
    Still, I wish it was a bit easier to find this info.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.