Skip to content

For examples/arduino_emulator, removed dependency on arduino-esp32#446

Merged
mathieucarbou merged 2 commits into
ESP32Async:mainfrom
MitchBradley:FixFS
Jun 9, 2026
Merged

For examples/arduino_emulator, removed dependency on arduino-esp32#446
mathieucarbou merged 2 commits into
ESP32Async:mainfrom
MitchBradley:FixFS

Conversation

@MitchBradley

Copy link
Copy Markdown

The Arduino Emulator example program had a dependency on the not-quite-standard
FS class that was being satisfied by cloning the arduino-esp32 repo and compiling
only FS.cpp therefrom. The problem is that v3.3.9 of that repo introduces some locking
in the included FSImpl.h, which creates a dependency on FreeRTOS.

The solution is to extract only the necessary FS files into the example source directory,
but from the rp2040 arduino core that does not have the FreeRTOS dependency.

An alternative approach would be to try and incorporate the FS class into Arduino-Emulator,
but that would be a substantial effort due to other file-related mismatches in Arduino-Emulator's
API surface.

Copilot AI review requested due to automatic review settings June 8, 2026 23:38

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds a minimal FS (filesystem) shim into the Arduino emulator example so ESPAsyncWebServer can compile/link in the host build without cloning the ESP32 Arduino core.

Changes:

  • Adds FS.h / FS.cpp / FSImpl.h (sourced from arduino-pico) into examples/arduino_emulator/.
  • Updates the emulator example CMake to build against the local FS shim instead of .ci/arduino-esp32 FS sources/headers.
  • Simplifies the GitHub Actions workflow by removing the arduino-esp32 clone step.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
examples/arduino_emulator/README_FS.md Documents why FS shim files are included and their provenance.
examples/arduino_emulator/FSImpl.h Adds FS implementation interface types required by FS wrapper.
examples/arduino_emulator/FS.h Adds the FS wrapper API used by ESPAsyncWebServer/static file serving.
examples/arduino_emulator/FS.cpp Implements FS wrapper methods and adds a DEBUGV() no-op.
examples/arduino_emulator/CMakeLists.txt Switches host build to compile/include the local FS shim.
.github/workflows/build-arduino-emulator.yml Removes dependency on cloning arduino-esp32 for FS.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread examples/arduino_emulator/FS.h Outdated

#include <memory>
#include <Arduino.h>
#include <../include/time.h> // See issue #6714
Comment thread examples/arduino_emulator/FSImpl.h Outdated

#include <stddef.h>
#include <stdint.h>
#include <FS.h>
Comment thread examples/arduino_emulator/FS.cpp Outdated
Comment on lines +45 to +51
int File::available() {
if (!_p) {
return false;
}

return _p->size() - _p->position();
}
Comment thread examples/arduino_emulator/FS.cpp Outdated
Comment on lines +193 to +203
String File::readString() {
String ret;
ret.reserve(size() - position());
uint8_t temp[256];
int countRead;
do {
countRead = read(temp, sizeof(temp));
ret.concat(temp, countRead);
} while (countRead > 0);
return ret;
}
Comment thread examples/arduino_emulator/FS.cpp Outdated
}


#if defined(FS_FREESTANDING_FUNCTIONS)
Comment thread examples/arduino_emulator/FS.cpp Outdated
Comment on lines +558 to +564
FSImplPtr p = fs._impl;
if (!p || !p->mount()) {
DEBUGV("FSImpl mount failed\r\n");
return false;
}

!make sure mountPoint has trailing '/' here
Comment thread examples/arduino_emulator/FS.cpp Outdated
for (MountEntry* entry = s_mounted; entry; entry = entry->next) {
size_t offset = entry->path.length();
if (strstr(path, entry->path.c_str())) {
File result = entry->fs->open(path + offset);
Comment on lines +4 to +5
ESPAsyncWebServer's dependency on the FS class for serving static
file. Arduino-Emulator does not implement the FS class, which is a

@mathieucarbou mathieucarbou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@MitchBradley we might want to exclude the new files from cpplint check in the GitHub workflow. mistake - example folder not considerd

@mathieucarbou mathieucarbou requested a review from me-no-dev June 9, 2026 06:52
@mathieucarbou

Copy link
Copy Markdown
Member

@me-no-dev FYI something you might be interested in (my comment plus @MitchBradley 's answer): #423 (comment)

A recent change in Arduino FS impl that now depends on FreeRTOS, which makes the FS impl unusable with Arduino Emulator.

Since ESPAsycnWebServer depends on FS lib, we then depend on FreeRTOS, which was not the case before (only AsyncTCP depended on FreeRTOS).

@MitchBradley

Copy link
Copy Markdown
Author

I'm not entusiastic about implementing the copilot suggestions, since these versions of FS.cpp, FS.h, and FSImpl.h are almost identical to the corresponding files in arduinopico - and those files, in turn, are almost identical to the original FS file in ESP8266 arduino. This does not seem like the right place to fix those problems; it seems better to mimic those other files to make it clear that there is nothing new here.

@mathieucarbou

Copy link
Copy Markdown
Member

I'm not entusiastic about implementing the copilot suggestions, since these versions of FS.cpp, FS.h, and FSImpl.h are almost identical to the corresponding files in arduinopico - and those files, in turn, are almost identical to the original FS file in ESP8266 arduino. This does not seem like the right place to fix those problems; it seems better to mimic those other files to make it clear that there is nothing new here.

Oh yes we have to ignore them! copilot automatically reviews PRs lol... But in this case we have to leave the files as-is.

@mathieucarbou mathieucarbou merged commit 3469e82 into ESP32Async:main Jun 9, 2026
34 checks passed
@mathieucarbou mathieucarbou self-requested a review June 9, 2026 07:42
@mathieucarbou

Copy link
Copy Markdown
Member

Hi @MitchBradley I pinged @me-no-dev about this issue and Arduino Core Team raised a PR (espressif/arduino-esp32#12670) to make the inclusion optional. So that should solve the issue. I think Lucas pinged you in the other PR (#423 (comment)).

@MitchBradley

Copy link
Copy Markdown
Author

That esp fix seems fine to me.

@lucasssvaz

Copy link
Copy Markdown

@mathieucarbou @MitchBradley I've optimized the PR a little. PTAL is it's still a proper fix.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants