Stack and heap information

Hi ! :slight_smile:

Iā€™m using the evaluation board based on STM32F446RET and uploaded PX4 F/W.

However, there is a problem on memory (maybe).

Firstly, I removed a lot of part in ā€˜nuttx_px4fmu-v4_default.cmakeā€™ file and just executed ā€˜nshā€™ in terminal.

After that I added sensor parts such as MPU9250, MS5611 and so on. It was initialized but I cannot check the sensorā€™s value.

When I debug on eclipse, the program stopped at ā€˜mm_mallinfoā€™ function in ā€˜mm_mallinfo.cā€™ file.

I think that I have to configure 'Stack and heap informationā€™ in ā€˜px4fmu-v4/nsh/defconfigā€™ file. (753 line)

What value should I change and how can I know it?

@DoEon_Lee: This wonā€™t quite answer your question, but I think it will give you some additional information that you should find useful.

Before tweaking the Stack allocation, make sure the linker script has the correct flash, and memory allocations set. The linker script ld.script can be found in nuttx-configs/px4fmu-v4/scripts.

If you search for ā€œstackā€ in the defconfig file, you will see a number of stack allocation sizes for various threads/processes.

When you start a daemon with px4_task_spawn_cmd(), one of the arguments that is passed to the function is the stack to be allocated to that process. You can see how much stack is allocated and currently being used by a process by running top from the NSH shell.

To see how much heap you have used, run free from the NSH shell.