Monday, 23 August 2010

Biffboot enhancements.

I've long been concerned about the fact that once you close a Bifferboard box it makes it difficult to replace the firmware.  You're stuck with ethernet flashing, which is only going to work from Linux.  The plan is to run a network server when the user presses the button while powering on the Bifferboard (this would be disabled by the config if you want to use the button for other things, obviously). Had a look at lwIP, but eventually decided it's too heavyweight.  Had a look at uIP, which is better, but the code is just hideous.  I actually got the uIP 'hello world' example working on the Bifferboard, but then realised combining it with DHCP was going to be difficult.  It seems you get to run one 'tcp/ip' and one 'UDP' type of application at the same time and then that's your lot.  Since Bifferboard *needs* DHCP this made things just too awkward so I eventually gave up on that too.

Still, it gave me some ideas.  I decided I'll change things progressively because Biffboot already had bootp and some crude networking to do the tftp booting.  So I enhanced my bootp to do DHCP as well.  I got that working then decided I'd like to be able to ping the Bifferboard as well when it's running this server.  ICMP was a lot harder than I expected because it needs another checksum to be generated, but it also needs to respond with the correct packet length.  For ages my reply packets were too short, but my windows machine was telling me there was no problem with them.  Pings from Windows, fine, pings from Linux gave the error 'truncated'.  Took another few hours to figure out what was going on.  Wireshark is usually helpful in this respect, but here it wasn't displaying any errors when printing the captured packets.  Eventually I worked it out with tcpdump, so it's fixed. 

Finished too late Sunday night to do anything useful with it, like add an 'application layer', but I can now go one of two routes: Implement tftpd (quite hard, I need to make 'put' work) or just extend the protocol I've already created from raw ethernet frames to working over UDP, so it works on Windows.  I will go for the latter, because at least everyone knows how to use the bb_eth_upload8.py script.  So, Windows users will have to press and hold the button, Linux people can just use the raw packets and just power on.  I will try
to just modify the python script and keep the one.

I think this sounds like a reasonable plan.

No comments:

Post a Comment