We are using an 'F5659 with a bootloader in the first page of Flash and an application beginning in the 2nd page. In order to reduce interrupt latency for one critical interrupt, we allowed all other ISRs to be nested by simply setting GIE as early as possible in the ISRs.
However, we recently changed our project's interrupt strategy from one of moving our interrupt table to RAM (SYSCTL |= SYSRIVECT), to one of using a jump table, and now nesting the ISRs crashes the system.
In our original scenario, since the bootloader and application both used interrupts, we designed so that when the application started up, it moved it's table to RAM and also copied it's ISRs from a table in flash to low RAM. That way, the ISRs remained callable by the vector table, but were free to access FAR data and we did not have to disturb the bootloader's space.
The change to using a jump table meant that we simply changed our old ISRs to normal functions, left them in upper flash pages and our new ISRs simply made far function calls to them.
Now, however, when the new ISR calls the isr function (which sets the GIE bit), we get mysterious crashes. Everything works fine if we disable nesting.
Does anyone have any idea as to why setting the GIE bit inside a function that is called from an ISR would be an issue? Does it have something to do with how the stack is unwound if that function is then interrupted?
The sequence would go something like this:
Interrupt->IV->ISR->function->GIE->Interrupt->IV->ISR->function->return->ISR return->function rtn->ISR rtn.
I've tried to figure out the stack in this scenario but cannot see a problem. The fact remains, though, that allowing nesting crashes the new project whereas it worked fine in the old project.
Any ideas?
Thanks.