xQueueCreate Failing

I am relatively new to FreeRTOS and trying to port FreeRTOS to R7 core. I don’t understand why xQueueCreate( mainQUEUE_LENGTH, sizeof( uint32_t ) ); fails.

While trying to debug, I understood that the assertion " configASSERT( uxSchedulerSuspended );", inside xTaskResumeAll() function fails, as uxSchedulerSuspended becomes zero inside vTaskSuspendAll(). How can I solve this issue??

Thanks in advance.

We already have some Cortex-R ports. Which compiler are you using? Also, which chip?

Each call to vTaskSuspendAll() needs to be paired with a falling call to xTaskResumeAll(). xTaskResumeAll() should therefore never find uxSchedulerSuspended is set to zero as it should have been incremented by a previous call to vTaskSuspendAll(). If uxSchedulerSuspended is 0 then either you are calling xTaskResumeAll() without first calling vTaskSuspendAll(), or uxSchedulerSuspended has been corrupted.

Thank you @rtel for responding. I am using the cortex-R5 port in Zynq Ultrascale as a base. My intention is to port FreeRTOS into R7 core in RCAR V3H by compiling using arm-none-eabi- toolchain.

The function I am calling from my application is xQueueCreate(). Before incrementing the uxSchedulerSuspended value in vTaskSuspendAll(), it is coming to be -1. So after that when the call to the vTaskResumeAll() is invoked, uxSchedulerSuspended is zero and the assertion fails. I am not sure if I am doing something wrong.

So it sounds like something has gone wrong before vTaskSuspendAll() is called within xQueueCreate(). Can you add the variable to the debugger window so you can see when it gets set to -1? Is it initialised to its correct initial value before main() is called. Also could you attach the .map file so I can see where the offending variable is in the memory space relative to other things.

I don’t have a debugger to work with. I am trying to debug within the code itself using serial console. I have attached the objdump file for your refernce. objdump.zip (85.3 KB)

Hmm, I think you will be more efficient if you use can get to use a debugger. I don’t think the serial console can give you much visibility without itself interfering with the code’s operation.

Are you out of heap?

Call xPortGetFreeHeapSize(); before you try to create the queue and make sure you have enough memory.


Thank you for the suggestions. Sorry for the late reply. I have solved that issue, the bss section initialization was getting skipped which caused this issue.