From 6b1d662cae9f362b60d4246fb9a7930e996116a3 Mon Sep 17 00:00:00 2001 From: Flavio Ceolin Date: Fri, 30 Jun 2023 23:45:19 -0700 Subject: [PATCH] kernel: dynamic: Add a constraint for user stacks Support for dynamic thread stack on userspace only works with MMU. On MPUs we depend in the number of partitions available in the hw and in the number of partitions used. Because of this constraint, enable heap based allocation only when userspace is not enabled in MPU devices. Signed-off-by: Flavio Ceolin --- kernel/Kconfig | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/kernel/Kconfig b/kernel/Kconfig index 5b25155bf089a18..ace3054f8ebcc21 100644 --- a/kernel/Kconfig +++ b/kernel/Kconfig @@ -220,6 +220,7 @@ config DYNAMIC_THREAD_STACK_SIZE help Default stack size (in bytes) for dynamic threads. +if !USERSPACE || (USERSPACE && MMU) config DYNAMIC_THREAD_ALLOC bool "Support heap-allocated thread objects and stacks" help @@ -228,6 +229,7 @@ config DYNAMIC_THREAD_ALLOC Only use this type of allocation in situations where malloc is permitted. +endif config DYNAMIC_THREAD_POOL_SIZE int "Number of statically pre-allocated threads" @@ -248,12 +250,14 @@ choice DYNAMIC_THREAD_PREFER CONFIG_DYNAMIC_THREAD_POOL_SIZE > 0, then the user may specify the order in which allocation is attmpted. +if !USERSPACE || (USERSPACE && MMU) config DYNAMIC_THREAD_PREFER_ALLOC bool "Prefer heap-based allocation" depends on DYNAMIC_THREAD_ALLOC help Select this option to attempt a heap-based allocation prior to any pool-based allocation. +endif config DYNAMIC_THREAD_PREFER_POOL bool "Prefer pool-based allocation"