[Tinyos-help] overwritten memory

Janos Sallai sallai at isis.vanderbilt.edu
Fri Sep 23 10:59:13 PDT 2005


It happens sometimes that the stack grows too big, and some of the
static variables get corrupted.

 

There's a component called PeaceKeeper in the official TinyOS
distribution, which watches the size of the stack and alerts (and shuts
down the mote) when the stack reaches dangerously close to the data
segment.

 

To avoid stack related issues, try to keep you're RAM requirement low.
Issues of this kind start appearing around 3500 bytes (on mica*), so you
should be safe if you use less than that. Furthermore, avoid weird
recursions, as well as passing large chunks of memory by value, or
anything that would slay the stack.

 

Janos

 

-----Original Message-----
From: tinyos-help-bounces at Millennium.Berkeley.EDU
[mailto:tinyos-help-bounces at Millennium.Berkeley.EDU] On Behalf Of
Daniele Puccinelli
Sent: Friday, September 23, 2005 12:29 PM
To: tinyos-help at Millennium.Berkeley.EDU
Subject: [Tinyos-help] overwritten memory

 

Hi

 

I'm using a matrix of uint32_t; I allocated the memory statically, and I
noticed that random elements of the matrix get overwritten.

In particular, I noticed stuff like 0xfffff731 becoming 0x00000031. Does
anybody have any idea what's going on? How do you guys deal with large
arrays?

 

Daniele

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.millennium.berkeley.edu/pipermail/tinyos-help/attachments/20050923/5f7ae5df/attachment.htm


More information about the Tinyos-help mailing list