boot_serial: Add image state set/get

Adds optional image state set/get functionality to serial recovery
mode which allows for listing image states and marking images to
be tested or as confirmed.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
diff --git a/boot/zephyr/Kconfig.serial_recovery b/boot/zephyr/Kconfig.serial_recovery
index c73573b..4d8f92f 100644
--- a/boot/zephyr/Kconfig.serial_recovery
+++ b/boot/zephyr/Kconfig.serial_recovery
@@ -207,4 +207,12 @@
 	  If y, image list responses will include the image hash (adds ~100
 	  bytes of flash).
 
+config BOOT_SERIAL_IMG_GRP_IMAGE_STATE
+	bool "Image state support"
+	depends on !SINGLE_APPLICATION_SLOT
+	select BOOT_SERIAL_IMG_GRP_HASH if UPDATEABLE_IMAGE_NUMBER > 1
+	help
+	  If y, image states will be included with image lists and the set
+	  state command can be used to mark an image as test/confirmed.
+
 endif # MCUBOOT_SERIAL
diff --git a/boot/zephyr/include/mcuboot_config/mcuboot_config.h b/boot/zephyr/include/mcuboot_config/mcuboot_config.h
index f4cd969..d69cf5d 100644
--- a/boot/zephyr/include/mcuboot_config/mcuboot_config.h
+++ b/boot/zephyr/include/mcuboot_config/mcuboot_config.h
@@ -213,6 +213,10 @@
 #define MCUBOOT_SERIAL_IMG_GRP_HASH
 #endif
 
+#ifdef CONFIG_BOOT_SERIAL_IMG_GRP_IMAGE_STATE
+#define MCUBOOT_SERIAL_IMG_GRP_IMAGE_STATE
+#endif
+
 /*
  * The option enables code, currently in boot_serial, that attempts
  * to erase flash progressively, as update fragments are received,