1 /* 2 * Copyright (C) 2017, Linaro Ltd 3 * Copyright (c) 2018-2021, Arm Limited. 4 * 5 * SPDX-License-Identifier: Apache-2.0 6 */ 7 8 /* 9 * Original code taken from mcuboot project at: 10 * https://github.com/mcu-tools/mcuboot 11 * Git SHA of the original version: ac55554059147fff718015be9f4bd3108123f50a 12 */ 13 14 #ifndef H_TARGETS_TARGET_ 15 #define H_TARGETS_TARGET_ 16 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 22 #ifdef DEFAULT_MCUBOOT_FLASH_MAP 23 /* No need to check the platform defines if custom flash map is used */ 24 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 33 #ifdef MCUBOOT_RAM_LOAD 34 #ifndef IMAGE_EXECUTABLE_RAM_START 35 #error "If MCUBOOT_RAM_LOAD is set then IMAGE_EXECUTABLE_RAM_START must be \ 36 defined by the target" 37 #endif 38 39 #ifndef IMAGE_EXECUTABLE_RAM_SIZE 40 #error "If MCUBOOT_RAM_LOAD is set then IMAGE_EXECUTABLE_RAM_SIZE must be \ 41 defined by the target" 42 #endif 43 #endif /* MCUBOOT_RAM_LOAD */ 44 45 #ifndef FLASH_AREA_0_OFFSET 46 #error "FLASH_AREA_0_OFFSET must be defined by the target" 47 #endif 48 49 #ifndef FLASH_AREA_0_SIZE 50 #error "FLASH_AREA_0_SIZE must be defined by the target" 51 #endif 52 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 58 #ifndef FLASH_AREA_2_OFFSET 59 #error "FLASH_AREA_2_OFFSET must be defined by the target" 60 #endif 61 62 #ifndef FLASH_AREA_2_SIZE 63 #error "FLASH_AREA_2_SIZE must be defined by the target" 64 #endif 65 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 71 #if (MCUBOOT_IMAGE_NUMBER == 2) 72 #ifndef FLASH_AREA_1_OFFSET 73 #error "FLASH_AREA_1_OFFSET must be defined by the target" 74 #endif 75 76 #ifndef FLASH_AREA_1_SIZE 77 #error "FLASH_AREA_1_SIZE must be defined by the target" 78 #endif 79 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 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 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 97 #endif /* (MCUBOOT_IMAGE_NUMBER == 2) */ 98 99 #if defined(MCUBOOT_SWAP_USING_SCRATCH) 100 #ifndef FLASH_AREA_SCRATCH_OFFSET 101 #error "FLASH_AREA_SCRATCH_OFFSET must be defined by the target" 102 #endif 103 104 #ifndef FLASH_AREA_SCRATCH_SIZE 105 #error "FLASH_AREA_SCRATCH_SIZE must be defined by the target" 106 #endif 107 108 #if defined(FLASH_DEV_NAME_SCRATCH) != defined(FLASH_DEVICE_ID_SCRATCH) 109 #error "FLASH DEV_NAME_SCRATCH and DEVICE_ID_SCRATCH must be simultaneously defined \ 110 or not by target" 111 #endif 112 #endif /* defined(MCUBOOT_SWAP_USING_SCRATCH) */ 113 114 #ifndef FLASH_DEV_NAME 115 #error "BL2 supports CMSIS flash interface and device name must be specified" 116 #endif 117 118 #ifndef MCUBOOT_STATUS_MAX_ENTRIES 119 #error "MCUBOOT_STATUS_MAX_ENTRIES must be defined by the target" 120 #endif 121 122 #ifndef MCUBOOT_MAX_IMG_SECTORS 123 #error "MCUBOOT_MAX_IMG_SECTORS must be defined by the target" 124 #endif 125 126 #endif /* DEFAULT_MCUBOOT_FLASH_MAP */ 127 128 #endif /* H_TARGETS_TARGET_ */ 129