Setting the stack size for an Ada main program? - VxWorks

This is a discussion on Setting the stack size for an Ada main program? - VxWorks ; Complete newbie to this group. I am compiling some code using GNAT for VxWorks. The code has been previously compiled using Apex for VxWorks. I think under Apex there is a pragma to set the stack size for the main ...

+ Reply to Thread
Results 1 to 5 of 5

Thread: Setting the stack size for an Ada main program?

  1. Setting the stack size for an Ada main program?

    Complete newbie to this group.

    I am compiling some code using GNAT for VxWorks. The code has been
    previously compiled using Apex for VxWorks.

    I think under Apex there is a pragma to set the stack size for the main
    program.

    How do i do this under GNAT?

    If i was writing pure VxWorks code, I think i can set the stack size in
    the taskSpawn call?

    However i am compiling exisitng high level Ada code and cross compiling
    it. What techniques can i use at this level to set the stack size.

    Examples, some linkers allow switches for stack size, eg windows where
    gnatmake myprog -Wl,-stack_size, 0x40000, or for unix setenv
    GNAT_STACK_LIMIT, it goes on....

    Whats the best way to achieve this on VxWorks???

    Stuart Clark


  2. Re: Setting the stack size for an Ada main program?

    The most straight forward method in the Ada code is to use the
    following

    task type MY_TASK_TYPE;
    for MY_TASK_TYPE'STORAGE_SIZE use 20000;
    MY_TASK : MY_TASK_TYPE;

    It will also keep your code portable as oppose to setting it directly
    from vxworks.
    Be aware that the 20000 above will not be the resulting stack size
    there is an overhead- so the resultant stack size is approximately
    19200.

    Regards


  3. Re: Setting the stack size for an Ada main program?


    stuart clark wrote:
    > Complete newbie to this group.
    >
    > I am compiling some code using GNAT for VxWorks. The code has been
    > previously compiled using Apex for VxWorks.
    >
    > I think under Apex there is a pragma to set the stack size for the main
    > program.
    >
    > How do i do this under GNAT?
    >
    > If i was writing pure VxWorks code, I think i can set the stack size in
    > the taskSpawn call?
    >
    > However i am compiling exisitng high level Ada code and cross compiling
    > it. What techniques can i use at this level to set the stack size.
    >
    > Examples, some linkers allow switches for stack size, eg windows where
    > gnatmake myprog -Wl,-stack_size, 0x40000, or for unix setenv
    > GNAT_STACK_LIMIT, it goes on....
    >
    > Whats the best way to achieve this on VxWorks???
    >
    > Stuart Clark


    For VxWorks, the stack size of your Ada main is the stack size of the
    task that it was called in. Thus, if you call your main via taskSpawn,
    it is the stack size specified in that call. If you don't want to
    worry about having the specify the stack size for main, leave your main
    as a null statement, and create a task that will act as your real main.
    This way you can give it a stack size in a standard way, and your
    actual main will not terminate until that task does.

    REH


  4. Re: Setting the stack size for an Ada main program?

    Thanks for the advice, i assume we use a taskSpawn to kick off our Ada
    main. If so the we can simply put stack-size in the call to taskSpawn.

    Do you know of any linker/binder options for VxWorks like the Windows

    gnatmake my_prog -Wl,-stack_size,0x40000

    i have seen a gnatbind option of -dnn[k|m] but that sets the default
    task stack size, i assume this is for all tasks that dont have a pragma
    storage_size().

    Do you know if this also sets the main program, ie primary/environment
    task???

    please xcuse any "dumb" questions, i havent done a lot of VxWorks, and
    not used gnat with VxWorks. I have done a little VxWorks but using
    GreenHills.

    You probalby know this but i found an option to adjust the stack size
    in the debugger, ie
    >set -wtx-task-stack-size .....


    Once again thanks for the help.


  5. Re: Setting the stack size for an Ada main program?


    "stuart clark" wrote in message
    news:1141954254.178543.53820@v46g2000cwv.googlegro ups.com...
    > Thanks for the advice, i assume we use a taskSpawn to kick off our Ada
    > main. If so the we can simply put stack-size in the call to taskSpawn.
    >
    > Do you know of any linker/binder options for VxWorks like the Windows
    >
    > gnatmake my_prog -Wl,-stack_size,0x40000
    >
    > i have seen a gnatbind option of -dnn[k|m] but that sets the default
    > task stack size, i assume this is for all tasks that dont have a pragma
    > storage_size().
    >
    > Do you know if this also sets the main program, ie primary/environment
    > task???
    >
    > please xcuse any "dumb" questions, i havent done a lot of VxWorks, and
    > not used gnat with VxWorks. I have done a little VxWorks but using
    > GreenHills.
    >
    > You probalby know this but i found an option to adjust the stack size
    > in the debugger, ie
    > >set -wtx-task-stack-size .....

    >
    > Once again thanks for the help.
    >

    It is not necessary to set the stack size for a Windows program. The OS
    handles it automatically. If there is a way to manually handle it, I don't
    know. I haven't done any Windows programming in 10 years. The mind is the
    first thing to go...

    You should ask in the comp.lang.ada group. There are a lot of smart people
    there that know GNAT and they don't get upset about OS-specific questions.

    REH



+ Reply to Thread