Marrinations

Marrinations

Placid is a cross-platform operating system for embedded systems. It can run on platforms as small as Arduino and ESP8266 all the way up to Raspberry Pi. The source code is available with an MIT license from GitHub.

 

Motivations

 

I started thinking about bare metal programming on the Raspberry Pi when I tried running OctoPrint (https://octoprint.org) on Model B+. This is a Linux web server designed to run a 3D printer. It works, but it takes minutes to boot into a running server. This is crazy. The Model B+ is not the newest, but it is a powerful ARM processor with 512MB of RAM. It made me harken back to a long time complaint of mine - that as software gets more complex it continues to run slower and slower with each new release.

 

The solution was always to get more RAM or a bigger disk, or a whole new machine. The thing is, hardware is advancing faster than software. Even though we have complex windowing systems with high resolution, beautifully rendered text and elaborate animations, we also have graphics hardware which can render over a billion pixels per second. So it seems like the system software has become more complex than the new features it's giving us warrants.

 

So I decided to see what I could do if I went right down to the bare metal. The performance would be much better without a doubt. But could I do anything practical with it? Could I build, for instance, a web browser, email client or word processor on top of it? I probably could if I simply ported over lots of legacy libraries, but that would kind of defeat the purpose. I’d just be putting the bloated software one layer up.

 

So I created Placid. The intent is to create a system that has a lot of capabilities, but that takes into account systems with a smaller footprint than the hardware that makes up today's laptop and desktop systems. In fact, I wanted to make a system that is scalable. Something that would be able to run a scaled down version on platforms as small and constrained as an ESP8266 or smaller ARM devices with 80-256K of RAM all the way to a Raspberry Pi with up to 1GB. It will work as a single task system with no memory management and a single stack or a multi-process system with virtual memory management. It will work with no floating point, software fixed point, or full floating point hardware.

 

At least that's the goal!

 

Bootloader

 

I’m starting by writing a bootloader for the Raspberry Pi Zero. This is a small executable which is installed on the RPi SD card. It makes software development much easier because it allows you to upload new kernels or system software without the cycle of moving the card to the dev system, loading a new binary, ejecting, plugging into the RPi and rebooting that is normally required. 

 

This talks to the serial port. The way RPi hardware works, you put a file called kernel.img on the SD card (the name of this file can be changed). This file gets loaded at location 0x8000 (this address can also be changed) and starts to run. My bootloader is very small and is named bootloader.bin. It actually loads itself lower in memory, at location 0x800. It prints a message to the console, waits 3 seconds and then loads a second executable from the SD card, named kernel.bin. Within that 3 seconds you can press the space bar on the serial console and the system will wait for an executable to be uploaded using the XModem or YModem protocol. This makes developing software for the Raspberry Pi much simpler, avoiding the need to move the SD card to your dev system, load a new binary, eject it, plug it into the RPi and reboot.

 

Read the GitHub page about the bootloader for more info.

 

Kernel

 

Once the bootloader is done I can start on a lightweight kernel that I can load with the bootloader without having to deal with swapping SD cards. See https://github.com/cmarrin/placid/blob/master/kernel/README.md for more info

Hi, my name is Chris and I have lots of hobbies. From woodworking, to Shapeoko, to IoT and other hardware projects, you’ll find it all here. I’ve been a professional software engineer for all of my life so my hardware and IoT projects always include a software component. My interest in IoT has lead me to the ESP8266 and to my m8rscript software project to drive it.

contact me

Name *
E-mail *
Message *