fjpanag commented on issue #2001:
URL: 
https://github.com/apache/incubator-nuttx/issues/2001#issuecomment-724786211


   I was thinking... In a typical bare-metal application, usually the 
top-of-stack is defined as a linker symbol, since its size its not known. There 
things are much simpler, there is only one stack which takes all available 
space after BSS.
   
   However, NuttX is a different thing. It has multiple stacks, all of which 
have a defined size in compile-time. There is no way for the stack to grow to 
take all remaining space after linking (and there would be no reason to do so).
   
   So, why have the IDLE stack defined like that? Why not make it a statically 
allocated buffer?
   E.g.
   ```
   uint8_t g_idle_topstack[CONFIG_IDLETHREAD_STACKSIZE];
   ```
   
   This way the stack will be allocated within BSS. The linker will be able to 
check its size and whether it fits.
   
   It will also give the ability to set it to a specific memory region. An 
users' custom linker scripts will be able to place the stack to whatever memory 
region they like. Just as discussed in #2002, there will be no assumptions on 
how stuff should be mapped into memory.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to