All of lore.kernel.org
 help / color / mirror / Atom feed
From: Philippe Gerum <rpm@xenomai.org>
To: Didenko Sergey <didenkos@domain.hid>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai-help] [VxWorks API] Compile and Link
Date: Thu, 29 Oct 2009 11:35:59 +0100	[thread overview]
Message-ID: <1256812559.2065.197.camel@domain.hid> (raw)
In-Reply-To: <1f3e02580910290229t5ad46268r5e7799a46950db5e@domain.hid>

On Thu, 2009-10-29 at 18:29 +0900, Didenko Sergey wrote:
> Dear experts
> 
> assuming I have:
> 
> xenomai_tree - path to Xenomai source code
> project_tree - path to my project (originally based on VxWorks)
> 
> Which directories and files should I include to the project's makefile
> to be able to compile and link it with Xenimai's VxWorks APIs instead
> of VxWorks's API's?
> Do I need only *.h and *.c files or any libraries are required?
> 

XENO_CONFIG := /usr/xenomai/bin/xeno-config
CFLAGS:= $(shell $(XENO_CONFIG) --xeno-cflags) -g
LDFLAGS:= $(shell $(XENO_CONFIG) --xeno-ldflags) -lvxworks

This said, moving a pristine VxWorks application from a traditional RTOS
environment to Linux requires some work, no API emulation layer will
give you 1:1 mapping between the zillions of WRS APIs and Linux+Xenomai.

Only playing whack-a-mole fixing syntactical/compilation issues until
your app eventually builds and links is the fastest way to hell for such
a porting exercise: this will NOT address the design-related issues that
must exist (e.g. what will you do with your original I/O drivers, how
and where will you put the kernel/user boundary when porting your code
etc, etc).

A core issue is that programming models are fundamentally different,
i.e:

- single-address space + flat/physically addressed memory + permanent
supervisor privileges + sloppy device driver model
VS 
- multiple process contexts + MMU protection + separate
kernel/application address spaces + non-privileged CPU mode for
applications + strict device driver model.

And, while I'm at it, just in case you might have considered this:
moving all of your original code to Linux kernel space on top of the
Xenomai APIs there would be likely terribly wrong. Aside of the license
issues (GPL vs proprietary), you may also have serious problems down the
road porting your code.

The Xenomai APIs _in kernel space_ are now deprecated, they were made
available at a time when Xenomai had no user-space support, back in
2001. We have such support since 2004 and the in-kernel APIs were kept
for backward compatibility purposes only, so moving a complex
application today, to such an hostile environment for user-level code is
basically masochistic.

A safer way to this journey is:

- assess which original I/O drivers have to be real-time and move them
to kernel space on top of RTDM.
- assess which original I/O drivers have direct Linux counter-parts,
and/or does not have any RT requirement, and reuse/implement a regular
Linux driver for those.
- segregate what parts of your original code has to be RT enabled from
the other more "relaxed" parts.
- move the application code bulk to userland, on top of the Xenomai APIs
there. Adapt the RT portions to the Xenomai APIs, use anything that fits
for the rest (e.g. plain glibc).

Driver-wise, there is rule #666 to abide by: in a dual kernel
environment - like Xenomai 2.x - never, ever, plan to share an IRQ line
between a real-time device and a regular one. As soon as anyone feels
tempted by implementing such a construct, the design flaw is there, and
something must have been wrongly assessed during the early porting
steps.

All in all, and to sum up: unless your application is 50 LOC at most,
porting it to Linux will require some implementation re-design work, and
Xenomai is no magic bullet to avoid that. What Xenomai aims at, is
providing a _correct_ emulation of the core VxWorks services (~100 of
them), which normally mitigates the impact of such re-design work. In
other words, do not confuse Xenomai with running the actual, original
RTOS within some virtual machine on top of a bare metal hypervisor.

The hypervisor approach is not Linux at all, it is just enabling the
legacy RTOS to run on the same hw than Linux. The former approach is
about mimicking the original RTOS environment natively in a Linux
context, which leads to very different trade-offs when porting.

You may at the very least want to read that piece, not much yet, but
this is still better than nothing:
http://www.xenomai.org/index.php/Xenomai:Porting_From_RTOS

> Sergey
> 
> _______________________________________________
> Xenomai-help mailing list
> Xenomai-help@domain.hid
> https://mail.gna.org/listinfo/xenomai-help


-- 
Philippe.




  parent reply	other threads:[~2009-10-29 10:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-29  9:29 [Xenomai-help] [VxWorks API] Compile and Link Didenko Sergey
2009-10-29  9:58 ` Gilles Chanteperdrix
2009-10-29 10:35 ` Philippe Gerum [this message]
2009-10-30  1:31   ` Didenko Sergey
2009-10-30 11:09     ` Philippe Gerum

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1256812559.2065.197.camel@domain.hid \
    --to=rpm@xenomai.org \
    --cc=didenkos@domain.hid \
    --cc=xenomai@xenomai.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.