Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chef: Use -u flag to force linking non-weak functions for esp32 example #33209

Merged
merged 1 commit into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions examples/chef/common/stubs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,3 +235,7 @@ void emberAfWakeOnLanClusterInitCallback(EndpointId endpoint)
WakeOnLan::SetDefaultDelegate(endpoint, &wakeOnLanManager);
}
#endif

// No-op function, used to force linking this file,
// instead of the weak functions from other files
extern "C" void chef_include_stubs_impl(void) {}
wqx6 marked this conversation as resolved.
Show resolved Hide resolved
3 changes: 3 additions & 0 deletions examples/chef/esp32/main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@ idf_component_register(PRIV_INCLUDE_DIRS
PRIV_REQUIRES chip nvs_flash bt console mbedtls QRCode tft screen-framework spidriver
SRC_DIRS ${SRC_DIRS_LIST})

# Forces the linker to include common/stubs.cpp
target_link_libraries(${COMPONENT_LIB} INTERFACE "-u chef_include_stubs_impl")
wqx6 marked this conversation as resolved.
Show resolved Hide resolved

include("${CHIP_ROOT}/build/chip/esp32/esp32_codegen.cmake")
chip_app_component_codegen("${CHEF}/devices/${SAMPLE_NAME}.matter")
chip_app_component_zapgen("${CHEF}/devices/${SAMPLE_NAME}.zap")
Expand Down
Loading