Add ESP32-S3, Optimize httpgenerator for Microcontroller Usage#197
Open
clauspruefer wants to merge 2 commits into
Open
Add ESP32-S3, Optimize httpgenerator for Microcontroller Usage#197clauspruefer wants to merge 2 commits into
clauspruefer wants to merge 2 commits into
Conversation
…/ cross-compiler settings
Contributor
There was a problem hiding this comment.
Pull request overview
Adds an Arduino/ESP-IDF cross-compile port for ESP32-S3 and refactors the HTTP message generator toward a microcontroller-friendly model (separating headers from payload to avoid building a full response string containing large bodies).
Changes:
- Added a new
ports/arduino/esp32s3cross-build setup (toolchain template, build script, CMake install rules, docs). - Updated ESP32-C3 port docs/build scripts and installed headers to include
httpgenerator.hpp. - Refactored
HTTPGeneratorto accept an external body pointer/length and to generate/copy only the header portion into an internal buffer.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| ports/arduino/README.md | Documents the new ESP32-S3 port alongside ESP32-C3. |
| ports/arduino/esp32s3/xtensa-cross.cmake.tpl | New Xtensa toolchain template for cross-compiling. |
| ports/arduino/esp32s3/README.md | New ESP32-S3 build and usage documentation. |
| ports/arduino/esp32s3/CMakeLists.txt | New ESP32-S3 CMake build/install rules for static library + headers. |
| ports/arduino/esp32s3/adjust-cross-build.sh | Generates a concrete toolchain file from the template. |
| ports/arduino/esp32c3/README.md | Updates install instructions and header include examples. |
| ports/arduino/esp32c3/CMakeLists.txt | Installs httpgenerator.hpp alongside httpparser.hpp. |
| ports/arduino/esp32c3/adjust-cross-build.sh | Makes HOMEDIR substitution more robust in sed. |
| lib/http/httpgenerator.hpp | Changes HTTPGenerator API toward body-by-reference + header buffer generation. |
| lib/http/httpgenerator.cpp | Implements new body reference + header generation/copy logic. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+25
to
+26
| #include "/usr/local/include/esp32c3/httpparser.hpp" | ||
| #include "/usr/local/include/esp32c3/httpgenerator.hpp" |
|
|
||
| ```cmake | ||
| add_library(httpparser_lib STATIC IMPORTED) | ||
| set_property(TARGET httpparser_lib PROPERTY IMPORTED_LOCATION /usr/local/lib/esp32c3/libhttpparser.a) |
| @@ -0,0 +1,33 @@ | |||
| # project settings | |||
| cmake_minimum_required(VERSION 3.11) | |||
| project(esp32c3-httplib) | |||
Comment on lines
7
to
11
| HTTPGenerator::HTTPGenerator() : | ||
| _StatusCode(200), | ||
| _StatusText("OK"), | ||
| _Body("") | ||
| _StatusText("OK") | ||
| { | ||
| } |
Comment on lines
+26
to
+30
| void setStatus(const uint16_t, const string&); | ||
| void setBodyRef(char*, const unsigned int); | ||
| void addHeader(const HeaderID_t, const HeaderValue_t); | ||
| void addDateHeader(); | ||
| string generate(); | ||
| void generate(); |
Comment on lines
+52
to
+57
| /* -- check really neccessary? | ||
| if (Name.find('\r') != string::npos || Name.find('\n') != string::npos || | ||
| Value.find('\r') != string::npos || Value.find('\n') != string::npos) { | ||
| continue; | ||
| } | ||
| */ |
Comment on lines
+65
to
+67
| _HeaderLength = Message.length(); | ||
|
|
||
| Message.copy(_HeaderBuffer, _HeaderLength); |
Comment on lines
45
to
46
| string Message = "HTTP/1.1 " + to_string(_StatusCode) + " " + _StatusText + "\r\n"; | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request
Description
ESP32-S3(Xtensa 32-bit RISC) board type.adjust-cross-build.sh.Related
Closes #196
Type of Change