libesphttpd on ESP32 using FreeRTOS under esp-idf

PeterR
Posts: 621
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

Hi,
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 https://github.com/Spritetm/libesphttpd 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 https://github.com/chmorgan/libesphttpd ... _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.
& I also believe that IDF CAN should be fixed.

User avatar
kolban
Posts: 1683
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:

https://github.com/nkolban/esp32-snippe ... Server.pdf

There is also the commercial implementation made by Cesanta Mongoose.

https://github.com/cesanta/mongoose
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

PeterR
Posts: 621
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

Hi,
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

espFsInit((void*)(webpages_espfs_start));
then once again I could grab an IP address.
Placing a debug printf and return as first first lines of

Code: Select all

espFsInit()
& 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
& I also believe that IDF CAN should be fixed.

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], ok-home and 130 guests