Friday, February 25, 2011

Running uCOS-III under Microsoft Windows

uCOS-III the Real-Time Kernel

uCOS-III is Micrium's newest RTOS, designed for developers who need to save time on their current and next embedded sytem projects. In addition to the features inherent in μC/OS-II, μC/OS-III also manages an unlimited number of application tasks, and features an interrupt disable time of near zero. For more details, you can check its data sheet.

uCOS-III Win32 Simulation

Win32 port allows uCOS-III to run under Microsoft Windows. The port relies on Windows' process and thread management features; the uCOS-III Win32 port does not turn Windows into a real-time operating system! It was developed for didactic purposes to teach the basics of real-time operating systems with an insight to OS internal implementation. This approach was chosen, because it is much easier access PCs rather than to proprietary embedded systems. Powerful PC-based development tools like Microsoft Visual Studio are available free of charge as compared to costly embedded system cross-compilers and debuggers. Thus real-time system mechanisms can be studied with uCOS-III under Win32 providing a soft real-time-environment on PCs. If the basic functionality of the application is working correctly, the application can be easily ported to an embedded system later in the lab.

Figure 1 shows the relationship between the user application, uCOS-III the underlying Windows system.

Figure 1: Application / uCOS-III / Windows Vista Relationship

As a result of this hierarchy, µC/OS-III tasks are really Windows threads and their stacks are converted to Windows thread stacks. The system ticker is driven by the high resolution multi-media timer if WIN_MM_TICK is defined in os_cpu.h. Otherwise it is driven by sleep(), the system coarse timer. A more realistic real-time effect can be achieved by using the multi-media timer since it has finer granularity (1ms) than the system coarse timer.

Critical sections are implemented using the Win32 API.

Fortunately, the underlying architecture is transparent to the application programmer and all µC/OS-III application code can utilize various features using traditional documented µC/OS-III function calls.

Since µC/OS-III is an infinite loop by nature, it should be noted that the processor utilization under windows will remain close to 100% while µC/OS-III is running. This is normal operating behavior for infinite loop consol based programs under Windows.

uCOS-III Win32 Simulation with Windows
To run this test, you have to install Microsoft Visual C++ 2008 Express. You can get it here.

Once you open the project, it will look as shown in Figure 2.

Figure 2: MS Visual C++ 2008 Express Project Structure

The directories used are:
  1. uC/CPU: generic and Win32 specific uC/CPU headers
  2. uC/LIB: compiler independent uC/LIB library functions
  3. BSP: header files for BSP
  4. uCOS-III: version 3.01.2 of uCOS-III
  5. App: example application
After building the project, once you run it you get the output shown in Figure 3.


Figure 3: uCOS-III for Windows


7 comments:

  1. Amr,

    Where did you get the port for Windows to uCOS-III? Did you write it yourself?

    I can't seem to find the port at Micrium website?

    Is it possible for you to post a link to the port, if you have it?

    Best Regards

    Mikael Wiberg

    ReplyDelete
  2. Micrium will release an official new port for windows for both ucos-ii and ucos-iii on their website soon.
    It will be within next week isA.

    ReplyDelete
  3. Hi Amr Ali,
    Regarding about the port for Windows to uCOS-III, it still cannot find. Please post some links,

    Regards,
    pak

    ReplyDelete
  4. I ll do a tutorial soon how to port ucos-iii isA

    ReplyDelete
  5. where is the port for x86 available. I cant find it in micrium website

    ReplyDelete
  6. I am not following if they released it or not

    ReplyDelete
  7. Embedded system training: Wiztech Automation Provides Excellent training in embedded system training in Chennai - IEEE Projects - Mechanical projects in Chennai. Wiztech provide 100% practical training, Individual focus, Free Accommodation, Placement for top companies. The study also includes standard microcontrollers such as Intel 8051, PIC, AVR, ARM, ARMCotex, Arduino, etc.

    Embedded training in chennai
    Best Embedded training in chennai
    Embedded System training in chennai
    Best Embedded training in chennai
    Embedded training institute in chennai
    Embedded projects in chennai
    VLSI training in Chennai

    ReplyDelete