Porting Linux Applications to VxWorks RTOS

Tips for Porting Linux Application to VxWorks: 

1. There is no notion of a process (in the POSIX sense), there is no notion of sharing of locks (mutexes) and condition variables between processes.  As a result, the POSIX symbol _POSIX_THREAD_PROCESS_SHARED is not defined in this implementation, and the routines pthread_condattr_getpshared( ), pthread_condattr_setpshared( ), pthread_mutexattr_getpshared( ) are not implemented.

2. There are NO processes in VxWorks, fork( ), wait( ), and pthread_atfork( ) are unimplemented. If you need to spawn a task for that using the 'taskSpawn' routine.

3. VxWorks does NOT have password, user, or group databases, therefore there are no implementations of getlogin( ), getgrgid( ), getpwnam( ), getpwuid( ), getlogin_r( ), getgrgid_r( ), getpwnam_r( ), and getpwuid_r( )

4. VxWorks programming discourages to use global variables and if in case you need to use the global variables ( global scope ,file scope ) make sure you initialize those before your application program starts and make sure use to use the unique variable names.This is because of the fact that vxWorks memory model is flat,so you need to be extra careful in using the global variables.

5. The 'main' routine does not work in vxWorks case, We need to write your own wrapper function to parse the command line arguments that you pass to your program from the interactive shell.

6. It is recommended to use the separate memory partition for your application if your application demands more frequent use of dynamic memory allocations and frees.

7. It is better to use the static memory for small memory allocations because vxWorks mem library does not use best fit  algorithm for its memory allocations and it can lead to memory fragmentation.

ref:



Porting RTOS drivers to Linux - http://www.linuxjournal.com/article/7355

VxWorks API to Linux - http://v2lin.sourceforge.net/