blob: 8a3b14d87280796e4a27b8918d3b9839dd540410 [file] [log] [blame]
Marti Bolivar51181cf2017-03-20 11:03:41 -04001/*
2 * Copyright (C) 2017, Linaro Ltd
3 * SPDX-License-Identifier: Apache-2.0
4 */
5
6#ifndef H_TARGETS_TARGET_
7#define H_TARGETS_TARGET_
8
9#if defined(MCUBOOT_TARGET_CONFIG)
Marti Bolivar3d9e3eb2017-09-20 16:28:57 -040010/*
11 * Target-specific definitions are permitted in legacy cases that
12 * don't provide the information via DTS, etc.
13 */
Marti Bolivar51181cf2017-03-20 11:03:41 -040014#include MCUBOOT_TARGET_CONFIG
Marti Bolivar3d9e3eb2017-09-20 16:28:57 -040015#else
16/*
17 * Otherwise, the Zephyr SoC header and the DTS provide most
18 * everything we need.
19 *
20 * TODO: remove soc_family_foo.h once image sector sizes come from the
21 * flash driver.
22 */
23#include <soc.h>
Marti Bolivar51181cf2017-03-20 11:03:41 -040024
Marti Bolivar3d9e3eb2017-09-20 16:28:57 -040025#define FLASH_ALIGN FLASH_WRITE_BLOCK_SIZE
26
Marti Bolivar29d3a772017-03-20 10:44:25 -040027#if defined(CONFIG_SOC_FAMILY_NRF5)
28#include "soc_family_nrf5.h"
Marti Bolivar382f64a2017-09-01 13:59:35 -040029#elif defined(CONFIG_SOC_FAMILY_STM32)
30#include "soc_family_stm32.h"
Marti Bolivar07cd2d02017-09-01 14:05:53 -040031#elif defined(CONFIG_SOC_FAMILY_KINETIS)
32#include "soc_family_kinetis.h"
Marti Bolivar29d3a772017-03-20 10:44:25 -040033#endif
Marti Bolivar3d9e3eb2017-09-20 16:28:57 -040034#endif /* !defined(MCUBOOT_TARGET_CONFIG) */
Marti Bolivar29d3a772017-03-20 10:44:25 -040035
Marti Bolivar61038df2017-09-01 12:52:56 -040036/*
Marti Bolivar3d9e3eb2017-09-20 16:28:57 -040037 * Sanity check the target support.
Marti Bolivar61038df2017-09-01 12:52:56 -040038 */
39#if !defined(FLASH_DRIVER_NAME) || \
40 !defined(FLASH_ALIGN) || \
41 !defined(FLASH_AREA_IMAGE_0_OFFSET) || \
42 !defined(FLASH_AREA_IMAGE_0_SIZE) || \
43 !defined(FLASH_AREA_IMAGE_1_OFFSET) || \
44 !defined(FLASH_AREA_IMAGE_1_SIZE) || \
45 !defined(FLASH_AREA_IMAGE_SCRATCH_OFFSET) || \
46 !defined(FLASH_AREA_IMAGE_SCRATCH_SIZE)
47#error "Target support is incomplete; cannot build mcuboot."
48#endif
49
Marti Bolivar51181cf2017-03-20 11:03:41 -040050#endif