diff --git a/connectivity/cellular/CMakeLists.txt b/connectivity/cellular/CMakeLists.txt index 05add3e8d7..13c4d2772b 100644 --- a/connectivity/cellular/CMakeLists.txt +++ b/connectivity/cellular/CMakeLists.txt @@ -39,5 +39,6 @@ target_link_libraries(mbed-cellular PUBLIC mbed-netsocket-api mbed-core-flags + mbed-rtos-flags mbed-randlib ) diff --git a/connectivity/drivers/cellular/Altair/COMPONENT_ALTAIR_ALT1250/PPP/ALT1250_PPP.cpp b/connectivity/drivers/cellular/Altair/COMPONENT_ALTAIR_ALT1250/PPP/ALT1250_PPP.cpp index d4120070fe..3b776cd5ff 100644 --- a/connectivity/drivers/cellular/Altair/COMPONENT_ALTAIR_ALT1250/PPP/ALT1250_PPP.cpp +++ b/connectivity/drivers/cellular/Altair/COMPONENT_ALTAIR_ALT1250/PPP/ALT1250_PPP.cpp @@ -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=", 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 + * symbol correctly. + */ +extern "C" +void LINK_ALT1250_PPP_CPP(void) +{ +} #endif diff --git a/connectivity/drivers/cellular/Altair/COMPONENT_ALTAIR_ALT1250/PPP/CMakeLists.txt b/connectivity/drivers/cellular/Altair/COMPONENT_ALTAIR_ALT1250/PPP/CMakeLists.txt index 64dff13fe7..f079b173a9 100644 --- a/connectivity/drivers/cellular/Altair/COMPONENT_ALTAIR_ALT1250/PPP/CMakeLists.txt +++ b/connectivity/drivers/cellular/Altair/COMPONENT_ALTAIR_ALT1250/PPP/CMakeLists.txt @@ -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() diff --git a/connectivity/drivers/cellular/COMPONENT_STMOD_CELLULAR/CMakeLists.txt b/connectivity/drivers/cellular/COMPONENT_STMOD_CELLULAR/CMakeLists.txt index aa221bba34..21c300e330 100644 --- a/connectivity/drivers/cellular/COMPONENT_STMOD_CELLULAR/CMakeLists.txt +++ b/connectivity/drivers/cellular/COMPONENT_STMOD_CELLULAR/CMakeLists.txt @@ -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() diff --git a/connectivity/drivers/cellular/COMPONENT_STMOD_CELLULAR/STModCellular.cpp b/connectivity/drivers/cellular/COMPONENT_STMOD_CELLULAR/STModCellular.cpp index 17f7c5b206..d9d4d4fa02 100644 --- a/connectivity/drivers/cellular/COMPONENT_STMOD_CELLULAR/STModCellular.cpp +++ b/connectivity/drivers/cellular/COMPONENT_STMOD_CELLULAR/STModCellular.cpp @@ -179,5 +179,19 @@ CellularDevice *CellularDevice::get_default_instance() static STModCellular device(&serial); return &device; } + +/* + * With e.g. GCC linker option "--undefined=", 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 + * symbol correctly. + */ +extern "C" +void LINK_STMODCELLULAR_CPP(void) +{ +} #endif diff --git a/connectivity/drivers/cellular/GEMALTO/COMPONENT_GEMALTO_CINTERION/CMakeLists.txt b/connectivity/drivers/cellular/GEMALTO/COMPONENT_GEMALTO_CINTERION/CMakeLists.txt index 96e563b4a8..a24e9226e2 100644 --- a/connectivity/drivers/cellular/GEMALTO/COMPONENT_GEMALTO_CINTERION/CMakeLists.txt +++ b/connectivity/drivers/cellular/GEMALTO/COMPONENT_GEMALTO_CINTERION/CMakeLists.txt @@ -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() diff --git a/connectivity/drivers/cellular/GEMALTO/COMPONENT_GEMALTO_CINTERION/GEMALTO_CINTERION.cpp b/connectivity/drivers/cellular/GEMALTO/COMPONENT_GEMALTO_CINTERION/GEMALTO_CINTERION.cpp index 402e56a52f..4a72a93f8a 100644 --- a/connectivity/drivers/cellular/GEMALTO/COMPONENT_GEMALTO_CINTERION/GEMALTO_CINTERION.cpp +++ b/connectivity/drivers/cellular/GEMALTO/COMPONENT_GEMALTO_CINTERION/GEMALTO_CINTERION.cpp @@ -214,4 +214,18 @@ CellularDevice *CellularDevice::get_default_instance() static GEMALTO_CINTERION device(&serial); return &device; } + +/* + * With e.g. GCC linker option "--undefined=", 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 + * symbol correctly. + */ +extern "C" +void LINK_GEMALTO_CINTERION_CPP(void) +{ +} #endif diff --git a/connectivity/drivers/cellular/GENERIC/COMPONENT_GENERIC_AT3GPP/CMakeLists.txt b/connectivity/drivers/cellular/GENERIC/COMPONENT_GENERIC_AT3GPP/CMakeLists.txt index 9f23a73608..56e0e4760f 100644 --- a/connectivity/drivers/cellular/GENERIC/COMPONENT_GENERIC_AT3GPP/CMakeLists.txt +++ b/connectivity/drivers/cellular/GENERIC/COMPONENT_GENERIC_AT3GPP/CMakeLists.txt @@ -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() diff --git a/connectivity/drivers/cellular/GENERIC/COMPONENT_GENERIC_AT3GPP/GENERIC_AT3GPP.cpp b/connectivity/drivers/cellular/GENERIC/COMPONENT_GENERIC_AT3GPP/GENERIC_AT3GPP.cpp index b486744202..3f48be4df4 100644 --- a/connectivity/drivers/cellular/GENERIC/COMPONENT_GENERIC_AT3GPP/GENERIC_AT3GPP.cpp +++ b/connectivity/drivers/cellular/GENERIC/COMPONENT_GENERIC_AT3GPP/GENERIC_AT3GPP.cpp @@ -61,4 +61,18 @@ CellularDevice *CellularDevice::get_default_instance() static GENERIC_AT3GPP device(&serial); return &device; } + +/* + * With e.g. GCC linker option "--undefined=", 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 + * symbol correctly. + */ +extern "C" +void LINK_GENERIC_AT3GPP_CPP(void) +{ +} #endif diff --git a/connectivity/drivers/cellular/MultiTech/DragonflyNano/COMPONENT_MULTITECH_DRAGONFLY_NANO_CELLULAR/CMakeLists.txt b/connectivity/drivers/cellular/MultiTech/DragonflyNano/COMPONENT_MULTITECH_DRAGONFLY_NANO_CELLULAR/CMakeLists.txt index 91cc7c7c8f..c4614f0318 100644 --- a/connectivity/drivers/cellular/MultiTech/DragonflyNano/COMPONENT_MULTITECH_DRAGONFLY_NANO_CELLULAR/CMakeLists.txt +++ b/connectivity/drivers/cellular/MultiTech/DragonflyNano/COMPONENT_MULTITECH_DRAGONFLY_NANO_CELLULAR/CMakeLists.txt @@ -14,4 +14,16 @@ target_sources(mbed-cellular if("MTS_DRAGONFLY_L471QG" IN_LIST MBED_TARGET_LABELS) add_subdirectory(TARGET_MTS_DRAGONFLY_L471QG) -endif() \ No newline at end of file +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() diff --git a/connectivity/drivers/cellular/MultiTech/DragonflyNano/COMPONENT_MULTITECH_DRAGONFLY_NANO_CELLULAR/SARA4_PPP.cpp b/connectivity/drivers/cellular/MultiTech/DragonflyNano/COMPONENT_MULTITECH_DRAGONFLY_NANO_CELLULAR/SARA4_PPP.cpp index 9c9380c73a..88b169a87b 100644 --- a/connectivity/drivers/cellular/MultiTech/DragonflyNano/COMPONENT_MULTITECH_DRAGONFLY_NANO_CELLULAR/SARA4_PPP.cpp +++ b/connectivity/drivers/cellular/MultiTech/DragonflyNano/COMPONENT_MULTITECH_DRAGONFLY_NANO_CELLULAR/SARA4_PPP.cpp @@ -185,4 +185,18 @@ CellularDevice *CellularDevice::get_default_instance() static SARA4_PPP device(&serial); return &device; } + +/* + * With e.g. GCC linker option "--undefined=", 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 + * symbol correctly. + */ +extern "C" +void LINK_SARA4_PPP_CPP(void) +{ +} #endif diff --git a/connectivity/drivers/cellular/RiotMicro/COMPONENT_RIOTMICRO_RM1000/CMakeLists.txt b/connectivity/drivers/cellular/RiotMicro/COMPONENT_RIOTMICRO_RM1000/CMakeLists.txt index 38e16566a4..557b286deb 100644 --- a/connectivity/drivers/cellular/RiotMicro/COMPONENT_RIOTMICRO_RM1000/CMakeLists.txt +++ b/connectivity/drivers/cellular/RiotMicro/COMPONENT_RIOTMICRO_RM1000/CMakeLists.txt @@ -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() diff --git a/connectivity/drivers/cellular/RiotMicro/COMPONENT_RIOTMICRO_RM1000/RM1000_AT.cpp b/connectivity/drivers/cellular/RiotMicro/COMPONENT_RIOTMICRO_RM1000/RM1000_AT.cpp index e90ad9ec88..5c350ada4c 100644 --- a/connectivity/drivers/cellular/RiotMicro/COMPONENT_RIOTMICRO_RM1000/RM1000_AT.cpp +++ b/connectivity/drivers/cellular/RiotMicro/COMPONENT_RIOTMICRO_RM1000/RM1000_AT.cpp @@ -103,5 +103,19 @@ CellularDevice *CellularDevice::get_default_instance() static RM1000_AT device(&serial); return &device; } + +/* + * With e.g. GCC linker option "--undefined=", 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 + * symbol correctly. + */ +extern "C" +void LINK_RM1000_AT_CPP(void) +{ +} #endif diff --git a/connectivity/drivers/cellular/TELIT/COMPONENT_TELIT_HE910/CMakeLists.txt b/connectivity/drivers/cellular/TELIT/COMPONENT_TELIT_HE910/CMakeLists.txt index b73c108aa6..a65929cb4d 100644 --- a/connectivity/drivers/cellular/TELIT/COMPONENT_TELIT_HE910/CMakeLists.txt +++ b/connectivity/drivers/cellular/TELIT/COMPONENT_TELIT_HE910/CMakeLists.txt @@ -17,4 +17,16 @@ endif() if("TARGET_MTS_DRAGONFLY_F413RH" IN_LIST MBED_TARGET_LABELS) add_subdirectory(TARGET_MTS_DRAGONFLY_F413RH) -endif() \ No newline at end of file +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() diff --git a/connectivity/drivers/cellular/TELIT/COMPONENT_TELIT_HE910/TELIT_HE910.cpp b/connectivity/drivers/cellular/TELIT/COMPONENT_TELIT_HE910/TELIT_HE910.cpp index eaa01332d9..49170b5572 100644 --- a/connectivity/drivers/cellular/TELIT/COMPONENT_TELIT_HE910/TELIT_HE910.cpp +++ b/connectivity/drivers/cellular/TELIT/COMPONENT_TELIT_HE910/TELIT_HE910.cpp @@ -70,4 +70,18 @@ CellularDevice *CellularDevice::get_default_instance() static TELIT_HE910 device(&serial); return &device; } + +/* + * With e.g. GCC linker option "--undefined=", 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 + * symbol correctly. + */ +extern "C" +void LINK_TELIT_HE910_CPP(void) +{ +} #endif diff --git a/connectivity/drivers/cellular/TELIT/COMPONENT_TELIT_ME310/CMakeLists.txt b/connectivity/drivers/cellular/TELIT/COMPONENT_TELIT_ME310/CMakeLists.txt index f28b7fb7b3..3b161e2daa 100644 --- a/connectivity/drivers/cellular/TELIT/COMPONENT_TELIT_ME310/CMakeLists.txt +++ b/connectivity/drivers/cellular/TELIT/COMPONENT_TELIT_ME310/CMakeLists.txt @@ -16,4 +16,16 @@ target_sources(mbed-cellular if("TARGET_EP_ATLAS" IN_LIST MBED_TARGET_LABELS) add_subdirectory(TARGET_EP_ATLAS) -endif() \ No newline at end of file +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() diff --git a/connectivity/drivers/cellular/TELIT/COMPONENT_TELIT_ME310/TELIT_ME310.cpp b/connectivity/drivers/cellular/TELIT/COMPONENT_TELIT_ME310/TELIT_ME310.cpp index 68c897d8b0..d69d132436 100644 --- a/connectivity/drivers/cellular/TELIT/COMPONENT_TELIT_ME310/TELIT_ME310.cpp +++ b/connectivity/drivers/cellular/TELIT/COMPONENT_TELIT_ME310/TELIT_ME310.cpp @@ -153,6 +153,20 @@ CellularDevice *CellularDevice::get_default_instance() MBED_CONF_TELIT_ME310_POLARITY); return &device; } + +/* + * With e.g. GCC linker option "--undefined=", 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 + * symbol correctly. + */ +extern "C" +void LINK_TELIT_ME310_CPP(void) +{ +} #endif nsapi_error_t TELIT_ME310::hard_power_on() diff --git a/connectivity/drivers/cellular/TELIT/COMPONENT_TELIT_ME910/CMakeLists.txt b/connectivity/drivers/cellular/TELIT/COMPONENT_TELIT_ME910/CMakeLists.txt index c7f3678e32..f053e654cf 100644 --- a/connectivity/drivers/cellular/TELIT/COMPONENT_TELIT_ME910/CMakeLists.txt +++ b/connectivity/drivers/cellular/TELIT/COMPONENT_TELIT_ME910/CMakeLists.txt @@ -15,4 +15,16 @@ target_sources(mbed-cellular if("TARGET_EP_AGORA" IN_LIST MBED_TARGET_LABELS) add_subdirectory(TARGET_EP_AGORA) -endif() \ No newline at end of file +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() diff --git a/connectivity/drivers/cellular/TELIT/COMPONENT_TELIT_ME910/TELIT_ME910.cpp b/connectivity/drivers/cellular/TELIT/COMPONENT_TELIT_ME910/TELIT_ME910.cpp index cd4976b1f9..9fb9398ceb 100644 --- a/connectivity/drivers/cellular/TELIT/COMPONENT_TELIT_ME910/TELIT_ME910.cpp +++ b/connectivity/drivers/cellular/TELIT/COMPONENT_TELIT_ME910/TELIT_ME910.cpp @@ -152,6 +152,20 @@ CellularDevice *CellularDevice::get_default_instance() MBED_CONF_TELIT_ME910_POLARITY); return &device; } + +/* + * With e.g. GCC linker option "--undefined=", 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 + * symbol correctly. + */ +extern "C" +void LINK_TELIT_ME910_CPP(void) +{ +} #endif nsapi_error_t TELIT_ME910::hard_power_on() diff --git a/connectivity/netsocket/source/NetworkInterfaceDefaults.cpp b/connectivity/netsocket/source/NetworkInterfaceDefaults.cpp index 9529df92d2..032ff4e407 100644 --- a/connectivity/netsocket/source/NetworkInterfaceDefaults.cpp +++ b/connectivity/netsocket/source/NetworkInterfaceDefaults.cpp @@ -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