RetroBSD

2.11BSD operating system for microcontrollers
It is currently Mon Aug 03, 2020 11:04 pm

All times are UTC




Post new topic Reply to topic  [ 35 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: Sun Feb 14, 2016 2:01 am 
Contributor
User avatar

Joined: Sun Oct 20, 2013 3:15 am
Posts: 322
Anyone want to be my hero and write a kernel driver for the Arduino Ethernet Shield? (what is that, the Wiznet W5100?) It fits my Wi-FIRE board and would be a great driver to have in general.

Bonus points if you write it and your name isn't Serge :D

_________________
@__briancallahan on Twitter


Top
 Profile  
 
PostPosted: Sun Feb 14, 2016 10:30 am 
Contributor
User avatar

Joined: Thu Nov 08, 2012 7:04 am
Posts: 2401
Location: Rapa Nui
There is one for RetroBSD I think:
viewtopic.php?f=3&t=2801&hilit=w5100

_________________
Pukao Hats Cleaning Services Ltd.


Top
 Profile  
 
PostPosted: Sun Feb 14, 2016 10:43 am 
Committer
User avatar

Joined: Thu Oct 11, 2012 8:45 am
Posts: 1801
Location: Room 217, Floor 8, Arm 8, Wheel S7, Mars Base Alpha 3
I am not sure that it will be possible. Can the w5100 run in a raw mode? I know it has its own internal IP stack, but if that can't be bypassed then it can't be used with LiteBSD. Just like the ESP8266.

The RetroBSD 'driver' isn't a driver, it is merely a library that allows user applications to directly interface with the w5100's IP stack.

Sent from my SM-T555 using Tapatalk

_________________
Why not visit my shop? http://majenko.co.uk/catalog
Universal IDE: http://uecide.org
"I was trying to find out if it was possible to only eat one Jaffa Cake. I had to abandon the experiment because I ran out of Jaffa Cakes".


Top
 Profile  
 
PostPosted: Sun Feb 14, 2016 10:44 am 
Contributor

Joined: Mon Nov 12, 2012 1:34 pm
Posts: 1092
Hi Brian,

IIRC there is a W5100 ethernet driver in Retro.

I never bought the board/chip. There is also the issue of some kernel loadable module provision in the kernel to speed development.

So I guess the first step as I see it is creating a modified kernel.

After that, it would seem to just SMOP (Small matter of programming). And pretty straightforward.

All that said, given a board/chip, I might, slow as I am, give it a go.

Lots of fun :).

Wiz


Top
 Profile  
 
PostPosted: Sun Feb 14, 2016 11:07 am 
Contributor
User avatar

Joined: Thu Nov 08, 2012 7:04 am
Posts: 2401
Location: Rapa Nui
Quote:
I am not sure that it will be possible. Can the w5100 run in a raw mode? I know it has its own internal IP stack, but if that can't be bypassed then it can't be used with LiteBSD. Just like the ESP8266.

LiteBSD needs a solution for ESP8266, w5100 and the like popular chips (soon or later)..
Especially for the cheap wifi modules..

_________________
Pukao Hats Cleaning Services Ltd.


Top
 Profile  
 
PostPosted: Sun Feb 14, 2016 11:18 am 
Committer
User avatar

Joined: Thu Oct 11, 2012 8:45 am
Posts: 1801
Location: Room 217, Floor 8, Arm 8, Wheel S7, Mars Base Alpha 3
Only if there is some kind of raw mode available on the chips can they be supported. Otherwise the best you can hope for is like the w5100 on RetroBSD where a user application that you write directly interfaces with the chip and doesn't use the standard BSD networking functionality at all.

Sent from my SM-T555 using Tapatalk

_________________
Why not visit my shop? http://majenko.co.uk/catalog
Universal IDE: http://uecide.org
"I was trying to find out if it was possible to only eat one Jaffa Cake. I had to abandon the experiment because I ran out of Jaffa Cakes".


Top
 Profile  
 
PostPosted: Sun Feb 14, 2016 2:44 pm 
Contributor
User avatar

Joined: Sun Oct 20, 2013 3:15 am
Posts: 322
There appears to be a Linux kernel driver for it, but don't know if it's sufficient for LiteBSD: http://lkml.iu.edu/hypermail/linux/kern ... 00996.html

_________________
@__briancallahan on Twitter


Top
 Profile  
 
PostPosted: Sun Feb 14, 2016 6:37 pm 
Contributor

Joined: Mon Nov 12, 2012 1:34 pm
Posts: 1092
Hi Brian,

I suppose what we are talking about is a question of definitions.

The 'driver' for W5100 or any other chip is 'supposed' to just send and receive packets. The raw packets over ethernet are up to 1505 bytes as usually done.

Once the packet is received, it gets processed by several 'layers' of code according to the so called ISO model.

Thus the ethernet can receive UDP, TCP and many other types of packets by putting together possibly multiple received packets.

To send a packet a reverse process, a sort of packing process, goes on depending upon what type of send packet is desired.

As networks have gotten more complex, the layers have gotten more and more complex as well.

So writing a simple application to say deliver web pages VIA tcp over port 80 can be rather simple. While the whole set of programs to handle web pages, ssh connections, and the many other connection types gets complicated almost without limit!

This leads to the various comments above about how easy or hard things will be.

All that said, the first step is to send and receive packets. And unix being a rather well developed set of programs, you can be pretty sure that most of the older connection types will already have programs available to process them.

Does BSD 4.4 handle web communications? Definitely YES. So while there may be many programs needed to do a telnet connection, you can be pretty sure they are there and reasonably bug free!!

On the other hand, processing speed may be a problem unless most of the programs needed reside in physical memory so that swapping [which is pretty slow] is not needed for each packet.

Somewhere I have code running on PIC32 that serves web pages but without all the steps talked about above.

Thus getting W5100 up and doing something, the obvious first step, seems to me to be pretty much a given.

Serge will have a MUCH better idea than I as to how much web code is already there to do the kind of generic web processing that we all hope to have.

And Serge already has networking code running on one his Microchip demo boards!! So if you connect the proper networking chip to your PIC32 MZ, the code Serge as written should 'just work'.

I hope this helps??

Lots of fun :).

Wiz


Top
 Profile  
 
PostPosted: Sun Feb 14, 2016 7:05 pm 
Contributor
User avatar

Joined: Thu Nov 08, 2012 7:04 am
Posts: 2401
Location: Rapa Nui
It depends what the guys want to do with a "networking". Full 'bsdlike" networking with LiteBSD on pic32mz seems to me more less an academical exercise. When considering something like "IoT" then even an arduino with 2kB ram and 32KB flash can do "IoT" with w5100 or ESP2866.. :)

_________________
Pukao Hats Cleaning Services Ltd.


Top
 Profile  
 
PostPosted: Sun Feb 14, 2016 7:19 pm 
Committer
User avatar

Joined: Thu Oct 11, 2012 8:45 am
Posts: 1801
Location: Room 217, Floor 8, Arm 8, Wheel S7, Mars Base Alpha 3
Pito and wiz...

LiteBSD has the full networking stack in the kernel. Applications do not need, or want, to have a clue about that sort of thing, only the *BSD Sockets* interface that it presents to the application.

Any network driver *must* interface with that already existing networking stack, which means that it *must* provide raw packet access.

If it cannot then it cannot be used as a network driver, and you will not be able to use it with any of the standard programs or utilities in LiteBSD.

That is not accademic, that is basic facts. That is how networking works.

Without that facility all you can do is use it kind of like an Arduino sketch where one single application directly controls the hardware and has to have all the software built in to it to control the hardware. That means no telnet, no ftp, no ssh, no web, except if you manually program those functions into your own software manually.

So if you want a driver it can *only* be done connecting it in to the existing network stack, and that means you cannot *ever* interface a device that doesn't provide raw packet access.

So if the w5100 doesn't provide raw packet access then you can *never ever* have a LiteBSD driver for it. The best you can hope for is to use the SPI driver in your own program to manually control the chip on the board, and it will be completely separate from the existing networking in LiteBSD.

That is not optional. That is a simple fact set in stone.

Sent from my SM-T555 using Tapatalk

_________________
Why not visit my shop? http://majenko.co.uk/catalog
Universal IDE: http://uecide.org
"I was trying to find out if it was possible to only eat one Jaffa Cake. I had to abandon the experiment because I ran out of Jaffa Cakes".


Top
 Profile  
 
PostPosted: Sun Feb 14, 2016 7:51 pm 
Contributor
User avatar

Joined: Thu Nov 08, 2012 7:04 am
Posts: 2401
Location: Rapa Nui
So for what is the all the bsd networking stuff there when I cannot connect myself via w5100 or EPS2866 and send a few packets somewhere? :P

_________________
Pukao Hats Cleaning Services Ltd.


Top
 Profile  
 
PostPosted: Sun Feb 14, 2016 7:53 pm 
Committer
User avatar

Joined: Thu Oct 11, 2012 8:45 am
Posts: 1801
Location: Room 217, Floor 8, Arm 8, Wheel S7, Mars Base Alpha 3
It is what you have in a real operating system. The w5100 and esp8266 are not designed for interfacing with an operating system.

Even windows uses the BSD networking stack.

Sent from my SM-T555 using Tapatalk

_________________
Why not visit my shop? http://majenko.co.uk/catalog
Universal IDE: http://uecide.org
"I was trying to find out if it was possible to only eat one Jaffa Cake. I had to abandon the experiment because I ran out of Jaffa Cakes".


Top
 Profile  
 
PostPosted: Sun Feb 14, 2016 8:27 pm 
Committer
User avatar

Joined: Wed Oct 10, 2012 11:01 pm
Posts: 1081
Location: Sunnyvale, CA
In both RetroBSD and LiteBSD, we already have everything needed to develop IoT applications based on W5100 or ESP8266. Just connect W100 to SPI port, and ESP8266 to UART port, and use existing spi and uart drivers. Only one application will have access to the network - but that's a limitation of these chips. Unix environment cannot help here.

These chips cannot transmit and receive raw network packets. That's why for LiteBSD we need a native Ethernet port, or an external Ethernet controller or Wi-Fi module.


Top
 Profile  
 
PostPosted: Sun Feb 14, 2016 8:56 pm 
Contributor

Joined: Mon Nov 12, 2012 1:34 pm
Posts: 1092
Hi Serge and all,

Serge if I understand you correctly, a J60 interfaced to the kernel would be able to do it all at least at 10baseT rates?

As would an old ISA style ethernet card?

I guess I need to look a little deeper into the kernel to see what is already there waiting to run :). I thought the whole effort was a much bigger deal.

Am I missing something?

FWIW - Somewhere I already have J60 code that is running :).

Lots of fun :).

Wiz


Top
 Profile  
 
PostPosted: Sun Feb 14, 2016 9:10 pm 
Committer
User avatar

Joined: Thu Oct 11, 2012 8:45 am
Posts: 1801
Location: Room 217, Floor 8, Arm 8, Wheel S7, Mars Base Alpha 3
The j60 and j600 are ideal candidates - the perfect choice for interfacing.

I have some j60 code here as well, already written for the pic32 that I made years ago for the chipKIT system. It should be fairly simple to port the relevant parts to LiteBSD. Not sure where it is though - maybe on github or maybe on sourceforge. I will hunt it out.

Sent from my SM-T555 using Tapatalk

_________________
Why not visit my shop? http://majenko.co.uk/catalog
Universal IDE: http://uecide.org
"I was trying to find out if it was possible to only eat one Jaffa Cake. I had to abandon the experiment because I ran out of Jaffa Cakes".


Top
 Profile  
 
PostPosted: Sun Feb 14, 2016 9:14 pm 
Committer
User avatar

Joined: Thu Oct 11, 2012 8:45 am
Posts: 1801
Location: Room 217, Floor 8, Arm 8, Wheel S7, Mars Base Alpha 3
Found it. 2012 I wrote it...

https://sourceforge.net/p/chipkitnetwor ... C28J60.cpp

Sent from my SM-T555 using Tapatalk

_________________
Why not visit my shop? http://majenko.co.uk/catalog
Universal IDE: http://uecide.org
"I was trying to find out if it was possible to only eat one Jaffa Cake. I had to abandon the experiment because I ran out of Jaffa Cakes".


Top
 Profile  
 
PostPosted: Mon Feb 15, 2016 8:12 pm 
Contributor

Joined: Mon Nov 12, 2012 1:34 pm
Posts: 1092
Hi Matt,

I was looking at the LiteBSD source code. The 'drivers' appear to be in /sys/mips/dev. As expected, there is a driver for the wireless module and one for the Microchip ethernet chips Serge has spoken of.

One easy way forward is to just take over the if_en.c driver and replace the routines with j60 pieces [yours or mine]. i.e.- steal the system name, etc. so most of the more obscure system stuff doesn't need to be figured out to get some real code up and running for the J60 or ISA card.

The only real problem IMHO is that this still requires a recompile and kernel reload at each step. [Sounds like a disaster waiting to happen to me!!]

So what I would suggest is to find a 'hole' in kernel RAM and compile in a jump to a fixed address in maybe the top of kernel RAM for each of the routines [except the ones executed during kernel powerup which are nops !]

Then figure out how to move the driver under test from 'user' memory into 'kernel' memory. In RetroBSD I compiled in some special syscalls that make that much easier to do.

Once this sort of development environment is up and running, progress is pretty simple and straightforward. After a crash, the system is simply restarted, the driver modified and reloaded.

I assume the Bell Labs folks were doing this? They were all pretty smart.

As an aside I had a grandfather who worked at the labs when they were on Long Island. As I remember him, He was a pretty bright guy like most of us :).

I wonder whose processor is in the Wireless module? I notice that the jtag pins are called out.

Lots of fun.

Wiz


Top
 Profile  
 
PostPosted: Mon Feb 15, 2016 8:34 pm 
Committer
User avatar

Joined: Thu Oct 11, 2012 8:45 am
Posts: 1801
Location: Room 217, Floor 8, Arm 8, Wheel S7, Mars Base Alpha 3
Personally I think it would be great to implement a TAP driver, then you can write network drivers in user-land. No messing with kernel memory or things then - just run your desired network interface driver at boot time.

_________________
Why not visit my shop? http://majenko.co.uk/catalog
Universal IDE: http://uecide.org
"I was trying to find out if it was possible to only eat one Jaffa Cake. I had to abandon the experiment because I ran out of Jaffa Cakes".


Top
 Profile  
 
PostPosted: Mon Feb 15, 2016 9:22 pm 
Contributor

Joined: Mon Nov 12, 2012 1:34 pm
Posts: 1092
Hi Matt,

TAP driver. I wonder what speed hit that would mean? Is it a simple kernel mod?

If it's almost as fast as a kernel driver, why not?

In RetroBSD I got stuck making a kernel loadable SPI routine so I could keep up [more or less] with a pretty slow RF chip. [Maybe I missed some ways to make things faster and not miss packets ?]

I wonder if that problem applies here?

Lots of fun :).

Wiz


Top
 Profile  
 
PostPosted: Mon Feb 15, 2016 9:36 pm 
Committer
User avatar

Joined: Thu Oct 11, 2012 8:45 am
Posts: 1801
Location: Room 217, Floor 8, Arm 8, Wheel S7, Mars Base Alpha 3
The TAP driver would be as fast as any in-kernel driver. It's just the user-land portion that might be a bottleneck. If the driver is small enough it may be able to reside in memory without ever swapping out, and so it may be fast enough. It will never be as fast as 100% kernel though.

_________________
Why not visit my shop? http://majenko.co.uk/catalog
Universal IDE: http://uecide.org
"I was trying to find out if it was possible to only eat one Jaffa Cake. I had to abandon the experiment because I ran out of Jaffa Cakes".


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 35 posts ]  Go to page 1, 2  Next

All times are UTC


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
cron




Powered by phpBB® Forum Software © phpBB Group

BSD Daemon used with permission