Jaa


Application development for embedded devices

[The following article is authored by one of the Windows Embedded MVPs (Most Valuable Professionals). Our MVPs have a heavy background in Embedded systems and are a great repository of information on Windows Embedded products. We’re providing this space on our team blog as a service to our readers by allowing MVPs to share some of their knowledge with the rest of the community.]

This post is intended as the introduction to a new series of posts related to application development on embedded devices. In all device projects developing the OS is just one part of the story. Completing the solution there are a lot of requirements to consider as well as best practices to apply from the application’s perspective. Very often such devices need to be integrated into backend infrastructure, too.

Development Technology Choices

Windows Embedded Standard 2009 systems, which are based on a componentized desktop operating system, are much closer to a normal PC than other embedded systems, for example Windows CE devices. Therefore, the majority of common desktop development technologies can be leveraged on these devices, bearing in mind that the required infrastructure for the targeted technology needs to be included into the OS image when it is built in Target Designer. The most prominent technologies for the Microsoft platform are:

  • Managed Code Development (C++, C#, VB.NET)
    • .NET Framework (1.0-3.5)
    • ASP.NET
    • .NET Compact Framework(1.0-3.5)
    • Silverlight
  • Native Code development in C++ leveraging
    • MFC
    • ATL
    • COM/DCOM
  • Scripting
    • HTA Applications
    • ASP (classic)
    • Windows Scripting Host
    • Batch Files

Managed Code

If development efficiency and time to market are important requirements in your project, using the .NET Framework is undisputedly the best choice. This is because of the availability of rich development framework classes as well as the great tools support with Visual Studio. In Standard 2009 the .NET Framework support is achieved by including required framework components into the image.

image

The components are located in the Software\System Services\Other node of the component catalog. Newer .NET versions naturally have the newest technologies on board, but are heavier in footprint than earlier versions, which might be a problem in smaller embedded OS images. Overall, when building connected devices, the .NET development framework offers pre-factored, state-of-the-art class libraries to access web services (WCF), create compelling user interfaces (WPF) and workflows (WF). When looking at headless systems ASP.NET might be an interesting approach to generate remote user interfaces for normal or administrative use.

Cross-platform targeting

If OEMs leverage the Windows Embedded platform for a complete device family, which includes Windows Embedded Compact and Windows Embedded Standard 2009 devices, there is an interesting option of code sharing between these systems using the .NET Compact Framework. It is not so publicly known that the .NET Compact Framework provides a runtime for x86 systems, as well. If developers do not target Windows Embedded Compact- specific APIs or class libraries, and uses conditional compilation for these, CF code could just work on a Windows Embedded Standard 2009 system that includes the .Net Framework componen. There might be other issues to handle e.g. different screen sizes and resolutions dependent on the differences in hardware between the devices.

One of the newest family members of the managed code family is Silverlight, which comes in version 1.0 with Standard 2009. It can be leveraged to create great web-based multimedia experiences even on low bandwidth connections. One can hope that more recent versions of Silverlight will be included in subsequent releases of Standard 2009 – I know the team is considering it as one of the out-of-band technologies, but no final decisions or time frame have been released on this.

Native Code

There are a lot of benefits to using managed code, and performance is more than acceptable for over 90% of the applications developed on this embedded platform. But, if one needs to have high-end performance e.g. for video decoding or high-end graphics, native code still is the way to go. On Standard 2009 all available desktop technologies for native code can be leveraged, such as ATL, MFC and COM/DCOM. The problem with using managed code is development efficiency. It takes significantly longer to create a native application and requires thorough testing to avoid memory leaks etc. that could endanger the stability of an embedded device in mid- to long-term scenarios.

An approach to combine the benefits of the two worlds would be to use native code for the high-end performance scenarios and managed code for nontime-critical UI or data handling functionality, leveraging the PInvoke interoperability bridge between managed and native code offered in all .NET Frameworks. This approach works fine, but requires some additional work in marshalling data types back and forth. PInvoke.net , a website focusing on Interop is able to provide valuable help to access Win32 APIs from managed code.

image

Native code runtime support in Standard 2009 is found below the “Application Support” node in the component catalog.

Scripting

Script code is an essential asset when it comes down to managing and maintaining embedded devices. There is very good integration between the Windows Scripting host and the Windows Management Instrumentation (WMI). VBScript, for example, can be leveraged to create classic ASP pages on an embedded device as well. It provides similar, but not as sophisticated, options as ASP.NET for creating remote UIs, but with much lighter footprint.

image

The Windows Scripting Host is part of the “Windows Script Engines” component located under the “Application Support” node, while classic ASP support is part of the “IIS Web Server” component.

image

If you do not like VBScript, the scripting engine provides a JScript option, as well.

HTA applications
You can create compiled HTML applications using script code. They are called HTA-Applications and MSDN library has a good starter article on this technology. HTA applications provide low footprint, and offer the infrastructure to create basic UI functionality on smaller OS images.

Batch files

And finally, there are batch files that leverage the Windows Command Interpreter (CMD.exe) which, although a technology that has existed for a long time, still provides a valuable means to build, test and manage embedded systems.

- Alexander

Alexander Wechsler

Wechsler Consulting

www.wechsler-consulting.de

Technorati Tags: XPe,Standard 2009,.NET

Comments

  • Anonymous
    May 08, 2009
    PingBack from http://asp-net-hosting.simplynetdev.com/application-development-for-embedded-devices/

  • Anonymous
    May 10, 2009
    Is there Java VM available for Windows Embedded?

  • Anonymous
    May 11, 2009
    Hi, there is no dedicated VM for WES, but if you have a functional image you most probably will be able to install a desktop VM. Windows Installer Service needs to be included in the iamge to make this possible. Alexander