There actually is even a new feature which was not available when that thread took place.
The current MCU 10 linker supports for the S08 to compute the stack size for simple code, it cannot handle recursive code, function pointers. But it does include calls to the runtime support. For example for this app
#include <hidef.h> /* for EnableInterrupts macro */#include "derivative.h" /* include peripheral declarations */float a = 1/3.0f;float b = 1/5.0f;float c;void t(void) { c = a/b;}void main(void) { for(;;) { t(); __RESET_WATCHDOG(); }}
for the S08 QE128, banked memory model, I get the following in the map file if I enable the stack computation:
*********************************************************************************************STACK CONSUMPTION COMPUTATION---------------------------------------------------------------------------------------------1)FileName = C:/Users/r1aake/workspace/s08/a/MC9S08QE128/Project_Settings/Startup_Code\start08_c.obj_Startup = 39Maximum Stack Usage is calculated for following path:-----------------------------------------------------_Startup|+-main | +-t | +-_FDIV | +-_FDIV_Common | +-_FDIV_K_is_L_div_K
For mcu 10.2 it can be enabled in the project properties, C/C++ Build/Settings , int Settings are, select S08 Linker/Output,
check "Enable Stack Consumation Computation (-StackConsumption).
The feature supports to compute the stack of specific functions, for example for t. For details search the online help of MCU10.2 for "STACK_CONSUMPTION".
Also by adding the interrupt handlers separately, one can compute all the stack sizes which might accumulate. Even when a app has recursion, knowing how much stack certain non recursive functions like this t need helps a lot.
Cool nice feature
.