Skip to content

Fix ESP32-S2 firmware build errors#2

Merged
Tecnologic merged 6 commits into
mainfrom
copilot/fix-build-errors
May 23, 2026
Merged

Fix ESP32-S2 firmware build errors#2
Tecnologic merged 6 commits into
mainfrom
copilot/fix-build-errors

Conversation

Copilot AI commented May 22, 2026

Copy link
Copy Markdown
Contributor

Four -Werror compilation failures in the ESP-IDF firmware build.

Changes

  • src/main.cpp — Remove invalid capture of static local transport in the SetRxCallback lambda.
  • src/main.cpp — Add #include "esp_efuse_table.h" to bring ESP_EFUSE_OPTIONAL_UNIQUE_ID into scope.
  • src/web/web_server.cpp — Explicitly initialize all seven httpd_uri_t fields in every URI entry to silence -Werror=missing-field-initializers.
  • lib/libcanard/canard_pio.c (new) — PlatformIO/ESP-IDF wrapper for canard.c that pre-includes <stdlib.h> with _GNU_SOURCE and _BSD_SOURCE suppressed. This prevents Espressif's picolibc from declaring long int random(void), which conflicts with libcanard's internal static uint64_t random(canard_t*, uint64_t) (ESP-IDF's assert.h unconditionally includes stdlib.h, surfacing the conflict).
  • lib/libcanard/library.json (new) — Compiles only canard_pio.c via srcFilter, uses -std=c11 to avoid the C23 stdbit.h requirement absent from the Xtensa toolchain, and -Wno-error to suppress the ESP-IDF toolchain's -fuse-cxa-atexit (a C++-only flag incorrectly present in the shared cflags response file).
  • lib/o1heap/library.json (new) — Same -std=c11 and -Wno-error flags to fix the identical -fuse-cxa-atexit issue for o1heap.

@Tecnologic

Copy link
Copy Markdown
Owner

@copilot build still fails

…uppress GCC -Wmissing-field-initializers

Agent-Logs-Url: https://github.com/Tecnologic/cymon/sessions/00860418-9a53-448e-a63a-0332acd88ec0

Co-authored-by: Tecnologic <1442404+Tecnologic@users.noreply.github.com>

Copilot AI commented May 22, 2026

Copy link
Copy Markdown
Contributor Author

@copilot build still fails

The root cause was GCC's -Wmissing-field-initializers warning fires even with designated initializers when trailing struct fields are omitted. Fixed in d9324ba by explicitly specifying all httpd_uri_t fields (.is_websocket, .handle_ws_control_frames, .supported_subprotocol) in every URI entry so no field is left uninitialized.

Copilot AI requested a review from Tecnologic May 22, 2026 21:55
@Tecnologic

Copy link
Copy Markdown
Owner

@copilot fix build errors and verify that pipeline is green

Copilot AI and others added 4 commits May 23, 2026 07:42
…stdbit.h absence

Agent-Logs-Url: https://github.com/Tecnologic/cymon/sessions/de85d3bc-198e-4652-9792-13665d807d86

Co-authored-by: Tecnologic <1442404+Tecnologic@users.noreply.github.com>
…rols stdlib.h inclusion order

Agent-Logs-Url: https://github.com/Tecnologic/cymon/sessions/de85d3bc-198e-4652-9792-13665d807d86

Co-authored-by: Tecnologic <1442404+Tecnologic@users.noreply.github.com>

Copilot AI commented May 23, 2026

Copy link
Copy Markdown
Contributor Author

@copilot fix build errors and verify that pipeline is green

Both pipelines are now green on commit 54e6470. Here's a summary of all fixes applied:

  1. web_server.cpp — explicitly initialize all httpd_uri_t fields to silence -Wmissing-field-initializers
  2. lib/libcanard/canard_pio.c — new PlatformIO wrapper that pre-includes <stdlib.h> with _GNU_SOURCE/_BSD_SOURCE suppressed; this prevents picolibc from declaring long int random(void), which conflicts with canard's internal static uint64_t random(...) function (ESP-IDF's assert.h unconditionally includes stdlib.h, surfacing the conflict)
  3. lib/libcanard/library.jsonsrcFilter to compile only canard_pio.c, -std=c11 to avoid the C23 stdbit.h requirement, -Wno-error to suppress the ESP-IDF toolchain's -fuse-cxa-atexit (a C++-only flag incorrectly present in the shared cflags response file)
  4. lib/o1heap/library.json — same -std=c11 and -Wno-error for the -fuse-cxa-atexit issue

@Tecnologic Tecnologic marked this pull request as ready for review May 23, 2026 13:30
@Tecnologic Tecnologic merged commit 15fec56 into main May 23, 2026
4 checks passed
@Tecnologic Tecnologic deleted the copilot/fix-build-errors branch May 23, 2026 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants