]> granicus.if.org Git - esp-idf/blob - components/esp32/include/esp_flash_data_types.h
Flash encryption: Support enabling flash encryption in bootloader, app support
[esp-idf] / components / esp32 / include / esp_flash_data_types.h
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 __ESP_BIN_TYPES_H__
15 #define __ESP_BIN_TYPES_H__
16
17 #include <stdint.h>
18
19 #ifdef __cplusplus
20 extern "C"
21 {
22 #endif
23
24 #define ESP_PARTITION_TABLE_ADDR 0x8000
25 #define ESP_PARTITION_MAGIC 0x50AA
26
27 /* OTA selection structure (two copies in the OTA data partition.)
28    Size of 32 bytes is friendly to flash encryption */
29 typedef struct {
30     uint32_t ota_seq;
31     uint8_t  seq_label[24];
32     uint32_t crc; /* CRC32 of ota_seq field only */
33 } esp_ota_select_entry_t;
34
35
36 typedef struct {
37     uint32_t offset;
38     uint32_t size;
39 } esp_partition_pos_t;
40
41 /* Structure which describes the layout of partition table entry.
42  * See docs/partition_tables.rst for more information about individual fields.
43  */
44 typedef struct {
45         uint16_t magic;
46         uint8_t  type;
47     uint8_t  subtype;
48     esp_partition_pos_t pos;
49         uint8_t  label[16];
50     uint32_t flags;
51 } esp_partition_info_t;
52
53 #define PART_TYPE_APP 0x00
54 #define PART_SUBTYPE_FACTORY  0x00
55 #define PART_SUBTYPE_OTA_FLAG 0x10
56 #define PART_SUBTYPE_OTA_MASK 0x0f
57 #define PART_SUBTYPE_TEST     0x20
58
59 #define PART_TYPE_DATA 0x01
60 #define PART_SUBTYPE_DATA_OTA 0x00
61 #define PART_SUBTYPE_DATA_RF  0x01
62 #define PART_SUBTYPE_DATA_WIFI 0x02
63
64 #define PART_TYPE_END 0xff
65 #define PART_SUBTYPE_END 0xff
66
67 #define PART_FLAG_ENCRYPTED (1<<0)
68
69 #ifdef __cplusplus
70 }
71 #endif
72
73 #endif //__ESP_BIN_TYPES_H__