intVecBaseGet( ) related simple question - VxWorks

This is a discussion on intVecBaseGet( ) related simple question - VxWorks ; Hi Guys I am still learning both C and VxWorks so I keep bumping into trivial issues which aren't trivial for me. Anyway the following code runs perfectly nicely the first time I do sp test but the second time ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: intVecBaseGet( ) related simple question

  1. intVecBaseGet( ) related simple question


    Hi Guys

    I am still learning both C and VxWorks so I keep bumping into trivial
    issues which aren't trivial for me.

    Anyway the following code runs perfectly nicely the first time I do
    sp test

    but the second time it gives me a page fault, as follows.

    -> sp test
    task spawned: id = 5f6c27c, name = s1u0
    value = 100057724 = 0x5f6c27c

    -> sp test
    task spawned: id = 5f6c27c, name = s1u1
    value = 100057724 = 0x5f6c27c
    ->
    Exception number 14: Task: 0x5f6c27c (s1u1)

    Page Fault
    Program Counter: 0x0012daa6
    Status Register: 0x00010246
    Error Code : 0x00000002


    My eventual goal is to attach my instrumentation code to Timer Tick
    Interrupt. Am I overlooking something, thanks in advance.

    --


  2. Re: intVecBaseGet( ) related simple question

    One usual suspect is that sp() gives you a pretty small default stack
    size. The first sp may result in some stack corruption that ultimately
    results in the second failure.

    You can test this, by explicitly spawning with a larger stack.


  3. Re: intVecBaseGet( ) related simple question


    > Thanks for the reply Fred
    >
    > But here is something strange which I found out by experimentation. My
    > lack of experience with pointers might be the result of this issue.
    >
    > void test(void)
    > {
    > int *fp;
    > /**fp = intVecBaseGet();*/
    > printf("\n%d/n", intVecBaseGet());
    > }
    >
    > The above code runs without any problem, no matter how many times I do
    > sp test but if I comment out the assignment to *fp the problem
    > returns.
    >
    >
    > NOTE: I did try it the way you suggested Fred but without any luck,
    > the driver function ran perfectly first time and then crashed
    > the whole target the next time.


    Thanks Fred,

    It finally dawned upon me that it was a pointer issue.

    --


  4. Re: intVecBaseGet( ) related simple question


    > One usual suspect is that sp() gives you a pretty small default stack
    > size. The first sp may result in some stack corruption that ultimately
    > results in the second failure.
    >
    > You can test this, by explicitly spawning with a larger stack.


    Thanks for the reply Fred

    But here is something strange which I found out by experimentation. My
    lack of experience with pointers might be the result of this issue.

    void test(void)
    {
    int *fp;
    /**fp = intVecBaseGet();*/
    printf("\n%d/n", intVecBaseGet());
    }

    The above code runs without any problem, no matter how many times I do
    sp test but if I comment out the assignment to *fp the problem returns.


    NOTE: I did try it the way you suggested Fred but without any luck, the
    driver function ran perfectly first time and then crashed the
    whole target the next time.

    --


+ Reply to Thread