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. |
| 19 | * |
| 20 | * TODO: remove soc_family_foo.h once image sector sizes come from the |
| 21 | * flash driver. |
| 22 | */ |
| 23 | #include <soc.h> |
Marti Bolivar | 51181cf | 2017-03-20 11:03:41 -0400 | [diff] [blame] | 24 | |
Marti Bolivar | 3d9e3eb | 2017-09-20 16:28:57 -0400 | [diff] [blame^] | 25 | #define FLASH_ALIGN FLASH_WRITE_BLOCK_SIZE |
| 26 | |
Marti Bolivar | 29d3a77 | 2017-03-20 10:44:25 -0400 | [diff] [blame] | 27 | #if defined(CONFIG_SOC_FAMILY_NRF5) |
| 28 | #include "soc_family_nrf5.h" |
Marti Bolivar | 382f64a | 2017-09-01 13:59:35 -0400 | [diff] [blame] | 29 | #elif defined(CONFIG_SOC_FAMILY_STM32) |
| 30 | #include "soc_family_stm32.h" |
Marti Bolivar | 07cd2d0 | 2017-09-01 14:05:53 -0400 | [diff] [blame] | 31 | #elif defined(CONFIG_SOC_FAMILY_KINETIS) |
| 32 | #include "soc_family_kinetis.h" |
Marti Bolivar | 29d3a77 | 2017-03-20 10:44:25 -0400 | [diff] [blame] | 33 | #endif |
Marti Bolivar | 3d9e3eb | 2017-09-20 16:28:57 -0400 | [diff] [blame^] | 34 | #endif /* !defined(MCUBOOT_TARGET_CONFIG) */ |
Marti Bolivar | 29d3a77 | 2017-03-20 10:44:25 -0400 | [diff] [blame] | 35 | |
Marti Bolivar | 61038df | 2017-09-01 12:52:56 -0400 | [diff] [blame] | 36 | /* |
Marti Bolivar | 3d9e3eb | 2017-09-20 16:28:57 -0400 | [diff] [blame^] | 37 | * Sanity check the target support. |
Marti Bolivar | 61038df | 2017-09-01 12:52:56 -0400 | [diff] [blame] | 38 | */ |
| 39 | #if !defined(FLASH_DRIVER_NAME) || \ |
| 40 | !defined(FLASH_ALIGN) || \ |
| 41 | !defined(FLASH_AREA_IMAGE_0_OFFSET) || \ |
| 42 | !defined(FLASH_AREA_IMAGE_0_SIZE) || \ |
| 43 | !defined(FLASH_AREA_IMAGE_1_OFFSET) || \ |
| 44 | !defined(FLASH_AREA_IMAGE_1_SIZE) || \ |
| 45 | !defined(FLASH_AREA_IMAGE_SCRATCH_OFFSET) || \ |
| 46 | !defined(FLASH_AREA_IMAGE_SCRATCH_SIZE) |
| 47 | #error "Target support is incomplete; cannot build mcuboot." |
| 48 | #endif |
| 49 | |
Marti Bolivar | 51181cf | 2017-03-20 11:03:41 -0400 | [diff] [blame] | 50 | #endif |