Interrupts are an important part of embedded systems, which leads to a lot of compiler developers providing an extension-letting standard C support break. The representative fact is that a new keyword __interrupt has been produced. The following code uses the __interrupt keyword to define an interrupt service subroutine (ISR), please comment on this code.
__interrupt Double Compute_area (double radius)
{
Double area = PI * radius * RADIUS;
printf ("area =%f", area);
return area;
}
1). ISR cannot return a value.
2). ISR cannot pass parameters.
3. In many processors/compilers, floating-point is generally not reentrant. Some processors/compilers need to allow the registers of the frontal register to stack, and some processors/compilers do not allow floating-point operations in the ISR. In addition, the ISR should be short and efficient, and it is unwise to do floating-point operations in the ISR.
4. In the same vein as 3rd, printf () often has the problem of reentrant and performance.