0

I am developing libraries for compatibility across a number of Arduino/compatible boards. I know that Arduino boards can be identified by the test "#if defined (AVR_ATmega328P)" and compatibles as well: #if defined(TM4C123GH6PM). There are a few lists of these IDs on the web but are all outdated. I have searched various cores and library code and do not see where these defines are actually defined.

Nick Gammon's Sketch to detect Atmega chip types identifies the chip type. What I'm looking for the board type to define pin configurations, etc.

Where and in what format are board signatures stored? Is there c++ code that can find the board signature? Does anyone know of a site where these signatures are stored and updated by the Arduino community?

1

In the boards.txt file each board has a board type definition, such as:

uno.build.board=AVR_UNO

When you compile your sketch that is adapted into a "board" define by prepending -DARDUINO_ to it and adding it to the compilation command line - so that one becomes the same as #define ARDUINO_AVR_UNO. You can, of course, test for it with:

#ifdef ARDUINO_AVR_UNO
....
#endif

The location of the boards.txt file varies with different versions of the IDE, but every installed core will have one. Look around in your Arduino program folder in the hardware subdirectory.

  • Thanks, Majenko. That one has been bugging me for months. – user3511552 Nov 21 '15 at 17:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.