Marti Bolivar | 51181cf | 2017-03-20 11:03:41 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2017, Linaro Ltd |
David Vincze | b75c12a | 2019-03-22 14:58:33 +0100 | [diff] [blame] | 3 | * Copyright (c) 2019, Arm Limited |
| 4 | * |
Marti Bolivar | 51181cf | 2017-03-20 11:03:41 -0400 | [diff] [blame] | 5 | * 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 Bolivar | 3d9e3eb | 2017-09-20 16:28:57 -0400 | [diff] [blame] | 12 | /* |
| 13 | * Target-specific definitions are permitted in legacy cases that |
| 14 | * don't provide the information via DTS, etc. |
| 15 | */ |
Marti Bolivar | 51181cf | 2017-03-20 11:03:41 -0400 | [diff] [blame] | 16 | #include MCUBOOT_TARGET_CONFIG |
Marti Bolivar | 3d9e3eb | 2017-09-20 16:28:57 -0400 | [diff] [blame] | 17 | #else |
| 18 | /* |
| 19 | * Otherwise, the Zephyr SoC header and the DTS provide most |
| 20 | * everything we need. |
Marti Bolivar | 3d9e3eb | 2017-09-20 16:28:57 -0400 | [diff] [blame] | 21 | */ |
| 22 | #include <soc.h> |
Marti Bolivar | 51181cf | 2017-03-20 11:03:41 -0400 | [diff] [blame] | 23 | |
Marti Bolivar | 3d9e3eb | 2017-09-20 16:28:57 -0400 | [diff] [blame] | 24 | #define FLASH_ALIGN FLASH_WRITE_BLOCK_SIZE |
| 25 | |
Sergey Koziakov | 3f0738d | 2019-12-02 22:48:44 +0300 | [diff] [blame] | 26 | #endif /* !defined(MCUBOOT_TARGET_CONFIG) */ |
| 27 | |
Marti Bolivar | dc4c42b | 2017-09-21 14:20:40 -0400 | [diff] [blame] | 28 | /* |
Marti Bolivar | 3d9e3eb | 2017-09-20 16:28:57 -0400 | [diff] [blame] | 29 | * Sanity check the target support. |
Marti Bolivar | 61038df | 2017-09-01 12:52:56 -0400 | [diff] [blame] | 30 | */ |
Kumar Gala | 32b61f3 | 2020-04-08 12:02:03 -0500 | [diff] [blame^] | 31 | #if (!defined(CONFIG_XTENSA) && !defined(DT_CHOSEN_ZEPHYR_FLASH_CONTROLLER_LABEL)) || \ |
Rajavardhan Gundi | 24321c3 | 2019-02-08 12:48:34 +0530 | [diff] [blame] | 32 | (defined(CONFIG_XTENSA) && !defined(DT_JEDEC_SPI_NOR_0_LABEL)) || \ |
Marti Bolivar | 61038df | 2017-09-01 12:52:56 -0400 | [diff] [blame] | 33 | !defined(FLASH_ALIGN) || \ |
Andrzej Puzdrowski | f1d189c | 2019-12-12 09:34:11 +0100 | [diff] [blame] | 34 | !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 Bolivar | 61038df | 2017-09-01 12:52:56 -0400 | [diff] [blame] | 40 | #error "Target support is incomplete; cannot build mcuboot." |
| 41 | #endif |
| 42 | |
David Vincze | b75c12a | 2019-03-22 14:58:33 +0100 | [diff] [blame] | 43 | #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 Bolivar | 51181cf | 2017-03-20 11:03:41 -0400 | [diff] [blame] | 48 | #endif |
David Vincze | b75c12a | 2019-03-22 14:58:33 +0100 | [diff] [blame] | 49 | |
| 50 | #endif /* H_TARGETS_TARGET_ */ |