Skip to content

fix(renesas): compile the bundled Arduino libraries a sketch includes - #2022

Merged
zackees merged 2 commits into
mainfrom
agent/renesas-core-libs
Nov 16, 2026
Merged

zackees merged 2 commits into
mainfrom
agent/renesas-core-libs

Conversation

@zackees

@zackees zackees commented Nov 16, 2026

Copy link
Copy Markdown
Member

fix(renesas): compile the bundled Arduino libraries a sketch includes

A UNO R4 WiFi sketch that did #include <WiFiS3.h> (or SPI, Wire, RTC, ...)
died at the include on fbuild 2.5.51:

src/main.cpp:1:10: fatal error: WiFiS3.h: No such file or directory

ArduinoCore-renesas ships 23 libraries in the core's own libraries/
directory, and the Renesas orchestrator never put any of them on the include
path or in the compile set, so the core's bundled libraries were unreachable
even though Arduino CLI builds the same sketch against renesas_uno 1.6.0
(#2020, the Renesas sibling of #1994 on ESP8266).

Fix, following the Teensy/STM32/RP2040/ESP8266 shape:

  • renesas/framework_libs.rs: resolve the bundled libraries the project
    actually reaches with the shared library-dependency finder (active #if
    branches, lib_deps, compiler include path) and contribute their include
    dirs and sources. Only reached libraries are added, so Arduino_FreeRTOS,
    LittleFilesystem, ... cannot shadow a core header; a plain sketch adds
    nothing.
  • RenesasCores::get_framework_libraries() discovers libraries/<name>
    through the shared discover_framework_libraries helper.
  • uno_r4_wifi.json carries -DARDUINO_UNOWIFIR4, the build.board macro
    from the core's boards.txt (unor4wifi.build.board=UNOWIFIR4) that
    Arduino's recipe passes on every compilation. Without it WiFiS3 takes its
    #else branch (ModemClass(D24,D25)) and fails to compile.
  • renesas_compiler.rs: the core's own bundled libraries are compiled one
    standard back (-std=gnu++14). fbuild pins GCC 15.2 while the core is
    validated against the vendor's 7.2.1; in gnu++17 the newer libstdc++
    declares std::byte from <cstddef> (pulled in by <string> since GCC
    13) and their using namespace std; next to the core's
    typedef uint8_t byte makes every unqualified byte ambiguous.
    -fpermissive does not downgrade that (verified against the pinned
    toolchain). Sketch and project sources stay at gnu++17. The per-source
    flags now flow through one effective_extra_flags seam shared by the
    compile call, the rebuild signature and the artifact cache key (the build(renesas): scope -Wno-error= overrides on uno_r4_wifi (return-mismatch, implicit-function-declaration, int-conversion, incompatible-pointer-types) to FSP only #404
    FSP demotions use it too, so the three paths cannot drift).

Verified on Linux with the pinned ARM GCC 15.2.1 and the real
renesas_uno 1.6.0 core:

before (installed 2.5.50 CLI, same project): build error: ... fatal error: WiFiS3.h: No such file or directory
after (this branch, clean build): build succeeded in 10.6s (flash: 33844 bytes, ram: 16640 bytes), 8 WiFiS3 translation units compiled from
libraries/WiFiS3/src/ (verified on the real g++ command lines in the
daemon log: -std=gnu++14), sketch still at -std=gnu++17.

Tests: new renesas_acceptance::uno_r4_wifi_sketch_with_bundled_wifis3_library_builds
(ignored, real toolchain: builds the sketch and asserts WiFiS3 sources are in
the compile database), 8 selection unit tests (selected / unselected /
inactive branch / active defined branch / lib_deps / no libraries /
logging / no project sources), 2 compiler tests for the compatibility
standard and its rebuild-signature coverage, 1 board-config test for the
boards.txt macro.

Gates: fbuild-build-arm lib 40 renesas tests pass (whole crate clippy
--no-deps clean), fbuild-library 337 passed/8 ignored, fbuild-config
250 passed/1 ignored, pre-existing UNO R4 acceptance test still passes,
rustfmt clean, platform boundary 44/43.

Fixes #2020

A UNO R4 WiFi sketch that did `#include <WiFiS3.h>` (or SPI, Wire, RTC, ...)
died at the include on fbuild 2.5.51:

  src/main.cpp:1:10: fatal error: WiFiS3.h: No such file or directory

ArduinoCore-renesas ships 23 libraries in the core's own `libraries/`
directory, and the Renesas orchestrator never put any of them on the include
path or in the compile set, so the core's bundled libraries were unreachable
even though Arduino CLI builds the same sketch against renesas_uno 1.6.0
(#2020, the Renesas sibling of #1994 on ESP8266).

Fix, following the Teensy/STM32/RP2040/ESP8266 shape:

- renesas/framework_libs.rs: resolve the bundled libraries the project
  actually reaches with the shared library-dependency finder (active `#if`
  branches, `lib_deps`, compiler include path) and contribute their include
  dirs and sources. Only reached libraries are added, so `Arduino_FreeRTOS`,
  `LittleFilesystem`, ... cannot shadow a core header; a plain sketch adds
  nothing.
- RenesasCores::get_framework_libraries() discovers `libraries/<name>`
  through the shared `discover_framework_libraries` helper.
- uno_r4_wifi.json carries `-DARDUINO_UNOWIFIR4`, the `build.board` macro
  from the core's `boards.txt` (unor4wifi.build.board=UNOWIFIR4) that
  Arduino's recipe passes on every compilation. Without it WiFiS3 takes its
  `#else` branch (`ModemClass(D24,D25)`) and fails to compile.
- renesas_compiler.rs: the core's own bundled libraries are compiled one
  standard back (`-std=gnu++14`). fbuild pins GCC 15.2 while the core is
  validated against the vendor's 7.2.1; in gnu++17 the newer libstdc++
  declares `std::byte` from `<cstddef>` (pulled in by `<string>` since GCC
  13) and their `using namespace std;` next to the core's
  `typedef uint8_t byte` makes every unqualified `byte` ambiguous.
  `-fpermissive` does not downgrade that (verified against the pinned
  toolchain). Sketch and project sources stay at gnu++17. The per-source
  flags now flow through one `effective_extra_flags` seam shared by the
  compile call, the rebuild signature and the artifact cache key (the #404
  FSP demotions use it too, so the three paths cannot drift).

Verified on Linux with the pinned ARM GCC 15.2.1 and the real
renesas_uno 1.6.0 core:

  before (installed 2.5.50 CLI, same project): `build error: ... fatal error:
  WiFiS3.h: No such file or directory`
  after (this branch, clean build): `build succeeded in 10.6s (flash: 33844
  bytes, ram: 16640 bytes)`, 8 WiFiS3 translation units compiled from
  `libraries/WiFiS3/src/` (verified on the real g++ command lines in the
  daemon log: `-std=gnu++14`), sketch still at `-std=gnu++17`.

Tests: new `renesas_acceptance::uno_r4_wifi_sketch_with_bundled_wifis3_library_builds`
(ignored, real toolchain: builds the sketch and asserts WiFiS3 sources are in
the compile database), 8 selection unit tests (selected / unselected /
inactive branch / active defined branch / lib_deps / no libraries /
logging / no project sources), 2 compiler tests for the compatibility
standard and its rebuild-signature coverage, 1 board-config test for the
boards.txt macro.

Gates: fbuild-build-arm lib 40 renesas tests pass (whole crate clippy
--no-deps clean), fbuild-library 337 passed/8 ignored, fbuild-config
250 passed/1 ignored, pre-existing UNO R4 acceptance test still passes,
rustfmt clean, platform boundary 44/43.

Fixes #2020
@coderabbitai

coderabbitai Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

The selection wrapper and its tests were left untracked by the previous
commit, so the orchestrator referenced a module that was not in the tree.
No behaviour change: the same code that was built and tested locally
(#2020).
@zackees
zackees added this pull request to the merge queue Nov 16, 2026
Merged via the queue into main with commit 02afd62 Nov 16, 2026
31 checks passed
@fastled-project-sync fastled-project-sync Bot moved this to Triage in FastLED Tracker Nov 17, 2026
@zackees
zackees deleted the agent/renesas-core-libs branch November 24, 2026 21:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

UNO R4 WiFi: a sketch that includes WiFiS3.h does not compile (2.5.51)

1 participant