11.07.2015 Views

Imagecraft c compiler and development environment for the atmel avr

Imagecraft c compiler and development environment for the atmel avr

Imagecraft c compiler and development environment for the atmel avr

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

ICCV8 <strong>for</strong> AVR – C Compiler <strong>for</strong> Atmel AVRStack Checking FunctionsSeveral library functions are provided <strong>for</strong> checking stack overflows. Consider <strong>the</strong>following memory map; if <strong>the</strong> hardware stack grows into <strong>the</strong> software stack, <strong>the</strong>content of <strong>the</strong> software stack changes. This alters <strong>the</strong> value of local variables <strong>and</strong>o<strong>the</strong>r stacked items. Since <strong>the</strong> hardware stack is used <strong>for</strong> function return addresses,this may happen if your function call tree nests too deeply.Likewise, a software stack overflow into <strong>the</strong> data areas would modify global variablesor o<strong>the</strong>r statically allocated items (or Heap items if you use dynamically allocatedmemory). This may happen if you declare too many local variables or if a localaggregate variable is too large.If you use <strong>the</strong> function printf a lot, <strong>the</strong> <strong>for</strong>mat strings can take up a lot of space in<strong>the</strong> data area. This could also contribute to stack overflow. See Strings.high addressHW StacksentinelSW StacksentinelData Areaslow addressSummaryTo use <strong>the</strong> stack checking functions:1. #include 106

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!