0

I am planning to implement Hiawatha web server on a non-linux platform which is uC/OS-II RTOS.

I need help to port the Linux dependent API's to RTOS platform.

Kindly let me if there are already build libraries that I can use to port Linux on RTOS.

Thanks in Advance

Clifford
  • 88,407
  • 13
  • 85
  • 165
Rohit Pai
  • 89
  • 9

1 Answers1

2

Any code that uses more than just the standard C library will require some porting effort - the extent to which non-standard and OS specific libraries and calls are made will determine the effort required or even the feasibility of such a port.

Most Linux code of any complexity will require a POSIX API and networking code will probably use BSD sockets. Multi-threaded code would likley use pthreads. uC/OS-II has neither of these; it deals with only scheduling, timing, synchronisation and inter-process communication; it is a scheduling kernel, not a full OS in the same sense as Linux - it does not even have a file system - a requirement of most Linux code. Of course adding additional libraries and extensions may provide some or all of what you may need.

Moreover uC/OS-II's simple one-thread-per-priority-level scheduler would make typical Linux multi-threaded code hard to schedule in the manner intended. Most RTOSes (including uC/OS-III) support round-robin/time-sliced scheduling of tasks at the same priority level, but uC/OS-II does not; possibly making it unsuitable for this task.

Something more sophisticated that uC/OS-II may be in order, or perhaps using code more suited to uC/OS-II perhaps. eCos for example is a far more complete RTOS for embedded systems; it is open-source and includes a POSIX API, file-system support and a socket API. It would be far easier to port Linux code to that. Equally there are many lightweight embedded webserver examples that are probably more suited to uC/OS-II and other simple RTOS or even no OS at all. LwIP for example is a TCP/IP stack for small embedded systems for which uC/OS-II ports exist and for which there are web server examples.

The point is that Linux are uC/OS-II are not comparable; one requires < 10Kb of code, the other has a minimal foot-print of about 4Mb! To get Linux code to run on such a system will require you to add a lot of additional code to provide the missing services, and it may not be feasible on your target platform.


[Edit: 08 July 2012]

Have you considered using Micrium's own TCP/IP stack and μC/HTTPs web-server add-on? It is likley to be better integrated to uC/OS-II and provide better performance than non-RTOS specific third-party code.

Clifford
  • 88,407
  • 13
  • 85
  • 165
  • I have a proven application running on UCOS-2 RTOS which user Rompager by AllegroSoft as a web server. But there is a performance issue with the web server, so I thought of porting Hiawatha on my UCOS-2 platform . I need to stick to UCOS -2 as my application is written on top of it. So I am left with only one option that is to change the web server. Kindly suggest any open source web server which can be implemented on UCOS-2 and provides rich user experience . – Rohit Pai Jul 04 '12 at 03:14
  • Performance may be a limitation of your hardware rather than Rompager. What are you running this on?. uC/OS=II is intended for and primarily used on resource constrained/low clock speed systems starting from 8 bit. Linux applications (even supposedly "light-weight" ones can assume the availability of tens-of megabytes of RAM, clock-speeds in excess of 200MHz, a complete network stack, MMU controlled memory, and a file-system; so I find it hard to imagine that porting a Linux application is the solution to your performance issues unless your system has similar resources. – Clifford Jul 08 '12 at 08:42
  • Our hardware has a 16 bit CPU, 64MB RAM and running at 200MHZ clock speed. Considering the above facts I doubt that the performance issue is the limitation of the hardware. Kindly share your opinion. Any suggestion on open source web server other than Allegro (Rompagear) is much appreciated. – Rohit Pai Jul 11 '12 at 02:51
  • Does it need to be open source? You are presumably already having to pay a license fee for uC/OS-II or at least will have to when you deploy commercially. If RomPager is itself open source, then you should be able to determine exactly where the performance issues lie and perhaps fix them. Often software designed for memory constrained systems are slow due to the use of necessarily small buffers for example. Does your code run from RAM or ROM? At 200 MHz running from ROM is almost certainly much slower. I am not sure this problem has had sufficient analysis to justify your solution. – Clifford Jul 13 '12 at 20:09