Marti Bolivar | 51181cf | 2017-03-20 11:03:41 -0400 | [diff] [blame] | 1 | /* |
| 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 Bolivar | 3d9e3eb | 2017-09-20 16:28:57 -0400 | [diff] [blame] | 10 | /* |
| 11 | * Target-specific definitions are permitted in legacy cases that |
| 12 | * don't provide the information via DTS, etc. |
| 13 | */ |
Marti Bolivar | 51181cf | 2017-03-20 11:03:41 -0400 | [diff] [blame] | 14 | #include MCUBOOT_TARGET_CONFIG |
Marti Bolivar | 3d9e3eb | 2017-09-20 16:28:57 -0400 | [diff] [blame] | 15 | #else |
| 16 | /* |
| 17 | * Otherwise, the Zephyr SoC header and the DTS provide most |
| 18 | * everything we need. |
Marti Bolivar | 3d9e3eb | 2017-09-20 16:28:57 -0400 | [diff] [blame] | 19 | */ |
| 20 | #include <soc.h> |
Marti Bolivar | 51181cf | 2017-03-20 11:03:41 -0400 | [diff] [blame] | 21 | |
Marti Bolivar | 3d9e3eb | 2017-09-20 16:28:57 -0400 | [diff] [blame] | 22 | #define FLASH_ALIGN FLASH_WRITE_BLOCK_SIZE |
| 23 | |
Marti Bolivar | dc4c42b | 2017-09-21 14:20:40 -0400 | [diff] [blame^] | 24 | /* |
| 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 Bolivar | 07cd2d0 | 2017-09-01 14:05:53 -0400 | [diff] [blame] | 29 | #include "soc_family_kinetis.h" |
Marti Bolivar | 29d3a77 | 2017-03-20 10:44:25 -0400 | [diff] [blame] | 30 | #endif |
Marti Bolivar | 3d9e3eb | 2017-09-20 16:28:57 -0400 | [diff] [blame] | 31 | #endif /* !defined(MCUBOOT_TARGET_CONFIG) */ |
Marti Bolivar | 29d3a77 | 2017-03-20 10:44:25 -0400 | [diff] [blame] | 32 | |
Marti Bolivar | 61038df | 2017-09-01 12:52:56 -0400 | [diff] [blame] | 33 | /* |
Marti Bolivar | 3d9e3eb | 2017-09-20 16:28:57 -0400 | [diff] [blame] | 34 | * Sanity check the target support. |
Marti Bolivar | 61038df | 2017-09-01 12:52:56 -0400 | [diff] [blame] | 35 | */ |
| 36 | #if !defined(FLASH_DRIVER_NAME) || \ |
| 37 | !defined(FLASH_ALIGN) || \ |
| 38 | !defined(FLASH_AREA_IMAGE_0_OFFSET) || \ |
| 39 | !defined(FLASH_AREA_IMAGE_0_SIZE) || \ |
| 40 | !defined(FLASH_AREA_IMAGE_1_OFFSET) || \ |
| 41 | !defined(FLASH_AREA_IMAGE_1_SIZE) || \ |
| 42 | !defined(FLASH_AREA_IMAGE_SCRATCH_OFFSET) || \ |
| 43 | !defined(FLASH_AREA_IMAGE_SCRATCH_SIZE) |
| 44 | #error "Target support is incomplete; cannot build mcuboot." |
| 45 | #endif |
| 46 | |
Marti Bolivar | 51181cf | 2017-03-20 11:03:41 -0400 | [diff] [blame] | 47 | #endif |