Keil Logo

Reentrant Functions

The C51 Compiler provides support for reentrant functions. Reentrant functions store parameters and local variables on a reentrant stack. This protects them from recursive or simultaneous calls. RTX51 Tiny does not contain any management for the C51 reentrant stack. So, if you use reentrant functions in your application, you must ensure that these functions do not call any RTX51 Tiny system functions and that reentrant functions are not interrupted by round-robin task switching.

C functions, which use only registers for parameter and automatic variables, are inherently reentrant and may be called without any restrictions from RTX51 Tiny.

Non-reentrant C functions may not be called from more than one task or interrupt procedure. Non-reentrant C51 functions store their parameters and automatic variables (local data) in static memory segments which may be overwritten when the function is called from multiple tasks simultaneously or recursively.

You may invoke non-reentrant functions from multiple tasks if you ensure that they are not called recursively (simultaneously). Usually this means that round-robin task scheduling must be disabled and that your non-reentrant functions may not call any RTX51 Tiny system functions.

Note

  • You should disable Round-Robin Task Switching if you wish to invoke reentrant or non-reentrant function from more than one task or interrupt.
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.