Skip to content

Add LibreTiny support #187

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

Merged
merged 9 commits into from
Jun 13, 2025

Conversation

kuba2k2
Copy link

@kuba2k2 kuba2k2 commented May 27, 2025

This PR introduces a series of non-breaking changes that make it possible to use latest ESPAsyncWebServer on LibreTiny platform (BK72xx, RTL87xx).

Previously, this was supported in https://github.com/esphome/ESPAsyncWebServer and used in ESPHome this way. That library is unmaintained, so I'm introducing support for LibreTiny in the updated version by ESP32Async. When it gets released, the web server used by ESPHome may be updated to ^v3.7.7 (in this PR: esphome/esphome#8867).

The AsyncTCP implementation used for LibreTiny is https://github.com/esphome/AsyncTCP - it is the same one used for the few last years, so it's well-tested and stable.

This was tested and verified working on BK7231N and RTL8710BN.

@mathieucarbou mathieucarbou marked this pull request as draft May 27, 2025 18:33
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds LibreTiny platform support to ESPAsyncWebServer by introducing conditional code branches for LIBRETINY alongside existing platforms and by adding a new dependency (AsyncTCP-esphome). Key changes include updates to preprocessor conditionals across several source files, integration of mbedtls-based SHA1 calculation for LibreTiny, and updated documentation and library metadata.

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/literals.h Added extern declaration and macro alias for emptyString for LIBRETINY support.
src/WebServer.cpp Defined emptyStringForEspAsync for LIBRETINY compilation.
src/WebRequest.cpp Updated conditional checks to include LIBRETINY when using legacy String methods.
src/WebHandlers.cpp Added LIBRETINY branches for etag generation.
src/Middleware.cpp Adjusted client IP printing logic to support LibreTiny.
src/ESPAsyncWebServer.h Extended platform conditionals to include LIBRETINY for AsyncTCP.
src/AsyncWebSocket.h Updated preprocessor conditions to include LIBRETINY.
src/AsyncWebSocket.cpp Integrated mbedtls SHA1 implementation for LibreTiny.
src/AsyncEventSource.h Updated conditionals for LIBRETINY support.
library.json Added LibreTiny platform and relevant dependency changes.
README.md Documented the new AsyncTCP-esphome dependency and LibreTiny usage.

@mathieucarbou
Copy link
Member

mathieucarbou commented Jun 1, 2025

@kuba2k2 : do you want to look into this compile issue (ESP32Async/AsyncTCP#64) before I release AsyncTCP and before you can resume this PR ? Or we simply drop support for generic-rtl8710bn-2mb-788k ?

@kuba2k2
Copy link
Author

kuba2k2 commented Jun 1, 2025

I will look into that.

@kuba2k2
Copy link
Author

kuba2k2 commented Jun 1, 2025

It's upgraded to v3.4.3 now - I'll let the CI do the rest 😄

src/literals.h Outdated
Comment on lines 6 to 10
#ifdef LIBRETINY
extern const String emptyStringForEspAsync;
#define emptyString emptyStringForEspAsync
#endif

Copy link
Member

Choose a reason for hiding this comment

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

is it safe to have it defined globally ? Could it conflict with other libs ?

@mathieucarbou mathieucarbou marked this pull request as ready for review June 1, 2025 17:05
@mathieucarbou
Copy link
Member

mathieucarbou commented Jun 1, 2025

@kuba2k2 : your PR is ready to be rebased on main: there are some conflicts.
Plus 2 comments to look at.
Thank you 👍

@mathieucarbou
Copy link
Member

@kuba2k2 : please let me know if you'll have time to revisit this PR, or if you can open your branch to maintainers so that I can continue within this same PR. Thanks!

@kuba2k2
Copy link
Author

kuba2k2 commented Jun 3, 2025

Hi
I have the changes ready, but I'm waiting for LibreTiny v1.9.1 to be available on PlatformIO Registry. Once it is, I will push the changes.

@kuba2k2 kuba2k2 force-pushed the feature/libretiny-support branch from cd2a5aa to 817efb2 Compare June 5, 2025 10:03
@kuba2k2
Copy link
Author

kuba2k2 commented Jun 5, 2025

The PR is now updated to use LibreTiny v1.9.1, since it's now available on PlatformIO Registry.
There is also a new CI workflow.

@mathieucarbou
Copy link
Member

@kuba2k2 : build is failing....

@kuba2k2
Copy link
Author

kuba2k2 commented Jun 5, 2025

That's because DNSServer library is not available in LT, ESPHome uses this instead: https://registry.platformio.org/libraries/bbx10/DNSServer
The examples will have to be updated.

@mathieucarbou
Copy link
Member

@kuba2k2 : could you please rebase ? I cannot update your branch. Thanks!

@kuba2k2 kuba2k2 force-pushed the feature/libretiny-support branch from fb38ee3 to dd934b8 Compare June 10, 2025 14:02
@kuba2k2
Copy link
Author

kuba2k2 commented Jun 10, 2025

There you go.
It seems that I can't enable writing to my branch by maintainers, perhaps because it's a PR from libretiny-eu organization.

But anyway, I also enabled WiFi related code on LT, so CI should now pass (I tested the AsyncResponseStream example locally and it compiles fine).

@mathieucarbou
Copy link
Member

@kuba2k2 : CI still not passing...

@swoboda1337
Copy link

If we could get this merged soon that would great. I am trying to move ESPHome to use this and having LibreTiny support would simplify that effort. Thanks!

@kuba2k2
Copy link
Author

kuba2k2 commented Jun 13, 2025

I will try to fix CI.
@swoboda1337 there already is a PR to ESPHome that updates ESPAsyncWebServer and enables web_server on RP2040.

@swoboda1337
Copy link

I will try to fix CI. @swoboda1337 there already is a PR to ESPHome that updates ESPAsyncWebServer and enables web_server on RP2040.

Ok yeah I see it, I basically did the same thing. I need this for the Arduino 3 PR, can join the discord discussion here https://discord.com/channels/429907082951524364/1377029109758038087

@swoboda1337
Copy link

swoboda1337 commented Jun 13, 2025

If you can get this LibreTiny PR merged hopefully we can get esphome/esphome#8867 merged with the Arduino 3 PR next week. Want to get it merged after the release.

@kuba2k2
Copy link
Author

kuba2k2 commented Jun 13, 2025

Some of the examples are ESP-specific, for example they use LittleFS.
I would suggest only keeping a few of the examples in LibreTiny CI. It doesn't really make sense to compile all of them anyway..

@mathieucarbou
Copy link
Member

mathieucarbou commented Jun 13, 2025

Some of the examples are ESP-specific, for example they use LittleFS. I would suggest only keeping a few of the examples in LibreTiny CI. It doesn't really make sense to compile all of them anyway..

Like I said, I cannot edit the PR to add a new commit.

I suggest you can replace the loop with a list of example names you know will compile then.

Thanks!

@mathieucarbou mathieucarbou merged commit 338f87b into ESP32Async:main Jun 13, 2025
33 checks passed
@mathieucarbou
Copy link
Member

Thanks!

Release v3.7.8 is in progress...

@swoboda1337
Copy link

Excellent thanks

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.

5 participants