• Create a bootable application

    From textsunil@gmail.com@21:1/5 to Rocketman on Wed Aug 2 23:16:07 2017
    On Thursday, February 12, 2009 at 1:31:11 AM UTC+5:30, Rocketman wrote:
    On Feb 11, 7:54 am, "Michael R. Kesti" <michaelke...@comcast.net>
    wrote:
    Rocketman wrote:
    I think this is an easy question but I couldn't find it in the manual. >I'm working with VxWorks 5.5 Tornado 2.2.

    I have an image project that builds the kernel that I want.  I also
    have a DKM project to build the application that I want.  Now I'd like >to combine the two so when my system boots it automatically starts my >application.

    I think I just need to call the application from usrAppInit, however,
    how do I link the DKM's .out into the kernel?  Do I need to build a >library first? etc.

    Can someone describe the steps or point me to some documentation?

    Many Thanks.

    John.

    Maybe you don't need to statically link your application with your
    VxWorks image.  If you can copy the application's .out file to the
    same file system on which you store the VxWorks image then you could
    code usrAppInit() to use loadModuleAt() to load the application in
    memory, symFindByName() to find the application's entry point, and
    finally call that entry point.


    Michael,

    Thanks that's an interesting solution. I'll have to give it a try.

    I found information on other ways to do this but had limited success:

    1. Add the path to the .out file as a value to the EXTRA_MODULES
    macro.
    Unfortunately when I rebuilt my kernel I got linking errors; 'multiple definition of _ctors and _dtors'
    Didn't try to solve this one.

    2. Use a boot script to load the module. I ran into the problem of Relocation value does not fit in 24 bits (I'm on a PowerPC with 128MB
    of ram)
    The normal fix of using the -mlongcall flag with the compiler didn't
    work.
    I haven't tried other fixes which basically fool the system to think
    there's less memory when loading the module.

    3. Combine the kernel image project and DKM project into one big
    kernel image project so the application is already built into the
    kernel.
    This is what I did. I don't like having one big project but it works.

    HTH anyone else asking this same question.

    Hi,
    I tried the 1st method and i am getting the same "Redeclaration of _ctor" and "_dtor" error, Any idea how to resolve it?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Sukum@21:1/5 to Rocketman on Fri Aug 4 02:35:15 2017
    On Thursday, February 12, 2009 at 1:31:11 AM UTC+5:30, Rocketman wrote:
    On Feb 11, 7:54 am, "Michael R. Kesti" <michaelke...@comcast.net>
    wrote:
    Rocketman wrote:
    I think this is an easy question but I couldn't find it in the manual. >I'm working with VxWorks 5.5 Tornado 2.2.

    I have an image project that builds the kernel that I want.  I also
    have a DKM project to build the application that I want.  Now I'd like >to combine the two so when my system boots it automatically starts my >application.

    I think I just need to call the application from usrAppInit, however,
    how do I link the DKM's .out into the kernel?  Do I need to build a >library first? etc.

    Can someone describe the steps or point me to some documentation?

    Many Thanks.

    John.

    Maybe you don't need to statically link your application with your
    VxWorks image.  If you can copy the application's .out file to the
    same file system on which you store the VxWorks image then you could
    code usrAppInit() to use loadModuleAt() to load the application in
    memory, symFindByName() to find the application's entry point, and
    finally call that entry point.


    Michael,

    Thanks that's an interesting solution. I'll have to give it a try.

    I found information on other ways to do this but had limited success:

    1. Add the path to the .out file as a value to the EXTRA_MODULES
    macro.
    Unfortunately when I rebuilt my kernel I got linking errors; 'multiple definition of _ctors and _dtors'
    Didn't try to solve this one.

    2. Use a boot script to load the module. I ran into the problem of Relocation value does not fit in 24 bits (I'm on a PowerPC with 128MB
    of ram)
    The normal fix of using the -mlongcall flag with the compiler didn't
    work.
    I haven't tried other fixes which basically fool the system to think
    there's less memory when loading the module.

    3. Combine the kernel image project and DKM project into one big
    kernel image project so the application is already built into the
    kernel.
    This is what I did. I don't like having one big project but it works.

    HTH anyone else asking this same question.


    I found a solution to the "multiple definition error". Need to specify the DKM application's partial image .o object file path to the EXTRA_MODULES Macro rather than ".out" path. If for example the application is "myApp" , "myapp_partialImage.o" path
    should be specified in the Macro. Multiple paths can be specified in the Macro with the space if Multiple app needs to be linked

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Sukum@21:1/5 to jab...@hotmail.com on Mon Aug 7 00:36:47 2017
    On Thursday, February 19, 2009 at 8:01:43 PM UTC+5:30, jab...@hotmail.com wrote:
    On 11 Feb., 21:01, Rocketman <jmm1...@gmail.com> wrote:
    On Feb 11, 7:54 am, "Michael R. Kesti" <michaelke...@comcast.net>
    wrote:



    Rocketman wrote:
    I think this is an easy question but I couldn't find it in the manual. >I'm working with VxWorks 5.5 Tornado 2.2.

    I have an image project that builds the kernel that I want.  I also >have a DKM project to build the application that I want.  Now I'd like >to combine the two so when my system boots it automatically starts my >application.

    I think I just need to call the application from usrAppInit, however, >how do I link the DKM's .out into the kernel?  Do I need to build a >library first? etc.

    Can someone describe the steps or point me to some documentation?

    Many Thanks.

    John.

    Maybe you don't need to statically link your application with your VxWorks image.  If you can copy the application's .out file to the
    same file system on which you store the VxWorks image then you could
    code usrAppInit() to use loadModuleAt() to load the application in memory, symFindByName() to find the application's entry point, and finally call that entry point.

    Michael,

    Thanks that's an interesting solution.  I'll have to give it a try.

    I found information on other ways to do this but had limited success:

    1. Add the path to the .out file as a value to the EXTRA_MODULES
    macro.
    Unfortunately when I rebuilt my kernel I got linking errors; 'multiple definition of _ctors and _dtors'
    Didn't try to solve this one.

    2. Use a boot script to load the module.  I ran into the problem of Relocation value does not fit in 24 bits (I'm on a PowerPC with 128MB
    of ram)
    The normal fix of using the -mlongcall flag with the compiler didn't
    work.
    I haven't tried other fixes which basically fool the system to think there's less memory  when loading the module.

    3. Combine the kernel image project and DKM project into one big
    kernel image project so the application is already built into the
    kernel.
    This is what I did.  I don't like having one big project but it works.

    HTH anyone else asking this same question.

    Hi,
    have you tried this in the usrAppInit.c?

    The problem is that the entry point of your application cannot be
    resolved when the VxWorks image is loading. So write a function to
    resolve the entry point of your application after loading it. That
    way, there will be no unresolved identifiers when the VxWorks image is loading, and then when the image starts executing in usrAppInit.c,
    your function will cause a jump to the entry point of your
    application. We have the following functions defined in usrAppInit.c.
    Below, "myEntryPointSymbol" will depend on how your linker puts
    together the symbols. (For example, if one were creating the app with RoseRealTime and Tornado2.02, the symbol "_rtsMain" is generated for
    the entry point rtsMain() ). Generally, as it might be in your case,
    is it "_main"???

    cheers.

    LOCAL STATUS loadApplicationModule ( char *fileName ){
    int fd = open(fileName, O_RDONLY, 0);.
    MODULE_ID moduleId;

    printErr("loading application module %s...", fileName);
    if( fd != ERROR ){
    moduleId = loadModule(fd, LOAD_ALL_SYMBOLS);
    close(fd);
    } else {
    printErr("file open error %08X\n", errno);
    }

    if( moduleId != NULL){
    FUNCPTR startfunction;
    SYM_TYPE symtype;
    STATUS rc;

    printErr("search entry point in module %08X...\n", moduleId );

    rc = symFindByName( sysSymTbl, "myEntryPointSymbol", (char **) &startfunction, &symtype);

    if ( rc == OK ){
    printErr("starting at %p %d\n", startfunction, symtype);

    startfunction("myApp", "-oblisten 35518", "-URTS_DEBUG=quit");

    } else {
    printErr("entry point not found error %08X\n", errno);
    }
    } else {
    printErr("module load error %08X\n", errno);
    }

    return (OK);
    }

    void start_myApplication(){
    taskSpawn(
    "myApplication",
    TASK_PRIORITY,
    TASK_OPTIONS,
    TASK_STACKSIZE,
    loadApplicationModule,
    (int) "myOutFileNameWithPath",
    0, 0, 0, 0, 0, 0, 0, 0, 0);
    }


    Hi, I tried this method to load and call the entry point function from usrAppInit(), but the open() call was failing. so i added a forever loop to give it a try for multiple times and i see that the first call to OPEN() fails and is success on the
    second call. But the problem here is that it is taking about one and a half minute to get the OPEN() call success and call the entry point after the boot up. Any idea how to get the application call immediately after boot up without any delay?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)