How to Develop an Application for VxWorks Using RDM

RDM examples written in C use the RDM_STARTUP_EXAMPLE macro. The argument to this macro must match the name of a named main function as shown below. The tims example uses this macro as follows:

int32_t EXTERNAL_FCN tims_main(
    int32_t argc,
    const char *const *argv)
{
    ...
}
RDM_STARTUP_EXAMPLE(tims)

You also have the option of compiling in a hook for the RDM_STARTUP_EXAMPLE. Compile in a hook like this:

-DPSP_STARTUP_HOOK=chdir("/ram0");

This will change the current working directory. This is most convenient when we launch this from WorkBench using a debug connection. WorkBench does not give you the option of specifying a current working directory for downloadable kernel modules. It must always be set programmatically.

Using VxWorks Kernel Modules

The RDM_STARTUP_EXAMPLE macro as used above expands to a function with the following signature (this signature matches the requirements for sp and taskSpawn):

int32_t tims(
    int32_t a1,
    int32_t a2,
    int32_t a3,
    int32_t a4,
    int32_t a5,
    int32_t a6,
    int32_t a7,
    int32_t a8,
    int32_t a9,
    int32_t a10);

Use this function as the entry point to the tims example. The tims example does not take any argument. You should therefore pass in 0 as the first and only argument to this function.

tims 0

This function takes care of initializing the RDM platform support layer (psp_init ()), builds up the argument list for the named main function, calls the named main function, and terminates the platform support layer (psp_term ()).

Examples and tools that do take arguments should have the arguments passed in as strings - one string for each parameter. You always need to pass in 0 after the last argument unless all ten arguments are specified.

Using VxWorks RTP

The RDM_STARTUP_EXAMPLE macro as used above expands to a normal main function under VxWorks RTP. This is just like many other host operating systems.