Hi all,
Just wondering if anyone has ever played around with this project (specifically integrating with ChibiOS)?
https://mongoose.ws/
I'm definitely not a web guy, so thought it might be interesting to do simple things with. Any other suggestions that I could look at?
Mongoose web server
Re: Mongoose web server
To follow up, I finally found some cycles to try this out.
Initially, I tried to follow some basic tutorials (all of course geared towards using the Cube tools + usual software stack). After a bunch of blind alleys, I finally just went for broke and tried to do it in Chibi which was way easier.
If anyone else is interested here's my notes:
If I find this project useful, I'll clean it up and submit a patch to upstream adding MG_ARCH_CHIBIOS as an official OS which would make the steps above easier/less hacky. In the meantime if anyone else plays around, let me know if you learn anything cool.
Initially, I tried to follow some basic tutorials (all of course geared towards using the Cube tools + usual software stack). After a bunch of blind alleys, I finally just went for broke and tried to do it in Chibi which was way easier.
If anyone else is interested here's my notes:
- Start by getting a basic project up, with LwIP enabled and responding to ping at least.
- Using the mongoose.ws online tool I made a basic UI. They make you select a target board (I chose a H7 devkit), and OS (baremetal or FreeRTOS). I selected FreeRTOS to start. In the end I'm really only interested in the C code comprising the web server but the FreeRTOS code uses LWIP which is closer to what I want here.
- Generate the project code from the web tool. Of the project, really only the mongoose.c/h, mongoose_glue.c/h, mongoose_fs.c and mongoose_impl.c are needed. It generates a whole firmware package and build system, but we already have an OS.
- I added the above .c files to my Makefile, and also added these defines:
- -DMG_ARCH=MG_ARCH_FREERTOS
- -DMG_ENABLE_LWIP=1
- I edited mongoose.h in the MG_ARCH_FREERTOS section, getting rid of the FreeRTOS specific code using their heap for calloc/free, and the associated headers. I changed to #define MG_ENABLE_CUSTOM_CALLOC 0 which just uses calloc/free. I guess you could use ChibiOS heaps as easily.
- In mongoose.c I changed the mg_millis() implementation to use ChibiOS implementation:
Code: Select all
return chTimeI2MS( chVTGetSystemTimeX() ); - Call mongoose_init() in your main init code (include mongoose_glue.h)
- Create a thread with lots of stack (they recommend 8k) which in turn simply calls mongoose_poll(); in an infinite loop which handles all the rest.
If I find this project useful, I'll clean it up and submit a patch to upstream adding MG_ARCH_CHIBIOS as an official OS which would make the steps above easier/less hacky. In the meantime if anyone else plays around, let me know if you learn anything cool.
- Giovanni
- Site Admin
- Posts: 14891
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: Mongoose web server
Hi,
It looks interesting, we could integrate it in ChibiOS as some kind of "bindings" like we do for lwIP, FatFS, LittleFS etc.
Note that
Could not work correctly because the converted value would not count up to 2^21-1 and go back, see the workaround we have in lwIP bindings for this.
Giovanni
It looks interesting, we could integrate it in ChibiOS as some kind of "bindings" like we do for lwIP, FatFS, LittleFS etc.
Note that
Code: Select all
return chTimeI2MS( chVTGetSystemTimeX() );Giovanni