E
E
eegmak2020-04-09 12:35:36
Microcontrollers
eegmak, 2020-04-09 12:35:36

How to calculate required stack and heap values ​​in CubeMx when using hal usb?

In the usb-audio project on hal usb mono 8kHz 16b, how to calculate the required stack and heap values ​​​​and determine whether a certain microcontroller has enough memory for such stack and heap values?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
benjik, 2020-04-16
@benjik

To determine the stack size in gcc, use the -fstack-usage flag when compiling.
As a result, a .su file will appear, which you can parse some avstack.pl and see how much of the stack is consumed in total, and how much in each individual function.
With a heap, this will not work - it allocates memory dynamically. You can search for all *malloc in the code you're using, for example.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question