A few years ago [Serge Vakulenko] started the RetroBSD project–a 16-bit port of the old 2.11BSD operating system to the Microchip PIC32 microcontroller. This was impressive, but version 2 of BSD is, to most people, old news and somewhat difficult to use compared to modern BSD and Linux operating systems.
[Serge] has been at it again, however, and now has a port of 4.4BSD–LiteBSD–running on the PIC32MZ. According to [Alexandru Voica] there is about 200K of user space memory in the basic build, and by removing some OS features, you could double or triple that figure.
If you aren’t familiar with BSD, it is the Berkeley Unix derivative. Unlike Linux (which was a rewrite of Unix functionality), BSD forked the original Unix source and added features. Version 4 of BSD adds several key features including TCP/IP networking, and LiteBSD includes an IPV4 stack and an Ethernet driver (a WiFi driver is in the works). You can view a talk about the history of BSD from [Kirk McKusick] (one of the prime people behind BSD) below.
We’ve seen RetroBSD on micros before, but with the 2.11BSD heritage, RetroBSD doesn’t have the potential that LiteBSD does. It is interesting, though, that the driver structure is compatible so that both projects can easily share driver source code. Maybe [Jaromir] will upgrade his laptop.
Thanks [Alexandru Voica] for the tip. PIC32 diagram courtesy Microchip.
13 thoughts on “LiteBSD Brings 4.4BSD To PIC32”
Yep, I’m upgrading to 4.4BSD. I had the first build on temporary hardware running few days ago
Please keep us posted. I really like your first version and especially the keyboard. Wish I had one of those for my project. I’m currently trying to use one from a HP Jornada.
This line “there is about 200K of user space memory in the basic build, and by removing some OS features, you could double or triple that figure” is a little bit misleading when compared to the actual statement “Currently about 200 KB of memory is available for the user space, and due to TLB [translation lookaside buffer] and paging support this amount can be doubled or even tripled.”
The PIC32MZ2048 range of products only has a maximum of 512KiB of RAM and 2MB of flash as shown in the image above. RAM is a lot faster than trashing swap space. If your swap is on flash and you are trashing it heavily, it will not last long.
It is an impressive project.
You could bank switch as many of these as you want… on an SQI bus so it’d be relatively fast. http://www.microchip.com/wwwproducts/Devices.aspx?product=23A1024
Speed is not the issue, it is wear – https://en.wikipedia.org/wiki/Flash_memory#Memory_wear a 2MB MLC with 100K writes for each of 7814 256 byte sized blocks may sound like a lot, but that is one block with a write limit (before failure of) 781 million writes. So if there was an error and you were swap thrashing and writing 100 blocks every second (25KiB/sec), that would be an expected average lifetime of 3 months. 100 blocks per second is a lowball estimate, the reality could be worse.
Sorry I assumed that it was Flash and not SRAM. Yes I agree, that is a good solution instead of using flash for swap.
It is good to have something to fall back on … when the bloatware in Linux becomes unbearable :)
Well you can run Linux on it too
There are SPI/QSPI SRAM, FRAM, and MRAMs available in capacities up to 4 Mbit. The interface speed is much slower then on-die SRAM. But they would be a good solution for swap.
4.4 BSD => PIC32 = :-O
There is also NuttX, a POSIX-comaptible, BSD-licensed, hard real-time Unix clone in a few KB
Looking at the source code I don’t see any reason why I can’t get this running on an 8 bit micro (with a little modification and some external storage.
Please be kind and respectful to help make the comments section excellent. (Comment Policy)