Skip to content

Linking failure on 0.3.1 with nRF52 #26

@WillyJL

Description

@WillyJL

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/[email protected]/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/[email protected]/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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions