blob: 794f40f2de73817c8f4db18b3a43ac5af904ba47 [file] [log] [blame]
Marti Bolivar51181cf2017-03-20 11:03:41 -04001/*
2 * Copyright (C) 2017, Linaro Ltd
David Vinczeb75c12a2019-03-22 14:58:33 +01003 * Copyright (c) 2019, Arm Limited
4 *
Marti Bolivar51181cf2017-03-20 11:03:41 -04005 * SPDX-License-Identifier: Apache-2.0
6 */
7
8#ifndef H_TARGETS_TARGET_
9#define H_TARGETS_TARGET_
10
11#if defined(MCUBOOT_TARGET_CONFIG)
Marti Bolivar3d9e3eb2017-09-20 16:28:57 -040012/*
13 * Target-specific definitions are permitted in legacy cases that
14 * don't provide the information via DTS, etc.
15 */
Marti Bolivar51181cf2017-03-20 11:03:41 -040016#include MCUBOOT_TARGET_CONFIG
Marti Bolivar3d9e3eb2017-09-20 16:28:57 -040017#else
18/*
19 * Otherwise, the Zephyr SoC header and the DTS provide most
20 * everything we need.
Marti Bolivar3d9e3eb2017-09-20 16:28:57 -040021 */
22#include <soc.h>
Marti Bolivar51181cf2017-03-20 11:03:41 -040023
Marti Bolivar3d9e3eb2017-09-20 16:28:57 -040024#define FLASH_ALIGN FLASH_WRITE_BLOCK_SIZE
25
Sergey Koziakov3f0738d2019-12-02 22:48:44 +030026#endif /* !defined(MCUBOOT_TARGET_CONFIG) */
27
Marti Bolivardc4c42b2017-09-21 14:20:40 -040028/*
Marti Bolivar3d9e3eb2017-09-20 16:28:57 -040029 * Sanity check the target support.
Marti Bolivar61038df2017-09-01 12:52:56 -040030 */
Kumar Gala32b61f32020-04-08 12:02:03 -050031#if (!defined(CONFIG_XTENSA) && !defined(DT_CHOSEN_ZEPHYR_FLASH_CONTROLLER_LABEL)) || \
Rajavardhan Gundi24321c32019-02-08 12:48:34 +053032 (defined(CONFIG_XTENSA) && !defined(DT_JEDEC_SPI_NOR_0_LABEL)) || \
Marti Bolivar61038df2017-09-01 12:52:56 -040033 !defined(FLASH_ALIGN) || \
Andrzej Puzdrowskif1d189c2019-12-12 09:34:11 +010034 !defined(DT_FLASH_AREA_IMAGE_0_OFFSET) || \
35 !defined(DT_FLASH_AREA_IMAGE_0_SIZE) || \
36 !defined(DT_FLASH_AREA_IMAGE_1_OFFSET) || \
37 !defined(DT_FLASH_AREA_IMAGE_1_SIZE) || \
38 (!defined(CONFIG_BOOT_SWAP_USING_MOVE) && !defined(DT_FLASH_AREA_IMAGE_SCRATCH_OFFSET)) || \
39 (!defined(CONFIG_BOOT_SWAP_USING_MOVE) && !defined(DT_FLASH_AREA_IMAGE_SCRATCH_SIZE))
Marti Bolivar61038df2017-09-01 12:52:56 -040040#error "Target support is incomplete; cannot build mcuboot."
41#endif
42
David Vinczeb75c12a2019-03-22 14:58:33 +010043#if ((MCUBOOT_IMAGE_NUMBER == 2) && (!defined(FLASH_AREA_IMAGE_2_OFFSET) || \
44 !defined(FLASH_AREA_IMAGE_2_SIZE) || \
45 !defined(FLASH_AREA_IMAGE_3_OFFSET) || \
46 !defined(FLASH_AREA_IMAGE_3_SIZE)))
47#error "Target support is incomplete; cannot build mcuboot."
Marti Bolivar51181cf2017-03-20 11:03:41 -040048#endif
David Vinczeb75c12a2019-03-22 14:58:33 +010049
50#endif /* H_TARGETS_TARGET_ */