i think there is ARDUINO define, but i'd guess that's for the original Arduino?
it is a little unfortunate as APIs (e.g. SPI) between cores are at least a little different so some ifdefs are necessary

Code: Select all
#if defined(STM32DUINO) && VERSION > 10000
//do this
#else
//do that
#endif
Code: Select all
ARDUINO_ARCH_STM32
Right this is the official defintion to use for STM32 core.ag123 wrote: Tue Jan 26, 2021 12:02 pm oh btw i saw that, maybe this would doCode: Select all
ARDUINO_ARCH_STM32
Code: Select all
ARDUINO_ARCH_STM32F1
Code: Select all
ARDUINO_ARCH_STM32F4
Code: Select all
-DARDUINO_ARCH_{build.arch}
name=STM32F1 Boards (Arduino_STM32)
version=0.1.2
Code: Select all
/**
* @brief STM32 core version number
*/
#define STM32_CORE_VERSION_MAJOR (0x02U) /*!< [31:24] major version */
#define STM32_CORE_VERSION_MINOR (0x00U) /*!< [23:16] minor version */
#define STM32_CORE_VERSION_PATCH (0x00U) /*!< [15:8] patch version */
/*
* Extra label for development:
* 0: official release
* [1-9]: release candidate
* F[0-9]: development
*/
#define STM32_CORE_VERSION_EXTRA (0xF0U) /*!< [7:0] extra version */
#define STM32_CORE_VERSION ((STM32_CORE_VERSION_MAJOR << 24U)\
|(STM32_CORE_VERSION_MINOR << 16U)\
|(STM32_CORE_VERSION_PATCH << 8U )\
|(STM32_CORE_VERSION_EXTRA))
Code: Select all
#if defined(STM32_CORE_VERSION) && (STM32_CORE_VERSION > 0x01090000)
// do some specific stuff
#endif