NNN50 WIFI_API library
Dependents: NNN50_CE_Test_UDP NNN50_linux_firmware NNN50_SoftAP_HelloWorld NNN50_BLEWIFISensor ... more
spi_flash_map.h
00001 /** 00002 * 00003 * \file 00004 * 00005 * \brief WINC1500 SPI Flash. 00006 * 00007 * Copyright (c) 2016-2017 Atmel Corporation. All rights reserved. 00008 * 00009 * \asf_license_start 00010 * 00011 * \page License 00012 * 00013 * Redistribution and use in source and binary forms, with or without 00014 * modification, are permitted provided that the following conditions are met: 00015 * 00016 * 1. Redistributions of source code must retain the above copyright notice, 00017 * this list of conditions and the following disclaimer. 00018 * 00019 * 2. Redistributions in binary form must reproduce the above copyright notice, 00020 * this list of conditions and the following disclaimer in the documentation 00021 * and/or other materials provided with the distribution. 00022 * 00023 * 3. The name of Atmel may not be used to endorse or promote products derived 00024 * from this software without specific prior written permission. 00025 * 00026 * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED 00027 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 00028 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE 00029 * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR 00030 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00031 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 00032 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 00033 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 00034 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 00035 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00036 * POSSIBILITY OF SUCH DAMAGE. 00037 * 00038 * \asf_license_stop 00039 * 00040 */ 00041 00042 /** 00043 * @file spi_flash_map.h 00044 * @brief This module contains spi flash CONTENT 00045 * @author M.S.M 00046 * @date 17 SEPT 2013 00047 * @version 1.0 00048 */ 00049 #ifndef __SPI_FLASH_MAP_H__ 00050 #define __SPI_FLASH_MAP_H__ 00051 00052 #define FLASH_MAP_VER_0 (0) 00053 #define FLASH_MAP_VER_1 (1) 00054 #define FLASH_MAP_VER_2 (2) 00055 #define FLASH_MAP_VER_3 (3) 00056 00057 #define FLASH_MAP_VERSION FLASH_MAP_VER_3 00058 00059 //#define DOWNLOAD_ROLLBACK 00060 //#define OTA_GEN 00061 #define _PROGRAM_POWER_SAVE_ 00062 00063 /* =======*=======*=======*=======*======= 00064 * General Sizes for Flash Memory 00065 * =======*=======*=======*=======*======= 00066 */ 00067 00068 #define FLASH_START_ADDR (0UL) 00069 /*!<Starting Address of Flash Memory 00070 * 00071 */ 00072 #define FLASH_BLOCK_SIZE (32 * 1024UL) 00073 /*!<Block Size in Flash Memory 00074 */ 00075 #define FLASH_SECTOR_SZ (4 * 1024UL) 00076 /*!<Sector Size in Flash Memory 00077 */ 00078 #define FLASH_PAGE_SZ (256) 00079 /*!<Page Size in Flash Memory 00080 */ 00081 #define FLASH_2M_TOTAL_SZ (256 * 1024UL) 00082 /*!<Total Size of 2M Flash Memory 00083 */ 00084 #define FLASH_4M_TOTAL_SZ (512 * 1024UL) 00085 /*!<Total Size of 4M Flash Memory 00086 */ 00087 #define FLASH_8M_TOTAL_SZ (1024 * 1024UL) 00088 /*!<Total Size of 8M Flash Memory 00089 */ 00090 00091 /* 00092 * Detailed Sizes and locations for Flash Memory: 00093 * ____________________ ___________ ____________________________________________________________________________ 00094 * | Starting Address | Size | Location's Name | Description | 00095 * |____________________|___________|___________________________|_______________________________________________| 00096 * | 0 K | 4 K | Boot Firmware | Firmware to select which version to run | 00097 * | 4 K | 8 K | Control Section | Structured data used by Boot firmware | 00098 * | 12 K | 4 K | PLL+GAIN : | LookUp Table for PLL and Gain calculations | 00099 * | | | PLL Size = 1K | PLL | 00100 * | | | GAIN Size = 3K | Gain configuration | 00101 * | 16 K | 4 K | CERTIFICATE | X.509 Certificate storage | 00102 * | 20 K | 8 K | TLS Server | TLS Server Private Key and certificates | 00103 * | 28 K | 8 K | HTTP Files | Files used with Provisioning Mode | 00104 * | 36 K | 4 K | Connection Parameters | Parameters for success connection to AP | 00105 * | 40 K | 236 K | Main Firmware/program | Main Firmware to run WiFi Chip | 00106 * | 276 K | 236 K | OTA Firmware | OTA firmware | 00107 * | 512 K Total flash size | 00108 * |____________________|___________|___________________________|_______________________________________________| 00109 * 00110 * 00111 * *Keys for Comments with each MACRO: 00112 * "L:xxxK" -means-> location :xxxK 00113 * "S:xxxK" -means-> Size is :xxxK 00114 */ 00115 00116 /* 00117 * Boot Firmware: which used to select which firmware to run 00118 * 00119 */ 00120 #define M2M_BOOT_FIRMWARE_STARTING_ADDR (FLASH_START_ADDR) 00121 #define M2M_BOOT_FIRMWARE_FLASH_SZ (FLASH_SECTOR_SZ) 00122 00123 /* 00124 * Control Section: which used by Boot firmware 00125 * 00126 */ 00127 #define M2M_CONTROL_FLASH_OFFSET (M2M_BOOT_FIRMWARE_STARTING_ADDR + M2M_BOOT_FIRMWARE_FLASH_SZ) 00128 #define M2M_CONTROL_FLASH_BKP_OFFSET (M2M_CONTROL_FLASH_OFFSET + FLASH_SECTOR_SZ) 00129 #define M2M_CONTROL_FLASH_SEC_SZ (FLASH_SECTOR_SZ) 00130 #define M2M_CONTROL_FLASH_TOTAL_SZ (FLASH_SECTOR_SZ * 2) 00131 00132 /* 00133 * LUT for PLL and TX Gain settings: 00134 * 00135 */ 00136 #define M2M_PLL_FLASH_OFFSET (M2M_CONTROL_FLASH_OFFSET + M2M_CONTROL_FLASH_TOTAL_SZ) 00137 #define M2M_PLL_FLASH_SZ (1024 * 1) 00138 #define M2M_GAIN_FLASH_OFFSET (M2M_PLL_FLASH_OFFSET + M2M_PLL_FLASH_SZ) 00139 #define M2M_GAIN_FLASH_SZ (M2M_CONFIG_SECT_TOTAL_SZ - M2M_PLL_FLASH_SZ) 00140 #define M2M_CONFIG_SECT_TOTAL_SZ (FLASH_SECTOR_SZ) 00141 00142 /* 00143 * Certificate: 00144 * 00145 */ 00146 #define M2M_TLS_ROOTCER_FLASH_OFFSET (M2M_PLL_FLASH_OFFSET + M2M_CONFIG_SECT_TOTAL_SZ) 00147 #define M2M_TLS_ROOTCER_FLASH_SIZE (FLASH_SECTOR_SZ * 1) 00148 00149 /* 00150 * TLS Server Key Files 00151 * 00152 */ 00153 #define M2M_TLS_SERVER_FLASH_OFFSET (M2M_TLS_ROOTCER_FLASH_OFFSET + M2M_TLS_ROOTCER_FLASH_SIZE) 00154 #define M2M_TLS_SERVER_FLASH_SIZE (FLASH_SECTOR_SZ * 2) 00155 00156 /* 00157 * HTTP Files 00158 * 00159 */ 00160 #define M2M_HTTP_MEM_FLASH_OFFSET (M2M_TLS_SERVER_FLASH_OFFSET + M2M_TLS_SERVER_FLASH_SIZE) 00161 #define M2M_HTTP_MEM_FLASH_SZ (FLASH_SECTOR_SZ * 2) 00162 00163 /* 00164 * Saved Connection Parameters: 00165 * 00166 */ 00167 #define M2M_CACHED_CONNS_FLASH_OFFSET (M2M_HTTP_MEM_FLASH_OFFSET + M2M_HTTP_MEM_FLASH_SZ) 00168 #define M2M_CACHED_CONNS_FLASH_SZ (FLASH_SECTOR_SZ * 1) 00169 00170 /* 00171 * 00172 * Common section size 00173 */ 00174 00175 #define M2M_COMMON_DATA_SEC \ 00176 (\ 00177 M2M_BOOT_FIRMWARE_FLASH_SZ + \ 00178 M2M_CONTROL_FLASH_TOTAL_SZ + \ 00179 M2M_CONFIG_SECT_TOTAL_SZ + \ 00180 M2M_TLS_ROOTCER_FLASH_SIZE + \ 00181 M2M_TLS_SERVER_FLASH_SIZE + \ 00182 M2M_HTTP_MEM_FLASH_SZ + \ 00183 M2M_CACHED_CONNS_FLASH_SZ \ 00184 ) 00185 00186 /* 00187 * 00188 * OTA image1 Offset 00189 */ 00190 00191 #define M2M_OTA_IMAGE1_OFFSET (M2M_CACHED_CONNS_FLASH_OFFSET + M2M_CACHED_CONNS_FLASH_SZ) 00192 /* 00193 * Firmware Offset 00194 * 00195 */ 00196 #if (defined _FIRMWARE_)||(defined OTA_GEN) 00197 #define M2M_FIRMWARE_FLASH_OFFSET (0UL) 00198 #else 00199 #if (defined DOWNLOAD_ROLLBACK) 00200 #define M2M_FIRMWARE_FLASH_OFFSET (M2M_OTA_IMAGE2_OFFSET) 00201 #else 00202 #define M2M_FIRMWARE_FLASH_OFFSET (M2M_OTA_IMAGE1_OFFSET) 00203 #endif 00204 #endif 00205 /* 00206 * 00207 * Firmware 00208 */ 00209 #define M2M_FIRMWARE_FLASH_SZ (236 * 1024UL) 00210 /** 00211 * 00212 * OTA image Size 00213 */ 00214 #define OTA_IMAGE_SIZE (M2M_FIRMWARE_FLASH_SZ) 00215 /** 00216 * 00217 * Flash Total size 00218 */ 00219 #define FLASH_IMAGE1_CONTENT_SZ (M2M_COMMON_DATA_SEC + OTA_IMAGE_SIZE) 00220 00221 /** 00222 * 00223 * OTA image 2 offset 00224 */ 00225 #define M2M_OTA_IMAGE2_OFFSET (FLASH_IMAGE1_CONTENT_SZ) 00226 00227 /* 00228 * App(Cortus App 4M): App. which runs over firmware 00229 * 00230 */ 00231 #define M2M_APP_4M_MEM_FLASH_SZ (FLASH_SECTOR_SZ * 16) 00232 #define M2M_APP_4M_MEM_FLASH_OFFSET (FLASH_4M_TOTAL_SZ - M2M_APP_4M_MEM_FLASH_SZ) 00233 #define M2M_APP_8M_MEM_FLASH_OFFSET (M2M_OTA_IMAGE2_OFFSET + OTA_IMAGE_SIZE) 00234 #define M2M_APP_8M_MEM_FLASH_SZ (FLASH_SECTOR_SZ * 32) 00235 #define M2M_APP_OTA_MEM_FLASH_OFFSET (M2M_APP_8M_MEM_FLASH_OFFSET + M2M_APP_8M_MEM_FLASH_SZ) 00236 00237 /* Check if total size of content 00238 * don't exceed total size of memory allowed 00239 **/ 00240 #if (M2M_COMMON_DATA_SEC + (OTA_IMAGE_SIZE *2)> FLASH_4M_TOTAL_SZ) 00241 #error "Excced 4M Flash Size" 00242 #endif /* (FLASH_CONTENT_SZ > FLASH_TOTAL_SZ) */ 00243 00244 00245 #endif /* __SPI_FLASH_MAP_H__ */ 00246
Generated on Wed Jul 13 2022 16:32:37 by
1.7.2