zephyr: move flash sectors configuration option to mcuboot_config.h
This allows us to delete all the remaining compiler command line
configuration from CMakeLists.txt.
Signed-off-by: Marti Bolivar <marti@opensourcefoundries.com>
diff --git a/boot/zephyr/CMakeLists.txt b/boot/zephyr/CMakeLists.txt
index da5a594..a76bcf2 100644
--- a/boot/zephyr/CMakeLists.txt
+++ b/boot/zephyr/CMakeLists.txt
@@ -8,8 +8,6 @@
set(KCONFIG_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/Kconfig)
-set(MCUBOOT_EXTRA_CFLAGS)
-
# Board-specific CONF_FILES should get merged into the build as well.
#
# Do this by defining the set_conf_file macro:
@@ -22,18 +20,6 @@
endif()
endmacro()
-# Enabling this option uses newer flash map APIs. This saves RAM and
-# avoids deprecated API usage.
-#
-# (This can be deleted when flash_area_to_sectors() is removed instead
-# of simply deprecated.)
-list(APPEND MCUBOOT_EXTRA_CFLAGS "-DMCUBOOT_USE_FLASH_AREA_GET_SECTORS")
-
-# Add values in MCUBOOT_EXTRA_CFLAGS_STR to the Zephyr build's
-# EXTRA_CFLAGS variable.
-string(REPLACE ";" " " MCUBOOT_EXTRA_CFLAGS_STR "${MCUBOOT_EXTRA_CFLAGS}")
-set(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${MCUBOOT_EXTRA_CFLAGS_STR}")
-
# The board should be set to a supported target.
if (NOT DEFINED BOARD)
set(BOARD qemu_x86)
diff --git a/boot/zephyr/include/mcuboot_config/mcuboot_config.h b/boot/zephyr/include/mcuboot_config/mcuboot_config.h
index 5872dcb..7daa58f 100644
--- a/boot/zephyr/include/mcuboot_config/mcuboot_config.h
+++ b/boot/zephyr/include/mcuboot_config/mcuboot_config.h
@@ -39,6 +39,15 @@
#define MCUBOOT_OVERWRITE_ONLY_FAST
#endif
+/*
+ * Enabling this option uses newer flash map APIs. This saves RAM and
+ * avoids deprecated API usage.
+ *
+ * (This can be deleted when flash_area_to_sectors() is removed instead
+ * of simply deprecated.)
+ */
+#define MCUBOOT_USE_FLASH_AREA_GET_SECTORS
+
#endif /* !__BOOTSIM__ */
#endif /* __MCUBOOT_CONFIG_H__ */