EEVblog® Electronics Community Forum
Electronics => Microcontrollers => Topic started by: tellurium on January 18, 2024, 01:05:16 pm
-
I started to write an embedded network programming guide:
https://github.com/cpq/embedded-network-programming-guide (https://github.com/cpq/embedded-network-programming-guide)
https://www.youtube.com/watch?v=lKYM4b8TZts (https://www.youtube.com/watch?v=lKYM4b8TZts)
It talks about TCP/IP stack and application in general, and showcases the actual implementation based on Mongoose Library.
Feedback is welcome.
-
Mongoose is very easy to integrate: just by copying two files, mongoose.c (https://github.com/cpq/embedded-network-programming-guide/blob/main) and mongoose.h (https://github.com/cpq/embedded-network-programming-guide/blob/main)
I don't understand how that can work. The mongoose git repository has an extensive src/ subdirectory, and I can't even find the "built in tcp stack" that is supposed to be there as well. There are comments that refer to using LWIP, which would be a whole separate install as well, wouldn't it?
-
mongoose.c and mongoose.h at the top of the repo is just an amalgamation / concatenation of the files in src/. And files in src/ contain a built-in TCP/IP stack, and TLS 1.3 stack, in addition to the protocol-specific API for HTTP, Websocket, MQTT, etc.
The built-in TCP/IP stack is here:
API: https://github.com/cesanta/mongoose/blob/master/src/net_builtin.h
Source: https://github.com/cesanta/mongoose/blob/master/src/net_builtin.c
Drivers: https://github.com/cesanta/mongoose/tree/master/src/drivers
Mongoose can work on top of an existing stack (like lwIP, Linux/Windows - anything with BSD API), as well as stand-alone.
-
Yeah, there are really just two files. And yes, nothing else is required - provided you use one of the supported chips with implemented driver.
Including TLS! (server mode for now, client mode TBD soon).
Take a look here:
https://mongoose.ws/demo/?board=Nucleo-H743ZI&project=simple
This is a simple bare metal project on a ST board, just several files.
Click on Build button. Firmware size is 54k. Note - it implements HTTPS, too. Test it yourself!
The project is download-able and build-able manually, on your own workstation. As you can see, there are really just two files, nothing else.
-
Yeah, SQLite also provides source code as an amalgamation - makes it easy to add to a project, plus gives more opportunities for compiler optimizations.
-
I have recorded a helper Youtube video that accompanies several sections of the guide - those that go practical and implement a Web UI on a ST dev board. The Youtube video is linked to the first post.