Other Parts Discussed in Thread: UNIFLASH
Hello,
I am having problems handling interrupts while reflashing the flash bank containing the interrupt vectors.
We have a bootloader running in the first two sectors of flash bank 0 followed by our application in the remaining sectors. The application needs to use nested interrupts so we're using the IRQ dispatch mode, following the TI app note. The bootloader interrupt vectors all just branch to the vectors at the start of our application, as per another TI app note.
The bootloader runs all code needed during reprogramming from RAM and uses an RTI timer interrupt to service a TPS65381 watchdog at regular intervals. I've set the RTI timer to use FIQ as we're using dispatch mode IRQ for the application code. However, the bootloader crashes once the flash programming sequence starts as soon as the RTI interrupt is triggered.
If I understand correctly, this issue occurs because you can't execute code (including the interrupt vectors) from a flash bank while writing to it. In an attempt to work around this I have tried using the Parameter Overlay Module to redirect accesses to the interrupt vectors to a RAM copy. Unfortunately, this still crashes with a prefetch abort when the RTI interrupt is triggered after flash programming starts. If we disable the RTI timer and watchdog, the reprogramming completes successfully.
I'm not sure why I see this issue as (as far as I can tell) I'm not running anything from flash at the time. Is this a sensible approach to using interrupts in the bootloader or is there another better way?
Many thanks