[En-Nut-Discussion] Stack overflow?

Toby Smith s354335 at student.uq.edu.au
Mon Sep 29 02:09:22 CEST 2003


I'm running some tests of a small Elvin content-based routing library that
I've written for the Ethernut.

I've test my library on Solaris and it all seems to work fine.

I've ported it across to the ethernut. I'm using avrgcc as my compiler.
I've converted all the necessary functions and I have my code running okay
on the ethernut.

With one exception.

Whenever I receive a certain type of packet, the machine hangs. I'm using
a rather deeply nested set of function calls to parse this packet, and I
suspect that I'm overfilling the stack.

I suspect this because I've placed printf's before return statements and
after the function is called.

For eg:

	...
	printf("returing from function XXX\n");
	return;
	...

	...
	functionXXX();
	printf("returned from function XXX\n");
	...

And when this runs on the ethernut, line 'returned from blah' never
appears for one level of function calls. So it looks like the stack might
be getting screwed?

I've tried placing my code in another thread and setting the stack size to
a huge value, but that didn't seem to help.

Any other ideas about what this culd be, or how I could fix it?

--Toby




More information about the En-Nut-Discussion mailing list