kernel.h: add note about K_THREAD_STACK_SIZEOF()

Each member of the array may need to have a padding size added
such that the base address of each array element corresponds to
the desired stack alignment.

This would mean that sizeof(some array element) would return
a larger size than what was originally provided.

This won't cause problems at runtime since the space is really
there, but for users who are only enabling this padding for
debug features, they may be surprised when their stacks are
effectively smaller than when this was enabled.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit is contained in:
Andrew Boie 2017-07-20 14:22:23 -07:00 committed by Anas Nashif
commit befb0695ba

View file

@ -3903,7 +3903,11 @@ extern void _timer_expiration_handler(struct _timeout *t);
* (for instance a guard area).
*
* The value returned here is guaranteed to match the 'size' parameter
* passed to K_THREAD_STACK_DEFINE and related macros.
* passed to K_THREAD_STACK_DEFINE.
*
* Do not use this for stacks declared with K_THREAD_STACK_ARRAY_DEFINE(),
* it is not guaranteed to return the original value since each array
* element must be aligned.
*
* @param sym Stack memory symbol
* @return Size of the stack