zephyr: enable MULTITHREADING by default except on nRF
CONFIG_MULTITHREADING is generally assumed to be y by the zephyr
kernel, even though that's not reflected in the Kconfig. For example,
semaphores depend on it being y, but CMake will still build sem.c even
if it's n.
The sensible default for this option is thus y.
However, it's a size advantage to disable it if the platform drivers
are all aware of this option, such as nRF.
Let's re-work our use of this option to keep it disabled when we know
it's safe, but enable it by default so more platforms can be expected
to work out of the box.
Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
diff --git a/boot/zephyr/Kconfig b/boot/zephyr/Kconfig
index feead57..e5a388e 100644
--- a/boot/zephyr/Kconfig
+++ b/boot/zephyr/Kconfig
@@ -271,4 +271,15 @@
comment "Zephyr configuration options"
+# Disabling MULTITHREADING provides a code size advantage, but
+# it requires peripheral drivers (particularly a flash driver)
+# that works properly with the option enabled.
+#
+# If you know for sure that your hardware will work, you can default
+# it to n here. Otherwise, having it on by default makes the most
+# hardware work.
+config MULTITHREADING
+ default n if SOC_FAMILY_NRF
+ default y
+
source "$ZEPHYR_BASE/Kconfig.zephyr"
diff --git a/boot/zephyr/boards/intel_s1000_crb.conf b/boot/zephyr/boards/intel_s1000_crb.conf
index e3c5ee4..ab2bfd6 100644
--- a/boot/zephyr/boards/intel_s1000_crb.conf
+++ b/boot/zephyr/boards/intel_s1000_crb.conf
@@ -1,5 +1,4 @@
CONFIG_DEBUG=n
CONFIG_I2C=n
CONFIG_BOOT_MAX_IMG_SECTORS=512
-CONFIG_MULTITHREADING=y
CONFIG_BOOT_WAIT_FOR_USB_DFU=y
diff --git a/boot/zephyr/boards/nrf52_minimal_footprint.conf b/boot/zephyr/boards/nrf52_minimal_footprint.conf
index b7aba7f..8c24f54 100644
--- a/boot/zephyr/boards/nrf52_minimal_footprint.conf
+++ b/boot/zephyr/boards/nrf52_minimal_footprint.conf
@@ -22,7 +22,6 @@
CONFIG_SOC_NRF52832_QFAA=y
CONFIG_ARM=y
CONFIG_ARM_MPU=n
-# CONFIG_MULTITHREADING is not set
CONFIG_MAIN_STACK_SIZE=10240
CONFIG_THREAD_STACK_INFO=n
# CONFIG_TICKLESS_KERNEL is not set
diff --git a/boot/zephyr/prj.conf b/boot/zephyr/prj.conf
index dd67333..d40307a 100644
--- a/boot/zephyr/prj.conf
+++ b/boot/zephyr/prj.conf
@@ -36,8 +36,6 @@
CONFIG_FLASH=y
-CONFIG_MULTITHREADING=n
-
### Various Zephyr boards enable features that we don't want.
# CONFIG_BT is not set
# CONFIG_BT_CTLR is not set