Tamas Ban | f70ef8c | 2017-12-19 15:35:09 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2017, Linaro Ltd |
Mark Horvath | 8576e38 | 2021-03-12 10:24:55 +0100 | [diff] [blame] | 3 | * Copyright (c) 2018-2021, Arm Limited. |
Tamas Ban | c382885 | 2018-02-01 12:24:16 +0000 | [diff] [blame] | 4 | * |
Tamas Ban | f70ef8c | 2017-12-19 15:35:09 +0000 | [diff] [blame] | 5 | * SPDX-License-Identifier: Apache-2.0 |
| 6 | */ |
| 7 | |
David Vincze | cea8b59 | 2019-10-29 16:09:51 +0100 | [diff] [blame] | 8 | /* |
| 9 | * Original code taken from mcuboot project at: |
Tamas Ban | c5b2f2b | 2020-11-12 09:47:05 +0000 | [diff] [blame] | 10 | * https://github.com/mcu-tools/mcuboot |
David Vincze | 2ddc137 | 2019-10-25 11:10:08 +0200 | [diff] [blame] | 11 | * Git SHA of the original version: ac55554059147fff718015be9f4bd3108123f50a |
David Vincze | cea8b59 | 2019-10-29 16:09:51 +0100 | [diff] [blame] | 12 | */ |
| 13 | |
Tamas Ban | f70ef8c | 2017-12-19 15:35:09 +0000 | [diff] [blame] | 14 | #ifndef H_TARGETS_TARGET_ |
| 15 | #define H_TARGETS_TARGET_ |
| 16 | |
Tamas Ban | c382885 | 2018-02-01 12:24:16 +0000 | [diff] [blame] | 17 | /* Target specific defines: flash partitions; flash driver name, etc. |
| 18 | * Comes from: platform/ext/target/<BOARD>/<SUBSYSTEM>/partition |
| 19 | */ |
| 20 | #include "flash_layout.h" |
| 21 | |
Mark Horvath | 8576e38 | 2021-03-12 10:24:55 +0100 | [diff] [blame] | 22 | #ifdef DEFAULT_MCUBOOT_FLASH_MAP |
| 23 | /* No need to check the platform defines if custom flash map is used */ |
| 24 | |
Tamas Ban | c382885 | 2018-02-01 12:24:16 +0000 | [diff] [blame] | 25 | #ifndef FLASH_BASE_ADDRESS |
| 26 | #error "FLASH_BASE_ADDRESS must be defined by the target" |
| 27 | #endif |
| 28 | |
| 29 | #ifndef FLASH_AREA_IMAGE_SECTOR_SIZE |
| 30 | #error "FLASH_AREA_IMAGE_SECTOR_SIZE must be defined by the target" |
| 31 | #endif |
| 32 | |
Tamas Ban | f4023f3 | 2020-09-16 11:02:52 +0100 | [diff] [blame] | 33 | #ifdef MCUBOOT_RAM_LOAD |
Raef Coles | af08238 | 2019-10-01 11:10:33 +0100 | [diff] [blame] | 34 | #ifndef IMAGE_EXECUTABLE_RAM_START |
Tamas Ban | f4023f3 | 2020-09-16 11:02:52 +0100 | [diff] [blame] | 35 | #error "If MCUBOOT_RAM_LOAD is set then IMAGE_EXECUTABLE_RAM_START must be \ |
Raef Coles | af08238 | 2019-10-01 11:10:33 +0100 | [diff] [blame] | 36 | defined by the target" |
| 37 | #endif |
| 38 | |
| 39 | #ifndef IMAGE_EXECUTABLE_RAM_SIZE |
Tamas Ban | f4023f3 | 2020-09-16 11:02:52 +0100 | [diff] [blame] | 40 | #error "If MCUBOOT_RAM_LOAD is set then IMAGE_EXECUTABLE_RAM_SIZE must be \ |
Raef Coles | af08238 | 2019-10-01 11:10:33 +0100 | [diff] [blame] | 41 | defined by the target" |
| 42 | #endif |
Tamas Ban | f4023f3 | 2020-09-16 11:02:52 +0100 | [diff] [blame] | 43 | #endif /* MCUBOOT_RAM_LOAD */ |
Raef Coles | af08238 | 2019-10-01 11:10:33 +0100 | [diff] [blame] | 44 | |
David Vincze | bb20798 | 2019-08-21 15:13:04 +0200 | [diff] [blame] | 45 | #ifndef FLASH_AREA_0_OFFSET |
| 46 | #error "FLASH_AREA_0_OFFSET must be defined by the target" |
Tamas Ban | c382885 | 2018-02-01 12:24:16 +0000 | [diff] [blame] | 47 | #endif |
| 48 | |
David Vincze | bb20798 | 2019-08-21 15:13:04 +0200 | [diff] [blame] | 49 | #ifndef FLASH_AREA_0_SIZE |
| 50 | #error "FLASH_AREA_0_SIZE must be defined by the target" |
Tamas Ban | c382885 | 2018-02-01 12:24:16 +0000 | [diff] [blame] | 51 | #endif |
| 52 | |
Michel Jaouen | 26f6c02 | 2020-12-03 10:37:22 +0100 | [diff] [blame] | 53 | #if defined(FLASH_DEV_NAME_0) != defined(FLASH_DEVICE_ID_0) |
| 54 | #error "FLASH DEV_NAME_0 and DEVICE_ID_0 must be simultaneously defined or not \ |
| 55 | by target" |
| 56 | #endif |
| 57 | |
David Vincze | bb20798 | 2019-08-21 15:13:04 +0200 | [diff] [blame] | 58 | #ifndef FLASH_AREA_2_OFFSET |
| 59 | #error "FLASH_AREA_2_OFFSET must be defined by the target" |
Tamas Ban | c382885 | 2018-02-01 12:24:16 +0000 | [diff] [blame] | 60 | #endif |
| 61 | |
David Vincze | bb20798 | 2019-08-21 15:13:04 +0200 | [diff] [blame] | 62 | #ifndef FLASH_AREA_2_SIZE |
| 63 | #error "FLASH_AREA_2_SIZE must be defined by the target" |
Tamas Ban | c382885 | 2018-02-01 12:24:16 +0000 | [diff] [blame] | 64 | #endif |
| 65 | |
Michel Jaouen | 26f6c02 | 2020-12-03 10:37:22 +0100 | [diff] [blame] | 66 | #if defined(FLASH_DEV_NAME_2) != defined(FLASH_DEVICE_ID_2) |
| 67 | #error "FLASH DEV_NAME_2 and DEVICE_ID_2 must be simultaneously defined or not \ |
| 68 | by target" |
| 69 | #endif |
| 70 | |
David Vincze | bb20798 | 2019-08-21 15:13:04 +0200 | [diff] [blame] | 71 | #if (MCUBOOT_IMAGE_NUMBER == 2) |
| 72 | #ifndef FLASH_AREA_1_OFFSET |
| 73 | #error "FLASH_AREA_1_OFFSET must be defined by the target" |
Tamas Ban | c382885 | 2018-02-01 12:24:16 +0000 | [diff] [blame] | 74 | #endif |
| 75 | |
David Vincze | bb20798 | 2019-08-21 15:13:04 +0200 | [diff] [blame] | 76 | #ifndef FLASH_AREA_1_SIZE |
| 77 | #error "FLASH_AREA_1_SIZE must be defined by the target" |
| 78 | #endif |
| 79 | |
Michel Jaouen | 26f6c02 | 2020-12-03 10:37:22 +0100 | [diff] [blame] | 80 | #if defined(FLASH_DEV_NAME_1) != defined(FLASH_DEVICE_ID_1) |
| 81 | #error "FLASH DEV_NAME_1 and DEVICE_ID_1 must be simultaneously defined or not \ |
| 82 | by target" |
| 83 | #endif |
| 84 | |
David Vincze | bb20798 | 2019-08-21 15:13:04 +0200 | [diff] [blame] | 85 | #ifndef FLASH_AREA_3_OFFSET |
| 86 | #error "FLASH_AREA_3_OFFSET must be defined by the target" |
| 87 | #endif |
| 88 | |
| 89 | #ifndef FLASH_AREA_3_SIZE |
| 90 | #error "FLASH_AREA_3_SIZE must be defined by the target" |
| 91 | #endif |
Michel Jaouen | 26f6c02 | 2020-12-03 10:37:22 +0100 | [diff] [blame] | 92 | |
| 93 | #if defined(FLASH_DEV_NAME_3) != defined(FLASH_DEVICE_ID_3) |
| 94 | #error "FLASH DEV_NAME_3 and DEVICE_ID_3 must be simultaneously defined or not \ |
| 95 | by target" |
| 96 | #endif |
David Vincze | bb20798 | 2019-08-21 15:13:04 +0200 | [diff] [blame] | 97 | #endif /* (MCUBOOT_IMAGE_NUMBER == 2) */ |
| 98 | |
| 99 | #ifndef FLASH_AREA_SCRATCH_OFFSET |
| 100 | #error "FLASH_AREA_SCRATCH_OFFSET must be defined by the target" |
| 101 | #endif |
| 102 | |
| 103 | #ifndef FLASH_AREA_SCRATCH_SIZE |
| 104 | #error "FLASH_AREA_SCRATCH_SIZE must be defined by the target" |
Tamas Ban | c382885 | 2018-02-01 12:24:16 +0000 | [diff] [blame] | 105 | #endif |
| 106 | |
Michel Jaouen | 26f6c02 | 2020-12-03 10:37:22 +0100 | [diff] [blame] | 107 | #if defined(FLASH_DEV_NAME_SCRATCH) != defined(FLASH_DEVICE_ID_SCRATCH) |
| 108 | #error "FLASH DEV_NAME_SCRATCH and DEVICE_ID_SCRATCH must be simultaneously defined \ |
| 109 | or not by target" |
| 110 | #endif |
| 111 | |
Tamas Ban | c382885 | 2018-02-01 12:24:16 +0000 | [diff] [blame] | 112 | #ifndef FLASH_DEV_NAME |
| 113 | #error "BL2 supports CMSIS flash interface and device name must be specified" |
Tamas Ban | f70ef8c | 2017-12-19 15:35:09 +0000 | [diff] [blame] | 114 | #endif |
| 115 | |
David Vincze | ead78fb | 2019-12-09 17:41:58 +0100 | [diff] [blame] | 116 | #ifndef MCUBOOT_STATUS_MAX_ENTRIES |
| 117 | #error "MCUBOOT_STATUS_MAX_ENTRIES must be defined by the target" |
Mate Toth-Pal | a76e2ab | 2018-05-31 15:43:01 +0200 | [diff] [blame] | 118 | #endif |
| 119 | |
David Vincze | ead78fb | 2019-12-09 17:41:58 +0100 | [diff] [blame] | 120 | #ifndef MCUBOOT_MAX_IMG_SECTORS |
| 121 | #error "MCUBOOT_MAX_IMG_SECTORS must be defined by the target" |
Mate Toth-Pal | a76e2ab | 2018-05-31 15:43:01 +0200 | [diff] [blame] | 122 | #endif |
| 123 | |
Mark Horvath | 8576e38 | 2021-03-12 10:24:55 +0100 | [diff] [blame] | 124 | #endif /* DEFAULT_MCUBOOT_FLASH_MAP */ |
| 125 | |
David Vincze | bb20798 | 2019-08-21 15:13:04 +0200 | [diff] [blame] | 126 | #endif /* H_TARGETS_TARGET_ */ |