Skip to content
This repository has been archived by the owner on Nov 11, 2024. It is now read-only.

Commit

Permalink
ESP-IDF fix for cellular HTTP: one more linker workaround (#860)
Browse files Browse the repository at this point in the history
Commit bf8cd21 introduced a mechanism for leaving out one or more of cell, GNSS or short-range [BLE and Wifi] from a build.  This hit bug in the ESP-IDF linker which means that, if a file happens to contain functions which ALL have WEAK counterparts, the linker will entirely ignore the .c file and use the WEAK versions instead; this is counter-productive, resulting in everything returning "NOT SUPPORTED".

This linker bug was worked-around in commit 6eff2c4 but it turns out that even that missed a bit, in the cellular HTTP code, where the file system calls needed a dummy "link" function to get them included.  Hopefully this is the last of them.
  • Loading branch information
RobMeades authored Mar 17, 2023
1 parent 86c97d3 commit 80e76d4
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
12 changes: 12 additions & 0 deletions cell/api/u_cell_file.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,18 @@ extern "C" {
* TYPES
* -------------------------------------------------------------- */

/* ----------------------------------------------------------------
* FUNCTIONS: WORKAROUND FOR LINKER ISSUE
* -------------------------------------------------------------- */

/** Workaround for Espressif linker missing out files that
* only contain functions which also have weak alternatives
* (see https://www.esp32.com/viewtopic.php?f=13&t=8418&p=35899).
*
* You can ignore this function.
*/
void uCellFilePrivateLink(void);

/* ----------------------------------------------------------------
* FUNCTIONS
* -------------------------------------------------------------- */
Expand Down
1 change: 1 addition & 0 deletions cell/src/u_cell.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ int32_t uCellInit()
uCellHttpPrivateLink();
uCellLocPrivateLink();
uCellMuxPrivateLink();
uCellFilePrivateLink();

if (gUCellPrivateMutex == NULL) {
// Create the mutex that protects the linked list
Expand Down
9 changes: 9 additions & 0 deletions cell/src/u_cell_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,15 @@ static uCellPrivateFileListContainer_t *gpFileList = NULL;
* STATIC FUNCTIONS
* -------------------------------------------------------------- */

/* ----------------------------------------------------------------
* PUBLIC FUNCTIONS: WORKAROUND FOR LINKER ISSUE
* -------------------------------------------------------------- */

void uCellFilePrivateLink()
{
//dummy
}

/* ----------------------------------------------------------------
* PUBLIC FUNCTIONS
* -------------------------------------------------------------- */
Expand Down

0 comments on commit 80e76d4

Please sign in to comment.