blob: a2c5cf4c0a25342aa895b2022ef7f60925fc76d9 [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.
Marti Bolivar3d9e3eb2017-09-20 16:28:57 -040019 */
20#include <soc.h>
Marti Bolivar51181cf2017-03-20 11:03:41 -040021
Marti Bolivar3d9e3eb2017-09-20 16:28:57 -040022#define FLASH_ALIGN FLASH_WRITE_BLOCK_SIZE
23
Marti Bolivardc4c42b2017-09-21 14:20:40 -040024/*
25 * TODO: remove soc_family_kinetis.h once its flash driver supports
26 * FLASH_PAGE_LAYOUT.
27 */
28#if defined(CONFIG_SOC_FAMILY_KINETIS)
Marti Bolivar07cd2d02017-09-01 14:05:53 -040029#include "soc_family_kinetis.h"
Marti Bolivar29d3a772017-03-20 10:44:25 -040030#endif
Marti Bolivar3d9e3eb2017-09-20 16:28:57 -040031#endif /* !defined(MCUBOOT_TARGET_CONFIG) */
Marti Bolivar29d3a772017-03-20 10:44:25 -040032
Marti Bolivar61038df2017-09-01 12:52:56 -040033/*
Marti Bolivar6f2857c2018-01-31 14:14:40 -050034 * Upstream Zephyr changed the name from FLASH_DRIVER_NAME to
35 * FLASH_DEV_NAME. For now, let's just convert the Zephyr name to the
36 * one expected by MCUboot. This can be cleaned up after the upstream
37 * Zephyr tree has been released and settled down.
38 */
39#if !defined(FLASH_DRIVER_NAME) && defined(FLASH_DEV_NAME)
40#define FLASH_DRIVER_NAME FLASH_DEV_NAME
41#endif
42
43/*
Marti Bolivar3d9e3eb2017-09-20 16:28:57 -040044 * Sanity check the target support.
Marti Bolivar61038df2017-09-01 12:52:56 -040045 */
46#if !defined(FLASH_DRIVER_NAME) || \
47 !defined(FLASH_ALIGN) || \
48 !defined(FLASH_AREA_IMAGE_0_OFFSET) || \
49 !defined(FLASH_AREA_IMAGE_0_SIZE) || \
50 !defined(FLASH_AREA_IMAGE_1_OFFSET) || \
51 !defined(FLASH_AREA_IMAGE_1_SIZE) || \
52 !defined(FLASH_AREA_IMAGE_SCRATCH_OFFSET) || \
53 !defined(FLASH_AREA_IMAGE_SCRATCH_SIZE)
54#error "Target support is incomplete; cannot build mcuboot."
55#endif
56
Marti Bolivar51181cf2017-03-20 11:03:41 -040057#endif