TI E2E Community
[C674X_0] ti.sysbios.gates.GateMutex: line 97: assertion failure: A_badContext: bad calling context. See GateMutex API doc for details.
[C674X_0] ti.sysbios.gates.GateMutex: line 97: assertion failure: A_badContext: bad calling context. See GateMutex API doc for details.xdc.runtime.Error.raise: terminating execution
I am not using the DSP/BIOS 6 GateMutex. I have attached my CFG.
How do I find out where this error is coming from?
I expect you are calling System_printf from a non-Task thread and using SysStd or calling Memory_alloc (on a HeapMem instance) from a non-Task thread. If so, search the forums for "assertion failure gatemutex" and you will find several related posts with solutions.
I also have this error using printf in a task context (not HWI, nor SWI). The cause of the error, found through trial and error of moving the array out of the function, is that I've got a static array allocation on the stack in the task. The task stack size was too small.
I couldn't see a stack corruption in the ROV either on the task that crashed. Also, I didn't find this on the Wiki page. Can someone add that?
BIOS fills the stacks with a known value and we check these stacks using ROV and during context switch to make sure that the top elements of the stack are not corrupted. As you know, it is possible for local variables to be allocated on the stack but not actually written to. In this case, the stack can overflow it's bounds but those top elements will not be trashed. Unfortunately, there is no easy way to detect this without h/w stack bounds checking which is not available on many parts. We do the best we can to measure and catch stack overflow, but the case of the big unused local array or structure is something we cannot catch.
All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.
TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs andembedded processors, along with software, tools and the industry’s largest sales/support staff.