I am working on an embedded project, and I am using the static method API to create queue. The goal is to make the FREERTOS queue retain through a reboot. I already figure out a way to retain a memory space through a reboot (which is by using noinit memory), but to do that with a FREERTOS queue, I need some help.
I have 2 ideas here, one is to make the whole FREERTOS queue retainable, by statically allocating queue buffer and queue structure in noinit memory space. I assume this will let queue keep its state and after reboot I just need to use the saved pointer of the queue and it will work, but I am not exactly sure. Can someone comment on this method?
Another work around is instead of making the queue retainable, I save all the items of the queue to another buffer. To do this, I know there is no official API doing ‘copy all item of queue to another buffer’ and the only way to me is to pop each item one by one but this is to trivial. So to make it easier, I have an idea of directly copying the content in the statically allocated queue buffer into buffer#2 by using memcpy(), I wonder will this method work? And when I interpret the buffer content can I interpret it as front item is at lower address?