Philips Bluetooth QuickStart Kit GPS Receiver User Manual


 
Bluetooth QuickStart Kit Version 1.0 - User’s Guide Page 74
Copyright 2004-2005 © Embedded Artists AB
sample_web/www/post.html – this file calls the formpost.egi.
sample_web/www/registry.shtml – this file interacts with the
listreg.egi, addreg.egi and the remreg.egi.
sample_web/www/ssi.shtml – this file illustrates how SSIs can be used. It
also calls the counter.egi.
C.3 Stack Size Tips
Setting stack sizes to correct values can be difficult. It is important to have them as small as
possible in order to save RAM. However, of a stack is too small the program is likely to
crash. The normal process is as follows:
1. Set the stack sizes to a relatively large value.
2. Run the application for a suitable amount of time.
3. Use the “stack usage” feature in the operating system. This will give the number of
bytes used in the stack for different processes in the system.
4. Adjust (i.e., decrease) the stack sizes according to these values.
Do not forget that printf() typically requires quite a lot of bytes from the stack. Avoid using
full-scale printf()-implementation if possible in order to save valuable stack space.
The stack sizes must normally not be very large. Below is a short list of recommendation to
minimize stack requirements in the code:
Avoid excessive use of local variables in functions since these will be placed on the
stack. If they are needed, declare them as static, if possible (since this will not
place them on the stack). The drawback with declaring variables as static is that
functions are no longer reentrant.
Avoid functions that take a large number in input parameters (more than 6) or
structures. If possible, send a pointer to a structure with input values instead.
Observe that the sample applications have not been optimized for low stack usage. These
stack sizes have intentionally been set to very large values since printf() calls are used in
the code. There is a large potential to decrease stack sizes in these sample programs.