mirror of https://github.com/ARMmbed/mbed-os.git
Fix build issues with cellular (#397)
* Cellular: Add back weak CellularInterface::get_default_instance The enables the cellular call flow below: 1. Weak CellularInterface::get_default_instance (NetworkInterfaceDefaults.cpp) 2. Weak CellularInterface::get_target_default_instance (NetworkInterfaceDefaults.cpp) 3. Weak CellularContext::get_default_instance (CellularContext.cpp) 4. Weak CellularDevice::get_default_instance (CellularDevice.cpp) 5. Weak CellularDevice::get_target_default_instance (CellularDevice.cpp) So that cellular modem driver can override CellularDevice::get_default_instance or CellularDevice::get_target_default_instance to provide actual default instance. * Cellular: Fix overriding CellularDevice::get_default_instance failure With e.g. GCC linker option "--undefined=<LINK_FOO>", pull in the object file implemening CellularDevice::get_default_instance anyway for being able to override weak symbol successfully even though from static library. See: https://stackoverflow.com/questions/42588983/what-does-the-gnu-ld-undefined-option-do * Cellular: Fix ThisThread::sleep_until link error ATHandler::cmd_start (ATHandler.c) calls ThisThread::sleep_until, which has parameter abs_time, whose type is Clock::time_point. Clock::time_point type has different definitions dependent on MBED_CONF_RTOS_PRESENT defined or not (rtos/Kernel.h). For cellular application whose executable cmake target always links mbed-os rather than mbed-baremetal, mbed-cellular must also link mbed-rtos-flags to be consistent with executable, so that both have MBED_CONF_RTOS_PRESENT defined.pull/15531/head
parent
2564b2c1bf
commit
df28d42a77
|
@ -39,5 +39,6 @@ target_link_libraries(mbed-cellular
|
|||
PUBLIC
|
||||
mbed-netsocket-api
|
||||
mbed-core-flags
|
||||
mbed-rtos-flags
|
||||
mbed-randlib
|
||||
)
|
||||
|
|
|
@ -118,5 +118,19 @@ CellularDevice *CellularDevice::get_default_instance()
|
|||
static ALT1250_PPP device(&serial, MBED_CONF_ALT1250_PPP_RST, PIN_OUTPUT, OpenDrainNoPull, 1);
|
||||
return &device;
|
||||
}
|
||||
|
||||
/*
|
||||
* With e.g. GCC linker option "--undefined=<LINK_FOO>", pull in this
|
||||
* object file anyway for being able to override weak symbol successfully
|
||||
* even though from static library. See:
|
||||
* https://stackoverflow.com/questions/42588983/what-does-the-gnu-ld-undefined-option-do
|
||||
*
|
||||
* NOTE: For C++ name mangling, 'extern "C"' is necessary to match the
|
||||
* <LINK_FOO> symbol correctly.
|
||||
*/
|
||||
extern "C"
|
||||
void LINK_ALT1250_PPP_CPP(void)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -12,3 +12,15 @@ target_sources(mbed-cellular
|
|||
ALT1250_PPP_CellularContext.cpp
|
||||
ALT1250_PPP_CellularNetwork.cpp
|
||||
)
|
||||
|
||||
# Link override object file coming from static library anyway
|
||||
#
|
||||
# NOTE: This linker option is to pretend undefined symbol and won't cause
|
||||
# undefined symbol error even though the override object file actually
|
||||
# doesn't provide such symbol definition.
|
||||
if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
|
||||
target_link_options(mbed-cellular
|
||||
INTERFACE
|
||||
LINKER:--undefined=LINK_ALT1250_PPP_CPP
|
||||
)
|
||||
endif()
|
||||
|
|
|
@ -10,3 +10,15 @@ target_sources(mbed-cellular
|
|||
PRIVATE
|
||||
STModCellular.cpp
|
||||
)
|
||||
|
||||
# Link override object file coming from static library anyway
|
||||
#
|
||||
# NOTE: This linker option is to pretend undefined symbol and won't cause
|
||||
# undefined symbol error even though the override object file actually
|
||||
# doesn't provide such symbol definition.
|
||||
if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
|
||||
target_link_options(mbed-cellular
|
||||
INTERFACE
|
||||
LINKER:--undefined=LINK_STMODCELLULAR_CPP
|
||||
)
|
||||
endif()
|
||||
|
|
|
@ -179,5 +179,19 @@ CellularDevice *CellularDevice::get_default_instance()
|
|||
static STModCellular device(&serial);
|
||||
return &device;
|
||||
}
|
||||
|
||||
/*
|
||||
* With e.g. GCC linker option "--undefined=<LINK_FOO>", pull in this
|
||||
* object file anyway for being able to override weak symbol successfully
|
||||
* even though from static library. See:
|
||||
* https://stackoverflow.com/questions/42588983/what-does-the-gnu-ld-undefined-option-do
|
||||
*
|
||||
* NOTE: For C++ name mangling, 'extern "C"' is necessary to match the
|
||||
* <LINK_FOO> symbol correctly.
|
||||
*/
|
||||
extern "C"
|
||||
void LINK_STMODCELLULAR_CPP(void)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -13,3 +13,15 @@ target_sources(mbed-cellular
|
|||
GEMALTO_CINTERION_CellularInformation.cpp
|
||||
GEMALTO_CINTERION_CellularStack.cpp
|
||||
)
|
||||
|
||||
# Link override object file coming from static library anyway
|
||||
#
|
||||
# NOTE: This linker option is to pretend undefined symbol and won't cause
|
||||
# undefined symbol error even though the override object file actually
|
||||
# doesn't provide such symbol definition.
|
||||
if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
|
||||
target_link_options(mbed-cellular
|
||||
INTERFACE
|
||||
LINKER:--undefined=LINK_GEMALTO_CINTERION_CPP
|
||||
)
|
||||
endif()
|
||||
|
|
|
@ -214,4 +214,18 @@ CellularDevice *CellularDevice::get_default_instance()
|
|||
static GEMALTO_CINTERION device(&serial);
|
||||
return &device;
|
||||
}
|
||||
|
||||
/*
|
||||
* With e.g. GCC linker option "--undefined=<LINK_FOO>", pull in this
|
||||
* object file anyway for being able to override weak symbol successfully
|
||||
* even though from static library. See:
|
||||
* https://stackoverflow.com/questions/42588983/what-does-the-gnu-ld-undefined-option-do
|
||||
*
|
||||
* NOTE: For C++ name mangling, 'extern "C"' is necessary to match the
|
||||
* <LINK_FOO> symbol correctly.
|
||||
*/
|
||||
extern "C"
|
||||
void LINK_GEMALTO_CINTERION_CPP(void)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -10,3 +10,15 @@ target_sources(mbed-cellular
|
|||
PRIVATE
|
||||
GENERIC_AT3GPP.cpp
|
||||
)
|
||||
|
||||
# Link override object file coming from static library anyway
|
||||
#
|
||||
# NOTE: This linker option is to pretend undefined symbol and won't cause
|
||||
# undefined symbol error even though the override object file actually
|
||||
# doesn't provide such symbol definition.
|
||||
if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
|
||||
target_link_options(mbed-cellular
|
||||
INTERFACE
|
||||
LINKER:--undefined=LINK_GENERIC_AT3GPP_CPP
|
||||
)
|
||||
endif()
|
||||
|
|
|
@ -61,4 +61,18 @@ CellularDevice *CellularDevice::get_default_instance()
|
|||
static GENERIC_AT3GPP device(&serial);
|
||||
return &device;
|
||||
}
|
||||
|
||||
/*
|
||||
* With e.g. GCC linker option "--undefined=<LINK_FOO>", pull in this
|
||||
* object file anyway for being able to override weak symbol successfully
|
||||
* even though from static library. See:
|
||||
* https://stackoverflow.com/questions/42588983/what-does-the-gnu-ld-undefined-option-do
|
||||
*
|
||||
* NOTE: For C++ name mangling, 'extern "C"' is necessary to match the
|
||||
* <LINK_FOO> symbol correctly.
|
||||
*/
|
||||
extern "C"
|
||||
void LINK_GENERIC_AT3GPP_CPP(void)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -14,4 +14,16 @@ target_sources(mbed-cellular
|
|||
|
||||
if("MTS_DRAGONFLY_L471QG" IN_LIST MBED_TARGET_LABELS)
|
||||
add_subdirectory(TARGET_MTS_DRAGONFLY_L471QG)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Link override object file coming from static library anyway
|
||||
#
|
||||
# NOTE: This linker option is to pretend undefined symbol and won't cause
|
||||
# undefined symbol error even though the override object file actually
|
||||
# doesn't provide such symbol definition.
|
||||
if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
|
||||
target_link_options(mbed-cellular
|
||||
INTERFACE
|
||||
LINKER:--undefined=LINK_SARA4_PPP_CPP
|
||||
)
|
||||
endif()
|
||||
|
|
|
@ -185,4 +185,18 @@ CellularDevice *CellularDevice::get_default_instance()
|
|||
static SARA4_PPP device(&serial);
|
||||
return &device;
|
||||
}
|
||||
|
||||
/*
|
||||
* With e.g. GCC linker option "--undefined=<LINK_FOO>", pull in this
|
||||
* object file anyway for being able to override weak symbol successfully
|
||||
* even though from static library. See:
|
||||
* https://stackoverflow.com/questions/42588983/what-does-the-gnu-ld-undefined-option-do
|
||||
*
|
||||
* NOTE: For C++ name mangling, 'extern "C"' is necessary to match the
|
||||
* <LINK_FOO> symbol correctly.
|
||||
*/
|
||||
extern "C"
|
||||
void LINK_SARA4_PPP_CPP(void)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -13,3 +13,15 @@ target_sources(mbed-cellular
|
|||
RM1000_AT_CellularNetwork.cpp
|
||||
RM1000_AT_CellularStack.cpp
|
||||
)
|
||||
|
||||
# Link override object file coming from static library anyway
|
||||
#
|
||||
# NOTE: This linker option is to pretend undefined symbol and won't cause
|
||||
# undefined symbol error even though the override object file actually
|
||||
# doesn't provide such symbol definition.
|
||||
if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
|
||||
target_link_options(mbed-cellular
|
||||
INTERFACE
|
||||
LINKER:--undefined=LINK_RM1000_AT_CPP
|
||||
)
|
||||
endif()
|
||||
|
|
|
@ -103,5 +103,19 @@ CellularDevice *CellularDevice::get_default_instance()
|
|||
static RM1000_AT device(&serial);
|
||||
return &device;
|
||||
}
|
||||
|
||||
/*
|
||||
* With e.g. GCC linker option "--undefined=<LINK_FOO>", pull in this
|
||||
* object file anyway for being able to override weak symbol successfully
|
||||
* even though from static library. See:
|
||||
* https://stackoverflow.com/questions/42588983/what-does-the-gnu-ld-undefined-option-do
|
||||
*
|
||||
* NOTE: For C++ name mangling, 'extern "C"' is necessary to match the
|
||||
* <LINK_FOO> symbol correctly.
|
||||
*/
|
||||
extern "C"
|
||||
void LINK_RM1000_AT_CPP(void)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -17,4 +17,16 @@ endif()
|
|||
|
||||
if("TARGET_MTS_DRAGONFLY_F413RH" IN_LIST MBED_TARGET_LABELS)
|
||||
add_subdirectory(TARGET_MTS_DRAGONFLY_F413RH)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Link override object file coming from static library anyway
|
||||
#
|
||||
# NOTE: This linker option is to pretend undefined symbol and won't cause
|
||||
# undefined symbol error even though the override object file actually
|
||||
# doesn't provide such symbol definition.
|
||||
if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
|
||||
target_link_options(mbed-cellular
|
||||
INTERFACE
|
||||
LINKER:--undefined=LINK_TELIT_HE910_CPP
|
||||
)
|
||||
endif()
|
||||
|
|
|
@ -70,4 +70,18 @@ CellularDevice *CellularDevice::get_default_instance()
|
|||
static TELIT_HE910 device(&serial);
|
||||
return &device;
|
||||
}
|
||||
|
||||
/*
|
||||
* With e.g. GCC linker option "--undefined=<LINK_FOO>", pull in this
|
||||
* object file anyway for being able to override weak symbol successfully
|
||||
* even though from static library. See:
|
||||
* https://stackoverflow.com/questions/42588983/what-does-the-gnu-ld-undefined-option-do
|
||||
*
|
||||
* NOTE: For C++ name mangling, 'extern "C"' is necessary to match the
|
||||
* <LINK_FOO> symbol correctly.
|
||||
*/
|
||||
extern "C"
|
||||
void LINK_TELIT_HE910_CPP(void)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -16,4 +16,16 @@ target_sources(mbed-cellular
|
|||
|
||||
if("TARGET_EP_ATLAS" IN_LIST MBED_TARGET_LABELS)
|
||||
add_subdirectory(TARGET_EP_ATLAS)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Link override object file coming from static library anyway
|
||||
#
|
||||
# NOTE: This linker option is to pretend undefined symbol and won't cause
|
||||
# undefined symbol error even though the override object file actually
|
||||
# doesn't provide such symbol definition.
|
||||
if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
|
||||
target_link_options(mbed-cellular
|
||||
INTERFACE
|
||||
LINKER:--undefined=LINK_TELIT_ME310_CPP
|
||||
)
|
||||
endif()
|
||||
|
|
|
@ -153,6 +153,20 @@ CellularDevice *CellularDevice::get_default_instance()
|
|||
MBED_CONF_TELIT_ME310_POLARITY);
|
||||
return &device;
|
||||
}
|
||||
|
||||
/*
|
||||
* With e.g. GCC linker option "--undefined=<LINK_FOO>", pull in this
|
||||
* object file anyway for being able to override weak symbol successfully
|
||||
* even though from static library. See:
|
||||
* https://stackoverflow.com/questions/42588983/what-does-the-gnu-ld-undefined-option-do
|
||||
*
|
||||
* NOTE: For C++ name mangling, 'extern "C"' is necessary to match the
|
||||
* <LINK_FOO> symbol correctly.
|
||||
*/
|
||||
extern "C"
|
||||
void LINK_TELIT_ME310_CPP(void)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
nsapi_error_t TELIT_ME310::hard_power_on()
|
||||
|
|
|
@ -15,4 +15,16 @@ target_sources(mbed-cellular
|
|||
|
||||
if("TARGET_EP_AGORA" IN_LIST MBED_TARGET_LABELS)
|
||||
add_subdirectory(TARGET_EP_AGORA)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Link override object file coming from static library anyway
|
||||
#
|
||||
# NOTE: This linker option is to pretend undefined symbol and won't cause
|
||||
# undefined symbol error even though the override object file actually
|
||||
# doesn't provide such symbol definition.
|
||||
if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
|
||||
target_link_options(mbed-cellular
|
||||
INTERFACE
|
||||
LINKER:--undefined=LINK_TELIT_ME910_CPP
|
||||
)
|
||||
endif()
|
||||
|
|
|
@ -152,6 +152,20 @@ CellularDevice *CellularDevice::get_default_instance()
|
|||
MBED_CONF_TELIT_ME910_POLARITY);
|
||||
return &device;
|
||||
}
|
||||
|
||||
/*
|
||||
* With e.g. GCC linker option "--undefined=<LINK_FOO>", pull in this
|
||||
* object file anyway for being able to override weak symbol successfully
|
||||
* even though from static library. See:
|
||||
* https://stackoverflow.com/questions/42588983/what-does-the-gnu-ld-undefined-option-do
|
||||
*
|
||||
* NOTE: For C++ name mangling, 'extern "C"' is necessary to match the
|
||||
* <LINK_FOO> symbol correctly.
|
||||
*/
|
||||
extern "C"
|
||||
void LINK_TELIT_ME910_CPP(void)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
nsapi_error_t TELIT_ME910::hard_power_on()
|
||||
|
|
|
@ -43,6 +43,13 @@ MBED_WEAK MeshInterface *MeshInterface::get_default_instance()
|
|||
return get_target_default_instance();
|
||||
}
|
||||
|
||||
#if MBED_CONF_CELLULAR_PRESENT
|
||||
MBED_WEAK CellularInterface *CellularInterface::get_default_instance()
|
||||
{
|
||||
return get_target_default_instance();
|
||||
}
|
||||
#endif // MBED_CONF_CELLULAR_PRESENT
|
||||
|
||||
/* For other types, we can provide a reasonable get_target_default_instance
|
||||
* in some cases. This is done in EthernetInterface.cpp, mbed-mesh-api and
|
||||
* OnboardCellularInterface.cpp. We have no implementation for WiFi, so a
|
||||
|
|
Loading…
Reference in New Issue