[Info] Mongoose HTTP library porting to ESP32

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

[Info] Mongoose HTTP library porting to ESP32

Postby kolban » Fri Oct 14, 2016 12:58 am

Note-2017-01-11
Since this post was originally made, the Mongoose library have been officially and properly ported to the ESP32 by Cesanta and as such any attempts here should be ignored ... see this thread for notes on the formal/proper port:

http://esp32.com/viewtopic.php?f=17&t=815

End-of-Note

The Cesanta mongoose Web Server project is an implementation of an embedable Web Server that is super rich in functions. I have been testing how easy (or difficult) it was to port to ESP32. There were some challenges and puzzles to be solved but nothing ferocious. I have this working now and am writing up the results. The source of the cesanta/mongoose project can be found here:

https://github.com/cesanta/mongoose

Since changes to the source are required in order to make it operate on ESP32, I'm trying to figure out how best to distribute these. In the long run, I'm going to write up changes as Github issues against the source of the project itself. In the short term, I'm guessing a fork of the project and the changes incorporated with the fork would suffice.

I have tested basic HTTP web serving and there were no issues. Next I'll be testing Websocket support. The purpose of this post is to let us (the community) know that it works and to say hi to others who may want mongoose on ESP32. Happy to collaborate with others on this area ... my primary hope is that the ESP32 changes we need get fed back into mongoose base source rather than continue with forked repositories.
Last edited by kolban on Wed Jan 11, 2017 8:31 pm, edited 1 time in total.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

User avatar
wolpi2006
Posts: 4
Joined: Tue Nov 01, 2016 9:16 am

Re: Mongoose HTTP library porting to ESP32

Postby wolpi2006 » Tue Nov 01, 2016 9:23 am

hi kolban,
I'm also searching around for a MQTT [...] library for the esp32.
Important for me is that it is running on RTOS (esp-idf should be ok, since it is based on FreeRTOS).
Do you have already a suitable framework for the mongoose lib on esp-idf?

wolpi

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

Re: Mongoose HTTP library porting to ESP32

Postby kolban » Tue Nov 01, 2016 2:31 pm

What I'll do is create a virgin fork of the Mongoose library and work into that the changes I needed to do to make the ESP32 work ... I'll then post back the link to the github repository ... that way it will become a distribution of a working Mongoose for ESP32. Note that I'm not that interested in being a Mongoose contributor/maintainer (its great code and good function ... just not an area that I want to have responsibilities for). The distribution can be used to "get you going". If there are deeper Mongoose fans out there, make yourself known today and I'll be happy to use that as the basis for a pull request.

The guys who own Mongoose are happy to accept changes as needed .. but right now we need to hack Mongoose to get it working ... see https://github.com/espressif/esp-idf/issues/52 which needs to be resolved before there can be a "clean" port of Mongoose.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: Mongoose HTTP library porting to ESP32

Postby WiFive » Tue Nov 01, 2016 2:43 pm

wolpi2006 wrote:hi kolban,
I'm also searching around for a MQTT [...] library for the esp32.
Important for me is that it is running on RTOS (esp-idf should be ok, since it is based on FreeRTOS).
Do you have already a suitable framework for the mongoose lib on esp-idf?

wolpi
https://github.com/tuanpmt/esp32-mqtt
https://github.com/carsonmcdonald/esp32-aws-iot

User avatar
wolpi2006
Posts: 4
Joined: Tue Nov 01, 2016 9:16 am

Re: Mongoose HTTP library porting to ESP32

Postby wolpi2006 » Tue Nov 01, 2016 3:28 pm

@WiFive
I've looked into different implementations -some for ESP8266.
The one from tuanpmt is promising, also it crashes for me at startup due to an uninitialsed queue.
the aws one looks too much specific for one service.

Mongoose looks perfect to me for the following reasons:
- it supports several different protocols, so the user can choose / select the one the other side understands
- it is generic
- it is easy to set up in a closed environment (yes, i want my automation at home not to be presented via the internet :D

@kolban
I read your posts on cesanta and espressif
to me it's just the problem that the tailoring features of newlib and putting it into ROM do not go together ... :twisted:
I'm not yet interested in a public release but sth 'working' for testing that saves me a few days of trial and error .... :mrgreen:

Wolpi

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

Re: Mongoose HTTP library porting to ESP32

Postby kolban » Sun Nov 06, 2016 10:14 pm

Note-2017-01-11
Since this original post, a proper port by Cesanta has been performed and as such the repository named below has been removed so as not to confuse anyone.

End-of-Note

Sorry for the delay ... here we go ... first the link to the repository ...

https://github.com/nkolban/esp32-mongoose

And here is a sample ESP32 app that uses it.

https://github.com/nkolban/esp32-snippe ... /webserver

What I'd be very interested to hear is any issues or problems you run into as anything you find, others will too ... so don't be hesitant in coming back and I'll work hard to get you going so we can update the information as needed.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

blavoie
Posts: 16
Joined: Sat Jan 21, 2017 6:41 pm

Re: [Info] Mongoose HTTP library porting to ESP32

Postby blavoie » Fri Jan 27, 2017 12:19 pm

I am trying to integrate the mongoose webserver into the ESP32 environment and I'm assuming that the " git clone https://github.com/cesanta/mongoose.git" command is done in the "esp-idf" in the ~/esp-idf/components/ directory? When I did the git clone command it pulled the sources into a new directory ~/esp-idf/components/mongoose.

I started down that path prior to seeing this posting. I tried using the link for the forked branch that was provided in the kolban posting, but github returns a 404 error with page not found. I also tried looking thru the issues sections on the github projects, but didn't find any references to esp32.

Question I have is, where can I find a procedure for integrating the mongoose webserver into the esp-idf?

Any help is greatly appreciated.

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

Re: [Info] Mongoose HTTP library porting to ESP32

Postby kolban » Sat Jan 28, 2017 4:50 am

Howdy,
I just tested the following recipe and it seems to work ...

1) Create an ESP32 project based off the ESP32 Template app
2) In the project directory, create a directory called "components"
3) Change into the components directory.
4) Run "git clone https://github.com/cesanta/mongoose.git"
5) Change into the mongoose directory.
6) Create a file called "component.mk" containing:

COMPONENT_ADD_INCLUDEDIRS=.

7) Compile your project.

At this point the API libraries for Mongoose should be available to your applications.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

JuergenD
Posts: 6
Joined: Sat Jan 28, 2017 1:09 pm

Re: [Info] Mongoose HTTP library porting to ESP32

Postby JuergenD » Sat Jan 28, 2017 1:15 pm

Hi,
maybe somebody could give me a hint. try to get the mongoose web server running, get the compile error 'dirent.h not supported'. what is the reason for this?
Thanks in advance. Juergen

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

Re: [Info] Mongoose HTTP library porting to ESP32

Postby kolban » Sun Jan 29, 2017 4:16 am

Can you validate that you are compiling with the very latest ESP-IDF as downloaded from master here:

https://github.com/espressif/esp-idf

It includes a <sys/dirent> ... https://github.com/espressif/esp-idf/bl ... s/dirent.h

which defines the struct dirent
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

Who is online

Users browsing this forum: No registered users and 14 guests