Pointer bug when using xQueueReceive() with non zero xTicksToWait


This problem occurs when I using FreeRTOSv10.2.1 & FreeRTOSv10.3.1. My chip is based on CM0 and IDE is IAR7.4. The bug description is below:

The first time of for loop excute well. Since there is no data in the queue, and then cpu yield to other task.

When cpu returns to current task, and starts second for loop, the pointer value becomes 0x0, as the picture shows, and it will cause a hardfauld error.

If I do changes that shows in the follow picture, then the function works properly.

Actually, xQueueSend(), xSemaphoreTake(), etc have the same problem in my chip.

It is very hard to comment on what might be going wrong from just these three images. Are you suggesting there is a bug in the queue code? Or noting there is a bug in your code you would like help debugging?

Hi Richard,

Thank you for your reply. This problem doubts me for a long time. I want to know what may be the reason of the problem, or you have any suggestions.