We have a vxWorks application that we would like to deploy either as a kernel module, or as a Real-Time process.
Is there a way to do this from the same source file, or do we have to create one file for the kernel module and another for the RTP?
We have a vxWorks application that we would like to deploy either as a kernel module, or as a Real-Time process.
Is there a way to do this from the same source file, or do we have to create one file for the kernel module and another for the RTP?
The easiest solution would be to have a single file that can be compiled either as a kernel module, or as a Real-Time Process. It probably should look something like this:
void MyModule_Init()
{
// Initialize the module
...
}
...
#ifdef __RTP__
int main(...)
{
// RTP Main just invokes the Module's initialization
MyModule_Init();
}
#endif
The __RTP__ macro is defined if the build is for a RTP environment
The _WRS_KERNEL macro is defined if the build is for a kernel environment.
With those two macros, you can have code compiling for both environment.