zephyr: move nRF5 target config into soc_family_nrf5.h

All of the information we need is in DTS or is the same across all
boards in the SoC family. There's no need for board-specific headers
for these targets.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
diff --git a/boot/zephyr/Makefile b/boot/zephyr/Makefile
index 4789268..e63adbc 100644
--- a/boot/zephyr/Makefile
+++ b/boot/zephyr/Makefile
@@ -1,4 +1,6 @@
+ifneq ($(wildcard $(PROJECT)/boot/zephyr/targets/$(BOARD).h),)
 subdir-ccflags-y += -DMCUBOOT_TARGET_CONFIG='"$(BOARD).h"'
+endif
 subdir-ccflags-y += -I$(PROJECT)/boot/bootutil/include
 subdir-ccflags-y += -I$(PROJECT)/boot/zephyr/include
 subdir-ccflags-y += -I$(PROJECT)/boot/zephyr/targets
diff --git a/boot/zephyr/include/target.h b/boot/zephyr/include/target.h
index de9ecaf..d37a523 100644
--- a/boot/zephyr/include/target.h
+++ b/boot/zephyr/include/target.h
@@ -9,8 +9,6 @@
 /* Board-specific definitions go first, to allow maximum override. */
 #if defined(MCUBOOT_TARGET_CONFIG)
 #include MCUBOOT_TARGET_CONFIG
-#else
-#error "Board is currently not supported by bootloader"
 #endif
 
 /* SoC family configuration. */
@@ -18,4 +16,20 @@
 #include "soc_family_nrf5.h"
 #endif
 
+/*
+ * This information can come from DTS, a target-specific header file,
+ * or an SoC-specific header file. If any of it is missing, target
+ * support is incomplete.
+ */
+#if !defined(FLASH_DRIVER_NAME) || \
+    !defined(FLASH_ALIGN) ||                  \
+    !defined(FLASH_AREA_IMAGE_0_OFFSET) || \
+    !defined(FLASH_AREA_IMAGE_0_SIZE) || \
+    !defined(FLASH_AREA_IMAGE_1_OFFSET) || \
+    !defined(FLASH_AREA_IMAGE_1_SIZE) || \
+    !defined(FLASH_AREA_IMAGE_SCRATCH_OFFSET) || \
+    !defined(FLASH_AREA_IMAGE_SCRATCH_SIZE)
+#error "Target support is incomplete; cannot build mcuboot."
+#endif
+
 #endif
diff --git a/boot/zephyr/targets/96b_nitrogen.h b/boot/zephyr/targets/96b_nitrogen.h
deleted file mode 100644
index 71e554a..0000000
--- a/boot/zephyr/targets/96b_nitrogen.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright (c) 2017 Linaro
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @file
- * @brief Bootloader device specific configuration.
- */
-
-#define FLASH_DRIVER_NAME		CONFIG_SOC_FLASH_NRF5_DEV_NAME
-#define FLASH_ALIGN			4
-/* Flash sector size is provided by SoC family include */
diff --git a/boot/zephyr/targets/nrf51_pca10028.h b/boot/zephyr/targets/nrf51_pca10028.h
deleted file mode 100644
index 8bf817d..0000000
--- a/boot/zephyr/targets/nrf51_pca10028.h
+++ /dev/null
@@ -1,9 +0,0 @@
-/*
- *  Copyright (C) 2017, Linaro Ltd
- *  Copyright (C) 2017, Nordic Semiconductor ASA
- *  SPDX-License-Identifier: Apache-2.0
- */
-
-#define FLASH_DRIVER_NAME		CONFIG_SOC_FLASH_NRF5_DEV_NAME
-#define FLASH_ALIGN			4
-/* Flash sector size is provided by SoC include */
diff --git a/boot/zephyr/targets/nrf52840_pca10056.h b/boot/zephyr/targets/nrf52840_pca10056.h
deleted file mode 100644
index df12989..0000000
--- a/boot/zephyr/targets/nrf52840_pca10056.h
+++ /dev/null
@@ -1,8 +0,0 @@
-/*
- *  Copyright (C) 2017, Linaro Ltd
- *  SPDX-License-Identifier: Apache-2.0
- */
-
-#define FLASH_DRIVER_NAME		CONFIG_SOC_FLASH_NRF5_DEV_NAME
-#define FLASH_ALIGN			4
-/* Flash sector size is provided by SoC include */
diff --git a/boot/zephyr/targets/nrf52_blenano2.h b/boot/zephyr/targets/nrf52_blenano2.h
deleted file mode 100644
index 71e554a..0000000
--- a/boot/zephyr/targets/nrf52_blenano2.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright (c) 2017 Linaro
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @file
- * @brief Bootloader device specific configuration.
- */
-
-#define FLASH_DRIVER_NAME		CONFIG_SOC_FLASH_NRF5_DEV_NAME
-#define FLASH_ALIGN			4
-/* Flash sector size is provided by SoC family include */
diff --git a/boot/zephyr/targets/nrf52_pca10040.h b/boot/zephyr/targets/nrf52_pca10040.h
deleted file mode 100644
index 8bf817d..0000000
--- a/boot/zephyr/targets/nrf52_pca10040.h
+++ /dev/null
@@ -1,9 +0,0 @@
-/*
- *  Copyright (C) 2017, Linaro Ltd
- *  Copyright (C) 2017, Nordic Semiconductor ASA
- *  SPDX-License-Identifier: Apache-2.0
- */
-
-#define FLASH_DRIVER_NAME		CONFIG_SOC_FLASH_NRF5_DEV_NAME
-#define FLASH_ALIGN			4
-/* Flash sector size is provided by SoC include */
diff --git a/boot/zephyr/targets/soc_family_nrf5.h b/boot/zephyr/targets/soc_family_nrf5.h
index 05d1d84..c0baeaf 100644
--- a/boot/zephyr/targets/soc_family_nrf5.h
+++ b/boot/zephyr/targets/soc_family_nrf5.h
@@ -5,8 +5,6 @@
 
 #include <soc.h>
 
-/*
- * Rather than hard-coding the flash size for each SoC, pull it out of
- * the factory information configuration registers.
- */
 #define FLASH_AREA_IMAGE_SECTOR_SIZE (NRF_FICR->CODEPAGESIZE)
+#define FLASH_DRIVER_NAME CONFIG_SOC_FLASH_NRF5_DEV_NAME
+#define FLASH_ALIGN 4