Microsoft and the embedded systems

In this article, I try to introduce the embedded system offered feature to the C# developer


The development world doesn't cover only the web applications, the windows applications and the mobile applications but also covers what it is called by the embedded system field. So the first question what is the embedded system?

What is the embedded system?

The embedded systems are an arrangement of soft programs and hardware or electronic devises and let's say combined small computers which are designed to leverage a very specific task, such as the programmed micro chipsets those found everywhere in the nature. They vary form no user interfaces such as programs those make command the stepper motor to those found within the vender machines.

What is the difference between the embedded system and the personal computer?

The personal computer is designed to leverage different tasks in a very general manner, at the contrast of the embedded system which is designed to leverage a much reduced set of tasks. Even the personal computer is composed by several embedded systems. Look at the peripherals of your computer, your keyboard, your rooter, your screen and even the hard drive, each one contains an independent embedded system that has a specific mission. At the other hand the embedded system are limited when comparing with the computer systems like the OS because the embedded system software couldn't be compatible within any kind of materials and devices, meanwhile an operating system could fairly be installed on every computer without compatibility problems.

Other difference that should be said in this context, is in fact that embedded systems are using micro chipsets of 8 bits and at least 16 bits with a small capacity of memory that is almost presented as flashable memory or as the EPROM (Erasable Programmable Read Only Memory) or EEPROM(Electric Erasable Programmable Read Only Memory) meanwhile the computers are using microprocessor that vary from 32 bits to 64 bit with a memory cache in addition to a big RAM (Random Access Memory) and an auxiliary memory such as the hard disk where one can store files.

What is common between the embedded system and the personal computers?

Well, in spite of differences between the two concepts there are a common characteristic between the both. It is in fact the Software programming. The embedded system programs could be leveraged using low level programs like assembler or the CIL in case of .Net platform and they can also be programmed using high level programs such as C, C++, Java and even C#. Yes C# why not?

The same process is respected when generating programs, first the preprocessor try to bring all needed resources and then the compiler compile the program in to assemblies then those assemblies are combined or grouped using a linker to finally obtain a running process within the machine, the only final step within the embedded system over the computer systems is in fact flashing the final executable program into micro chip memory.

Who is the target of such programming tasks?

The programs are targeting the microprocessor as it is a kind of Maestro of the rest of the electronic devices and the brain that commands the entire engine or automate regardless of its nature or the different tasks that it will have as mission.

What is a Microprocessor?

The microprocessor or CPU "central processing unit" as it is technically called is mainly composed by an IC that stands of integrated circuit, a memory cache or EPROM/EEPROM and an input/output interface.



Figure 1

There are a variety of microprocessors and they are categorized in several families

  • The 8 bit microprocessors

  • The 16 bit microprocessors

  • The 32 bit microprocessors

  • The 64 bit microprocessors

  • The multi core microprocessors

  • The RISC(Reduced Instruction Set Computer)

What is a Microcontroller then?

If it is a microprocessor then why we called it microcontroller? Logically, different name means different object. In fact, at the beginning microprocessors are used in a several domains and they covered practically all fields where automation capacities are needed. But later, the industrials realized that there is no need of this huge computational power in certain domains, and therefore a new kind of microprocessors with reduced capacities is coming to the world, those derived types are designed to leverage punctual missions instead of general purposes, and nowadays they could be found everywhere around us. And after a certain period they gained their own independent identity and they have been calling MCU instead of CPU.

The microcontrollers, as their name indicates, are designed not mainly for computational purposes but for controlling and instructional purposes, they integrate a small CPU, read/write memory for data storage and Flash memory for permanent data program or an erasable programmable Read only memory EPROM as well as input/output entries called ports, in addition to that they represent less rapidity and less power consumption than their ancestors namely the microprocessors, thus, they are more convenient for the embedded system context. Another characteristic that makes a difference between Microcontrollers and ordinary microprocessors is in fact that microcontrollers will play the role of an embedded computer; hence they are supposed to be more vigorous, I mean they are able to face extreme conditions like the cold, heat, certain degree of pressure and so forth.



Figure 2

What is the measurement unit, is it the hertz?

No, the hertz is not the main measurement unit. It is the MIPS that stands for "Million Instructions Per Second" and which is used to test or recognize the computing performance of a given microprocessor. In fact the microprocessor performance is measured by the number of MIPS leveraged in a determined period. To get the information about the performance a set of "bench mark" are usually used. They are programs specially used to provide such measurements.

What does Microsoft do within this domain?

Up to now, Microsoft offer was made up of 4 solutions chosen according to architecture and the required functionalities:

Windows Embedded Standard is intended for the embedded systems of x86 architecture. It is a modular version of Windows XP. It provides the full Win32 API for x86 processors. The system can be configured to install only the necessary components just the minimal size for a functional system.

 

It constitutes a solution for profiting of the last technological evolvements particularly in term of user interface, security or connectivity through networks. 

 

It is specially designed for the Compact world, pocket PC and cellular, It has several hundreds of components, covering connectivity with and without wire, the applications multi-media in addition to an advanced management of power or energy

 

Windows Embedded PoSReady is a specialization of Windows Embedded Standard specially intended for the points of services, and other automated terminals. It is issued from the common endeavor of Microsoft with its partners such as IBM, NEC and Fujitsu

Does .Net platform exist for such domain?

Yes, in addition to the standard .Net framework, the compact .Net framework and Silverlight SDK, Microsoft provides a subset of the .Net framework especially leveraged for micro applications and embedded systems.

And what could be said about languages?

Until now, there is the possibility to leverage managed code only with C# which is enough in my point of view, but I think that it will be possible in the near future to use other languages, I mean other than C# like VB and J#, but the essential is the architecture and the set of possible services that could this framework provide.



Figure 3

You can get the .Net Framework micro version from this link
http://www.microsoft.com/netmf/download/default.mspx

The .Net framework micro is principally covering those fields:

  • Sensor networks

  • Robotics

  • GPS navigation

  • Wearable devices

  • Medical instrumentation

  • Industrial automation devices

The .Net Framework micro architecture could be divided into 4 levels from the physique level to the height abstraction level.




Figure 4

What is the HAL?

The HAL stands for Hardware Abstraction Layer and I can resume it in one word, it is the driver, any driver such as the motherboard driver or the sound card driver that stands between the physical and the medium software level, therefore it depends on the kind of the hardware device going to be programmed. In this case the developer should either write its own driver by himself or buy the device with its driver. The used code to leverage such driver is generally the famous grandfather, I mean the nostalgic C or the father and I mean the C++. Indeed, a smart question could be asked in this context which is; OK well when I go ahead to program a device do I need an operating system such as Windows or at least the OS kernel as any of the .Net framework those I know need basically an OS to be operational? Good question but the .Net Framework micro doesn't need an OS, only what it needs is a driver that enables it to communicate with the physical level.

What is the PAL?

The PAL is a set of C++ functions those could play the role of the middleware that tie the low level environment with the height or abstract level. It communicates with both sides; the hardware and the driver from one side and the common language runtime from the other side and it provides the interconnection of the two different worlds.

What is the CLR version used in this context?

As the field changes completely from the software development for PC to the embedded system, then the CLR is optimized to fit the embedded system environment requirements, as mentioned in the MSDN, it occupies only 390 kb when all the functionalities are being used. All programming and debugging activities could be leveraged from within Visual Studio like any other applications.

Again as mentioned in the MSDN, the common language runtime , or let's be more determinate, the run time environment includes the most known features, namely the known reference and value types, the reflection, the GC, Exception handling and so forth. But there are also some limitations when comparing with standard CLR due to constrains of the embedded environment reduced memory capacity and all the limitations are targeting the reduce of the RAM and the ROM cross-references among assemblies, as an example for that, there aren't virtual tables for methods resolutions for saving RAM.

So what is the first step through this new world?

Once the .Net Framework micro is successfully installed, open the Visual Studio



Figure 5

You can observe that a new node is added to the solutions' tree, and there are four types of projects

  • Class library

  • Device emulator

  • Console application

  • Windows application

The most important namespaces are Microsoft.SPOT, the Microsoft.SPOT. Hardware and the Microsoft.SPOT. Emulator .

And what else?

The Microsoft Robotics Developer Studio is dedicated to robotized solutions programming. This integrated development environment is intended to facilitate the simulation programming and optimize them by minimizing the draw backs and limitations caused by the eventual differences between the simulation and the real world as it enables realize virtual simulation closely near the advanced physics simulation running within real time constraints.

This IDE is available in three editions, namely the Standard edition for the professional developers, the Academic Edition for the students and Express Edition for impassioned users like me.

The express edition is downloadable from this link

http://www.microsoft.com/downloads/details.aspx?FamilyID=84c5b49f-0f9c-4182-a267-a951328d3fbd&displaylang=en

And then let's start to satisfy our curiosities

Good Dotneting!!!