Skip to main content
amoreno
Associate III
February 19, 2009
Question

GLOBAL and LOCAL variables with IAR EWARM ?

  • February 19, 2009
  • 6 replies
  • 1653 views
Posted on February 19, 2009 at 05:02

GLOBAL and LOCAL variables with IAR EWARM ?

This topic has been closed for replies.

6 replies

amoreno
amorenoAuthor
Associate III
February 9, 2009
Posted on February 09, 2009 at 13:32

[ This message was edited by: amoreno on 21-04-2009 11:47 ]

kleshov
Associate
February 10, 2009
Posted on February 10, 2009 at 09:14

Variables may APPEAR to be corrupted when single-stepping through code in debugger at high optimization levels.

Local variable corruption can be caused by stack overflow. Careless memory manipulation with pointers can cause this too.

amoreno
amorenoAuthor
Associate III
February 17, 2009
Posted on February 17, 2009 at 14:47

Thank you for reply my post.

To avoid optimizations issues, I have dissabled ALL optimizations (now is runnig with ''NONE for best debug'')

Regarding stack size, I use this,

-D_CSTACK_SIZE=1000

-D_SVC_STACK_SIZE=100

-D_FIQ_STACK_SIZE=100

-D_ABT_STACK_SIZE=100

-D_UND_STACK_SIZE=100

-D_IRQ_STACK_SIZE=800

-D_HEAP_SIZE=800

I think it is enought for my purposse.

I have noted this issue in several differents functions and situations.

Allways is caused by the same, a ''corrupted local variable''.

Are there anything that I can do ?

Really I dont know what to do. Really desperating... :-Y

Ideas are wellcome,

Thanks

ALFA

kleshov
Associate
February 18, 2009
Posted on February 18, 2009 at 14:58

There are ways to measure stack usage in target MCU. The way I like to do it is like this: in startup code, fill stack with fixed pattern (say, 0xDEADBEEF, or whatever), let the program run for a while, preferably reproducing the bug, pause the program and inspect stack space - the used stack space will have the fixed pattern overwritten.

Or you can try increasing stack space dramatically: if it doesn't help, it's probably something else then.

amoreno
amorenoAuthor
Associate III
February 18, 2009
Posted on February 18, 2009 at 15:20

[ This message was edited by: amoreno on 21-04-2009 11:48 ]

kleshov
Associate
February 19, 2009
Posted on February 19, 2009 at 05:02

Sorry, I have no time for this.

Maybe you should read some manuals? That's what I normally do, anyway...