2025-04-05 6:21 AM
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.
2025-04-05 6:34 AM
Yes, of course it can!
https://savannah.nongnu.org/projects/lwip/ - no dependency on any RTOS
https://www.nongnu.org/lwip/2_1_x/index.html
STM32, no RTSO - eg, https://community.st.com/t5/stm32-mcus/how-to-use-the-lwip-ethernet-middleware-on-the-stm32h5-series/ta-p/691100
2025-04-05 6:55 AM
Forgive me if I am missing your point, but none of those links point to bare metal sockets.
These just show that a large part of the lwIP stack can be used with no OS, but that is not the question.
The standard lwIP socket API relies on the Netconn API
From there, all I see is mentions to "threads" and "semaphores", OS stuff, not bare-metal.
2025-04-05 10:03 AM
Hello @AndrewST ,
The only wrork done (to my knowledge) with ethernet in baremetal on STM32 is described in this article: How to create a bare metal HAL Ethernet application on STM32H563/STM32H723
2025-04-05 11:57 AM
Thanks, but there is a ton more published work that's been done with Ethernet in bare metal than what's in this article. Starting with bare metal TCP server and clients examples provided by ST in the Fxxx Eval or Nucleo packages.
None of what I have seen so far addresses bare metal BSD Sockets, because the default lwIP API implementation requires a OS. I am think this can be done without any RTOS, which is why I am asking.
2025-04-05 12:11 PM
Sorry I didn't understand.. Do you mean by "baremetal" LWIP without RTOS?
2025-04-05 12:26 PM
Correct, that is the original question:
"Has anyone ever implemented lwIP sockets without any OS? Can it be done?"
2025-04-05 12:37 PM - edited 2025-04-05 12:39 PM
2025-04-05 1:05 PM
I appreciate your help, but no, the thread you linked does NOT address bare metal SOCKET.
It explains how some of the lwIP stack can be used without RTOS using the RAW API, which is a given fact if you read the first sentence of the post: "I am running a simple TCP server using the lwIP stack and no RTOS."
2025-04-05 1:42 PM - edited 2025-04-05 1:47 PM
It looks that this API requires context changes between user "process" and TCP "process", therefore some kind of threads or "tasks", and timers. If this can be called RTOS, then yes, RTOS. Chuck Norris could do it bare-metal but he's retired long long ago.