Hardfault in xQueueGenericReceive() at certain optimisation levels on STM32 ARM Cortex M4, FreeRTOS v9.0.0

stuartbrown wrote on Thursday, March 22, 2018:

Thanks for your help Richard. I found the problem, and as I expected it was in my code. I found an array overrun that was clobbering the queue handle. It seems that the optimisation settings changed what got clobbered when the overrun happened. It was just coincidence that it always clobbered the queue handle for levels -O2 and -O1.