I am modifying the landing module, to make a throw launch module.

While looking at the CMake file there where two lines that caught my attention differing from the example shown in Writing your First Application · PX4 Developer Guide

MODULE modules__throw_launch
MAIN throw_launch
STACK_MAIN 1200 # dont understand
COMPILE_FLAGS # dont understand
	platforms__common # dont understand

What does the number after STACK_MAIN do, i have seen it at 2000, and now at 1200?
What does COMPILE_FLAGS do?

STACK_MAIN defines the stack size in bytes for your main task. Only if you see low stack warnings on the debug console or in the log, you will need to increase it. Use the top command to see the stack usage of all running applications.
COMPILE_FLAGS are additional flags passed to the compiler. You typically don’t need them.

1 Like

Although I increased the value of STACK_MAIN because ‘low on stack!’ message happens, the stack size is not changed when I see it by the ‘top’ command.

And also I changed all the stack values such as CONFIG_USERMAIN_STACKSIZE in deconfig file, but the stack size of a user made application module does not change.

Finally, the stack size changed after I increased the size in px4_task_spawn_cmd().

So my problem was resolved.

1 Like

This was my experience as well. Does anyone know relation to the stack_size argument in px4_task_spawn_cmd() and STACK_MAIN in the CMakeLists?