I had a bunch of problems with FreeRTOS queues in my MCU serial communication. I’ve made the H8S-2633 port of FreeRTOS (if someone is interested I can upload it somewhere), and started
my project with a modified version of serial.c of GCC H8S2329 demo example. In my application, the serial port is “hammered” with a protocol packets, and sometimes data byte inserted in queue (from serial RX ISR) with xQueueSendFromISR was “lost” in the queue itself ( or “delayed” of some positions inside the queue ). This because uxMessagesWaiting, uxLength and uxItemSize aren’t
updated in compilation level with -O2 parameter.
The solution is modify QueueDefinition in queue.c like this :
volatile unsigned portBASE_TYPE uxMessagesWaiting;
volatile unsigned portBASE_TYPE uxLength;
volatile unsigned portBASE_TYPE uxItemSize;
I hope this solution can be useful