Hi. I want to use static memory for message queue in RTX5. What is the cb_size (size of provided memory for control block ) in osMessageQueueAttr_t. how to calculate proper size for it?
RTX5 implements the new CMSIS RTOS API V2 where Mail Queue has been deprecated and replaced with enhanced Message Queue.
RTX5 however provides also a compatibility layer for API V1 when selected. This layer also defines the legacy macros including osMailQDef.
Mail is implemented using a Memory Pool which stores mail data and a Message Queue which stores only pointers to mail data. Therefore both mentioned variables are needed.
But you are right in regards to message queue data size which needs to hold only pointers and should be decreased as shown below. Will be fixed in the next release (already accessible in development version on github).
static uint32_t os_mail_mp_data_##name[osRtxMemoryPoolMemSize ((queue_sz),sizeof(type) )/4]; static uint32_t os_mail_mq_data_##name[osRtxMessageQueueMemSize((queue_sz),sizeof(void*))/4];