You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This was previously hardcoded to 4k, which is intended for devices with
6k of EEPROM reserving 2k for the LoRaWAN library. For devices like the
L053, that only has 2k of EEPROM, this would result in an invalid EEPROM
size.
Now, this reserved value is more explicit and is configured on a
per-board basis in variant.h using the new
`STM32L0_CONFIG_EEPROM_RESERVED` macro. This is set to 2048 for all boards
that have an embedded LoRaWAN transceiver and left undefined for the
more generic boards.
Then the full EEPROM size is autodetected using the STM32 CMSIS header
files and exposed as `REAL_E2END`, and the reserved area is subtracted
from that and exposed as `E2END` (and also through `EEPROM.length()`).
This also changes `Arduino.h` to move the `avr/*.h` includes down to below
the `variant.h` include (just moving `avr/io.h` would have been enough,
but this is more consistent), so `variant.h` can be used in io.h.
This also includes `Arduino.h` from `io.h`, in case `io.h` is included
directly by a sketch.
Note that the autodetection uses macros that include a typecast, so the
resulting `E2END` macro cannot be examined by the preprocessor (e.g. an
`#if` statement), which is why this uses a `static_assert` instead to
check that `STM32L0_CONFIG_EEPROM_RESERVED` is not too big. The resulting
expression is a valid constant expression in both C and C++ contexts,
though.
0 commit comments