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.
--
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.
Re: intVecBaseGet( ) related simple question
[color=blue]
> 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.[/color]
Thanks Fred,
It finally dawned upon me that it was a pointer issue.
--
Re: intVecBaseGet( ) related simple question
[color=blue]
> 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.[/color]
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.
--