Author Topic: Embedded network programming guide  (Read 3800 times)

0 Members and 1 Guest are viewing this topic.

Offline telluriumTopic starter

  • Frequent Contributor
  • **
  • Posts: 341
  • Country: ua
Embedded network programming guide
« 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





It talks about TCP/IP stack and application in general, and showcases the actual implementation based on Mongoose Library.
Feedback is welcome.
« Last Edit: January 22, 2024, 02:17:27 am by tellurium »
Mongoose - a full-stack embedded network library for STM32, NXP and other - https://mongoose.ws
TCP/IP stack + drivers + TLS1.3 + HTTP/WebSocket/MQTT + OTA in a single file
 
The following users thanked this post: bingo600, linux-works, slothsd, snarkysparky, uliano, IOsetting

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4668
  • Country: us
Re: Embedded network programming guide
« Reply #1 on: January 18, 2024, 10:17:12 pm »
Quote
Mongoose is very easy to integrate: just by copying two files, mongoose.c and mongoose.h
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?
 

Offline telluriumTopic starter

  • Frequent Contributor
  • **
  • Posts: 341
  • Country: ua
Re: Embedded network programming guide
« Reply #2 on: January 18, 2024, 11:41:53 pm »
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.
Mongoose - a full-stack embedded network library for STM32, NXP and other - https://mongoose.ws
TCP/IP stack + drivers + TLS1.3 + HTTP/WebSocket/MQTT + OTA in a single file
 

Offline telluriumTopic starter

  • Frequent Contributor
  • **
  • Posts: 341
  • Country: ua
Re: Embedded network programming guide
« Reply #3 on: January 18, 2024, 11:58:08 pm »
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.
Mongoose - a full-stack embedded network library for STM32, NXP and other - https://mongoose.ws
TCP/IP stack + drivers + TLS1.3 + HTTP/WebSocket/MQTT + OTA in a single file
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 17830
  • Country: fr
Re: Embedded network programming guide
« Reply #4 on: January 19, 2024, 12:21:31 am »
Yeah, SQLite also provides source code as an amalgamation - makes it easy to add to a project, plus gives more opportunities for compiler optimizations.
 

Offline telluriumTopic starter

  • Frequent Contributor
  • **
  • Posts: 341
  • Country: ua
Re: Embedded network programming guide
« Reply #5 on: January 22, 2024, 02:16:53 am »
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.
Mongoose - a full-stack embedded network library for STM32, NXP and other - https://mongoose.ws
TCP/IP stack + drivers + TLS1.3 + HTTP/WebSocket/MQTT + OTA in a single file
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf

 

- - -
-->