Replace mcuboot flash_map by zephyr flash_map

The patch introduce usage of zephyr flas_map module instead
of mcuboot zephyr-only implementation. Unused flash_area_to_sectors
API of former flash_map was removed as well.
Size of sector-status-update-map entry is now defined thanks to the
minimum write size supported by the flash driver.

For avoid ambiguity former zephyr-only files flash_map.c
were renamed to flash_map_extended.c (its code now implements
only addition to this what zephyr flash_map implements).

flash_map.h header include is now warped by flash_map_backedn.h headre
because implementations and include pathes are diferent in Zephyr and Mynewt.

Usage of hal_flash_align() were replaced by usage flash_area_align().
This provide consistency between MyNewt and Zephyr implementation as
this API is available in both RTOSes.

flash_map.h was moved to the simulator c-support files as now missing in
the boot/zephyr subdirectories.

f. boot_scratch_fa_device_id was removed as unused.
f. boot_img_fa_device_id was and expanded the only use of it
(on loader.c).

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
diff --git a/boot/mynewt/flash_map_backend/include/flash_map_backend/flash_map_backend.h b/boot/mynewt/flash_map_backend/include/flash_map_backend/flash_map_backend.h
new file mode 100644
index 0000000..5de2800
--- /dev/null
+++ b/boot/mynewt/flash_map_backend/include/flash_map_backend/flash_map_backend.h
@@ -0,0 +1,12 @@
+/*
+ * Copyright (c) 2018 Nordic Semiconductor ASA
+ * Copyright (c) 2015 Runtime Inc
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+#ifndef __FLASH_MAP_BACKEND_H__
+#define __FLASH_MAP_BACKEND_H__
+
+#include <flash_map/flash_map.h>
+
+#endif /* __FLASH_MAP_BACKEND_H__ */
diff --git a/boot/mynewt/flash_map_backend/pkg.yml b/boot/mynewt/flash_map_backend/pkg.yml
new file mode 100644
index 0000000..5f04e29
--- /dev/null
+++ b/boot/mynewt/flash_map_backend/pkg.yml
@@ -0,0 +1,13 @@
+#
+# Copyright (c) 2018 Nordic Semiconductor ASA
+#
+# SPDX-License-Identifier: Apache-2.0
+#
+
+pkg.name: boot/mynewt/flash_map_backend
+pkg.description: Flash_map API helper reference.
+pkg.author: "Nordic Semiconductor ASA"
+pkg.homepage: "http://mcuboot.com"
+
+pkg.deps:
+    - "@apache-mynewt-core/sys/flash_map"
diff --git a/boot/mynewt/pkg.yml b/boot/mynewt/pkg.yml
index a005522..396df49 100644
--- a/boot/mynewt/pkg.yml
+++ b/boot/mynewt/pkg.yml
@@ -31,6 +31,7 @@
 pkg.deps:
     - "@mcuboot/boot/mynewt/mcuboot_config"
     - "@mcuboot/boot/bootutil"
+    - "@mcuboot/boot/mynewt/flash_map_backend"
     - "@apache-mynewt-core/kernel/os"
     - "@apache-mynewt-core/sys/console/minimal"
 
diff --git a/boot/mynewt/src/main.c b/boot/mynewt/src/main.c
index 8cad67c..1f2bb5e 100755
--- a/boot/mynewt/src/main.c
+++ b/boot/mynewt/src/main.c
@@ -24,7 +24,7 @@
 #include <inttypes.h>
 #include <stdio.h>
 #include "syscfg/syscfg.h"
-#include <flash_map/flash_map.h>
+#include <flash_map_backend/flash_map_backend.h>
 #include <os/os.h>
 #include <bsp/bsp.h>
 #include <hal/hal_bsp.h>