TCP/IP Protocol stack without an OS
Asked Answered
A

8

10

I'm looking for a TCP/IP stack that can be used without an OS. Our customer has an "aversion" to interrupts and doesn't want a real OS on a embedded board we're building. It's desirable to move as much of the functionality to FPGA as possible due to the fact we will be only using a 50 to 100 MHz Arm. And I'm pretty sure GPL licensed stuff won't be acceptable for this client. (Due to the legal quagmire associated with it. They expect to have full unrestricted rights to the software once it's complete.)

Amand answered 12/7, 2010 at 13:2 Comment(5)
They should require you to give a reason why you are voting to close a question. This isn't a general inquiry, it's a specific question based on system requirements? I need a TCP/IP stack and I don't want to write it from scratch. Where can I get one that doesn't require an OS? (uIP looks like it has potential.)Amand
What's the reason for the aversion to interrupts? Does the customer have hard real-time constraints?Rem
Please do not invent new tags like "no-os" if at all possible.Dobruja
@Rem - The reason for there aversion? The governing spec was handed down from on high and so shall it be until the end of time! They feel interrupts allow "unpredictable" behaviour, simalar to Java's fear of pointers. Can bad things happen? In both cases if you misuse either interrupts or pointers yeah, but I contend that's true whenever you write bad code regardless of what features you're using.Amand
@Neil - No OS is a significant constraint on the system. And if you can offer a pre-existing tag that captures that information I would be glad to use it. However I am unaware of one. I didn't mark this as a "ARM" tag because I don't feel using a ARM is constraining the system in any significant way, however No-os is.Amand
E
18

uIP (micro IP) and lwIP (lightweight IP) are both candidates worth consideration. According to the original developer of both stacks - Adam Dunkel - one of the primary differences between the two is: "lwIP is larger than uIP, but provides better throughput". Both stacks employ a modified BSD license and have been used in commercial products.

Everetteverette answered 12/7, 2010 at 20:57 Comment(1)
We have used both uIP and lwIP with great success, both without an OS. I would highly recommend either. If you have the room, lwIP seems to do less "magic" and is easier to understand. However, uIP seems to be better supported recently.Melisamelisande
H
2

This doesn't necessarily answer your question the way you want it answered (it's not in the comments section since my diatribe is probably going to be too long). However, I think it may still be helpful.

A couple of points. I think you should re-educate your clients on the benefits and costs of interrupts. Interrupts are a very efficient way of handling device control and, unless you're meticulous about your coding, you're unlikely to match the performance with non-interrupt-driven code.

Secondly, using GPL software will give them full unrestricted rights to the software, it just won't allow them to restrict others. If you mean they do want to restrict others then I'd be asking why they think they should have the right to use the labours of others without any give-back.

You may well be able to find a TCP stack under a more permissive licence than GPL (allowing them to effectively close-source it). If you have a C compiler for your FPGA, you can possibly look into uIP which has a very permissive licence from a brief look:

Copyright (c) 2001-2006, Adam Dunkels and the Swedish Institute of Computer Science

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

  3. The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE AUTHOR `AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

That's it, no "must release under GPL" or any other viral clauses, and the only attribution is the inclusion of the copyright notice.

Hardigg answered 12/7, 2010 at 13:26 Comment(4)
I've tried to use interupts in the past, but it violates a governing spec that they invoke for all systems. Basically performance be damned, if there is ANY way to meet the requirements of the system without using interrupts then thou shalt not use interupts. As far as GPL, they will NEVER disclose any source code to the public, therefore no GPL. How complete of an implementation is uIP?Amand
I think that is a crappy license - what does "binary form" mean.? Does that mean in an embedded system you must burn the text of the license into ROM? This is what happens when people write their own licenses - they make their software impossible to use.Dobruja
@Neil, normally I would read that as just putting the licence text into your documentation somewhere ("... in the documentation and/or ..."). A certain large nameless company do a similar thing with their use of third-party products - they have their own licence in the doco and they also state that other software is used, putting all those other licenses in there as well. As far as how crappy it is, it's certainly easier to understand and comply with than the GPL - only three clauses to worry about.Hardigg
This is a BSD license with the author, organization and year changed to reflect who the author and organization are and the years the materials are copyrighted. (opensource.org/licenses/bsd-license.php)Marrs
M
1

Currently I'm using the lwIP library on an ARM Cortex-M3 at 50MHz with no OS. It's a project based on the Luminary Micro (now TI) Stellaris Serial to Ethernet Reference Design Kit (http://www.luminarymicro.com/products/rdk-s2e.html).

This kit includes source code and schematics and gives us a solid base to develops some products.

I've no affiliation with TI or Luminary, just a very happy customer.

Marissamarist answered 16/7, 2010 at 7:34 Comment(0)
M
1

I have written a Ethernet+TCP stack on 'bare metal' for a Texas Instruments 16-bit DSP. The lack of byte-wide addressing was rather a nuisance; some data structures store data packed two bytes per word, while others store one byte per word (in the C compiler, both 'char' and 'int' are signed 16-bit types). None of the Ethernet or TCP code uses interrupts; both handled in a "call as often as convenient" routine which typically cycles around 100x/second. Performance is not super-duper, but it is generally adequate. Perhaps the biggest weakness in my stack is that it doesn't handle out-of-order packets (packets arriving out of sequence will be ignored; they'll hopefully get retransmitted after the expected packets arrive). What you're seeking is certainly doable, though that doesn't necessarily mean it's worth the effort.

BTW, my TCP stack supports a rather interesting 'echo server' on port 23. Any number of telnet clients can connect to port 23, and whatever data they send will be given back to them. Although this server just echos data, it could be adapted to send things like documents completely statelessly. Anyone ever seen anything like that?

Methoxychlor answered 1/2, 2011 at 17:19 Comment(2)
I am also working on the same DSP in TI boards without an OS using Code Composer Studio. My Ethernet packets containing raw data which is captured is shown in the following link [s8.picofile.com/file/8356768868/8284_shot_PNG_1230x0.png]. Some of them are lost. Is your work available? or can I share with you my source?Perpetua
@AhmadSiavashi: It's been about a decade since I've looked on that code, and I don't particularly remember it. What handling if any do you have for out-of-order delivery or fragmentation? My stack keeps packets below 576 bytes (including headers) to avoid fragmentation, and is used in contexts where out-of-order delivery wouldn't usually be a problem (a packet which arrives out of order will be ignored and not acknowledged, generally resulting in its getting retransmitted a second later).Methoxychlor
W
0

Just adding a note that there's a fairly new open source TCP/IP stack intended for MCUs in Freescale's FNET. It's LGPL/GPLv3 licensed, differing from some of the other BSD licensed ones, so it may not be suitable for the original poster's project, but it may still be relevant to other users. It current lists Kinetis (Cortex-M4) as a supported platform along with some ColdFire parts.

Wilkins answered 29/2, 2012 at 5:31 Comment(0)
C
0

Well, I stumbled on this post as a result of looking into FNET, and although its old, its not answered, so I'll add my two cents... Micromonitor is a boot monitor that when run standalone, supports TFTP client/server, DHCP client, ping client/server and a simple UDP based command line interface. It includes demo applications that allow you to hook LWIP directly to the underlying ethernet driver used by the bootmonitor. This allows the demo to be used on any micromonitor port with almost no change.

No interrupts, no GPL... just a polling loop. The example applications include several different hookups: (LWIP, LUA, PICO-C, BWBASIC, etc..). The demo includes an HTTP server (hooks to uMon's TFS file system so you just build up html basic files), UDP-based command server, a telnet client and http-get client. Most of the demos are extensions of the demos that come with LWIP.

Check it out... http://www.umonfw.com

Cora answered 17/4, 2013 at 13:50 Comment(0)
K
0

You can use Simulink Embedded Coder to implement it. And then if you need, you can modify the generated code. (Ofcourse it is not advised if you have another option such as one of the solutions stated above.)

Koerlin answered 10/8, 2015 at 15:24 Comment(0)
Q
0

For anyone reading this thread: https://github.com/cesanta/mongoose is the bare-metal TCP/IP stack which includes:

  • HTTP, MQTT, Websocket API
  • TLS 1.3 stack
  • built-in firmware update support for several architectures (e.g. STM32)
  • all that in two files: mongoose.c and mongoose.h
Quickie answered 23/5, 2024 at 20:38 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.