• Please review our updated Terms and Rules here

microcontrollers running Un*x, Linux, *BSD, etc.

NobodyIsHere

Veteran Member
Joined
Dec 21, 2006
Messages
2,394
Hi, microcontrollers are typically known for small RAM memories which limited using advanced operating systems like Un*x, Linux, *BSD, etc. However here is a case where someone got LiteBSD to run on a PIC32 microcontroller.

Are there other examples of microcontrollers running advanced operating systems? ARM SoCs have been running Linux but usually are using some kind of external memory.

http://hackaday.com/2016/01/04/litebsd-brings-4-4bsd-to-pic32/

I think the difference which allows the PIC32 to run LiteBSD is the new microcontrollers include sufficient on chip Flash, RAM, and an MMU. The MMU is a fairly recent development AFAIK.

http://www.microchip.com/wwwproducts/en/PIC32MZ2048EFM144

Single chip running *BSD. The difference between microcontrollers and SoCs is getting really fuzzy.
 

eeguru

Veteran Member
Joined
Mar 14, 2011
Messages
1,618
Location
Atlanta, GA, USA
For me at least, the break point between a MCU and MPU is the inclusion of an MMU. I don't consider a (eg) Cortex A anything, R4Ke, or e200z6 a MCU - they are embedded MPUs.

There are tons of parts that feature hobby friendly assembly (ie lead frame), have a MMU, and either have lots of RAM in-package or easily interface to lead-frame SDRAM externally. Many of the Atmel Cortex A parts (eg SAMA5) have SDR SDRAM controllers. Renesas RZ/A1H is a 400 MHz Cortex A9 in a QFP with 10 MB of SRAM in-package. The newly announced PIC32MZ DA series has up to 32 MB of DDR2 in-package on a 176 pin LQFP. Lot's of options these days.

And wrt. PIC32, the MIPS 4000 series powered most of the early Silicon Graphics work-stations running IRIX. The core hasn't changed much from those days to PIC32. It's always been solidly in the microprocessor category in my book - despite miniaturization.
 

NobodyIsHere

Veteran Member
Joined
Dec 21, 2006
Messages
2,394
Any word on other Linux or *BSD ports to these advanced microcontrollers? NetBSD, a lean Debian, etc. can't be too far away if there is sufficient program memory. The PIC32 with the 32MB DDR2 seems to have it "bolted on" for the GPU. Its not clear to me whether its usable for program execution or reserved for the graphics. If the uC can execute programs from the 32MB RAM then small Linux/*BSD distributions should be available or soon will be. Adding graphic display controller really changes the mix too. Literally complete single chip Un*x machines can't be far away. *Pi, beagle board, etc. ARM SoCs come close but are still PCBs with multiple chips.
 

eeguru

Veteran Member
Joined
Mar 14, 2011
Messages
1,618
Location
Atlanta, GA, USA
ARM SoCs come close but are still PCBs with multiple chips.

RZ/A1H is all in one except external QSPI flash - as long as 10 MB works. I haven't tried bringing up a Linux kernel on it yet. 10MB would be enough for some minimal user space work.

Of course you can also get modules with OpenWRT supported chips on them (eg. Carambola2, etc) that have SoC, flash, and main memory mounted on an easy to solder carrier PCB that is smaller than a (eg) QFP176 in the case of PIC32MZ DA.

And yes, you can load and execute program code out of the 32 MB in-package RAM on the PIC32MZ DA.

-Alan
 

glitch

Veteran Member
Joined
Feb 1, 2010
Messages
5,011
Location
Central VA
There are versions of UNIX that don't require a MMU. LSX, for example, runs on a PDP-11/03 with no MMU and no split I+D. Not sure how useful porting it to a microcontroller would be, especially with all of these ultra cheap embedded systems we've already got, as mentioned, that run something UNIX-like from the start -- and fast!
 

Chuck(G)

25k Member
Joined
Jan 11, 2007
Messages
39,810
Location
Pacific Northwest, USA
Well, it's an interesting subject and changes are happening so fast that I'm leery of making generalizations. Even an STM32F4 (several years old) has enough on-chip RAM (384K) and Flash(2M) to run early Unices, including BSD. I assume that by "PIC32", you're talking about PIC32MZ DA versions with an embedded 32MB DRAM. I think someone ported a small Unix to a PIC32MX at one point.

I suspect that it won't be too many years before we see single-chip smartphone MPU/MCUs. Moore's law and all that.
 

NobodyIsHere

Veteran Member
Joined
Dec 21, 2006
Messages
2,394
All the modern Linux, Un*x, *BSD, et al require a 32 bit ISA, MMU and sufficient memory although there are some very early Unix & BSD implementations which didn't require an MMU. The only current example around today is uCLinux which doesn't require an MMU but it is more of an exceptional case. I've been following SoCs for a while and they are quite capable. However the idea of an entire Un*x/*BSD system including display running in a single low cost microcontroller chip seems really remarkable to me. At some point the whole idea of a microcomputer is just going to blink out of existence and disappear into a haze of electronic junk.
 

Chuck(G)

25k Member
Joined
Jan 11, 2007
Messages
39,810
Location
Pacific Northwest, USA
Ah, but there's the rub--"modern" Linux, which, if you take it from the original Slackware 0.90 release has grown bloated like beached whale.

Similarly, original BSD 4.1 didn't require much in the way of resources and SysV can run quite well on a 16 bit MCU without MMU.

Stuff changes and grows--both software and hardware. My wife marvels at the fact that when I started out running a 486 full-tower system for our mailserver., a $15 Orange Pi PC using a USB pen drive does the same job, loafing along without so much as a fan. It's way overkill for the job, but there's nothing to be had by spending less. Sitting next to it is an OPi PC running Ubuntu 16.04 XFCE4 that essentially turns in the same performance browsing that yesterday's P4 system does.

To tell the truth, a $5 PiZero would probably do the job for the mailserver, but the cables would cost more.

Here's the current status of the mailserver--and it's also broadcasting streaming audio via mplayer:

Code:
Welcome to ARMBIAN 5.27 stable Ubuntu 16.04.2 LTS 3.4.113-sun8i   
System load:   0.00 0.01 0.05  	Up time:       14:56 hours		
Memory usage:  4 % of 1000MB 	IP:            10.0.0.252
CPU temp:      36°C           	
Usage of /:    20% of 7.2G

I believe that there's still a ton of cruft in that, but what's the point of going after it?
 
Last edited:

NobodyIsHere

Veteran Member
Joined
Dec 21, 2006
Messages
2,394
Pairing up LiteBSD with the Microchip PIC32MZ DA would be awesome indeed. A single low cost chip to run a modern sophisticated OS (BSD) with memory protection and display.

*Pi type devices have done similar things with ARM and Linux but this is taking it to a new level. Very cool project.
 

Chuck(G)

25k Member
Joined
Jan 11, 2007
Messages
39,810
Location
Pacific Northwest, USA
"Modern" and "BSD" is a matter of perspective. I administered a VAX 11/750 running 4.1BSD (IIRC) in the early 1980s.

One could make the argument that porting any "modern" operating system should be simple; in theory, it should mostly be coding the hardware drivers to fit the new architecture--even back in the late 70s, that was an attraction of Unix. Initially, I think that's what Windows NT was about--running on x86, PPC, Alpha or MIPS was the goal. Not so much for OS/2--has it been ported to any other architecture than x86?

Unix wasn't always so portable--I can recall an article in one of the ACM or IEEE pubs about the effort to port it to an IBM System/3. Lots of "endian" issues (otherwise known as the "nuxi" problem)...
 
Last edited:

NobodyIsHere

Veteran Member
Joined
Dec 21, 2006
Messages
2,394
I'd consider the latest versions of FreeBSD/NetBSD/OpenBSD to be modern operating systems. They aren't Unix but they've kept up with the times. Personally I like NetBSD since it is designed for easy porting and runs on practically every CPU architecture or at least did at one point. If Linux distributions are modern, then so are *BSD. Similar heritage and lineage but not identical.

Windows is getting pretty long in the tooth now too. I recall running Windows 1.0 on a PC in 1985 so it's at least 32 years old.

Anyway, I'd love to see NetBSD (or LiteBSD) running on a PIC32MZ DA. Basically a really super inexpensive mini-PC. I think it could give *Pi a run for the money in terms of value and low price. Fully open source too.
 

Chuck(G)

25k Member
Joined
Jan 11, 2007
Messages
39,810
Location
Pacific Northwest, USA
NetBSD is pretty slow compared to other Unices. I've run it on old hardware (I believe that you can still get a version for VAX), but you pay for the generality with performance. None of the BSDs that I've tried have been as feature-laden as the Debian-based Linux family. On my OPi, I run Armbian and it performs quite well (I even run x86 code (not quickly) under qemu on it). Support for many of the more esoteric packages simply isn't there under BSD--although, for a tightly-controlled distro, OpenBSD is hard to beat.
 

Tor

Veteran Member
Joined
Mar 14, 2011
Messages
984
Location
Norway/Japan
I have a 32GB Transcend SD card w/wifi. It runs Linux. But I don't know (recall) how much RAM it has, or what other hardware is included (it's been a long time since I fiddled with it - you can get a login shell on this thing).
 

glitch

Veteran Member
Joined
Feb 1, 2010
Messages
5,011
Location
Central VA
Ah, I'd sort of forgotten about those! Hacking them was a big thing for a while, I believe there were several base boards made that added SPI RAM and GPIO.
 

eeguru

Veteran Member
Joined
Mar 14, 2011
Messages
1,618
Location
Atlanta, GA, USA
A M4 is just a M3 with an extended instruction set and a few more license options (FPU, etc). No real architectural differences. So it should work the same. However, without a MCU, a fixed partitioned Linux experience would suck...
 
Top