Hello, I have faced a problem with a function pointer variable. I have separated the uart module in two parts: HAL, which abstracts the hardware, and Service, which provides the uart service to the application. The interrupt routine is in HAL module, which has a function pointer variable that is called into the interrupt routine as interrupt handler. The actual interrupt handler function is in Service module. This function is assigned to the function pointer variable through a install function in the init routine. It works in debug simulation, but when I load the hex file to the microcontroller the application does not work. Anyone can help me?
"All functions called within an interrupt must be reentrant."
No, that is not true at all.
The point is that C51 functions are not inherently reentrant; so, if you need them to be so - eg, because you call them from both ISR and "main" code - then you must specifically make them so. eg, by use of the reentrant keyword.