C7x: CPU NLC Module Not Clearing State on Interrupt
Details:
Data corruption will occur when:
- An application is running that involves task switching. In this case there
are at least 2 tasks that may use NLC.
- There is a NLCINIT issued that would be followed by a TICK when an interrupt
comes in for Task A. This action ends up setting some internal state in the
NLC module that says we need to reload the ILCNT_INIT value to ILCNT on the
next TICK since the forwarded case it computed was flushed. This state is
not being properly cleared when the interrupt is taken.
- The ISR performs a task switch to Task B, which is also running NLC code.
The NLC code being returned to needs to be in-progress and have a different
ILCNT_INIT value than the NLC loop in the original task.
- After returning from the ISR, the next TICK will end up setting ILCNT to the
wrong value (ILCNT_INIT - 2) due to the corrupted state.
At this point the ILCNT is corrupted and the NLC loop will execute the wrong number
of iterations, leading to data corruption.
Workaround(s):
Issue a NLCINIT (parameters don't
matter and there's no need for TICK's/BNL afterwards) in ISR's as part of the
context saving. There is no performance impact due to the work-around.