FreeRTOS on XU4 with Xen

Moderators: mdrjr, odroid

FreeRTOS on XU4 with Xen

Unread postby dumpram » Mon Jul 03, 2017 11:09 pm

Hello,

I've developed FreeRTOS 9.0.0 support for Exynos5422 and Xen 4.10 based on Mini-OS and Galois Inc port. (https://github.com/dumpram/odroid-xen-rtos)
I posted topic about bare metal approach for configuring EXTI interrupts on Exynos5422. This went very well with little help on this forum (viewtopic.php?f=97&t=27325). I measured interrupt latencies and compared them to Linux which runs natively on XU4. These are results that I've got:

For Linux kernel module:
linux-latency.png
Linux latency
linux-latency.png (41.04 KiB) Viewed 1003 times


FreeRTOS on Xen:
xen-latency.png
FreeRTOS (xen-latency)
xen-latency.png (37.41 KiB) Viewed 1003 times



This is tested under stress(memory hogs) running in Linux. In Xen stress was performed in Domain-0. Deviation is 10 times bigger in Linux. In FreeRTOS on Xen latency is still unpredictable but bounded by 30 microseconds. Average interrupt latency is about 8 microseconds but I think this can be less.

I don't know if frequency of cores is fixed to 2.0 GHz. I assume that it is setup with bootloader. Problem is how to raise frequency for performance on A15 cores or make sure that it is constant. I measured how many instructions can be performed in one second. About 8 million instruction can be performed in roughly 5 ms. That is 1600 MIPS? How is this related to CPU frequency is this to expect if frequency is 2.0 GHz? As I see in https://github.com/hardkernel/linux/blo ... ynos5420.c clock configuration is very complicated. But if someone could provide functions like get_cpu_rate and set_cpu_rate for core it would be great :D. I don't know which registers to look for :D.

For easier understanding of question. Here is architecture of virtualized system (vCPUs are pinned to pCPUs):
virt-scheme.png
virt-scheme
virt-scheme.png (49.3 KiB) Viewed 1003 times


The best thing about result is that effect of Linux on FreeRTOS is minimal. Unlike using only Linux. Are there any ideas how to improve this and raise predictability?
dumpram
 
Posts: 9
Joined: Tue Apr 19, 2016 3:27 am
languages_spoken: english
ODROIDs: XU3

Re: FreeRTOS on XU4 with Xen

Unread postby jokeyth » Tue Dec 26, 2017 8:04 pm

Hello dumpram,

I am quite interested to your porting project. I am a very newbie of forums as well as embedded systems, although I am linux (gentoo) users for quite a while. Surfing the web for getting info about RT linux systems has left me quite confused. I read that preempt RT is not actually RT, because RT means just that a system react in real time and much more in a deterministic way to particular actions.

I am about to receive my brand new odroid UX4 and I would like to implement on that board a real time GPS receiver. I did one in the past on a personal PC thanks to the SIMD instruction with no threads management, but now I would like to have fun with something smaller. So I thought to move on the ARM cortex, use the GPU for fast FFTs and use this time threads. Why not adding also some RT to manage the tight 1 ms correlation interval in GPS? During this 1 ms I should get 1 ms of data from the USB and perform a bunch of correlations.

For this reason I am considering to use something RT so to have quite defined 1 kHz of rate and a quasi-deterministic behaviors. I might not need it now, but the final goal is to make an Ultra-Tight-Coupling with an Inertial Navigation System (INS) and for that I need to keep quite tight the time synchronization between the data read from the GPS front-end and the data read from the INS.

So I am asking your advice for:

    1) Do you believe that the FreeRTOS is the proper tool I need for RT?
    2) what's the difference with the Real-Time RT patch on odroid-x? (from https://wiki.linuxfoundation.org/realtime/start: seems that on ARM there might be some problem: "ARM is using stop_machine() while patching assembly opcodes at run time which can cause high latencies" is really an issue)?
    3) Does your porting of freeRTOS support threads and support for USB drivers like libusb?
    4) Can I install it on any version of linux for oDroid?
    5) I read on wikipedia that freeRTOS can burn hardware and it is not safe, so it was developed safeRTOS. Is it correct?

Sorry for the many many questions but I lost my way off around the fragmented documentation on the web on this topic...

Jokeyth
jokeyth
 
Posts: 1
Joined: Tue Dec 26, 2017 7:30 pm
languages_spoken: english
ODROIDs: UX4

Re: FreeRTOS on XU4 with Xen

Unread postby dumpram » Thu Feb 01, 2018 6:01 am

Hello,

jokeyth wrote:1) Do you believe that the FreeRTOS is the proper tool I need for RT?

Yes. But based on what you described, you have to utilize lots of hardware,
so it could be problematic in this configuration.
jokeyth wrote:2) what's the difference with the Real-Time RT patch on odroid-x? (from https://wiki.linuxfoundation.org/realtime/start: seems that on ARM there might be some problem: "ARM is using stop_machine() while patching assembly opcodes at run time which can cause high latencies" is really an issue)?

If you want to use only Linux, I suggest Xenomai project, these other modifications are way to complicated.
jokeyth wrote:3) Does your porting of freeRTOS support threads and support for USB drivers like libusb?

FreeRTOS is real-time task scheduler and it supports tasks (threads). There is no support
for libusb as far as I know.
jokeyth wrote:4) Can I install it on any version of linux for oDroid?

No. This is specific use of Linux and FreeRTOS in separate VMs. FreeRTOS and Linux are modified to run in
that kind of enviroment. You could probably install any version of Linux to run in VM on top of Xen as guest
domain.
jokeyth wrote:5) I read on wikipedia that freeRTOS can burn hardware and it is not safe, so it was developed safeRTOS. Is it correct?

This concerns functional safety. Unless you want to certify your product for standards like IEC-61508, ISO 26262 and
similiar, you don't have to worry about it.
dumpram
 
Posts: 9
Joined: Tue Apr 19, 2016 3:27 am
languages_spoken: english
ODROIDs: XU3


Return to Projects

Who is online

Users browsing this forum: No registered users and 5 guests