I am porting Meshtastic firmware from PCF8563_Library to SensorLib (meshtastic/firmware#8061), it works well on ESP32, however the same code fails linking on nRF52 platform:
Linking .pio/build/t-echo/firmware.elf
/home/user/.platformio/packages/toolchain-gccarmnoneeabi@1.90301.200702/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: .pio/build/t-echo/src/gps/RTC.cpp.o: in function `readFromRTC()':
/home/user/Git/meshtastic-firmware/src/gps/RTC.cpp:106: undefined reference to `PCF8563Constants::PCF8563_SLAVE_ADDRESS'
/home/user/.platformio/packages/toolchain-gccarmnoneeabi@1.90301.200702/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/bin/ld: .pio/build/t-echo/src/gps/RTC.cpp.o: in function `SensorPCF8563::setDateTime(RTC_DateTime)':
/home/user/Git/meshtastic-firmware/.pio/libdeps/t-echo/SensorLib/src/SensorPCF8563.hpp:116: undefined reference to `PCF8563Constants::PCF8563_SLAVE_ADDRESS'
collect2: error: ld returned 1 exit status
I was able to compile by changing this line:
|
static constexpr uint8_t PCF8563_SLAVE_ADDRESS = 0x51; |
to
const uint8_t PCF8563_SLAVE_ADDRESS = 0x51;
but I'm guessing this means that the data is stored physically in the class vtable instead of being compiled in the code that uses it as a literal value, which means more flash usage, so not an ideal fix. Any help is appreciated.
Also, considering #22 reported something similar, I assume it is the same issue and it affects all the other src/REG/*Constants.h files.
I am porting Meshtastic firmware from
PCF8563_LibrarytoSensorLib(meshtastic/firmware#8061), it works well on ESP32, however the same code fails linking on nRF52 platform:I was able to compile by changing this line:
SensorLib/src/REG/PCF8563Constants.h
Line 40 in 769b484
to
but I'm guessing this means that the data is stored physically in the class vtable instead of being compiled in the code that uses it as a literal value, which means more flash usage, so not an ideal fix. Any help is appreciated.
Also, considering #22 reported something similar, I assume it is the same issue and it affects all the other
src/REG/*Constants.hfiles.