Skip to content

Add ESP32-S3, Optimize httpgenerator for Microcontroller Usage#197

Open
clauspruefer wants to merge 2 commits into
mainfrom
arduino-esp32s3
Open

Add ESP32-S3, Optimize httpgenerator for Microcontroller Usage#197
clauspruefer wants to merge 2 commits into
mainfrom
arduino-esp32s3

Conversation

@clauspruefer

@clauspruefer clauspruefer commented Jun 25, 2026

Copy link
Copy Markdown
Member

Pull Request

Description

  • Add compiler settings for ESP32-S3 (Xtensa 32-bit RISC) board type.
  • Optimize http generator code for microcontroller usage (less heap adicted).
  • Fix adjust-cross-build.sh.

Related

Closes #196

Type of Change

  • Add architecture

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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/esp32s3 cross-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 HTTPGenerator to 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 thread lib/http/httpgenerator.cpp Outdated
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";

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.

HTTP Message Generator Library Microcontroller Unfriendly

2 participants