Make F_CPU a compile-time constant (#21051)
This commit is contained in:
@ -63,6 +63,12 @@ TERN_(POSTMORTEM_DEBUGGING, extern void install_min_serial());
|
||||
void HAL_init() {
|
||||
FastIO_init();
|
||||
|
||||
// Ensure F_CPU is a constant expression.
|
||||
// If the compiler breaks here, it means that delay code that should compute at compile time will not work.
|
||||
// So better safe than sorry here.
|
||||
constexpr int cpuFreq = F_CPU;
|
||||
UNUSED(cpuFreq);
|
||||
|
||||
#if ENABLED(SDSUPPORT) && DISABLED(SDIO_SUPPORT) && (defined(SDSS) && SDSS != -1)
|
||||
OUT_WRITE(SDSS, HIGH); // Try to set SDSS inactive before any other SPI users start up
|
||||
#endif
|
||||
|
@ -24,3 +24,9 @@
|
||||
#if defined(USBD_USE_CDC_MSC) && DISABLED(NO_SD_HOST_DRIVE)
|
||||
#define HAS_SD_HOST_DRIVE 1
|
||||
#endif
|
||||
|
||||
// Fix F_CPU not being a compile-time constant in STSTM32 framework
|
||||
#ifdef BOARD_F_CPU
|
||||
#undef F_CPU
|
||||
#define F_CPU BOARD_F_CPU
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user