Technical Support

C51: STACK REQUIREMENTS OF RUN-TIME LIBRARY FUNCTIONS


Information in this article applies to:

  • C51 Version 7 or higher

QUESTION

Is there any information about the stack requirements of the Keil C51 run-time library available? I need figures for the floating point arithmetic functions.

ANSWER

Most of the C51 run-time library functions are pretty small and do not require (except for the CALL itself) additional stack space.

No additional stack is required by the following run-time library functions:

  • Standard Load and Store routines (except when using the far memory type).
  • unsigned int and unsigned long arithmetic library functions.
  • signed int and signed long arithmetic library functions, except division.

One additional CALL level (2 or 3 stack bytes) is required by the following run-time library functions:

  • Auto increment/decrement Load and Store routines, except float.
  • signed int and signed long division.
  • unsigned int and unsigned long arithmetic library functions.
  • floating point add, sub, mul, div and compare.

Two additional CALL levels (4 or 6 stack bytes) are required by the following run-time library functions:

  • Auto increment/decrement Load and Store routines with data type float.
  • Floating point square root (sqrt).

Three additional CALL levels (6 or 9 stack bytes) are required by the following run-time library functions:

  • Floating point trigonometric functions (sin, cos, tan, asin, acos, atan).
  • Floating point logarithm function (log, log10).
  • Floating point exponential function (exp).

More complex functions may have even higher stack requirements, however none of the library functions require more than 22 bytes (35 for 3-byte CALL/RET frame size).

  • Floating point trigonometric functions (sin, cos, tan, asin, acos, atan).
  • Floating point logartihm (log, log10).

SEE ALSO

Last Reviewed: Monday, January 17, 2005


Did this article provide the answer you needed?
 
Yes
No
Not Sure