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 | |
Kumar Gala | 9a5b951 | 2020-04-08 12:06:21 -0500 | [diff] [blame^] | 28 | #if DT_NODE_HAS_PROP(DT_INST(0, jedec_spi_nor), label) |
| 29 | #define JEDEC_SPI_NOR_0_LABEL DT_LABEL(DT_INST(0, jedec_spi_nor)) |
| 30 | #endif |
| 31 | |
Marti Bolivar | dc4c42b | 2017-09-21 14:20:40 -0400 | [diff] [blame] | 32 | /* |
Marti Bolivar | 3d9e3eb | 2017-09-20 16:28:57 -0400 | [diff] [blame] | 33 | * Sanity check the target support. |
Marti Bolivar | 61038df | 2017-09-01 12:52:56 -0400 | [diff] [blame] | 34 | */ |
Kumar Gala | 32b61f3 | 2020-04-08 12:02:03 -0500 | [diff] [blame] | 35 | #if (!defined(CONFIG_XTENSA) && !defined(DT_CHOSEN_ZEPHYR_FLASH_CONTROLLER_LABEL)) || \ |
Kumar Gala | 9a5b951 | 2020-04-08 12:06:21 -0500 | [diff] [blame^] | 36 | (defined(CONFIG_XTENSA) && !defined(JEDEC_SPI_NOR_0_LABEL)) || \ |
Marti Bolivar | 61038df | 2017-09-01 12:52:56 -0400 | [diff] [blame] | 37 | !defined(FLASH_ALIGN) || \ |
Andrzej Puzdrowski | f1d189c | 2019-12-12 09:34:11 +0100 | [diff] [blame] | 38 | !defined(DT_FLASH_AREA_IMAGE_0_OFFSET) || \ |
| 39 | !defined(DT_FLASH_AREA_IMAGE_0_SIZE) || \ |
| 40 | !defined(DT_FLASH_AREA_IMAGE_1_OFFSET) || \ |
| 41 | !defined(DT_FLASH_AREA_IMAGE_1_SIZE) || \ |
| 42 | (!defined(CONFIG_BOOT_SWAP_USING_MOVE) && !defined(DT_FLASH_AREA_IMAGE_SCRATCH_OFFSET)) || \ |
| 43 | (!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] | 44 | #error "Target support is incomplete; cannot build mcuboot." |
| 45 | #endif |
| 46 | |
David Vincze | b75c12a | 2019-03-22 14:58:33 +0100 | [diff] [blame] | 47 | #if ((MCUBOOT_IMAGE_NUMBER == 2) && (!defined(FLASH_AREA_IMAGE_2_OFFSET) || \ |
| 48 | !defined(FLASH_AREA_IMAGE_2_SIZE) || \ |
| 49 | !defined(FLASH_AREA_IMAGE_3_OFFSET) || \ |
| 50 | !defined(FLASH_AREA_IMAGE_3_SIZE))) |
| 51 | #error "Target support is incomplete; cannot build mcuboot." |
Marti Bolivar | 51181cf | 2017-03-20 11:03:41 -0400 | [diff] [blame] | 52 | #endif |
David Vincze | b75c12a | 2019-03-22 14:58:33 +0100 | [diff] [blame] | 53 | |
| 54 | #endif /* H_TARGETS_TARGET_ */ |