]> granicus.if.org Git - esp-idf/commitdiff
merge esp_flash_data_types into esp_flash_partitions
authormorris <maoshengrong@espressif.com>
Thu, 14 Mar 2019 14:03:04 +0000 (22:03 +0800)
committerbot <bot@espressif.com>
Mon, 18 Mar 2019 08:51:55 +0000 (08:51 +0000)
12 files changed:
components/app_update/esp_ota_ops.c
components/app_update/include/esp_ota_ops.h
components/bootloader_support/include/bootloader_common.h
components/bootloader_support/include/esp_flash_data_types.h [new file with mode: 0644]
components/bootloader_support/include/esp_flash_partitions.h
components/bootloader_support/include_bootloader/bootloader_config.h
components/bootloader_support/src/bootloader_common.c
components/bootloader_support/src/flash_encrypt.c
components/bootloader_support/src/flash_partitions.c
components/esp32/include/esp_flash_data_types.h [deleted file]
components/spi_flash/partition.c
components/spi_flash/sim/SpiFlash.cpp

index 02eab8eb6bb81a128e9a8291e4d848201debc40b..d5c87b42714bddb416e6865262284d2a1d00790c 100644 (file)
@@ -36,7 +36,7 @@
 #include "rom/crc.h"
 #include "soc/dport_reg.h"
 #include "esp_log.h"
-#include "esp_flash_data_types.h"
+#include "esp_flash_partitions.h"
 #include "bootloader_common.h"
 #include "sys/param.h"
 #include "esp_system.h"
index 635144638dde40a00ea09fa52d3c77f22e8ceea3..73ca8a302879d2aff68b654237ac0b94ba03a5ba 100644 (file)
@@ -21,7 +21,7 @@
 #include "esp_err.h"
 #include "esp_partition.h"
 #include "esp_image_format.h"
-#include "esp_flash_data_types.h"
+#include "esp_flash_partitions.h"
 
 #ifdef __cplusplus
 extern "C"
index d18b97ceb3e6b43fa9c14b4365de125e56d29c56..c7136d4aa5f3086f5ef0fd2a226f7eb9451a2106 100644 (file)
@@ -13,7 +13,7 @@
 // limitations under the License.
 
 #pragma once
-#include "esp_flash_data_types.h"
+#include "esp_flash_partitions.h"
 #include "esp_image_format.h"
 
 /// Type of hold a GPIO in low state
diff --git a/components/bootloader_support/include/esp_flash_data_types.h b/components/bootloader_support/include/esp_flash_data_types.h
new file mode 100644 (file)
index 0000000..fda6d5c
--- /dev/null
@@ -0,0 +1,2 @@
+#warning esp_flash_data_types.h has been merged into esp_flash_partitions.h, please include esp_flash_partitions.h instead
+#include "esp_flash_partitions.h"
index b5f37aa5fc649c2809123e83ed2d15ec9f3cfebc..e5305d836d2d2b7ef13b4a4f7a7a0f558f4ca8de 100644 (file)
 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 // See the License for the specific language governing permissions and
 // limitations under the License.
-#ifndef __ESP_FLASH_PARTITIONS_H
-#define __ESP_FLASH_PARTITIONS_H
+#pragma once
 
 #include "esp_err.h"
-#include "esp_flash_data_types.h"
-#include <stdbool.h>
+#include "esp_types.h"
 #include "sdkconfig.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define ESP_PARTITION_MAGIC 0x50AA
+#define ESP_PARTITION_MAGIC_MD5 0xEBEB
+
+#define PART_TYPE_APP 0x00
+#define PART_SUBTYPE_FACTORY  0x00
+#define PART_SUBTYPE_OTA_FLAG 0x10
+#define PART_SUBTYPE_OTA_MASK 0x0f
+#define PART_SUBTYPE_TEST     0x20
+
+#define PART_TYPE_DATA 0x01
+#define PART_SUBTYPE_DATA_OTA 0x00
+#define PART_SUBTYPE_DATA_RF  0x01
+#define PART_SUBTYPE_DATA_WIFI 0x02
+#define PART_SUBTYPE_DATA_NVS_KEYS 0x04
+#define PART_SUBTYPE_DATA_EFUSE_EM 0x05
+
+#define PART_TYPE_END 0xff
+#define PART_SUBTYPE_END 0xff
+
+#define PART_FLAG_ENCRYPTED (1<<0)
+
 /* Pre-partition table fixed flash offsets */
 #define ESP_BOOTLOADER_DIGEST_OFFSET 0x0
 #define ESP_BOOTLOADER_OFFSET 0x1000 /* Offset of bootloader image. Has matching value in bootloader KConfig.projbuild file. */
 #define ESP_PARTITION_TABLE_MAX_LEN 0xC00 /* Maximum length of partition table data */
 #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 */
 
+/// OTA_DATA states for checking operability of the app.
+typedef enum {
+    ESP_OTA_IMG_NEW             = 0x0U,         /*!< Monitor the first boot. In bootloader this state is changed to ESP_OTA_IMG_PENDING_VERIFY. */
+    ESP_OTA_IMG_PENDING_VERIFY  = 0x1U,         /*!< First boot for this app was. If while the second boot this state is then it will be changed to ABORTED. */
+    ESP_OTA_IMG_VALID           = 0x2U,         /*!< App was confirmed as workable. App can boot and work without limits. */
+    ESP_OTA_IMG_INVALID         = 0x3U,         /*!< App was confirmed as non-workable. This app will not selected to boot at all. */
+    ESP_OTA_IMG_ABORTED         = 0x4U,         /*!< App could not confirm the workable or non-workable. In bootloader IMG_PENDING_VERIFY state will be changed to IMG_ABORTED. This app will not selected to boot at all. */
+    ESP_OTA_IMG_UNDEFINED       = 0xFFFFFFFFU,  /*!< Undefined. App can boot and work without limits. */
+} esp_ota_img_states_t;
+
+/* OTA selection structure (two copies in the OTA data partition.)
+   Size of 32 bytes is friendly to flash encryption */
+typedef struct {
+    uint32_t ota_seq;
+    uint8_t  seq_label[20];
+    uint32_t ota_state;
+    uint32_t crc; /* CRC32 of ota_seq field only */
+} esp_ota_select_entry_t;
+
+
+typedef struct {
+    uint32_t offset;
+    uint32_t size;
+} esp_partition_pos_t;
+
+/* Structure which describes the layout of partition table entry.
+ * See docs/partition_tables.rst for more information about individual fields.
+ */
+typedef struct {
+    uint16_t magic;
+    uint8_t  type;
+    uint8_t  subtype;
+    esp_partition_pos_t pos;
+    uint8_t  label[16];
+    uint32_t flags;
+} esp_partition_info_t;
+
 /* @brief Verify the partition table
  *
  * @param partition_table Pointer to at least ESP_PARTITION_TABLE_MAX_ENTRIES of potential partition table data. (ESP_PARTITION_TABLE_MAX_LEN bytes.)
@@ -43,5 +103,6 @@ inline static __attribute__((deprecated)) esp_err_t esp_partition_table_basic_ve
 {
     return esp_partition_table_verify(partition_table, log_errors, num_partitions);
 }
-
+#ifdef __cplusplus
+}
 #endif
index d6ec5da1bc131ae4e1ced6a0258acb418919dae0..1d69195f0c3e8358fe39fde4bbf337e2c30b8df2 100644 (file)
@@ -21,7 +21,7 @@ extern "C"
 {
 #endif
 
-#include "esp_flash_data_types.h"
+#include "esp_flash_partitions.h"
 #include "soc/soc.h"
 
 #define SPI_SEC_SIZE 0x1000
index 29e591d1af12523dff89af4b48391e3132c075bc..92b824669080cdf67188952c26b65bf11a97d111 100644 (file)
@@ -21,7 +21,6 @@
 #include "rom/crc.h"
 #include "rom/ets_sys.h"
 #include "rom/gpio.h"
-#include "esp_flash_data_types.h"
 #include "esp_secure_boot.h"
 #include "esp_flash_partitions.h"
 #include "bootloader_flash.h"
index 814bb39259e7ed82c9108beb94cd9dfec603860f..c79531f13a5f9158733cdac2bab68a454ddd6574 100644 (file)
@@ -18,7 +18,6 @@
 #include "esp_image_format.h"
 #include "esp_flash_encrypt.h"
 #include "esp_flash_partitions.h"
-#include "esp_flash_data_types.h"
 #include "esp_secure_boot.h"
 #include "esp_efuse.h"
 #include "esp_log.h"
@@ -340,11 +339,11 @@ esp_err_t esp_flash_encrypt_region(uint32_t src_addr, size_t data_length)
     return err;
 }
 
-void esp_flash_write_protect_crypt_cnt() 
+void esp_flash_write_protect_crypt_cnt()
 {
     uint32_t efuse_blk0 = REG_READ(EFUSE_BLK0_RDATA0_REG);
     bool flash_crypt_wr_dis = efuse_blk0 & EFUSE_WR_DIS_FLASH_CRYPT_CNT;
-    if(!flash_crypt_wr_dis) { 
+    if(!flash_crypt_wr_dis) {
         REG_WRITE(EFUSE_BLK0_WDATA0_REG, EFUSE_WR_DIS_FLASH_CRYPT_CNT);
         esp_efuse_burn_new_values();
     }
index 6686457338671674164b62b86a56d8b4351eeed0..bf499fcade9b2ef7448b3d01a74331b2cd9c6c2f 100644 (file)
@@ -16,7 +16,6 @@
 #include "esp_log.h"
 #include "rom/spi_flash.h"
 #include "rom/md5_hash.h"
-#include "esp_flash_data_types.h"
 
 static const char *TAG = "flash_parts";
 
diff --git a/components/esp32/include/esp_flash_data_types.h b/components/esp32/include/esp_flash_data_types.h
deleted file mode 100644 (file)
index 998e522..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-#ifndef __ESP_BIN_TYPES_H__
-#define __ESP_BIN_TYPES_H__
-
-#include <stdint.h>
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-#define ESP_PARTITION_MAGIC 0x50AA
-#define ESP_PARTITION_MAGIC_MD5 0xEBEB
-
-/// OTA_DATA states for checking operability of the app.
-typedef enum {
-    ESP_OTA_IMG_NEW             = 0x0U,         /*!< Monitor the first boot. In bootloader this state is changed to ESP_OTA_IMG_PENDING_VERIFY. */
-    ESP_OTA_IMG_PENDING_VERIFY  = 0x1U,         /*!< First boot for this app was. If while the second boot this state is then it will be changed to ABORTED. */
-    ESP_OTA_IMG_VALID           = 0x2U,         /*!< App was confirmed as workable. App can boot and work without limits. */
-    ESP_OTA_IMG_INVALID         = 0x3U,         /*!< App was confirmed as non-workable. This app will not selected to boot at all. */
-    ESP_OTA_IMG_ABORTED         = 0x4U,         /*!< App could not confirm the workable or non-workable. In bootloader IMG_PENDING_VERIFY state will be changed to IMG_ABORTED. This app will not selected to boot at all. */
-    ESP_OTA_IMG_UNDEFINED       = 0xFFFFFFFFU,  /*!< Undefined. App can boot and work without limits. */
-} esp_ota_img_states_t;
-
-/* OTA selection structure (two copies in the OTA data partition.)
-   Size of 32 bytes is friendly to flash encryption */
-typedef struct {
-    uint32_t ota_seq;
-    uint8_t  seq_label[20];
-    uint32_t ota_state;
-    uint32_t crc; /* CRC32 of ota_seq field only */
-} esp_ota_select_entry_t;
-
-
-typedef struct {
-    uint32_t offset;
-    uint32_t size;
-} esp_partition_pos_t;
-
-/* Structure which describes the layout of partition table entry.
- * See docs/partition_tables.rst for more information about individual fields.
- */
-typedef struct {
-       uint16_t magic;
-       uint8_t  type;
-    uint8_t  subtype;
-    esp_partition_pos_t pos;
-       uint8_t  label[16];
-    uint32_t flags;
-} esp_partition_info_t;
-
-#define PART_TYPE_APP 0x00
-#define PART_SUBTYPE_FACTORY  0x00
-#define PART_SUBTYPE_OTA_FLAG 0x10
-#define PART_SUBTYPE_OTA_MASK 0x0f
-#define PART_SUBTYPE_TEST     0x20
-
-#define PART_TYPE_DATA 0x01
-#define PART_SUBTYPE_DATA_OTA 0x00
-#define PART_SUBTYPE_DATA_RF  0x01
-#define PART_SUBTYPE_DATA_WIFI 0x02
-#define PART_SUBTYPE_DATA_NVS_KEYS 0x04
-#define PART_SUBTYPE_DATA_EFUSE_EM 0x05
-
-#define PART_TYPE_END 0xff
-#define PART_SUBTYPE_END 0xff
-
-#define PART_FLAG_ENCRYPTED (1<<0)
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif //__ESP_BIN_TYPES_H__
index 7f546e99334ffcdbac09b6e2b07633a395578fc4..77c13bd57b85363ece5396f4370a1846dff9bad4 100644 (file)
@@ -19,7 +19,6 @@
 #include <sys/lock.h>
 #include "esp_flash_partitions.h"
 #include "esp_attr.h"
-#include "esp_flash_data_types.h"
 #include "esp_spi_flash.h"
 #include "esp_partition.h"
 #include "esp_flash_encrypt.h"
index 46b09bccfada1915670e21b1d0580c7a1c4c78ff..f2991e01a5f1a03c922b52d11c3a4bad42f1dac7 100644 (file)
@@ -23,7 +23,7 @@
 #include <string>
 
 #include "sdkconfig.h"
-#include "esp_flash_data_types.h"
+#include "esp_flash_partitions.h"
 
 using namespace std;