1 // Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 #ifndef __BOOT_CONFIG_H__ 15 #define __BOOT_CONFIG_H__ 16 17 #include <stdint.h> 18 19 #ifdef __cplusplus 20 extern "C" 21 { 22 #endif 23 24 #include "esp_flash_partitions.h" 25 #include "soc/soc.h" 26 27 #define SPI_SEC_SIZE 0x1000 28 29 #define SPI_ERROR_LOG "spi flash error" 30 31 #define MAX_OTA_SLOTS 16 32 33 typedef struct { 34 esp_partition_pos_t ota_info; 35 esp_partition_pos_t factory; 36 esp_partition_pos_t test; 37 esp_partition_pos_t ota[MAX_OTA_SLOTS]; 38 uint32_t app_count; 39 uint32_t selected_subtype; 40 } bootloader_state_t; 41 42 bool flash_encrypt(bootloader_state_t *bs); 43 44 /* Indices used by index_to_partition are the OTA index 45 number, or these special constants */ 46 #define FACTORY_INDEX (-1) 47 #define TEST_APP_INDEX (-2) 48 #define INVALID_INDEX (-99) 49 50 #ifdef __cplusplus 51 } 52 #endif 53 54 #endif /* __BOOT_CONFIG_H__ */ 55