Page 1 of 1

finding out how much memory is available

Posted: Tue Dec 17, 2019 5:42 pm
by wydmynd
hello

I am trying to write some autonomous code using the "app" api , my code is not massive but running along with 3 decks at the same time, when I increase the stack size the CF hangs on startup. I think I'm running out of memory..
the only way for me to find out is using the "task dump" feature. it works on boot, but during flight the task dump output stops after 1-2 rows. (maybe low priority)
how can I know the maximum amount of stack I can allocate to my app? if I see the available heap is down to less than 500b can it cause instability?
is it OK to increase the heap? currently I am making minor adjustments to stack sizes and flashing to see how it affects performance.
I raised this in the FW issues and was referred to https://github.com/bitcraze/crazyflie-firmware/pull/513 but didn't understand how it can be used.
I have an st-link debug adapter but I can't see how to find out the memory status even using it..

thanks for any suggestions!

Re: finding out how much memory is available

Posted: Wed Dec 18, 2019 8:41 am
by arnaud
You might be running our of heap, currently the task stacks are allocated on heap (this is something we really want to change in the future, FreeRTOS now has a static API).

It is more than OK to increase the stack, memory outside of static allocation and stack is unused/wasted in the Crazyflie. You can increase the heap size and if you do it too much it will just stop compiling.

As for the task dump during flight, this is very odd. I would have expected it to work. There might indeed be priorities issues.

Re: finding out how much memory is available

Posted: Wed Dec 18, 2019 9:13 am
by wydmynd
thanks alot! people will start developing interesting applications for CF I expect methods to increase available memory to "apps" will need to be made clear to the developers. I will link to this answer in the relevant git issue