function depth support
Hi All,
I want to know what is maximum function depth supported by STM32F417 in stmcube ide?
how function depth managed by stack pointer?
Hi All,
I want to know what is maximum function depth supported by STM32F417 in stmcube ide?
how function depth managed by stack pointer?
There is no limit. The stack may overflow at run-time and this is not automatically detected and in your responsibility.
Here is a recursive function:
int ackermann(int n, int m) {
if (n == 0)
return m + 1;
else if (m == 0)
return ackermann(n - 1, 1);
else
return ackermann(n - 1, ackermann(n, m - 1));
}
ackermann(3,6) is 509. Calculating this results involves 2.986.490 recursive function calls (without optimizations). Finding the max. stack size used is left an exercise.
Learning abaout the stack in Cortex-M is a covered in books like "Definitve Guide..." by Joseph Yiu and online:
Happy reading
KnarfB
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.