Guysoft’s Weblog
RealtimePi – out of the box real-time RaspberryPi Raspbian October 9, 2017
» data-medium-file=»https://guysoft.files.wordpress.com/2017/10/realtimepi_icon_small.png?w=222″ data-large-file=»https://guysoft.files.wordpress.com/2017/10/realtimepi_icon_small.png?w=222″ src=»https://guysoft.files.wordpress.com/2017/10/realtimepi_icon_small.png?w=460″ alt=»RealtimePi logo»/>
Hey all,
So it started as a curiosity, and it looks like its working. I made a Raspbian-based distro that ships with a realtime kernel called RealtimePi. You can download the latest here. It’s open source, sources are here.
A realtime system means its deterministic, it means you should know how long things take to run. They way to do is is to apply a patch to the linux kernel that makes it non-preemptible. To explain – P reemption is the act of temporarily interrupting a task being carried out by a computer system, without requiring its cooperation, and with the intention of resuming the task later.
This is useful for building hardware and robotics, low latency audio and other gpio because there are no surprises when it comes to timing. It seems like something good to try out with the RaspberryPi, because of the GPIO and IOT capabilities.
Bundled with CustomPiOS you can build your customized realtime-kernel device.
Features
- Both armv6 and arm v7 are supported! Aka all versions of RaspberryPi to date!
- 4.9.52-rt37-v7 with PREEMPT kernel
- Easy way to set up the network using realtimepi_wpa_supplicant.txt in the boot partition
Steps to install
- Download the image here
- Unzip and flash it to an SD card (small enough to fit a 2GB card)
- Open newly flashed image and edit two files, one for the wifi, and one for the bot token:
- Put in realtimepi-wpa-supplicant.txt your wifi address (skip if using Ethernet cable). Here is how it should look:
You can test the realtime kernel is enabled, by running in the commandline
You should see something like this, note PREEMPT RT which indicates its realtime:
The line should look a little different for armv7
I am not an expert with actually building realtime systems, so input on how it preforms, and examples would be appreciated!
Raspberry real time linux
What kernel version will we likely see for the release?
Will you supply your patches upstream? This would allow the real-time patch developers to have an eye on them.
How easy will be migration to newer (and therefore more real-time capable) kernels?
You can access official real-time patches, instructions and tests from here:
Patches are slowly migrated to mainline kernel. 3.0 and 3.2 are recent major steps, from what I got.
The claim has been for (almost) hard real-time performance on linux with these latest patches, this would still be depending on the well-behaving of custom drivers, SoC design and custom kernel patches.
But certainly there is light at the end of the tunnel!
Re: Real-time linux kernel
for some reason I cannot post to this thread.
I am adding small copy and paste snippets, as I think this is due to anti spam tests and will not allow me to paste more than a few characters.
I have spent this morning trying to work out how to compile the kernel with rtai.
I am no expert and have no real experience with low level programming of ARM or of linux kernel programming, so I am probably not the best person to be doing this. So far it is a fail, but I hope if I document what I have done someone better than I will be successful.
I think the HAL patch needs fixing (actually applying
)and also the rtai config from ‘make config’ was not quite correct, I hope someone who knows has some help.
The simple step by step guide to how to compile the kernel using the http://russelldavis.org/2011/09/10/virt . velopment/
Once you have logged in open a terminal and type the following in. mkdir kcompile
cd kcompile
wget https://www.rtai.org/RTAI/rtai-3.8.tar.bz2 then there are lots of other commands that anti spam will not allow
Re: Real-time linux kernel
Re: Real-time linux kernel
for some reason I cannot post to this thread.
I am really looking like an idiot now as I cannot seem to include web links or complete a continuous post without quoting my original posting and editing it.
WTF is wrong with this forum.
I am adding small copy and paste snippets, as I think this is due to anti spam tests and will not allow me to paste more than a few characters.
I have spent this morning trying to work out how to compile the kernel with rtai.
I am no expert and have no real experience with low level programming of ARM or of linux kernel programming, so I am probably not the best person to be doing this. So far it is a fail, but I hope if I document what I have done someone better than I will be successful.
I think the HAL patch needs fixing (actually applying
)and also the rtai config from «make config» was not quite correct, I hope someone who knows has some help.
The simple step by step guide to how to compile the kernel using the http://russelldavis.org/2011/09/10/virt . velopment/
Once you have logged in open a terminal and type the following in. mkdir kcompilecd kcompile
wget https://www.rtai.org/RTAI/rtai-3.8.tar.bz2wget anticore.org/ratgentoo/files/kernels/xenomai/linux-2.6.35.7.tar.bz2wget raspberrypi.org/kernel.ziptar xjf linux-2.6.35.7.tar.bz2
cd linux-2.6.35.7
unzip ../kernel.zip
gzip -d raspberrypi.patch.gz
patch -p0
Re: Real-time linux kernel
Re: Real-time linux kernel
Re: Real-time linux kernel
Very interesting to notice the others who has interest having a real-time kernel on the RP. Lets see when the forums will be fixed for letting people paste stuff in it..
I am mainly interested in the rtai kernel support so that EMC2 and possibly other robotic and control software can be run on the RP. The RP seems like the perfect cheap robot controller if the gert board can be integrated with some of the control software available for linux. I started looking at compiling realtime kernel and rtai only due to my intrest in EMC2 see this post: http://www.raspberrypi.org/for. controller
I have unfortunately never yet given this a concerted enough effort to ever complete compiling a real time kernel though I have managed to get realtime for a i486 compiled I never quite got it working right, and I have not even got as far as getting the kernel properly configured for the ARM (this is my first ever attempt at making kernel ‘make config’ changes for ARM)
So far I have spent maybe 3-4 hours on this, and I think will take a lot lot longer??
I doubt I will be putting much more effort into this until I order a RP, and I doubt I will be the person that will actually get things working as I think I don’t have enough time, talent, or experience.
Would love to help and I hope that others can add more information and links on this thread to help with getting some good realtime control software running on the RP.
I should say that as far as I can see linux should support rtai on ARM ‘out of the box’, but that depends on finding the right kernel .config options and compiling the kernel in order to put it ‘into the box’
I have so far not found any default config file that purports to compile linux for ARM with rtai may be worth reading this http://uu.diva-portal.org/smas. FULLTEXT01
Also I am not totally sure the Broadcom ARM chip used in the RP has all the right instructions and supervisor logic to get RT working(I have no real idea about anything, but I have heard custom chips sometimes drop parts of the architecture to save power or cut production costs. )
Would be good if some RP or Broadcom tech experts could comment?
Re: Real-time linux kernel
They talk about the repository for the kernel v3.. Although I’m interested into 2.6 for realtime.
Re: Real-time linux kernel
Oh my god, having RTAI on RPI would be sooooooooo nice for motor control.
Please tell me you guys haven’t forgotten about this thread?
Would love to help get it done, but I dont have any experience with kernel compilation either. RTAI works on ARM 7, do we have any idea whether it is feasible on this board?
Re: Real-time linux kernel
Re: Real-time linux kernel
Yes, real-time capabilities would be extremely nice to have, especially if they were made fairly straightforward to apply.. I remember some of my colleagues trying to get the real-time kernel on a Gumstix a couple of years ago, and spending many nights fighting it.
I’m not the biggest Linux guru — hardware is my strong point, so I’m probably not going to dive into this on my own, but I’d sure be appreciative of anyone who can get it working and provide a write-up of how he did it. Having real-time support really opens RP up as a research platform for things like robotics, avionics, and other serious embedded systems. Best of luck.
Re: Real-time linux kernel
I have no idea if this will copy paste here okay, but it is the last script of notes I made in looking at compiling realtime support in a kernel.
Re: Real-time linux kernel
Xenomai Real-Time Support for MPC5121 (ADS5121) and i.MX31 (Qong)
Tue Feb 17 2009
DENX Software Engineering proudly presents Xenomai based RTOS emulation and real-time support for the popular Freescale MPC5121 Power Architecture® and i.MX31 ARM11 processors. All needed code has been integrated into the official Xenomai distribution and is available from the Xenomai Download Area. Benchmark results for example for the i.MX31 based QONG EVB-Lite board are available here.
Tue Dec 09 2008
DENX Computer Systems ships the new QONG EVB-Lite. Based on the i.MX31 CPU the board was developed as an extended version of the QONG processor module. The «heart» of the board consists by the QONG module itself; surrounded by a PCB extension that provides native connectors for most common I/O interfaces.
More information on the QONG EVB-Lite is available in our product page
Embedded Linux Development Kit 4.2 for ARM11
Tue Nov 25 2008
DENX today announced a new release of its Embedded Linux Development Kit (ELDK Release 4.2) for ARM processors. This new versions targets especially for ARM11 and other systems with hardware floating point support, like the Freescale i.MX31 or Samsung S3C6400 processors. Another important new feature is support for the Embedded Application Binary Interface (EABI) standard.
The DENX Embedded Linux Development Kit provides a complete and powerful software development environment for Embedded and Real-Time Systems:
Cross development tools (compiler, assembler, linker etc .) to develop software for the target system
Native tools (shell, commands and libraries) that will run on the target system
Firmware that can easily be ported to new boards and processors
Linux kernel including all device drivers, board-support functions etc .
Supports Xenomai  kernel extensions for systems with hard real-time requirements
EABI support
Software and Hardware Floating Point versions
SELF (Simple Embedded Linux Framework) as a base to build run-time environments for your embedded systems
All components of the ELDK are available as Free Software with complete source code under GPL and other Open Source licenses . The ELDK can be downloaded from the DENX FTP server and from several mirror sites. A mailing list for ELDK related discussion is available here.
This suggests that xenomai supports the i.MX31 which is an ARM11 based processor, so maybe the best route to compiling real time kernel support for the rasp pi is to start from the xenomai i.MX31 patches. Once that is working look at the RTAI skin for xenomai then compile emc.
Now we just need someone stupid enough to spend many hours of free time doing all this hard work