boot: zephyr: fix flash page layout hacks

Zephyr now has proper page layout APIs in its flash driver. Use these
to implement flash_area_get_sectors() and flash_area_to_sectors() when
they are available. Leave the existing implementation behind as a
"legacy" version, for flash drivers which lack page layout support.

This lets us obtain all the target support we need for nRF and STM32
targets entirely from the operating system.

There are two cases where OS-level support is still not enough:

- NXP K6x targets still need an SoC family header, because their flash
  driver does not yet support CONFIG_FLASH_PAGE_LAYOUT.

- The arduino_101 target needs partition and flash alignment
  definitions in its DTS, and a flash driver with page layout support
  as well, so its board-specific header must remain for now.

Fixing these is left to future work. Once that is done,
boot/zephyr/targets/ can be removed completely.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
diff --git a/boot/zephyr/include/target.h b/boot/zephyr/include/target.h
index 8a3b14d..9ccc032 100644
--- a/boot/zephyr/include/target.h
+++ b/boot/zephyr/include/target.h
@@ -16,19 +16,16 @@
 /*
  * Otherwise, the Zephyr SoC header and the DTS provide most
  * everything we need.
- *
- * TODO: remove soc_family_foo.h once image sector sizes come from the
- * flash driver.
  */
 #include <soc.h>
 
 #define FLASH_ALIGN FLASH_WRITE_BLOCK_SIZE
 
-#if defined(CONFIG_SOC_FAMILY_NRF5)
-#include "soc_family_nrf5.h"
-#elif defined(CONFIG_SOC_FAMILY_STM32)
-#include "soc_family_stm32.h"
-#elif defined(CONFIG_SOC_FAMILY_KINETIS)
+/*
+ * TODO: remove soc_family_kinetis.h once its flash driver supports
+ * FLASH_PAGE_LAYOUT.
+ */
+#if defined(CONFIG_SOC_FAMILY_KINETIS)
 #include "soc_family_kinetis.h"
 #endif
 #endif /* !defined(MCUBOOT_TARGET_CONFIG) */