apache / apache/nuttx

Idle stack size is not checked.

Open
#2,001 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
4k
Forks
1.7k
Avg merge
1d 17h
Merged PRs (30d)
237

Description

I am using NuttX v9.1.0, on an STM32F427.

As I see, (at least) on Cortex-M architectures, the idle stack is placed right after BSS.
The top of stack is defined as:
`#define IDLE_STACK ((unsigned)&_ebss+CONFIG_IDLETHREAD_STACKSIZE-4)`

This makes the assumption that there is enough memory after BSS to fit the idle stack. If BSS grows enough that there is less than `CONFIG_IDLETHREAD_STACKSIZE` free space, then the top of stack will fall outside the memory region.

Even worse, since this is not checked during build, there will be no warning or any indication of the problem. The system will just crash during initialization.

My proposition is to add an explicit memory region in the linker script to place the idle stack, so its position and size are well defined, and checked during build.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.