Closed terrillmoore closed 5 years ago
Do you also want to remove #if
when declare table instances as below?
If we remove this #if
, these table instances are constructed and actual code size will be increased.
The linker is supposed to remove the unused CATENA_PLATFORM
instances, because there will be no reference to them (this is the --gc-sections
option). You can compare size after you take out the #if
s; size shouldn't change. That's why I used this sort of strange format rather than a vector.
I checked the linker doesn't remove the unused CATENA_PLATORM
instances. I also checked --gc-sections
option applied when build STM32.
All changes are merged.
Samd21 classes use an elaborate technique to avoid conditional compiles, based on the C compiler's ability to optimize out globals that aren't used.
Catena4450
, etc., has agetPlatformTable()
method that returns the platforms supported by the device.STM32 classes instead have a table that's constructed with
#if
. This is much more fragile.Please refactor the Stm32 classes to use the Samd21 technique.