00001 00002 // This file is compiled with WinAVR version 4.1.2 00003 // 00004 // These routines mess with the stack 00005 // 00006 // you must use either of these optimizations: 00007 // -O1 00008 // -O3 00009 // -O2 00010 // 00011 // Whatever you do, do NOT use -O0....it will NOT work 00012 // 00013 // ///////////////////////////////////////////////////////////////////////////////////////// 00014 00015 #include "task.h" 00016 00017 00018 unsigned MeasureStackUsage(char *s,unsigned max) 00019 { 00020 unsigned unused=0; 00021 int loop = 1; 00022 00023 for(unused=0;(unused < max) && loop;++unused) 00024 if((unsigned char)s[unused] != (unsigned char)0xcd) loop = 0; 00025 return unused; 00026 }