Open ianfixes opened 5 years ago
from https://www.microchip.com/webdoc/avrlibcreferencemanual/using_tools_1using_avr_gcc_mach_opt.html
via @per1234 (https://github.com/ianfixes/arduino_ci/issues/86#issuecomment-454173396)
Architecture | MCU name | Macro |
---|---|---|
avr1 | at90s1200 | __AVR_AT90S1200__ |
avr1 | attiny11 | __AVR_ATtiny11__ |
avr1 | attiny12 | __AVR_ATtiny12__ |
avr1 | attiny15 | __AVR_ATtiny15__ |
avr1 | attiny28 | __AVR_ATtiny28__ |
avr2 | at90s2313 | __AVR_AT90S2313__ |
avr2 | at90s2323 | __AVR_AT90S2323__ |
avr2 | at90s2333 | __AVR_AT90S2333__ |
avr2 | at90s2343 | __AVR_AT90S2343__ |
avr2 | attiny22 | __AVR_ATtiny22__ |
avr2 | attiny26 | __AVR_ATtiny26__ |
avr2 | at90s4414 | __AVR_AT90S4414__ |
avr2 | at90s4433 | __AVR_AT90S4433__ |
avr2 | at90s4434 | __AVR_AT90S4434__ |
avr2 | at90s8515 | __AVR_AT90S8515__ |
avr2 | at90c8534 | __AVR_AT90C8534__ |
avr2 | at90s8535 | __AVR_AT90S8535__ |
avr2/avr25[1] | at86rf401 | __AVR_AT86RF401__ |
avr2/avr25[1] | ata6289 | __AVR_ATA6289__ |
avr2/avr25[1] | ata5272 | __AVR_ATA5272__ |
avr2/avr25[1] | ata6616c | __AVR_ATA6616C__ |
avr2/avr25[1] | attiny13 | __AVR_ATtiny13__ |
avr2/avr25[1] | attiny13a | __AVR_ATtiny13A__ |
avr2/avr25[1] | attiny2313 | __AVR_ATtiny2313__ |
avr2/avr25[1] | attiny2313a | __AVR_ATtiny2313A__ |
avr2/avr25[1] | attiny24 | __AVR_ATtiny24__ |
avr2/avr25[1] | attiny24a | __AVR_ATtiny24A__ |
avr2/avr25[1] | attiny25 | __AVR_ATtiny25__ |
avr2/avr25[1] | attiny261 | __AVR_ATtiny261__ |
avr2/avr25[1] | attiny261a | __AVR_ATtiny261A__ |
avr2/avr25[1] | attiny4313 | __AVR_ATtiny4313__ |
avr2/avr25[1] | attiny43u | __AVR_ATtiny43U__ |
avr2/avr25[1] | attiny44 | __AVR_ATtiny44__ |
avr2/avr25[1] | attiny44a | __AVR_ATtiny44A__ |
avr2/avr25[1] | attiny441 | __AVR_ATtiny441__ |
avr2/avr25[1] | attiny45 | __AVR_ATtiny45__ |
avr2/avr25[1] | attiny461 | __AVR_ATtiny461__ |
avr2/avr25[1] | attiny461a | __AVR_ATtiny461A__ |
avr2/avr25[1] | attiny48 | __AVR_ATtiny48__ |
avr2/avr25[1] | attiny828 | __AVR_ATtiny828__ |
avr2/avr25[1] | attiny84 | __AVR_ATtiny84__ |
avr2/avr25[1] | attiny84a | __AVR_ATtiny84A__ |
avr2/avr25[1] | attiny841 | __AVR_ATtiny841__ |
avr2/avr25[1] | attiny85 | __AVR_ATtiny85__ |
avr2/avr25[1] | attiny861 | __AVR_ATtiny861__ |
avr2/avr25[1] | attiny861a | __AVR_ATtiny861A__ |
avr2/avr25[1] | attiny87 | __AVR_ATtiny87__ |
avr2/avr25[1] | attiny88 | __AVR_ATtiny88__ |
avr3 | atmega603 | __AVR_ATmega603__ |
avr3 | at43usb355 | __AVR_AT43USB355__ |
avr3/avr31[3] | atmega103 | __AVR_ATmega103__ |
avr3/avr31[3] | at43usb320 | __AVR_AT43USB320__ |
avr3/avr35[2] | at90usb82 | __AVR_AT90USB82__ |
avr3/avr35[2] | at90usb162 | __AVR_AT90USB162__ |
avr3/avr35[2] | ata5505 | __AVR_ATA5505__ |
avr3/avr35[2] | ata6617c | __AVR_ATA6617C__ |
avr3/avr35[2] | ata664251 | __AVR_ATA664251__ |
avr3/avr35[2] | atmega8u2 | __AVR_ATmega8U2__ |
avr3/avr35[2] | atmega16u2 | __AVR_ATmega16U2__ |
avr3/avr35[2] | atmega32u2 | __AVR_ATmega32U2__ |
avr3/avr35[2] | attiny167 | __AVR_ATtiny167__ |
avr3/avr35[2] | attiny1634 | __AVR_ATtiny1634__ |
avr3 | at76c711 | __AVR_AT76C711__ |
avr4 | ata6285 | __AVR_ATA6285__ |
avr4 | ata6286 | __AVR_ATA6286__ |
avr4 | ata6612c | __AVR_ATA6612C__ |
avr4 | atmega48 | __AVR_ATmega48__ |
avr4 | atmega48a | __AVR_ATmega48A__ |
avr4 | atmega48pa | __AVR_ATmega48PA__ |
avr4 | atmega48p | __AVR_ATmega48P__ |
avr4 | atmega8 | __AVR_ATmega8__ |
avr4 | atmega8a | __AVR_ATmega8A__ |
avr4 | atmega8515 | __AVR_ATmega8515__ |
avr4 | atmega8535 | __AVR_ATmega8535__ |
avr4 | atmega88 | __AVR_ATmega88__ |
avr4 | atmega88a | __AVR_ATmega88A__ |
avr4 | atmega88p | __AVR_ATmega88P__ |
avr4 | atmega88pa | __AVR_ATmega88PA__ |
avr4 | atmega8hva | __AVR_ATmega8HVA__ |
avr4 | at90pwm1 | __AVR_AT90PWM1__ |
avr4 | at90pwm2 | __AVR_AT90PWM2__ |
avr4 | at90pwm2b | __AVR_AT90PWM2B__ |
avr4 | at90pwm3 | __AVR_AT90PWM3__ |
avr4 | at90pwm3b | __AVR_AT90PWM3B__ |
avr4 | at90pwm81 | __AVR_AT90PWM81__ |
avr5 | at90can32 | __AVR_AT90CAN32__ |
avr5 | at90can64 | __AVR_AT90CAN64__ |
avr5 | at90pwm161 | __AVR_AT90PWM161__ |
avr5 | at90pwm216 | __AVR_AT90PWM216__ |
avr5 | at90pwm316 | __AVR_AT90PWM316__ |
avr5 | at90scr100 | __AVR_AT90SCR100__ |
avr5 | at90usb646 | __AVR_AT90USB646__ |
avr5 | at90usb647 | __AVR_AT90USB647__ |
avr5 | at94k | __AVR_AT94K__ |
avr5 | atmega16 | __AVR_ATmega16__ |
avr5 | ata5790 | __AVR_ATA5790__ |
avr5 | ata5702m322 | __AVR_ATA5702M322__ |
avr5 | ata5782 | __AVR_ATA5782__ |
avr5 | ata6613c | __AVR_ATA6613C__ |
avr5 | ata6614q | __AVR_ATA6614Q__ |
avr5 | ata5790n | __AVR_ATA5790N__ |
avr5 | ata5795 | __AVR_ATA5795__ |
avr5 | ata5831 | __AVR_ATA5831__ |
avr5 | atmega161 | __AVR_ATmega161__ |
avr5 | atmega162 | __AVR_ATmega162__ |
avr5 | atmega163 | __AVR_ATmega163__ |
avr5 | atmega164a | __AVR_ATmega164A__ |
avr5 | atmega164p | __AVR_ATmega164P__ |
avr5 | atmega164pa | __AVR_ATmega164PA__ |
avr5 | atmega165 | __AVR_ATmega165__ |
avr5 | atmega165a | __AVR_ATmega165A__ |
avr5 | atmega165p | __AVR_ATmega165P__ |
avr5 | atmega165pa | __AVR_ATmega165PA__ |
avr5 | atmega168 | __AVR_ATmega168__ |
avr5 | atmega168a | __AVR_ATmega168A__ |
avr5 | atmega168p | __AVR_ATmega168P__ |
avr5 | atmega168pa | __AVR_ATmega168PA__ |
avr5 | atmega169 | __AVR_ATmega169__ |
avr5 | atmega169a | __AVR_ATmega169A__ |
avr5 | atmega169p | __AVR_ATmega169P__ |
avr5 | atmega169pa | __AVR_ATmega169PA__ |
avr5 | atmega16a | __AVR_ATmega16A__ |
avr5 | atmega16hva | __AVR_ATmega16HVA__ |
avr5 | atmega16hva2 | __AVR_ATmega16HVA2__ |
avr5 | atmega16hvb | __AVR_ATmega16HVB__ |
avr5 | atmega16hvbrevb | __AVR_ATmega16HVBREVB__ |
avr5 | atmega16m1 | __AVR_ATmega16M1__ |
avr5 | atmega16u4 | __AVR_ATmega16U4__ |
avr5 | atmega32 | __AVR_ATmega32__ |
avr5 | atmega32a | __AVR_ATmega32A__ |
avr5 | atmega323 | __AVR_ATmega323__ |
avr5 | atmega324a | __AVR_ATmega324A__ |
avr5 | atmega324p | __AVR_ATmega324P__ |
avr5 | atmega324pa | __AVR_ATmega324PA__ |
avr5 | atmega325 | __AVR_ATmega325__ |
avr5 | atmega325a | __AVR_ATmega325A__ |
avr5 | atmega325p | __AVR_ATmega325P__ |
avr5 | atmega325pa | __AVR_ATmega325PA__ |
avr5 | atmega3250 | __AVR_ATmega3250__ |
avr5 | atmega3250a | __AVR_ATmega3250A__ |
avr5 | atmega3250p | __AVR_ATmega3250P__ |
avr5 | atmega3250pa | __AVR_ATmega3250PA__ |
avr5 | atmega328 | __AVR_ATmega328__ |
avr5 | atmega328p | __AVR_ATmega328P__ |
avr5 | atmega329 | __AVR_ATmega329__ |
avr5 | atmega329a | __AVR_ATmega329A__ |
avr5 | atmega329p | __AVR_ATmega329P__ |
avr5 | atmega329pa | __AVR_ATmega329PA__ |
avr5 | atmega3290 | __AVR_ATmega3290__ |
avr5 | atmega3290a | __AVR_ATmega3290A__ |
avr5 | atmega3290p | __AVR_ATmega3290P__ |
avr5 | atmega3290pa | __AVR_ATmega3290PA__ |
avr5 | atmega32c1 | __AVR_ATmega32C1__ |
avr5 | atmega32hvb | __AVR_ATmega32HVB__ |
avr5 | atmega32hvbrevb | __AVR_ATmega32HVBREVB__ |
avr5 | atmega32m1 | __AVR_ATmega32M1__ |
avr5 | atmega32u4 | __AVR_ATmega32U4__ |
avr5 | atmega32u6 | __AVR_ATmega32U6__ |
avr5 | atmega406 | __AVR_ATmega406__ |
avr5 | atmega64rfr2 | __AVR_ATmega64RFR2__ |
avr5 | atmega644rfr2 | __AVR_ATmega644RFR2__ |
avr5 | atmega64 | __AVR_ATmega64__ |
avr5 | atmega64a | __AVR_ATmega64A__ |
avr5 | atmega640 | __AVR_ATmega640__ |
avr5 | atmega644 | __AVR_ATmega644__ |
avr5 | atmega644a | __AVR_ATmega644A__ |
avr5 | atmega644p | __AVR_ATmega644P__ |
avr5 | atmega644pa | __AVR_ATmega644PA__ |
avr5 | atmega645 | __AVR_ATmega645__ |
avr5 | atmega645a | __AVR_ATmega645A__ |
avr5 | atmega645p | __AVR_ATmega645P__ |
avr5 | atmega6450 | __AVR_ATmega6450__ |
avr5 | atmega6450a | __AVR_ATmega6450A__ |
avr5 | atmega6450p | __AVR_ATmega6450P__ |
avr5 | atmega649 | __AVR_ATmega649__ |
avr5 | atmega649a | __AVR_ATmega649A__ |
avr5 | atmega6490 | __AVR_ATmega6490__ |
avr5 | atmega6490a | __AVR_ATmega6490A__ |
avr5 | atmega6490p | __AVR_ATmega6490P__ |
avr5 | atmega649p | __AVR_ATmega649P__ |
avr5 | atmega64c1 | __AVR_ATmega64C1__ |
avr5 | atmega64hve | __AVR_ATmega64HVE__ |
avr5 | atmega64hve2 | __AVR_ATmega64HVE2__ |
avr5 | atmega64m1 | __AVR_ATmega64M1__ |
avr5 | m3000 | __AVR_M3000__ |
avr5/avr51[3] | at90can128 | __AVR_AT90CAN128__ |
avr5/avr51[3] | at90usb1286 | __AVR_AT90USB1286__ |
avr5/avr51[3] | at90usb1287 | __AVR_AT90USB1287__ |
avr5/avr51[3] | atmega128 | __AVR_ATmega128__ |
avr5/avr51[3] | atmega128a | __AVR_ATmega128A__ |
avr5/avr51[3] | atmega1280 | __AVR_ATmega1280__ |
avr5/avr51[3] | atmega1281 | __AVR_ATmega1281__ |
avr5/avr51[3] | atmega1284 | __AVR_ATmega1284__ |
avr5/avr51[3] | atmega1284p | __AVR_ATmega1284P__ |
avr5/avr51[3] | atmega128rfr2 | __AVR_ATmega128RFR2__ |
avr5/avr51[3] | atmega1284rfr2 | __AVR_ATmega1284RFR2__ |
avr6 | atmega2560 | __AVR_ATmega2560__ |
avr6 | atmega2561 | __AVR_ATmega2561__ |
avr6 | atmega256rfr2 | __AVR_ATmega256RFR2__ |
avr6 | atmega2564rfr2 | __AVR_ATmega2564RFR2__ |
avrxmega2 | atxmega16a4 | __AVR_ATxmega16A4__ |
avrxmega2 | atxmega16a4u | __AVR_ATxmega16A4U__ |
avrxmega2 | atxmega16c4 | __AVR_ATxmega16C4__ |
avrxmega2 | atxmega16d4 | __AVR_ATxmega16D4__ |
avrxmega2 | atxmega32a4 | __AVR_ATxmega32A4__ |
avrxmega2 | atxmega32a4u | __AVR_ATxmega32A4U__ |
avrxmega2 | atxmega32c3 | __AVR_ATxmega32C3__ |
avrxmega2 | atxmega32c4 | __AVR_ATxmega32C4__ |
avrxmega2 | atxmega32d3 | __AVR_ATxmega32D3__ |
avrxmega2 | atxmega32d4 | __AVR_ATxmega32D4__ |
avrxmega2 | atxmega8e5 | __AVR_ATxmega8E5__ |
avrxmega2 | atxmega16e5 | __AVR_ATxmega16E5__ |
avrxmega2 | atxmega32e5 | __AVR_ATxmega32E5__ |
avrxmega4 | atxmega64a3 | __AVR_ATxmega64A3__ |
avrxmega4 | atxmega64a3u | __AVR_ATxmega64A3U__ |
avrxmega4 | atxmega64a4u | __AVR_ATxmega64A4U__ |
avrxmega4 | atxmega64b1 | __AVR_ATxmega64B1__ |
avrxmega4 | atxmega64b3 | __AVR_ATxmega64B3__ |
avrxmega4 | atxmega64c3 | __AVR_ATxmega64C3__ |
avrxmega4 | atxmega64d3 | __AVR_ATxmega64D3__ |
avrxmega4 | atxmega64d4 | __AVR_ATxmega64D4__ |
avrxmega5 | atxmega64a1 | __AVR_ATxmega64A1__ |
avrxmega5 | atxmega64a1u | __AVR_ATxmega64A1U__ |
avrxmega6 | atxmega128a3 | __AVR_ATxmega128A3__ |
avrxmega6 | atxmega128a3u | __AVR_ATxmega128A3U__ |
avrxmega6 | atxmega128b1 | __AVR_ATxmega128B1__ |
avrxmega6 | atxmega128b3 | __AVR_ATxmega128B3__ |
avrxmega6 | atxmega128c3 | __AVR_ATxmega128C3__ |
avrxmega6 | atxmega128d3 | __AVR_ATxmega128D3__ |
avrxmega6 | atxmega128d4 | __AVR_ATxmega128D4__ |
avrxmega6 | atxmega192a3 | __AVR_ATxmega192A3__ |
avrxmega6 | atxmega192a3u | __AVR_ATxmega192A3U__ |
avrxmega6 | atxmega192c3 | __AVR_ATxmega192C3__ |
avrxmega6 | atxmega192d3 | __AVR_ATxmega192D3__ |
avrxmega6 | atxmega256a3 | __AVR_ATxmega256A3__ |
avrxmega6 | atxmega256a3u | __AVR_ATxmega256A3U__ |
avrxmega6 | atxmega256a3b | __AVR_ATxmega256A3B__ |
avrxmega6 | atxmega256a3bu | __AVR_ATxmega256A3BU__ |
avrxmega6 | atxmega256c3 | __AVR_ATxmega256C3__ |
avrxmega6 | atxmega256d3 | __AVR_ATxmega256D3__ |
avrxmega6 | atxmega384c3 | __AVR_ATxmega384C3__ |
avrxmega6 | atxmega384d3 | __AVR_ATxmega384D3__ |
avrxmega7 | atxmega128a1 | __AVR_ATxmega128A1__ |
avrxmega7 | atxmega128a1u | __AVR_ATxmega128A1U__ |
avrxmega7 | atxmega128a4u | __AVR_ATxmega128A4U__ |
avrtiny10 | attiny4 | __AVR_ATtiny4__ |
avrtiny10 | attiny5 | __AVR_ATtiny5__ |
avrtiny10 | attiny9 | __AVR_ATtiny9__ |
avrtiny10 | attiny10 | __AVR_ATtiny10__ |
avrtiny10 | attiny20 | __AVR_ATtiny20__ |
avrtiny10 | attiny40 | __AVR_ATtiny40__ |
I guess I already had a bunch of this via https://github.com/ianfixes/arduino_ci/blob/master/cpp/arduino/avr/io.h ... the trick is correlating them all to Arduino platforms
I bought and received recently an Arduino MKRZero which is using a SAMD21 Cortex-M0+ 32bit low power ARM MCU. Any chance to have this MCU supported by arduino_ci ?
Here is the list of Arduino boards (from https://www.arduino.cc/en/products.compare )
Board | MCU | Arduino CI support (1) | Platform name (2) |
---|---|---|---|
Genuino101 | Intel® Curie | ❌ | |
Gemma | ATtiny85 | ✅ | gemma |
LilyPad 168 | ATmega168V | ❌ | |
LilyPad 328 | ATmega328P | ❌ | |
LilyPad SimpleSnap | ATmega328P | ❌ | |
LilyPad USB | ATmega32U4 | ❌ | |
Mega 2560 | ATmega2560 | ✅ | mega2560 |
Micro | ATmega32U4 | ❌ | |
MKR1000 | SAMD21 Cortex-M0+ | ❌ | |
Pro 168 | ATmega168 | ❌ | |
Pro 328 | ATmega328P | ❌ | |
Pro Mini | ATmega328P | ❌ | |
Uno | ATmega328P | ✅ | uno |
Zero | ATSAMD21G18 | ✅ | zero |
Due | ATSAM3X8E | ✅ | due |
Esplora | ATmega32U4 | ❌ | |
Ethernet | ATmega328P | ❌ | |
Leonardo | ATmega32U4 | ✅ | leonardo |
Mega ADK | ATmega2560 | ❌ | |
Mini | ATmega328P | ❌ | |
Nano 168 | ATmega168 | ❌ | |
Nano 328 | ATmega328P | ❌ | |
Yùn 32 | ATmega32U4 | ❌ | |
Yùn 9331 | AR9331 Linux | ❌ | |
Arduino Robot | ATmega32u4 | ❌ | |
MKRZero | SAMD21 Cortex-M0+ 32bit low power ARM MCU | ❌ |
Others boards
Board | MCU | Arduino CI support (1) | Platform name (2) |
---|---|---|---|
ESP32 | ESP32 | ✅ | esp32 |
ESP8266 | ESP8266 | ✅ | esp8266 |
Trinket | Attiny85 | ✅ | trinket |
m4 | SAMD51 | ✅ | m4 |
Circuit Playground Classic | ATmega32u4 | ✅ | cplayClassic |
Circuit Playground Express | ATSAMD21 ARM Cortex M0 | ✅ | cplayExpress |
(1) currently defined in misc/default.yml
... to be tested
(2) name of the platform in Arduino CI
Do these platforms have official identifiers (something that can be used in code, like promini
or pro_mini
for the "Pro Mini")? That's the missing piece here. I can (of course) invent my own IDs, I just don't want to create accidental conflicts like the 2 "Pro Mini" possibilities above.
Maybe @per1234 can tell us if Arduino platforms have official identifiers.
Note to self, combine with this info from #7
This looks like a good resource for what #define
s might be available
https://arduino.stackexchange.com/questions/21137/arduino-how-to-get-the-board-type-in-code
#if defined(TEENSYDUINO)
// --------------- Teensy -----------------
#if defined(__AVR_ATmega32U4__)
#define BOARD "Teensy 2.0"
#elif defined(__AVR_AT90USB1286__)
#define BOARD "Teensy++ 2.0"
#elif defined(__MK20DX128__)
#define BOARD "Teensy 3.0"
#elif defined(__MK20DX256__)
#define BOARD "Teensy 3.2" // and Teensy 3.1 (obsolete)
#elif defined(__MKL26Z64__)
#define BOARD "Teensy LC"
#elif defined(__MK64FX512__)
#define BOARD "Teensy 3.5"
#elif defined(__MK66FX1M0__)
#define BOARD "Teensy 3.6"
#else
#error "Unknown board"
#endif
#else // --------------- Arduino ------------------
#if defined(ARDUINO_AVR_ADK)
#define BOARD "Mega Adk"
#elif defined(ARDUINO_AVR_BT) // Bluetooth
#define BOARD "Bt"
#elif defined(ARDUINO_AVR_DUEMILANOVE)
#define BOARD "Duemilanove"
#elif defined(ARDUINO_AVR_ESPLORA)
#define BOARD "Esplora"
#elif defined(ARDUINO_AVR_ETHERNET)
#define BOARD "Ethernet"
#elif defined(ARDUINO_AVR_FIO)
#define BOARD "Fio"
#elif defined(ARDUINO_AVR_GEMMA)
#define BOARD "Gemma"
#elif defined(ARDUINO_AVR_LEONARDO)
#define BOARD "Leonardo"
#elif defined(ARDUINO_AVR_LILYPAD)
#define BOARD "Lilypad"
#elif defined(ARDUINO_AVR_LILYPAD_USB)
#define BOARD "Lilypad Usb"
#elif defined(ARDUINO_AVR_MEGA)
#define BOARD "Mega"
#elif defined(ARDUINO_AVR_MEGA2560)
#define BOARD "Mega 2560"
#elif defined(ARDUINO_AVR_MICRO)
#define BOARD "Micro"
#elif defined(ARDUINO_AVR_MINI)
#define BOARD "Mini"
#elif defined(ARDUINO_AVR_NANO)
#define BOARD "Nano"
#elif defined(ARDUINO_AVR_NG)
#define BOARD "NG"
#elif defined(ARDUINO_AVR_PRO)
#define BOARD "Pro"
#elif defined(ARDUINO_AVR_ROBOT_CONTROL)
#define BOARD "Robot Ctrl"
#elif defined(ARDUINO_AVR_ROBOT_MOTOR)
#define BOARD "Robot Motor"
#elif defined(ARDUINO_AVR_UNO)
#define BOARD "Uno"
#elif defined(ARDUINO_AVR_YUN)
#define BOARD "Yun"
// These boards must be installed separately:
#elif defined(ARDUINO_SAM_DUE)
#define BOARD "Due"
#elif defined(ARDUINO_SAMD_ZERO)
#define BOARD "Zero"
#elif defined(ARDUINO_ARC32_TOOLS)
#define BOARD "101"
#else
#error "Unknown board"
#endif
#endif
Do these platforms have official identifiers (something that can be used in code, like promini or pro_mini for the "Pro Mini")?
There is a standard convention that a macro be created ARDUINO_{build.board}
, where the {build.board}
property is defined for each board in boards.txt. If {build.board}
is not defined, the Arduino IDE automatically defines it as {architecture}_{board ID}
. There is nothing that requires the actual macro to be defined in platform.txt so it's possible that some silly 3rd party hardware package author might leave that off, but I'm not aware of any instances of that. Certainly all of the official Arduino hardware packages are going to define it.
Reference: https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5-3rd-party-Hardware-specification#boardstxt
Looking at how arduino handles boards:
It looks like it gives each architecture has its own 'core' (located in AppData\Local\Arduino15\packages\arduino\hardware\
on windows) and then presumably uses #defines
to switch between cores.
The naming for the IO definitions does not seem to follow a convention between architectures, with sam Arduino.h including chip.h
instead of avr/io.h
. I found chip.h
here: C:\Users\acovrig\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.12\system\libsam\chip.h
For the Godmode virtual core, it would be nice if we had a way to remove the <avr/io.h>
component from all the cpp/arduino/*
files except for one. We could then use the misc/default.yml
definitions to change where this file pointed when using different arduino cores. I don't know if we will also need to use this procedure for other files in cpp/arduino
and cpp/arduino/avr
.
There are some oddities related to this, IIRC but I absolutely like this idea.
The oddities are that some code files want to include from arduino/avr
. See #119 , maybe @hlovdal can comment on possible obstacles?
I've been looking through the project to come up with a plan, and noticed that there is support for installing libraries and boards included in /lib/arduino_ci/arduino_cmd.rb
and it appears to be called in /exe/arduino_ci_remote.rb
.
It would appear that the main difference between the ./arduino
build tool and the g++ setup is that the build call also includes a reference to the target board (issue thread with example). This would make sense, as the error is for missing headers.
Here is some sample output without the micro-controller defined:
g++ -std=c++0x -o /home/travis/build/Doom4535/arduino_ci/SampleProjects/TestSomething/unittest_defines.cpp.bin -DARDUINO=100 -g -O1 -fno-omit-frame-pointer -fno-optimize-sibling-calls -fsanitize=address -I/home/travis/build/Doom4535/arduino_ci/cpp/arduino -I/home/travis/build/Doom4535/arduino_ci/cpp/unittest -I/home/travis/build/Doom4535/arduino_ci/SampleProjects/TestSomething/test -I/home/travis/build/Doom4535/arduino_ci/SampleProjects/TestSomething /home/travis/build/Doom4535/arduino_ci/cpp/arduino/Arduino.cpp /home/travis/build/Doom4535/arduino_ci/cpp/arduino/Godmode.cpp /home/travis/build/Doom4535/arduino_ci/cpp/arduino/stdlib.cpp /home/travis/build/Doom4535/arduino_ci/cpp/unittest/ArduinoUnitTests.cpp /home/travis/build/Doom4535/arduino_ci/SampleProjects/TestSomething/test-something.cpp /home/travis/build/Doom4535/arduino_ci/SampleProjects/TestSomething/test/defines.cpp
I'm thinking that this will need to be modified to include something along the lines of:
~/.arduino15/packages/arduino/hardware/sam/1.6.12/cores/arduino
on a linux system. Where this path is modified to match the core being built against (if it is not the standard avr core, additional cores are added in the users home directory and not the main install location with the 'standard' avr cores).
Where would be a good entry point to try to add an addition include flag into the code, possibly arduino_cmd
?
More info on arduino board names: https://github.com/arduino/Arduino/issues/8716 and here: https://github.com/arduino/arduino-cli and here: https://github.com/arduino/Arduino/issues/6165
arduino_cmd.rb
does indeed wrap much of the functionality provided by the Arduino binary. There are 3 main uses for that:
the main difference between the
./arduino
build tool and the g++ setup
Just so we're on the same page about the differences:
./arduino build tool |
g++ manual compilation |
|
---|---|---|
Purpose | Verify that sketches compile | Standalone unit testing of the library |
Output artifact | Sketch | Unit test binary |
Target architecture | Arduino (chipset specified on command line) | x86 |
Hardware support | Board-specific libraries | Mocks or manual references to board headers |
Compiler flag generation | ??? | cpp_library.rb |
Handles dependent libraries | Yes | Not yet |
The crux of the issue here is that I'm subverting the normal compilation of a library & sketch -- I want all the board-specific items like registers, ports, etc, but not the actual Arduino architecture.
There's probably a far easier way to do all of this, but I'm not familiar enough with the source code of the Arduino IDE to know where to look or what to do there.
As far as defining your own flags, the quickest way to experiment would be to just put them in .arduino-ci.yml
as per the REFERENCE.md: https://github.com/ianfixes/arduino_ci/blob/master/REFERENCE.md#defining-new-arduino-platforms
This can be made easier by https://github.com/arduino/arduino-cli/issues/1090
Add new board definitions based on this gist