Getting the Raspberry Pi RTOS-ready for embedded systems
November 01, 2014
Embedded developers are testing DIY platforms' abilities to perform in serious applications. Here we see how the Raspberry Pi and the Raspberry Pi Com...
DIY platforms are quickly developing for all sorts of applications. From fun projects for kids just catching the engineering bug to serious, advanced projects, there should be at least one board that fits your needs. And makers are finding ways to expand the functionality of popular platforms like BeagleBone Black and Raspberry Pi all the time; embedded developers, too, are discovering how they can stretch the application possibilities of simple, but increasingly powerful, maker boards.
Porting an RTOS for the Pi
Pebble Bay (www.pebblebay.com) Co-founder and Technical Director John Efstathiades caught my attention recently with a project to see how he could implement an RTOS like VxWorks on a Raspberry Pi. He says the Pi was an interesting target platform in part because of its architectural design.
"I started thinking about running VxWorks on the Pi after writing drivers for the Synopsys USB 2.0 OTG controller on a customer project," Efstathiades says. "This is the same USB controller that is used on the Pi, so I started putting together a list of all the components I would need if I actually wanted to do this and what the steps would be."
There are a few RTOS and kernel ports already out there for the Raspberry Pi, such as FreeRTOS and ChibiOS/RT, but Efstathiades takes a different approach with his work, using RTOSs with a memory management unit (MMU) to provide virtual addressing.
"The ARM1176 in the Broadcom SoC at the heart of the Pi is a classic 32-bit ARM processor with an MMU and cache, which makes it suitable to run the type of RTOS I am interested in," Efstathiades says.
Like with any new project, challenges arose, in this case with the way the Pi implements Ethernet – an external MAC is required as the Broadcom SoC doesn't have an integrated Ethernet MAC.
"On the Raspberry Pi B model this is provided by LAN9512 USB to an Ethernet controller, which also provides the USB host ports," Efstathiades says. "This means that to have networking you need a USB host stack with a suitable class driver. As I have the USB covered, all I would need to do is write the Ethernet driver. Not trivial, but I've written network drives before so it's a tractable problem."
A Pi for commercial/industrial applications
The Raspberry Pi B model isn't aimed at commercial/industrial applications, but the Raspberry Pi Foundation (www.raspberrypi.org) launched the Raspberry Pi Compute Module in 2014, which could open Pis up to more possibilities. Efstathiades says the SODIMM form factor used in the Compute Module also makes it a good fit for integration into embedded systems, and familiar for ease of use by embedded designers.
"The Compute Module opens out the processor I/O, which means you can use both the on-chip UARTs and use standard JTAG tools for development," Efstathiades says. "Availability of good development tools is (or should be) an important factor in deciding how to build a system."
The presence of onboard flash on this model for non-volatile storage removes the SD card booting that limits other Pi models from being acceptable in some applications.
So while the Raspberry Pi's limitations may not make it the best option for implementing an RTOS and using it as an embedded system platform, changes in the Compute Module could make it more attractive for future embedded projects.
DIY and embedded making
Though not actively involved in the maker community, Efstathiades is impressed by what he has seen.
"It is amazing what some people have been able to build using a Pi and their imagination," Efstathiades says. "Good embedded engineers are always looking for new and better ways for solving tricky problems or dealing with tight resource constraints. So ingenuity and perseverance are qualities that are valuable in both communities."
Efstathiades hasn't gotten VxWorks functional on the Raspberry Pi, but maybe with this start a fellow embedded maker will take the next step.