0
\$\begingroup\$

I would like to use use a RTOS and OS side by side to implement a cooperative work.

The RTOS would perform time critical (real-time) task and the OS will perform the other non-critical functionalities such as user display, tcp/ip communication etc.

Can you recommend any framework or projects that is able to achieve this need ? It would be great if it is open source.

RTOS and OS would have some kind of communication mechanism. (mail box or shared memory)

If needed, the RTOS could run on a specific core and the OS on another core. (with dual core CPU)

A possible configuration could be:

Zephyr (RTOS) and Linux (OS).

FreeRTOS (RTOS) and Linux (OS).

As of now, I found this information: http://www.evidence.eu.com/embedded-linux-osekvdx-erika-enterprise-dual-core-automotive-cpu-without-hypervisor.html

Is there anything else available ?

\$\endgroup\$
6
  • \$\begingroup\$ In the old days we just used MC6800 or 6805 or 'HC11 machine language to create 1ms RTOS IRQ routines with all others pushed to stack when Real-time work was done for digital telephony. There are a lot more powerful Cores avail now, like Cortex. \$\endgroup\$
    – D.A.S.
    Commented May 7, 2017 at 20:03
  • \$\begingroup\$ @TonyStewart.EEsince'75 Times have changed. Just throw a 4-core 3GHz ODROID-C2, with built in wifi, 4k HDMI, etc. at it. So may actually run a VM with two O/S. It's about shoveling in a whole bunch of random libraries in the hopes of getting something done without a clue about what is going on inside. And to a degree, that approach works today. I care about measurement and this means that the output may be subjected to FFTs or applied to closed loop control, which means microsecond precision sampling and similarly predictable and unvarying phase delays. RTOS means something different to me. \$\endgroup\$
    – jonk
    Commented May 7, 2017 at 21:18
  • \$\begingroup\$ RTOS just means a lot of synchronous IO operations, it can be at any period. 3ms for telephony DS1 frame rates or whatever. The Op must define this cycle time and number of Ops needed to determine the clock rate and thus get a rough sizing of CPU topology to determine if it is a $1PIC or $35 Droid card with a Quad core with constraints on cost for R&D and production to get a more intelligent answer. Lack of specs is always a limiting factor here. \$\endgroup\$
    – D.A.S.
    Commented May 7, 2017 at 23:50
  • 2
    \$\begingroup\$ Check remoteproc in Linux. It is basically created for this propose: on one chip, run multiple OSes on multiple cores: kernel.org/doc/Documentation/remoteproc.txt \$\endgroup\$ Commented May 8, 2017 at 0:46
  • \$\begingroup\$ @TonyStewart.EEsince'75 To me, the "OS" part is mostly a programming paradigm that greatly improves maintainability as well as simplicity and predictable expectations as an application changes over time. I can't count the number of times I've seen an application turn into an unsalvageable "basket case" of spaghetti without one. Though simple cases can just be "simple," of course. The "RT" part of "RTOS" is a matter of perspective, obviously. \$\endgroup\$
    – jonk
    Commented May 8, 2017 at 1:46

2 Answers 2

3
\$\begingroup\$

You probably don't need to run two different OSs. You can usually lock the realtime processes to a specific core in the OS to keep things running smoothly while letting the scheduler and system processes do their thing on the other core. I like to use RT-linux which is not hard realtime but on modern x86 and big ARM processors it is responsive enough to run timed loops with very little jitter and I have used it for some very high performance robots. You will still need to setup a shared-memory interface between realtime and non-realtime processes with a some sort of arbitration scheme to keep them from stepping on eachother's toes.

I have used RTAI micro-kernel in the distant past but I think these are only really useful if you have a very resource limited processor (like sub 400 MHz). I would think real hard about your latency requirements before looking into more exotic solutions and start with RT-linux

\$\endgroup\$
4
  • \$\begingroup\$ Indeed, PREEMPT_RT may be enough for my current needs. However, it would still be nice to have a solution for hard real time. I suppose remoteproc is one solution. Alternatively, I could always use another small external MCU. \$\endgroup\$
    – ssinfod
    Commented May 8, 2017 at 15:01
  • \$\begingroup\$ How quickly do you need to respond to an event? \$\endgroup\$
    – kkemper
    Commented May 8, 2017 at 20:14
  • \$\begingroup\$ I have to scan 10 sensors over a RS485 network at 100 hz. The problem is that I have to "ping" each sensor one after the other. I ping with one byte and then I got 3 bytes. (ex: 01 x x x 02 x x x ... 10 x x x). In the past, the scanning was done with uart polling with a MCU (HCS12)! Now I want to perform the scanning with linux. My problem is that there is many (select) timeout involve and I am not sure I can have a "stable" scanning at 100HZ. \$\endgroup\$
    – ssinfod
    Commented May 8, 2017 at 22:29
  • 1
    \$\begingroup\$ PREEMPT_RT will be plenty accurate for you. We use it to run a 2 kHz loop that reads/writes data over EtherCAT each cycle and runs our control code for a 6 DOF robot. We have very little jitter in the timing of the loop even when using an Intel NUC. The biggest thing to watch out for in your case is the UART driver itself - which is independent of the scheduler. It may have strange buffering behaviors. But I'd probably assume it's OK for now since UART is pretty simple fundamentally. You could write your own driver that gets you better latency if it was an issue (not as hard as it sounds). \$\endgroup\$
    – kkemper
    Commented May 8, 2017 at 23:32
1
\$\begingroup\$

This can be done with systems like phyBOARD-i.MX 7, Pico-PI-IMX7, and other boards that offer dual processors to do this (check out imx7 series boards). Just use Debian, or Ubuntu for your Linux and FreeRTOS for the RTOS! :)

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.