FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [April 2011 Threads] Queue and Memory Management functions Posted by iporboon on April 11, 2011 Hello
I use the queue functions of freertos to pass the messages among the tasks in the real-time systems. My messages are the groups of data such as arrays or structures. I have to create the queues with the message size of array or structure.
It seems to consume a lot of RAM from my systems. I can not send the pointers to the queues because there is not the dynamic mem alloc in freertos API to use to store the arrays or structures, and I do not want to use malloc function from standard C library because of the real-time predictability problem of that function.
Please suggest the solutions of my problem. Thank you very much.
RE: Queue and Memory Management functions Posted by Richard on April 11, 2011 Normally, if you are sending large items of data, you would queue a pointer to the data and the application would have to ensure the data was access correctly (only one task has responsibility for changing the data, only one task for marking the buffer free again once the data is read, etc.).
If you want to send different items on a single queue, then the normal way is to send structures on the queue, with one of the structure members indicating what the queued item actually is, so the receiving task knows how to handle the data.
Regards.
RE: Queue and Memory Management functions Posted by iporboon on April 11, 2011 I am very sorry if my problem was not clear.
I can not send the pointers to queue because there is not the dynamic mem alloc in freertos API, so I can not get mem blocks to store the data and I do not want to use malloc function of standard C library because of the real-time predictivity problem of that function.
Best regards.
RE: Queue and Memory Management functions Posted by Dave on April 11, 2011 If your blocks are always the same size then you can use heap_2.c as a dynamic memory allocator without fear of fragmentation. Otherwise, can you use statically declared memory blocks?
RE: Queue and Memory Management functions Posted by Stephen Cleary on April 11, 2011 If your blocks are the same size, then you can write a very simple pool allocator. Otherwise, you can write your own (deterministic) memory allocator. I have implemented a modified version of TLSF, and it works quite well so far.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|