Go to the documentation of this file. 35 #ifndef __SPI_FLASH_MAP_H__ 36 #define __SPI_FLASH_MAP_H__ 40 #define _PROGRAM_POWER_SAVE_ 41 #define BT_IMAGE_PRESENT 48 #define FLASH_START_ADDR (0UL) 52 #define FLASH_BLOCK_SIZE (32 * 1024UL) 55 #define FLASH_SECTOR_SZ (4 * 1024UL) 58 #define FLASH_PAGE_SZ (256) 62 #define FLASH_2M_TOTAL_SZ (256 * 1024UL) 65 #define FLASH_4M_TOTAL_SZ (512 * 1024UL) 68 #define FLASH_8M_TOTAL_SZ (1024 * 1024UL) 106 #define M2M_BOOT_FIRMWARE_STARTING_ADDR (FLASH_START_ADDR) 107 #define M2M_BOOT_FIRMWARE_FLASH_SZ (FLASH_SECTOR_SZ * 1) 112 #define M2M_CONTROL_FLASH_OFFSET (M2M_BOOT_FIRMWARE_STARTING_ADDR + M2M_BOOT_FIRMWARE_FLASH_SZ) 113 #define M2M_CONTROL_FLASH_SZ (FLASH_SECTOR_SZ * 1) 118 #define M2M_BACKUP_FLASH_OFFSET (M2M_CONTROL_FLASH_OFFSET + M2M_CONTROL_FLASH_SZ) 119 #define M2M_BACKUP_FLASH_SZ (FLASH_SECTOR_SZ * 1) 124 #define M2M_PLL_FLASH_OFFSET (M2M_BACKUP_FLASH_OFFSET + M2M_BACKUP_FLASH_SZ) 125 #define M2M_PLL_MAGIC_NUMBER_FLASH_SZ (2*4) // 2 32bit values 126 #define M2M_PLL_WIFI_CHAN_FLASH_OFFSET (M2M_PLL_FLASH_OFFSET + M2M_PLL_MAGIC_NUMBER_FLASH_SZ) 127 #define M2M_PLL_WIFI_CHAN_FLASH_SZ (14*8*4) // Wifi Channels 1 to 14 inclusive, 8 32bit values for each channel. 128 #define M2M_PLL_FREQ_FLASH_OFFSET (M2M_PLL_WIFI_CHAN_FLASH_OFFSET + M2M_PLL_WIFI_CHAN_FLASH_SZ) 129 #define M2M_PLL_FREQ_FLASH_SZ ((1+84)*4) // Frequencies 2401 to 2484MHz inclusive, also 1920 used for cpll compensate. 130 #define M2M_PLL_FLASH_SZ (1024 * 2) 131 #define M2M_GAIN_FLASH_OFFSET (M2M_PLL_FLASH_OFFSET + M2M_PLL_FLASH_SZ) 132 #define M2M_GAIN_FLASH_SZ (M2M_CONFIG_SECT_TOTAL_SZ - M2M_PLL_FLASH_SZ) 133 #define M2M_CONFIG_SECT_TOTAL_SZ (FLASH_SECTOR_SZ * 2) 138 #define M2M_TLS_ROOTCER_FLASH_OFFSET (M2M_PLL_FLASH_OFFSET + M2M_CONFIG_SECT_TOTAL_SZ) 139 #define M2M_TLS_ROOTCER_FLASH_SZ (FLASH_SECTOR_SZ * 1) 140 #define M2M_TLS_ROOTCER_FLASH_SIG {0x01,0xF1,0x02,0xF2,0x03,0xF3,0x04,0xF4,0x05,0xF5,0x06,0xF6,0x07,0xF7,0x08,0xF8} 141 #define M2M_TLS_ROOTCER_FLASH_SIG_LENGTH 16 148 #define M2M_TLS_SERVER_FLASH_OFFSET (M2M_TLS_ROOTCER_FLASH_OFFSET + M2M_TLS_ROOTCER_FLASH_SZ) 149 #define M2M_TLS_SERVER_FLASH_SZ (FLASH_SECTOR_SZ * 2) 150 #define M2M_TLS_SERVER_FLASH_SIG 155 #define M2M_CACHED_CONNS_FLASH_OFFSET (M2M_TLS_SERVER_FLASH_OFFSET + M2M_TLS_SERVER_FLASH_SZ) 156 #define M2M_CACHED_CONNS_FLASH_SZ (FLASH_SECTOR_SZ * 1) 157 #define M2M_CACHED_CONNS_FLASH_SIG 163 #define M2M_OTA_IMAGE1_OFFSET (M2M_CACHED_CONNS_FLASH_OFFSET + M2M_CACHED_CONNS_FLASH_SZ) 168 #define FLASH_COMMON_SZ (\ 169 M2M_BOOT_FIRMWARE_FLASH_SZ +\ 170 M2M_CONTROL_FLASH_SZ +\ 171 M2M_BACKUP_FLASH_SZ +\ 172 M2M_CONFIG_SECT_TOTAL_SZ +\ 173 M2M_TLS_ROOTCER_FLASH_SZ +\ 174 M2M_TLS_SERVER_FLASH_SZ +\ 175 M2M_CACHED_CONNS_FLASH_SZ ) 180 #if (FLASH_COMMON_SZ != M2M_OTA_IMAGE1_OFFSET) 181 #error "Common Size Mismatch" 187 #define HOST_CONTROL_FLASH_OFFSET (M2M_OTA_IMAGE1_OFFSET + OTA_IMAGE_SIZE) 188 #define HOST_CONTROL_FLASH_SZ (FLASH_SECTOR_SZ * 1) 189 #define HOST_CONTROL_FLASH_SIG 0x414f5354 195 #define M2M_OTA_IMAGE2_OFFSET (FLASH_4M_TOTAL_SZ) 200 #if (defined _FIRMWARE_)||(defined OTA_GEN) 201 #define M2M_FIRMWARE_FLASH_OFFSET (0UL) 203 #if (defined DOWNLOAD_ROLLBACK) 204 #define M2M_FIRMWARE_FLASH_OFFSET (M2M_OTA_IMAGE2_OFFSET) 206 #define M2M_FIRMWARE_FLASH_OFFSET (M2M_OTA_IMAGE1_OFFSET) 209 #ifdef _PROGRAM_POWER_SAVE_ 210 #define M2M_PROGRAM_FLASH_SZ (8 * 1024UL) 212 #define M2M_PROGRAM_FLASH_SZ (0UL) 214 #define M2M_FIRMWARE_FLASH_SZ (304 * 1024UL) 219 #define M2M_HTTP_MEM_FLASH_OFFSET (M2M_FIRMWARE_FLASH_OFFSET + M2M_FIRMWARE_FLASH_SZ) 220 #define M2M_HTTP_MEM_FLASH_SZ (FLASH_SECTOR_SZ * 2) 225 #define M2M_PS_FIRMWARE_FLASH_OFFSET (M2M_HTTP_MEM_FLASH_OFFSET + M2M_HTTP_MEM_FLASH_SZ) 226 #define M2M_PS_FIRMWARE_FLASH_SZ (FLASH_SECTOR_SZ * 0) 231 #define M2M_BT_FIRMWARE_FLASH_OFFSET (M2M_PS_FIRMWARE_FLASH_OFFSET + M2M_PS_FIRMWARE_FLASH_SZ) 232 #ifdef BT_IMAGE_PRESENT 233 #define M2M_BT_FIRMWARE_FLASH_SZ (160 * 1024UL) 235 #define M2M_BT_FIRMWARE_FLASH_SZ (0) 242 #define OTA_IMAGE_SIZE (\ 243 M2M_FIRMWARE_FLASH_SZ +\ 244 M2M_HTTP_MEM_FLASH_SZ +\ 245 M2M_PS_FIRMWARE_FLASH_SZ +\ 246 M2M_BT_FIRMWARE_FLASH_SZ ) 251 #if ((M2M_FIRMWARE_FLASH_OFFSET + OTA_IMAGE_SIZE) != (M2M_BT_FIRMWARE_FLASH_OFFSET + M2M_BT_FIRMWARE_FLASH_SZ)) 252 #error "OTA Size Mismatch" 260 #if ((FLASH_COMMON_SZ + OTA_IMAGE_SIZE + HOST_CONTROL_FLASH_SZ) > M2M_OTA_IMAGE2_OFFSET) 261 #error "Exceed Flash Size" 263 #if ((M2M_OTA_IMAGE2_OFFSET + OTA_IMAGE_SIZE) > FLASH_8M_TOTAL_SZ) 264 #error "OTA Exceed Flash Size"