libesphttpd on ESP32 using FreeRTOS under esp-idf

Posts: 25
Joined: Mon Jun 04, 2018 2:47 pm

libesphttpd on ESP32 using FreeRTOS under esp-idf

Postby PeterR » Wed Jun 20, 2018 9:57 am

I am trying to get a web server running on the ESP32 using FreeRTOS and esp-idf.
Using development environment: esp32_win32_msys2_environment_and_toolchain-20180110
Downloaded the esp-idf branch of and placed in the components folder of the Ethernet example which I had previously configured and tested.

The build fails. There is a clear syntax error in cgiFlash.c:303 which is easy to fix but this warns that this is not a functioning branch...
Next I have an unknown ConnTypePtr so I include "platform.h"
Then follow a series of include order issues and missing definitions e.g. os_printf().

I am new to the ESP toolchain and wonder if I am missing a #define?
Has anyone compiled libesphttpd?

I had similar problems with ... _chmorgan/ the referenced FreeRTOS example seems to be esp8266 based.

Open to alternatives. I need cgi. Have used lwip's httpd before. Would be Ok but no POST etc & also could not find a socket version, only raw.

User avatar
Posts: 1572
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

Re: libesphttpd on ESP32 using FreeRTOS under esp-idf

Postby kolban » Wed Jun 20, 2018 4:21 pm

If you are a fan of the C++ language then I'd like to point you to this possibility: ... Server.pdf

There is also the commercial implementation made by Cesanta Mongoose.
Free book on ESP32 available here:
Available for ESP32 consulting.

Posts: 25
Joined: Mon Jun 04, 2018 2:47 pm

Re: libesphttpd on ESP32 using FreeRTOS under esp-idf

Postby PeterR » Fri Jun 22, 2018 2:26 pm

Thanks. Ideally I am looking for a worked startup example. Neither HttpServer.cpp nor Mongose provide that.
Otherwise there is a lot of detail to work through including building and compressing the file system before I discover the other issues.

What has me spooked is that after getting libsphttpd to compile and adding the two startup calls then the ethernet adapter example fails to grap an IP address.
If I comment out

Code: Select all

then once again I could grab an IP address.
Placing a debug printf and return as first first lines of

Code: Select all

& uncommenting and yet again no IP address. Voodoo.

The only obvious difference is segment 0 is now 185,776 instead of 46,044 and segment 5 is now 35,116 rather than 26,456
I do not understand why the huge size difference as there are only macros used in espFsInit() (confirmed that memcpy used).
Also do not understand how this process kills IP assignment.

Clearly a lot to learn about the ESP hence worked example....
PS Using a ESP-EVB

Who is online

Users browsing this forum: No registered users and 7 guests