I have a situation where at least 1 member variable and 1 member pointer variable are getting overwritten after an external interrupt. The variables are members of the same class. The pointer is set to a non-zero value on startup while the member variable/flag is set to 0 on startup. After the external interrupt occurs, the code enters a task where the flag get set to 1. From within the IDE, when the flag is set, the pointer is observed to have the value set at startup (breakpoint was set). When the code is allowed to run, it returns to the ISR handle responsible for processing the interrupt. After exiting the ISR handler, code flow returns to the task that set the flag where its status is checked. At this point it is observed that the flag is now 0 and the pointer value of interest in now 0. Any thoughts on what may be happening or how this might be resolved?
Standard questions: Did you define configASSERT
and enabled stack checking ?
Very often data corruption is caused by stack overflows.
See also the FreerRTOS FAQ.
And last but not least show the relevant code like task creation, the ISR and task code.
Otherwise it’s hard to guess or help.
Data breakpoint is another very useful tool to debug these kind of memory corruptions if your IDE/Debugger supports it.
Thanks very much for the feedback. After more collaboration with team members and after adding additional sections of code to the project (the project is primarily a “code porting”/code merging effort) the issue appears to be resolved. It’s only been in the last day or so that I’ve been able to confirm that the problem seemingly no longer exists. Thanks again for the support.
Thank you for reporting back.