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

fixes ESP32-C3 WiFiProv and btInUse() #8243

Merged
merged 1 commit into from
May 31, 2023
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
3 changes: 2 additions & 1 deletion cores/esp32/esp32-hal-bt.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@

#ifdef CONFIG_BT_ENABLED

bool btInUse(){ return true; }
// user may want to change it to free resources
__attribute__((weak)) bool btInUse(){ return true; }

#include "esp_bt.h"

Expand Down
5 changes: 2 additions & 3 deletions cores/esp32/esp32-hal-misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,8 @@ bool verifyRollbackLater() { return false; }
#endif

#ifdef CONFIG_BT_ENABLED
//overwritten in esp32-hal-bt.c
bool btInUse() __attribute__((weak));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SuGlider I am wondering if this change is also applicable for other weak symbols in this file?

cc @sanketwadekar

Copy link
Collaborator Author

@SuGlider SuGlider May 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have verified it.
The issue occurs when a weak and strong symbols are part of the same core.a library file.
In the building process with Arduino, it first compiles all the Core Files and build a reusable Library.
The other weak functions are changed/redefined in the Sketch, therefore, its strong symbols are correctly linked.

The issue only happens with this very specific btInUse() function because its strong symbol is in the same core.a file and it is ignored by the RISC-V Linker.

bool btInUse(){ return false; }
//from esp32-hal-bt.c
extern bool btInUse();
#endif

void initArduino()
Expand Down