esp_flash_partitions.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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. // http://www.apache.org/licenses/LICENSE-2.0
  7. //
  8. // Unless required by applicable law or agreed to in writing, software
  9. // distributed under the License is distributed on an "AS IS" BASIS,
  10. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. // See the License for the specific language governing permissions and
  12. // limitations under the License.
  13. #ifndef __ESP_FLASH_PARTITIONS_H
  14. #define __ESP_FLASH_PARTITIONS_H
  15. #include "esp_err.h"
  16. #include "esp_flash_data_types.h"
  17. #include <stdbool.h>
  18. /* Pre-partition table fixed flash offsets */
  19. #define ESP_BOOTLOADER_DIGEST_OFFSET 0x0
  20. #define ESP_BOOTLOADER_OFFSET 0x1000 /* Offset of bootloader image. Has matching value in bootloader KConfig.projbuild file. */
  21. #define ESP_BOOTLOADER_SIZE (ESP_PARTITION_TABLE_OFFSET - ESP_BOOTLOADER_OFFSET)
  22. #define ESP_PARTITION_TABLE_OFFSET 0x8000 /* Offset of partition table. Has matching value in partition_table Kconfig.projbuild file. */
  23. #define ESP_PARTITION_TABLE_MAX_LEN 0xC00 /* Maximum length of partition table data */
  24. #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 */
  25. /* @brief Verify the partition table (does not include verifying secure boot cryptographic signature)
  26. *
  27. * @param partition_table Pointer to at least ESP_PARTITION_TABLE_MAX_ENTRIES of potential partition table data. (ESP_PARTITION_TABLE_MAX_LEN bytes.)
  28. * @param log_errors Log errors if the partition table is invalid.
  29. * @param num_partitions If result is ESP_OK, num_partitions is updated with total number of partitions (not including terminating entry).
  30. *
  31. * @return ESP_OK on success, ESP_ERR_INVALID_STATE if partition table is not valid.
  32. */
  33. esp_err_t esp_partition_table_basic_verify(const esp_partition_info_t *partition_table, bool log_errors, int *num_partitions);
  34. #endif