Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob

Making PSoC 3/5 functions reentrant

Making PSoC 3/5 functions reentrant

VivekK_11
Employee
Employee
Welcome! First solution authored 10 replies posted

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 simultaneously by 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.

0 Likes
627 Views