I'm working on a multiprotocol application which is build on top of Micrium OS. I'm using message queues and events to communicate between tasks and I have a question related to memory allocation of the messages.
By reading the documentation and the examples it is clear that only the pointer to the message is stored in the queue, and, as described in the doc, the actual memory used by the message should be allocated in the calling task stack. This is clear, but how would you sugest to do that?
My first thought suggest to use malloc/free, but I don't like it because of the memory fragmentation. I have a couple of alternatives in my mind, but I would like to know of Micrium experts have some hints about it.
Hello Davide, your understanding of message queues is correct.
We usually allocate the message in the calling task stack.
See the following examples at: