Architecture flags for different devices

Hi! Just a quick question. I'm building software that is supposed to be compatible with several different devices, such as the ESP32, Arduino Nano, Nano 33 BLE and RP2040 Connect.

I'm current using architecture flags AVR to detect when software is compiled for Arduino Nano and ESP32 to detect when software is compiled for the ESP32. I check this with the defined() method to differentiate pinouts and methods between these boards.

Does anyone know the specific flags to use for the Nano 33 BLE and/or for the RP2040 connect? Are the any docs for this? Thanks.

I don't think there is a list because new architectures and boards can be added by third parties. You can find the defines in the "boards.txt" file. For example, in the file "hardware/mbed_nano/2.0.0/boards.txt" you will see:


That would mean that these two names are defined on the "Nano RP2040 Connect":


And thes two for the "Nano 33 BLE"

#if !defined(ARDUINO_ARCH_ESP32)

Yeah that makes sense.

Thank you for the answer!

This should work for all board except ESP32 right?

remove the "!".

Writing libraries for multiple boards is a bit of nightmare, "Write once, test everwhere".
Check out the defines used in the SafeString library which covers a lot of boards and weird Stream stuff for some mbed packages

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