AnsweredAssumed Answered

Crash if an unused variable is commented out???

Question asked by dave408 on Apr 13, 2016
Latest reply on Jul 30, 2016 by SCOTT MILLER

This is unlike anything I've experienced before, so I was hoping that some of the ARM experts here could chime in and offer their perspective on my situation.


I have an application running on a MK22FN128VLL10.  I have a class A that has a uint32_t member variable.  I have another unrelated class B that pulls data in from the UART.  The problem I'm seeing is that if I comment out the uint32_t in class A, a method in class B literally causes a hard fault.  If I replace the uint32_t with a uint8_t, it also crashes.  However, if I use a uint8_t[4], then it runs just fine.  So it seems like a memory alignment issue; I did a hail mary and added the -mno-unaligned-access compiler flag, but that didn't fix the problem.


Can anyone suggest what's going on, or throw some potential search terms at me that will get me on the right track towards fixing this problem?