blob: a32dbf22e7079c619cfe1bb24e91fe9ee5a51a0a [file] [log] [blame]
Tamas Banf70ef8c2017-12-19 15:35:09 +00001/*
2 * Copyright (C) 2017, Linaro Ltd
Mark Horvath8576e382021-03-12 10:24:55 +01003 * Copyright (c) 2018-2021, Arm Limited.
Tamas Banc3828852018-02-01 12:24:16 +00004 *
Tamas Banf70ef8c2017-12-19 15:35:09 +00005 * SPDX-License-Identifier: Apache-2.0
6 */
7
David Vinczecea8b592019-10-29 16:09:51 +01008/*
9 * Original code taken from mcuboot project at:
Tamas Banc5b2f2b2020-11-12 09:47:05 +000010 * https://github.com/mcu-tools/mcuboot
David Vincze2ddc1372019-10-25 11:10:08 +020011 * Git SHA of the original version: ac55554059147fff718015be9f4bd3108123f50a
David Vinczecea8b592019-10-29 16:09:51 +010012 */
13
Tamas Banf70ef8c2017-12-19 15:35:09 +000014#ifndef H_TARGETS_TARGET_
15#define H_TARGETS_TARGET_
16
Tamas Banc3828852018-02-01 12:24:16 +000017/* 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 Horvath8576e382021-03-12 10:24:55 +010022#ifdef DEFAULT_MCUBOOT_FLASH_MAP
23/* No need to check the platform defines if custom flash map is used */
24
Tamas Banc3828852018-02-01 12:24:16 +000025#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 Banf4023f32020-09-16 11:02:52 +010033#ifdef MCUBOOT_RAM_LOAD
Raef Colesaf082382019-10-01 11:10:33 +010034#ifndef IMAGE_EXECUTABLE_RAM_START
Tamas Banf4023f32020-09-16 11:02:52 +010035#error "If MCUBOOT_RAM_LOAD is set then IMAGE_EXECUTABLE_RAM_START must be \
Raef Colesaf082382019-10-01 11:10:33 +010036defined by the target"
37#endif
38
39#ifndef IMAGE_EXECUTABLE_RAM_SIZE
Tamas Banf4023f32020-09-16 11:02:52 +010040#error "If MCUBOOT_RAM_LOAD is set then IMAGE_EXECUTABLE_RAM_SIZE must be \
Raef Colesaf082382019-10-01 11:10:33 +010041defined by the target"
42#endif
Tamas Banf4023f32020-09-16 11:02:52 +010043#endif /* MCUBOOT_RAM_LOAD */
Raef Colesaf082382019-10-01 11:10:33 +010044
David Vinczebb207982019-08-21 15:13:04 +020045#ifndef FLASH_AREA_0_OFFSET
46#error "FLASH_AREA_0_OFFSET must be defined by the target"
Tamas Banc3828852018-02-01 12:24:16 +000047#endif
48
David Vinczebb207982019-08-21 15:13:04 +020049#ifndef FLASH_AREA_0_SIZE
50#error "FLASH_AREA_0_SIZE must be defined by the target"
Tamas Banc3828852018-02-01 12:24:16 +000051#endif
52
Michel Jaouen26f6c022020-12-03 10:37:22 +010053#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 \
55by target"
56#endif
57
David Vinczebb207982019-08-21 15:13:04 +020058#ifndef FLASH_AREA_2_OFFSET
59#error "FLASH_AREA_2_OFFSET must be defined by the target"
Tamas Banc3828852018-02-01 12:24:16 +000060#endif
61
David Vinczebb207982019-08-21 15:13:04 +020062#ifndef FLASH_AREA_2_SIZE
63#error "FLASH_AREA_2_SIZE must be defined by the target"
Tamas Banc3828852018-02-01 12:24:16 +000064#endif
65
Michel Jaouen26f6c022020-12-03 10:37:22 +010066#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 \
68by target"
69#endif
70
David Vinczebb207982019-08-21 15:13:04 +020071#if (MCUBOOT_IMAGE_NUMBER == 2)
72#ifndef FLASH_AREA_1_OFFSET
73#error "FLASH_AREA_1_OFFSET must be defined by the target"
Tamas Banc3828852018-02-01 12:24:16 +000074#endif
75
David Vinczebb207982019-08-21 15:13:04 +020076#ifndef FLASH_AREA_1_SIZE
77#error "FLASH_AREA_1_SIZE must be defined by the target"
78#endif
79
Michel Jaouen26f6c022020-12-03 10:37:22 +010080#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 \
82by target"
83#endif
84
David Vinczebb207982019-08-21 15:13:04 +020085#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 Jaouen26f6c022020-12-03 10:37:22 +010092
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 \
95by target"
96#endif
David Vinczebb207982019-08-21 15:13:04 +020097#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 Banc3828852018-02-01 12:24:16 +0000105#endif
106
Michel Jaouen26f6c022020-12-03 10:37:22 +0100107#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 \
109or not by target"
110#endif
111
Tamas Banc3828852018-02-01 12:24:16 +0000112#ifndef FLASH_DEV_NAME
113#error "BL2 supports CMSIS flash interface and device name must be specified"
Tamas Banf70ef8c2017-12-19 15:35:09 +0000114#endif
115
David Vinczeead78fb2019-12-09 17:41:58 +0100116#ifndef MCUBOOT_STATUS_MAX_ENTRIES
117#error "MCUBOOT_STATUS_MAX_ENTRIES must be defined by the target"
Mate Toth-Pala76e2ab2018-05-31 15:43:01 +0200118#endif
119
David Vinczeead78fb2019-12-09 17:41:58 +0100120#ifndef MCUBOOT_MAX_IMG_SECTORS
121#error "MCUBOOT_MAX_IMG_SECTORS must be defined by the target"
Mate Toth-Pala76e2ab2018-05-31 15:43:01 +0200122#endif
123
Mark Horvath8576e382021-03-12 10:24:55 +0100124#endif /* DEFAULT_MCUBOOT_FLASH_MAP */
125
David Vinczebb207982019-08-21 15:13:04 +0200126#endif /* H_TARGETS_TARGET_ */