is there a preprocessor define or a #define tag which i can tell between the cores (e.g. between official & libmaple) and version?
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
core and version identification
Re: core and version identification
I think ARDUINO_ARCH_STM32F1 works for libmaple (roger's and steve's). Not sure about STM core.
Have you tried this? viewtopic.php?f=7&t=870
Have you tried this? viewtopic.php?f=7&t=870
Re: core and version identification
it seemed the official stm core could reserve the tag STM32DUINO or __STM32DUINO__ for its tag
not sure what is a failsafe way to do versions, e.g. so that we can have
But literally i don't like it just that that's the way the world evolves
oh btw i saw that, maybe this would do
not sure what is a failsafe way to do versions, e.g. so that we can have
Code: Select all
#if defined(STM32DUINO) && VERSION > 10000
//do this
#else
//do that
#endif
oh btw i saw that, maybe this would do
Code: Select all
ARDUINO_ARCH_STM32
Re: core and version identification
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
For Libmaple F1 as mentionned by@GonzoG :
Code: Select all
ARDUINO_ARCH_STM32F1
Code: Select all
ARDUINO_ARCH_STM32F4
Code: Select all
-DARDUINO_ARCH_{build.arch}
Re: core and version identification
thanks ! i'd use these symbols for now
oh what about version, does it matter?
i think for now we'd make do 'without versions' (too complicated)
glibc did something like this
https://stackoverflow.com/questions/426 ... bc-is-used
oh what about version, does it matter?
i think for now we'd make do 'without versions' (too complicated)
glibc did something like this
https://stackoverflow.com/questions/426 ... bc-is-used
-
- Posts: 633
- Joined: Thu Dec 19, 2019 1:23 am
Re: core and version identification
in the compile/link environment, version is available from platform.txt
name=STM32F1 Boards (Arduino_STM32)
version=0.1.2
Re: core and version identification
For STM32 core since version 1.5.0 IIRW, the version are available this help to maintains some backward compatibility and check:
https://github.com/stm32duino/Arduino_C ... f.h#L5-L21
You can use it like this:
https://github.com/stm32duino/Arduino_C ... f.h#L5-L21
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