cancel
Showing results for 
Search instead for 
Did you mean: 

TCP Socket bare-metal, can it be done?

AndrewST
Associate II

Hi,

I am running a simple TCP server using the lwIP stack and no RTOS. I got help from the "Echo_Server" example offered in most ST eval board packages, everything works fine.

I need to accept a single socket connection from the outside and maybe also establish one as a client.

I understand that because sockets are sort of blocking, they are often implemented in a multi-thread environment. I am trying to not use any OS. Any type of the F series microC will do.

Has anyone ever implemeted lwIP sockets without any OS? Can it be done?

Thank you.

 

12 REPLIES 12

We know the API as it is requires those mechanisms and therefore some sort of OS. That has been stated a thousand times already in this thread. The question is: has someone done it without an OS (cherry on top would be to know how).

Danish1
Lead III

With blocking code, everything that needs to be done to unblock must happen “by magic” - in other threads or by interrupt service routines. And things like semaphores, thrrad-safe queues are all helpful.

An OS will provide calls for those.

Or you could write them from scratch.

I use the “Crossworks Tasking library” that comes with the (paid-for) Rowley Crossworks IDE to give me multiple threads, semaphores etc. I don’t regard it as an Operating System. Does that count as an OS or not by your criteria?

A lot of my decisions are historic - the project started pre-stm32cube. And I like the Rowley Crossworks IDE.

I use the netconn api of LWIP. Do you specifically want their Socket API?

I suppose I should add that my system can accept incoming TCP connections.

So whether or not I have succeeded depends on your specific interpretation of terms like socket an OS

Interesting.. Thanks for sharing.

 


@Danish1 wrote:

I use the “Crossworks Tasking library” that comes with the (paid-for) Rowley Crossworks IDE to give me multiple threads, semaphores etc. I don’t regard it as an Operating System. Does that count as an OS or not by your criteria?


The owners themselves call it an RTOS, so I guess it does count as an OS. From Rowley's website: "CTL is a real-time operating system designed for deployment in embedded systems that require a solid foundation to support their application infrastructure.".

 


@Danish1 wrote:

So whether or not I have succeeded depends on your specific interpretation of terms like socket an OS


Forgive me but there isn't any "interpretation of terms" on my end. A TCP socket is a TCP socket. lwIP's Netconn is a broader TCP API and their Socket API relies on it, sure, but it is not socket.

Your work was definitely in the same realm as the question I asked, but it was not baremetal and it was not socket.