title: How to determine maximum stack usage?
body: <p>What methods are available for determining the optimum stack size for embedded/memory constrained system? If it's too big then memory is wasted that could be used elsewhere. However, if it is too small then we get this website's namesake...</p>
  
  <p>To try to jump start things: Jack Ganssle states in <em><a href="https://rads.stackoverflow.com/amzn/click/com/0750698691" rel="noreferrer" rel="nofollow noreferrer">The Art of Designing Embedded Systems</a></em> that, <strong>"With experience, one learns the standard, scientific way to compute the proper size for a stack: Pick a size at random and hope."</strong> Can anyone do better than that?</p>
  
  <p>A more specific example was requested. So, how about a C program targeting an <a href="http://focus.ti.com/mcu/docs/mcuprodoverview.tsp?sectionId=95&amp;tabId=140&amp;familyId=342" rel="noreferrer">MSP430 MCU</a> with 2 kB of RAM using the <a href="http://www.iar.com/website1/1.0.1.0/50/1/index.php?" rel="noreferrer">IAR Embedded Workbench</a> toolchain without an operating system? This IDE can display the stack contents and usage while using a JTAG debugger.</p>