zephyr: configurable log thread stack size

Introduced Kconfig property for configure log processing
thread stack size.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
diff --git a/boot/zephyr/Kconfig b/boot/zephyr/Kconfig
index 96bcd89..70ef76d 100644
--- a/boot/zephyr/Kconfig
+++ b/boot/zephyr/Kconfig
@@ -247,6 +247,18 @@
 module-str = MCUBoot bootloader
 source "subsys/logging/Kconfig.template.log_config"
 
+config MCUBOOT_LOG_THREAD_STACK_SIZE
+	int "Stack size for the MCUBoot log processing thread"
+	depends on LOG && !LOG_IMMEDIATE
+	default 2048 if COVERAGE_GCOV
+	default 1024 if NO_OPTIMIZATIONS
+	default 1024 if XTENSA
+	default 4096 if (X86 && X86_64)
+	default 4096 if ARM64
+	default 768
+	help
+	  Set the internal stack size for MCUBoot log processing thread.
+
 menuconfig MCUBOOT_SERIAL
 	bool "MCUboot serial recovery"
 	default n
diff --git a/boot/zephyr/main.c b/boot/zephyr/main.c
index 47e118c..517ec60 100644
--- a/boot/zephyr/main.c
+++ b/boot/zephyr/main.c
@@ -51,11 +51,10 @@
 #else
 #include <logging/log_ctrl.h>
 
-#define BOOT_LOG_STACK_SIZE 768
 #define BOOT_LOG_PROCESSING_INTERVAL 30 /* [ms] */
 
 /* log are processing in custom routine */
-K_THREAD_STACK_DEFINE(boot_log_stack, BOOT_LOG_STACK_SIZE);
+K_THREAD_STACK_DEFINE(boot_log_stack, CONFIG_MCUBOOT_LOG_THREAD_STACK_SIZE);
 struct k_thread boot_log_thread;
 volatile bool boot_log_stop = false;
 K_SEM_DEFINE(boot_log_sem, 1, 1);