Part of the original design of uspace realtime is that there is a base class “RtapiApp” which can be subclassed for other RTOSes that fit within the userspace model. But until now there is just one subclass, PosixApp.
In this PR, I implement two new subclasses: RtaiApp (which uses the RTAI LXRT API) and XenomaiApp (which uses the Xenomai POSIX skin API). Each class is around 200 LOC and is dynamically loaded with dlopen() based on the running kernel.
In a short test, without trying to stress the RTOS, I get latencies similar to RTAI with kernel modules.
This is far from ready to actually be merged. Additional work to be done includes (but is not limited to)
– [x] scripts/realtime: now need to load/unload modules for uspace+rtai realtime
– [x] configure: now need to detect paths (includes, libs, module locations) for rtai, xenomai
– [x] packaging: install right build dependencies
– [x] safe path for rtapi_print\* out of realtime
– [x] fix any other non-realtime syscalls being made (e.g., clock_gettime)
– [ ] get feedback from other testers
– [ ] placate buildbot
To run it you need to:
1. Install an appropriate realtime kernel plus rtai-modules (for rtai) or libxenomai-dev and xeno-runtime (for xenomai)
2. Check that the RTOS works separately from LinuxCNC.
1. For RTAI, Check if the tests/user/latency test from rtai works with your system. (for me it required sudo ./run)
2. For xenomai, try sudo xeno latency
3. Configure this tree --with-realtime=uspace, make, sudo make setuid
4. . scripts/rip-environment
5. python -c 'import hal; print hal.isrt, hal.isuserspace should print 1 1.
6. Now you should be able to run halrun, latency-test, latency-histogram, linuxcnc
1. The type of RTOS used is printed on the terminal, e.g., Note: Using XENOMAI (posix-skin) realtime
评论 (7)
#2 – jepler 于 2016-07-07
@tinkercnc that would be a fine topic for a different PR, thanks.
#3 – jepler 于 2016-07-08
Now this works on systems that follow the linuxcnc standard (but debian-filesystem-layout non-compliant) system of putting rtai modules in /usr/realtime-uname -r/modules without any extra steps.
#4 – jepler 于 2016-07-08
and now it packages. Probably needs some more detection when the target is uspace and there is no rtai developement header available. (in fact, rtai-modules is currently a missing build-dep, hmm)
#5 – jepler 于 2016-07-12
getting close to building on all platforms in our buildbot, though because of technical limitations that doesn’t include rtai support now.
#6 – jepler 于 2016-07-14
I’m going to close this and open a fresh PR that is about the branch from glo
#7 – jepler 于 2016-07-15
See #110 for news about this work.
#1 – tinkercnc 于 2016-07-07
Suggestion:
Adding “Canonical System Type” macros to the autoconf chain to determine the different system types (build, host, target) for using it in the make or preprocessor rules.
https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.69/html_node/Canonicalizing.html#Canonicalizing