Skip to content

Commit a7e55b8

Browse files
aescolarAnas Nashif
authored andcommitted
native: arch: added recommended stack size config
Added a new config variable with the recommended stack size for threads which are only meant for the posix architecture Signed-off-by: Alberto Escolar Piedras <[email protected]>
1 parent 9489fa5 commit a7e55b8

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

arch/posix/Kconfig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,16 @@ config ARCH_DEFCONFIG
2525

2626
source "arch/posix/core/Kconfig"
2727

28+
config ARCH_POSIX_RECOMMENDED_STACK_SIZE
29+
int
30+
depends on ARCH_POSIX
31+
default 24
32+
help
33+
In bytes, stack size for Zephyr threads meant only for the POSIX
34+
architecture.
35+
(In this architecture only part of the thread status is kept in the Zephyr
36+
thread stack, the real stack is the native underlying pthread stack.
37+
Therefore the allocated stack can be limited to this size)
2838

2939
source "arch/posix/soc/*/Kconfig"
3040

arch/posix/include/posix_core.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ typedef struct {
2626
/* times */
2727
int aborted;
2828
#endif
29+
30+
/*
31+
* Note: If more elements are added to this structure, remember to
32+
* update ARCH_POSIX_RECOMMENDED_STACK_SIZE in the configuration
33+
* Currently it is 24 = 4 pointers + 2 ints = 4*4 + 2*4
34+
*/
2935
} posix_thread_status_t;
3036

3137

0 commit comments

Comments
 (0)