]> granicus.if.org Git - esp-idf/blob - components/bootloader_support/include/esp_flash_partitions.h
Flash encryption: Support enabling flash encryption in bootloader, app support
[esp-idf] / components / bootloader_support / include / esp_flash_partitions.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_FLASH_PARTITIONS_H
15 #define __ESP_FLASH_PARTITIONS_H
16
17 #include "esp_err.h"
18 #include "esp_flash_data_types.h"
19 #include <stdbool.h>
20
21 /* Pre-partition table fixed flash offsets */
22 #define ESP_BOOTLOADER_DIGEST_OFFSET 0x0
23 #define ESP_BOOTLOADER_OFFSET 0x1000 /* Offset of bootloader image. Has matching value in bootloader KConfig.projbuild file. */
24 #define ESP_PARTITION_TABLE_OFFSET 0x8000 /* Offset of partition table. Has matching value in partition_table Kconfig.projbuild file. */
25
26 #define ESP_PARTITION_TABLE_MAX_LEN 0xC00 /* Maximum length of partition table data */
27 #define ESP_PARTITION_TABLE_MAX_ENTRIES (ESP_PARTITION_TABLE_MAX_LEN / sizeof(esp_partition_info_t)) /* Maximum length of partition table data, including terminating entry */
28
29 /* @brief Verify the partition table (does not include verifying secure boot cryptographic signature)
30  *
31  * @param partition_table Pointer to at least ESP_PARTITION_TABLE_MAX_ENTRIES of potential partition table data. (ESP_PARTITION_TABLE_MAX_LEN bytes.)
32  * @param log_errors Log errors if the partition table is invalid.
33  * @param num_partitions If result is ESP_OK, num_partitions is updated with total number of partitions (not including terminating entry).
34  *
35  * @return ESP_OK on success, ESP_ERR_INVALID_STATE if partition table is not valid.
36  */
37 esp_err_t esp_partition_table_basic_verify(const esp_partition_info_t *partition_table, bool log_errors, int *num_partitions);
38
39 #endif