The STM32 BSP uses the following code for min/max:
In cores\arduino\wiring_constants.h, lines 24 ff:
#ifdef __cplusplus
#include <algorithm>
using std::min;
using std::max;
#else // C
...
Unfortunately, with the version of the compiler and libraries that we use, this causes things like the Adafruit ePaper Display Library not to compile, with cryptic warnings related to iterators pointing at uses of min and max. Comparing to other BSPs, I found that the Arduino.cc H7 BSP provides its own implementation:
In cores\arduino\api\Common.h, lines 122 ff:
#ifdef __cplusplus
template<class T, class L>
auto min(const T& a, const L& b) -> decltype((b < a) ? b : a)
{
return (b < a) ? b : a;
}
template<class T, class L>
auto max(const T& a, const L& b) -> decltype((b < a) ? b : a)
{
return (a < b) ? b : a;
}
#else
...
This (and the Adafruit/MCCI SAMD BSP, which just #definemin() and max()) compile the Adafruit libraries without difficulty.
Patching the STM32 BSP with the code from the H7 BSP solves the problem.
The STM32 BSP uses the following code for min/max:
In
cores\arduino\wiring_constants.h
, lines 24 ff:Unfortunately, with the version of the compiler and libraries that we use, this causes things like the Adafruit ePaper Display Library not to compile, with cryptic warnings related to iterators pointing at uses of
min
andmax
. Comparing to other BSPs, I found that the Arduino.cc H7 BSP provides its own implementation:In
cores\arduino\api\Common.h
, lines 122 ff:This (and the Adafruit/MCCI SAMD BSP, which just
#define
min()
andmax()
) compile the Adafruit libraries without difficulty.Patching the STM32 BSP with the code from the H7 BSP solves the problem.