1 /* Manual version of auto-generated version. */
2 
3 #ifndef __SYSFLASH_H__
4 #define __SYSFLASH_H__
5 
6 #define FLASH_DEVICE_INTERNAL_FLASH        (0x7F)
7 
8 #define FLASH_AREA_BOOTLOADER 0
9 #define FLASH_AREA_IMAGE_0 1
10 #define FLASH_AREA_IMAGE_1 2
11 #define FLASH_AREA_IMAGE_SCRATCH 3
12 #define FLASH_AREA_IMAGE_2 5
13 #define FLASH_AREA_IMAGE_3 6
14 
15 /* Uncomment if external flash is being used */
16 /* #define CY_BOOT_USE_EXTERNAL_FLASH */
17 
18 /* use PDL-defined offset or one from SMFI config */
19 #define CY_SMIF_BASE_MEM_OFFSET             (0x18000000)
20 
21 #define CY_FLASH_ALIGN                      (CY_FLASH_SIZEOF_ROW)
22 #define CY_FLASH_DEVICE_BASE                (CY_FLASH_BASE)
23 
24 #ifndef CY_BOOT_SCRATCH_SIZE
25 #define CY_BOOT_SCRATCH_SIZE                (0x1000)
26 #endif
27 
28 #ifndef CY_BOOT_BOOTLOADER_SIZE
29 #define CY_BOOT_BOOTLOADER_SIZE             (0x18000)
30 #endif
31 
32 #ifndef CY_BOOT_PRIMARY_1_SIZE
33 #define CY_BOOT_PRIMARY_1_SIZE              (0x10000)
34 #endif
35 
36 #ifndef CY_BOOT_SECONDARY_1_SIZE
37 #define CY_BOOT_SECONDARY_1_SIZE            (0x10000)
38 #endif
39 
40 #if (MCUBOOT_IMAGE_NUMBER == 2) /* if dual-image */
41 #ifndef CY_BOOT_PRIMARY_2_SIZE
42 #define CY_BOOT_PRIMARY_2_SIZE              (0x10000)
43 #endif
44 
45 #ifndef CY_BOOT_SECONDARY_2_SIZE
46 #define CY_BOOT_SECONDARY_2_SIZE            (0x10000)
47 #endif
48 #endif
49 
50 #if (MCUBOOT_IMAGE_NUMBER == 1)
51 #define FLASH_AREA_IMAGE_PRIMARY(x)    (((x) == 0) ?          \
52                                          FLASH_AREA_IMAGE_0 : \
53                                          FLASH_AREA_IMAGE_0)
54 #define FLASH_AREA_IMAGE_SECONDARY(x)  (((x) == 0) ?          \
55                                          FLASH_AREA_IMAGE_1 : \
56                                          FLASH_AREA_IMAGE_1)
57 
58 #elif (MCUBOOT_IMAGE_NUMBER == 2)
59 
60 #define FLASH_AREA_IMAGE_PRIMARY(x)    (((x) == 0) ?          \
61                                          FLASH_AREA_IMAGE_0 : \
62                                         ((x) == 1) ?          \
63                                          FLASH_AREA_IMAGE_2 : \
64                                          255)
65 #define FLASH_AREA_IMAGE_SECONDARY(x)  (((x) == 0) ?          \
66                                          FLASH_AREA_IMAGE_1 : \
67                                         ((x) == 1) ?          \
68                                          FLASH_AREA_IMAGE_3 : \
69                                          255)
70 
71 #else
72 #warning "Image slot and flash area mapping is not defined"
73 #endif
74 #define CY_IMG_HDR_SIZE 0x400
75 
76 #ifndef CY_FLASH_MAP_EXT_DESC
77 /* Uncomment in case you want to use separately defined table of flash area descriptors */
78 /* #define CY_FLASH_MAP_EXT_DESC */
79 #endif
80 
81 #endif /* __SYSFLASH_H__ */
82