ring Windows XP on the PC - PC/104 and Small Form Factors

Transcrição

ring Windows XP on the PC - PC/104 and Small Form Factors
Special FEATURE
By Heinrich Munz
Heinrich Munz of KUKA Roboter discusses in this article how to bring
Microsoft Windows CE and WindowsXP together on the same PC. He discusses
system and application requirements, communications, loading, and activation
by interrupts and lists the technical and commercial features of each.
Reprinted from PC/104 Embedded Solutions / Spring 2004
Microsoft Windows XP
Microsoft’s Windows XP includes a
graphical user interface that is widely used
for IBM PCs. Due to the absence of real-time
ability, however, Windows XP has not been
suitable for all industrial applications. On
the other hand, Microsoft Windows has
the advantage of having both widespread
applications and
broad user acceptance. Moreover,
many low-priced
user programs for Windows are available.
Developers have recently created a way
to make Windows useful for industrial
real-time applications, eliminating the
disadvantages of Windows without giving
up its advantages.
Microsoft Windows CE
Windows CE (the embedded Windows)
is a widespread Real-Time Operating
System (RTOS).
Several versions
of Windows CE
are available for
different processor architectures (ARM,
MIPS, Intel 80x86, and others). Windows
CE normally runs standalone on a single
processor with exclusive use of RAM,
ROM, I/O hardware, and other resources.
CeWin brings Windows CE
and Windows XP together
on one PC
The CeWin product family combines the
Windows CE and XP operating systems,
so they can run concurrently on the same
PC, and the user can get the best of both
worlds. To make this possible, Microsoft
has developed a software-only, real-time
extension technology for Windows XP,
CeWin. The new technology guarantees
deterministic response on interrupts that
are targeted at Windows CE. Any PCI
or ISA PC plug-in board controlled by
Windows CE can generate these interrupts, and interrupts aimed at Windows
CE always receive a higher priority than
those targeting Windows XP.
As long as at least one Windows CE task
is active, the processor’s execution time
is available exclusively for Windows CE.
Windows XP will be reactivated only if
all Windows CE tasks have given up their
execution time, and Windows CE has
entered an idle mode. Windows XP
may be said to run as the idle mode of
Windows CE. The Windows CE idle mode
controls the reactivation of Windows. This
makes it possible for the programmer to
control processor sharing between the
two operating systems according to the
application requirements.
There are two members within the CeWin
product family: CeWin PE (Professional
Edition) and CeWin LE (Light Edition).
While CeWin PE has the full functionality
of the original Windows CE, CeWin LE
as a low-cost entry product has some
limitations:
■ Pre-configured images have several
fixed sizes that cannot be modified.
■ Additional OS features cannot be
included.
■ Development environment: Embedded
Visual Studio® and Visual Studio .NET
Platform Builder cannot be used.
■ Only one user process is supported.
■ CeWin LE does support Transmission
Control Protocol/Internet Protocol
(TCP/IP) communication between
Windows XP and Windows CE but
with no routing (IP Forwarding)
support.
However, both versions do support:
■ Access of the local Windows XP hard
disk (i.e., to load the user application)
■ Win32® subset API, Visual C++®
■ Windows CE console access using
Telnet
Windows XP using shared memory
areas. For this purpose, two corresponding
network drivers have been developed for
the Windows XP and Windows CE sides.
Both systems can exchange data over the
commonly accessible shared memory area
as they would via an Ethernet line. Using
the Windows XP built-in IP-Forwarding
feature, Windows CE can access other
systems that are connected to the Windows
XP TCP/IP network.
This communication method offers the
advantage of allowing the two systems
to be torn apart and connected by a real
Ethernet line without changing one of
the applications. This approach makes
sense if the real-time target system is
not only PC-based but also an embedded
system like a standalone controller without Windows XP functionality.
Users can install a more direct TCP/IP
connection to systems outside the PC
using additional Ethernet hardware. An
Ethernet board, which is supported by
a standard Windows CE driver, can be
plugged into the PC. Usually, this requires
using an Ethernet board that is in addition
to the Ethernet board used by Windows.
CeWin controls this additional Ethernet
board directly.
“Using the Windows XP built-in IP-Forwarding
feature, Windows CE can access other
systems that are connected to the
Windows XP TCP/IP network.”
The CeWin product license from KUKA
Roboter only consists of the coupling
mechanisms to have both operating systems
concurrently on the same PC. However, it
does not include the two required original
Microsoft licenses for Windows XP and
Windows CE. Those have to be procured at
the official Microsoft distributors. CeWin
installation has to follow installation of
the two original software products.
Communication between
Windows CE and Windows XP
The TCP/IP protocol is used for communication between Windows CE and
Using the standard TCP/IP protocol, any
additional Windows CE products, for
example, development systems such as
Platform Builder or Kernel Tracker, can be
used together with CeWin. As Windows
CE and Windows XP run on the same
processor, no special host is required for
development.
For the runtime system, TCP/IP sockets,
etc., can be used for proprietary communication protocols between Windows
XP and Windows CE programs. Alternatively, standard mechanisms such
Reprinted from PC/104 Embedded Solutions / Spring 2004
as DCOM or SOAP may be used for
communication.
When considering the application features
of both Windows CE and Windows XP,
there is no difference between running
under CeWin on the same PC (Figure 1)
or running on two different systems as
usual (Figure 2). Host and target systems
are identical.
Loading and starting CeWin
After Windows XP is up and running,
a user can start CeWin by uploading the
Windows CE image file (see Figure 3)
with a little loader tool, which is a Win32
application, easily integrated into a userwritten Windows XP application. This
application communicates with the
CeWin interface driver loaded during the
Windows XP boot sequence. Initially, the
loader calls the driver to allocate memory
that Windows CE later uses for code and
data. The allocated memory is guaranteed
to be fixed (not swapped to disk), and
the code running in this memory has the
highest privilege level (Ring 0).
The loader’s next step is reading the
Windows CE image from disk, and copying it to the allocated memory on behalf
of the driver. After the code and data are
relocated to the loading address, calling
the init function of Windows CE starts
Windows CE. As soon as all initialization
Figure 2
Figure 1
Reprinted from PC/104 Embedded Solutions / Spring 2004
Figure 3
tasks are idle, the init function returns,
and the loader terminates. From now
on, Windows CE will only be activated
by real-time interrupts (see Figure 4)
followed by task scheduling.
Activation of CeWin by
interrupts
The interrupts for Windows CE as well
as for Windows come directly from the
PC’s Programmable Interrupt Controller
(PIC). However, the CeWin real-time
extension technology ensures that the
interrupts enabled for Windows CE
always have higher priority than everything in Windows (including Windows
interrupts). These interrupts will interrupt
Windows XP or CeWin tasks within a few
microseconds and call the corresponding
Windows CE Interrupt Service Routine
(ISR). After returning from the ISR, but
before returning to Windows, the system checks if there are any Windows CE
tasks ready to run. If this is the case (one
or more tasks have been activated within
the ISR), the system will not return to
Windows, but it will activate the corresponding Windows CE task first. As mentioned
earlier, those tasks keep running until all
of them are suspended again. The system
then enters the idle mode of Windows CE,
which will lead to a return to Windows XP.
Windows XP will only be reactivated if all
Windows CE tasks are idle. The Windows
CE idle mode controls the reactivation
of Windows, enabling processor sharing
between Windows CE and Windows XP.
See Figure 5 for a state diagram of CeWin.
Exception handling of
Windows CE
Whenever Windows CE is activated via the
ISRs, a new exception table is loaded by
only one assembler instruction. Therefore,
the exception handling for page faults,
debugging, and so on is exactly the same
as if Windows CE were running standalone. Before falling back to Windows XP,
the exception table is reloaded.
“The Windows CE
idle mode controls
the reactivation
of Windows,
enabling processor
sharing between
The arithmetic coprocessor can be used
within CeWin without any restrictions.
It is possible that the interrupted
Target with Windows CE
Windows XP has the coprocessor currently in use, so the state of the arithmetic
coprocessor is saved whenever Windows
CE needs it and is restored before returning to Windows XP.
Figure 4
Reprinted from PC/104 Embedded Solutions / Spring 2004
Windows CE and
Windows XP.”
Figure 5
TCP/IP on
PC wit
Key attributes are:
■ Real-time extender for Windows XP
using Windows CE
■ PC-based automation (PLC, motion
control)
■ Real-time measurements and controls
■ PC and HMI add-on for existing
Windows CE applications
■ Windows CE target simulation with
real-time behavior and hardware
access
The technical features are:
■ Full usage of the RTOS Windows CE
concurrently to Windows XP
– Multitasking, intertask communication, Win32 API
– TCP/IP stack, ISAPI, ASP, SOAP,
etc.
– Optional products
– Runtime environment for Visual
C®, Visual C++, Visual C#®, Visual
Basic®, etc.
■ Software-only solution, no additional
hardware necessary
■ Use of the well known Microsoft development tools for Windows XP as
well as for RTOS development
■ Graphical real-time analysis tools
(Kernel Tracker, etc.)
■ High resolution real-time timer, granularity 0.8 µs
■ Hardware access to ISA and PCI plugin boards
■ Use of the original Win32 API for
Windows CE
■ All additional features of Windows CE
■ Communication between Windows XP
and Windows CE via shared memory
TCP/IP; use of DCOM or SOAP possible
■ Access of the Windows hard disk (using
a directory share)
The commercial features include:
■ No need for additional intelligent
coprocessor board or separate control
– Reduction of hardware costs
– Fewer hardware components: reduction of failures
– More compact controls possible
■ Small learning curve
– Known tools (Visual Studio, Visual
Basic, etc.)
– Win32 API
■ Reuse of existing Windows CE software and know-how is possible
■ Two scaled versions available
– Low cost entry product CeWin LE
(Light Edition)
– Full version CeWin PE (Professional
Edition)
How to work with it
Use Microsoft tools as the Integrated
Development Environment (IDE) to develop and debug real-time applications. In
addition, Wizards are available to generate
applications. Visual Studio enables development, test, and debugging of the real
target, with no simulation, on the same
PC. A shared memory TCP/IP facilitates
communication between Windows XP and
Windows CE. A Win32 application can be
built into a user application (DLL) enabling
start and stop of the RTOS after Windows
is up and running.
Heinrich Munz
cofounded LP
Elektronik in 1985,
focusing on software
and hardware contract
development. Heinrich
was instrumental in
LP’s development of
plug-in boards for
PCs to couple RTOSs
like OS-9 and VxWorks with DOS, and
later Windows. Having the goal of bringing
together the PC-based office world with
its powerful tools and the poorly equipped
industrial automation world led to LP’s
development of a Real Time Extender
Technology in 1993 for the 16-bit Windows
OSs and Windows NT family. In 1994,
KUKA Roboter acquired LP Elektronik,
which in 2002 was renamed KUKA
Controls. Today Heinrich works with
KUKA as a strategic product manager.
KUKA Roboter GmbH, Augsburg, is an
IWKA Group company and is a worldwide
leading manufacturer of PC-based industrial robots. The company’s core competencies are the development, production,
and sale of industrial robots, controllers, software, and linear units. In 2002,
company sales were C250 million Euro.
For more information on KUKA Roboter
GmbH, call Jürgen Schulze, PR Manager,
at 0821-4533–3473 or visit the Web site at
www.kuka-roboter.de/english.
KUKA Roboter GmbH
Zügspitzstrasse 140
D-86165 Augsburg • Postfach 431364
D-86073 Augsburg
Tel.: +49-821-797-4000
Fax: +49-821-797-1616
E-mail: [email protected]
Web site: www.kuka-roboter.de/english
Information contained herein supersedes previously published specifications and is subject to change without notice.
Reprinted from PC/104 Embedded Solutions / Spring 2004