finding out how much memory is available

Firmware/software/electronics/mechanics
Post Reply
wydmynd
Member
Posts: 87
Joined: Thu Dec 06, 2018 9:25 am

finding out how much memory is available

Post 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!
arnaud
Bitcraze
Posts: 2538
Joined: Tue Feb 06, 2007 12:36 pm

Re: finding out how much memory is available

Post 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.
wydmynd
Member
Posts: 87
Joined: Thu Dec 06, 2018 9:25 am

Re: finding out how much memory is available

Post 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
Post Reply