Memory corruption on TJPro with IC
- View SourceHas anyone experienced unexplained corruption of array variables on
the TJPro when programming in Interactive C? If so, do you have any
idea what could be causing it? Of course the obvious answer is that
there is a bug in my code (and I will continue to look for one), but
I thought it would be worth shooting off this post to see if anyone
has had any similar experiences.
The code I am writing uses fairly large arrays. Could I be reaching
any kind of IC memory constraints (before reaching the hardware
constraints)? If so, IC is not telling me (and I've noticed that
it generally *does* go out of its way to let you know when you're
trying to do something you shouldn't, like access an array out of its
I've just bought ICC11, so I will be moving my code over to that
compiler soon, but I'd still like to get to the bottom of my problems
Here are the kind of problems I am seeing (not all at the same time)
with a typical array declaration, say:
- Just entering 'readings' at the IC> prompt gives rise to
an "Array reference out of bounds" error.
- Entering 'readings = 123' followed by 'readings' at the IC>
prompt returns some large integer, instead of the expected 123.
- Sometimes entering 'readings' does *not* give rise to an "Array
reference out of bounds" error, even though in this case, I would
I should point out that I've seen these problems even without any
threads running (except the IC user interaction thread).
Of course it did occur to me that perhaps the MTJPRO11 board isn't
working properly, but I think that's unlikely. Does anyone have any
code that thoroughly exercises the memory? If not I may have to
write something to do this just to rule out a bad SRAM chip.