fix(nuttx): scale task stack sizes with the pointer size

Module stack sizes are tuned for 32-bit targets. The POSIX task spawn
and the work queues already pass them through PX4_STACK_ADJUSTED(),
which doubles them when pointers are 64-bit; px4_task_spawn_cmd() on
NuttX did not, so a 64-bit NuttX target overflows stacks such as the
SIH simulator's. On 32-bit targets PX4_STACK_ADJUSTED() leaves the size
unchanged.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Afonso Oliveira <afonso.oliveira707@gmail.com>
This commit is contained in:
Afonso Oliveira authored and Julian Oes committed 2026-10-23 22:42:28 +02:00
1 parent 79b4e7e469
commit d78ffbd1cb
1 file changed
+3 -2
+3 -2
View File
@@ -39,6 +39,7 @@
#include <px4_platform_common/px4_config.h>
#include <px4_platform_common/log.h>
#include <px4_platform_common/posix.h>
#include <px4_platform_common/tasks.h>
#include <px4_platform_common/time.h>
@@ -71,9 +72,9 @@ int px4_task_spawn_cmd(const char *name, int scheduler, int priority, int stack_
#if !defined(__KERNEL__)
/* create the task */
int pid = task_create(name, priority, stack_size, entry, argv);
int pid = task_create(name, priority, PX4_STACK_ADJUSTED(stack_size), entry, argv);
#else
int pid = kthread_create(name, priority, stack_size, entry, argv);
int pid = kthread_create(name, priority, PX4_STACK_ADJUSTED(stack_size), entry, argv);
#endif
if (pid > 0) {