Strictly necessary cookies are on by default and cannot be turned off. Functional, Performance and Tracking/targeting/sharing cookies can be turned on below based on your preferences (this banner will remain available for you to accept cookies). You may change your cookie settings by deleting cookies from your browser. Then this banner will appear again. You can learn more details about cookies HERE.
Strictly necessary (always on)
Functional, Performance and Tracking/targeting/sharing (default off)
Question: How to make PSoC 3/5 functions reentrant?
Functions (including Component APIs) written using the C51 compiler are typically NOT reentrant. The reason for this limitation is that function arguments and local variables are stored in fixed memory locations due to limited size of the 8051 stack. Recursive calls to the function use the same memory locations. And, in this case, arguments and locals would get corrupted.
Reentrant functions can be called recursively, and can be called simultaneouslyby two or more processes. Reentrant functions are often required in real-time applications or in situations where interrupt code, and non-interrupt code must share a function. The"reentrant" function attribute in KEIL compiler allows you to declare reentrant functions. Refer to the application note “AN54460: Interrupt Handling in PSoC 3“ for knowing how to declare and define a reentrant function.