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

[ESP32] Weak functions are linked when building all-cluster-app #31439

Closed
erwinpan1 opened this issue Jan 16, 2024 · 0 comments · Fixed by #31474
Closed

[ESP32] Weak functions are linked when building all-cluster-app #31439

erwinpan1 opened this issue Jan 16, 2024 · 0 comments · Fixed by #31474

Comments

@erwinpan1
Copy link
Contributor

erwinpan1 commented Jan 16, 2024

Reproduction steps

  1. Follow the instructions in https://github.com/project-chip/connectedhomeip/blob/master/docs/guides/esp32/build_app_and_commission.md to build all-clusters-app. The ESP32 toolchain is v5.1.1
  2. After build done, check the function emberAfAirQualityClusterInitCallback
$  cd examples/all-clusters-app
$ grep -nrs emberAfAirQualityClusterInitCallbac *
all-clusters-common/src/air-quality-instance.cpp:22:void emberAfAirQualityClusterInitCallback(chip::EndpointId endpointId)
grep: esp32/build/chip-all-clusters-app.elf: binary file matches
esp32/build/chip-all-clusters-app.map:142636: .text._Z36emberAfAirQualityClusterInitCallbackt
esp32/build/chip-all-clusters-app.map:142638:                0x00000000401e6120                _Z36emberAfAirQualityClusterInitCallbackt
esp32/build/chip-all-clusters-app.map:185573:_Z36emberAfAirQualityClusterInitCallbackt         esp-idf/main/libmain.a(callback-stub.cpp.obj)
esp32/build/gen/app-codegen/cpp-app/app/callback-stub.cpp:26:        emberAfAirQualityClusterInitCallback(endpoint);
esp32/build/gen/app-codegen/cpp-app/app/callback-stub.cpp:296:void __attribute__((weak)) emberAfAirQualityClusterInitCallback(EndpointId endpoint)
grep: esp32/build/esp-idf/main/libmain.a: binary file matches
grep: esp32/build/esp-idf/main/CMakeFiles/__idf_main.dir/__/__/gen/app-codegen/cpp-app/app/callback-stub.cpp.obj: binary file matches
grep: esp32/build/esp-idf/main/CMakeFiles/__idf_main.dir/__/third_party/connectedhomeip/examples/all-clusters-app/all-clusters-common/src/air-quality-instance.cpp.obj: binary file matches
  1. From grep result above:
  • emberAfAirQualityClusterInitCallback function are defined in 2 cpp: all-clusters-common/src/air-quality-instance.cpp:22:void emberAfAirQualityClusterInitCallback(chip::EndpointId endpointId) and esp32/build/gen/app-codegen/cpp-app/app/callback-stub.cpp:296:void __attribute__((weak)) emberAfAirQualityClusterInitCallback(EndpointId endpoint)
  • esp32/build/chip-all-clusters-app.map:185573:_Z36emberAfAirQualityClusterInitCallbackt esp-idf/main/libmain.a(callback-stub.cpp.obj) means that the weak function is linked which doesn't make sense. The weak function should be replaced by normal function when linking. It's expected that air-quality-instance.cpp:22:void emberAfAirQualityClusterInitCallback() should be linked

Platform

esp32

Platform Version(s)

v5.1.1

Type

Manually tested with SDK

(Optional) If manually tested please explain why this is only manually tested

Other platform (e..g Linux, nRFConnect, ...) works correctly.

Anything else?

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants