pbeam wrote on Tuesday, April 12, 2016:
In trying to make things better and more efficient, I am totally unable to get shadow registers to work for an interrupt that does not use FreeRTOS services. The effect I get is that FreeRTOS “crashes” when malloc fails – which is really not the problem.
I have an ISR that interrupts at 200 Khz, so overhead is a problem. This does not work:
void __attribute ((interrupt(IPL7SRS), no_fpu, vector(_EXTERNAL_2_VECTOR))) Int2_ISR(void) {
//void Int2_ISR(void) {
unsigned flag = 0;
if (!SPI1STATbits.SPIRBE) {
This does work:
void __attribute ((interrupt(IPL7AUTO), no_fpu, vector(_EXTERNAL_2_VECTOR))) Int2_ISR(void) {
//void Int2_ISR(void) {
unsigned flag = 0;
if (!SPI1STATbits.SPIRBE) {
…
Obviously, the IPL7SRS has lower overhead, so it is desirable. I have defined the PRISS bits so that interrupt priority 7 uses shadow register 7. (I have also used the no_fpu attribute since FreeRTOS v8.2.3 does not handle the FPU properly, and I don’t use it anyway.)
Should this work? I have looked at the assembly with IPL7AUTO, and it does seem to recognize the shadow registers are available as it skips a number of PUSH instructions. What makes this more critical is that I need to service an A/D at 1Mhz, so the shadow registers would surely help.