diff --git a/connectivity/cellular/CMakeLists.txt b/connectivity/cellular/CMakeLists.txt index 05add3e8d7d..13c4d2772bf 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 d4120070fe3..3b776cd5ff2 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 64dff13fe7f..f079b173a95 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 aa221bba34f..21c300e330f 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 17f7c5b2063..d9d4d4fa021 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 96e563b4a8a..a24e9226e2e 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 402e56a52f8..4a72a93f8a1 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 9f23a736083..56e0e4760fa 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 b486744202e..3f48be4df42 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 91cc7c7c8f6..c4614f03182 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 9c9380c73ac..88b169a87bc 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 38e16566a46..557b286deb9 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 e90ad9ec88a..5c350ada4c7 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 b73c108aa6b..a65929cb4d1 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 eaa01332d92..49170b55720 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 f28b7fb7b3c..3b161e2daa9 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 68c897d8b03..d69d1324360 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 c7f3678e328..f053e654cfd 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 cd4976b1f97..9fb9398cebb 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 9529df92d21..032ff4e4071 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