esp_partition.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461
  1. /*
  2. * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. #ifndef __ESP_PARTITION_H__
  7. #define __ESP_PARTITION_H__
  8. #include <stdint.h>
  9. #include <stdbool.h>
  10. #include <stddef.h>
  11. #include "esp_err.h"
  12. #ifdef __cplusplus
  13. extern "C" {
  14. #endif
  15. /**
  16. * @file esp_partition.h
  17. * @brief Partition APIs
  18. */
  19. /** @cond */
  20. typedef struct esp_flash_t esp_flash_t;
  21. /** @endcond */
  22. /**
  23. * @brief Enumeration which specifies memory space requested in an mmap call
  24. */
  25. typedef enum {
  26. ESP_PARTITION_MMAP_DATA, /**< map to data memory (Vaddr0), allows byte-aligned access, 4 MB total */
  27. ESP_PARTITION_MMAP_INST, /**< map to instruction memory (Vaddr1-3), allows only 4-byte-aligned access, 11 MB total */
  28. } esp_partition_mmap_memory_t;
  29. /**
  30. * @brief Opaque handle for memory region obtained from esp_partition_mmap.
  31. */
  32. typedef uint32_t esp_partition_mmap_handle_t;
  33. /**
  34. * @brief Partition type
  35. *
  36. * @note Partition types with integer value 0x00-0x3F are reserved for partition types defined by ESP-IDF.
  37. * Any other integer value 0x40-0xFE can be used by individual applications, without restriction.
  38. *
  39. * @internal Keep this enum in sync with PartitionDefinition class gen_esp32part.py @endinternal
  40. *
  41. */
  42. typedef enum {
  43. ESP_PARTITION_TYPE_APP = 0x00, //!< Application partition type
  44. ESP_PARTITION_TYPE_DATA = 0x01, //!< Data partition type
  45. ESP_PARTITION_TYPE_ANY = 0xff, //!< Used to search for partitions with any type
  46. } esp_partition_type_t;
  47. /**
  48. * @brief Partition subtype
  49. *
  50. * @note These ESP-IDF-defined partition subtypes apply to partitions of type ESP_PARTITION_TYPE_APP
  51. * and ESP_PARTITION_TYPE_DATA.
  52. *
  53. * Application-defined partition types (0x40-0xFE) can set any numeric subtype value.
  54. *
  55. * @internal Keep this enum in sync with PartitionDefinition class gen_esp32part.py @endinternal
  56. */
  57. typedef enum {
  58. ESP_PARTITION_SUBTYPE_APP_FACTORY = 0x00, //!< Factory application partition
  59. ESP_PARTITION_SUBTYPE_APP_OTA_MIN = 0x10, //!< Base for OTA partition subtypes
  60. ESP_PARTITION_SUBTYPE_APP_OTA_0 = ESP_PARTITION_SUBTYPE_APP_OTA_MIN + 0, //!< OTA partition 0
  61. ESP_PARTITION_SUBTYPE_APP_OTA_1 = ESP_PARTITION_SUBTYPE_APP_OTA_MIN + 1, //!< OTA partition 1
  62. ESP_PARTITION_SUBTYPE_APP_OTA_2 = ESP_PARTITION_SUBTYPE_APP_OTA_MIN + 2, //!< OTA partition 2
  63. ESP_PARTITION_SUBTYPE_APP_OTA_3 = ESP_PARTITION_SUBTYPE_APP_OTA_MIN + 3, //!< OTA partition 3
  64. ESP_PARTITION_SUBTYPE_APP_OTA_4 = ESP_PARTITION_SUBTYPE_APP_OTA_MIN + 4, //!< OTA partition 4
  65. ESP_PARTITION_SUBTYPE_APP_OTA_5 = ESP_PARTITION_SUBTYPE_APP_OTA_MIN + 5, //!< OTA partition 5
  66. ESP_PARTITION_SUBTYPE_APP_OTA_6 = ESP_PARTITION_SUBTYPE_APP_OTA_MIN + 6, //!< OTA partition 6
  67. ESP_PARTITION_SUBTYPE_APP_OTA_7 = ESP_PARTITION_SUBTYPE_APP_OTA_MIN + 7, //!< OTA partition 7
  68. ESP_PARTITION_SUBTYPE_APP_OTA_8 = ESP_PARTITION_SUBTYPE_APP_OTA_MIN + 8, //!< OTA partition 8
  69. ESP_PARTITION_SUBTYPE_APP_OTA_9 = ESP_PARTITION_SUBTYPE_APP_OTA_MIN + 9, //!< OTA partition 9
  70. ESP_PARTITION_SUBTYPE_APP_OTA_10 = ESP_PARTITION_SUBTYPE_APP_OTA_MIN + 10,//!< OTA partition 10
  71. ESP_PARTITION_SUBTYPE_APP_OTA_11 = ESP_PARTITION_SUBTYPE_APP_OTA_MIN + 11,//!< OTA partition 11
  72. ESP_PARTITION_SUBTYPE_APP_OTA_12 = ESP_PARTITION_SUBTYPE_APP_OTA_MIN + 12,//!< OTA partition 12
  73. ESP_PARTITION_SUBTYPE_APP_OTA_13 = ESP_PARTITION_SUBTYPE_APP_OTA_MIN + 13,//!< OTA partition 13
  74. ESP_PARTITION_SUBTYPE_APP_OTA_14 = ESP_PARTITION_SUBTYPE_APP_OTA_MIN + 14,//!< OTA partition 14
  75. ESP_PARTITION_SUBTYPE_APP_OTA_15 = ESP_PARTITION_SUBTYPE_APP_OTA_MIN + 15,//!< OTA partition 15
  76. ESP_PARTITION_SUBTYPE_APP_OTA_MAX = ESP_PARTITION_SUBTYPE_APP_OTA_MIN + 16,//!< Max subtype of OTA partition
  77. ESP_PARTITION_SUBTYPE_APP_TEST = 0x20, //!< Test application partition
  78. ESP_PARTITION_SUBTYPE_DATA_OTA = 0x00, //!< OTA selection partition
  79. ESP_PARTITION_SUBTYPE_DATA_PHY = 0x01, //!< PHY init data partition
  80. ESP_PARTITION_SUBTYPE_DATA_NVS = 0x02, //!< NVS partition
  81. ESP_PARTITION_SUBTYPE_DATA_COREDUMP = 0x03, //!< COREDUMP partition
  82. ESP_PARTITION_SUBTYPE_DATA_NVS_KEYS = 0x04, //!< Partition for NVS keys
  83. ESP_PARTITION_SUBTYPE_DATA_EFUSE_EM = 0x05, //!< Partition for emulate eFuse bits
  84. ESP_PARTITION_SUBTYPE_DATA_UNDEFINED = 0x06, //!< Undefined (or unspecified) data partition
  85. ESP_PARTITION_SUBTYPE_DATA_ESPHTTPD = 0x80, //!< ESPHTTPD partition
  86. ESP_PARTITION_SUBTYPE_DATA_FAT = 0x81, //!< FAT partition
  87. ESP_PARTITION_SUBTYPE_DATA_SPIFFS = 0x82, //!< SPIFFS partition
  88. #if __has_include("extra_partition_subtypes.inc")
  89. #include "extra_partition_subtypes.inc"
  90. #endif
  91. ESP_PARTITION_SUBTYPE_ANY = 0xff, //!< Used to search for partitions with any subtype
  92. } esp_partition_subtype_t;
  93. /**
  94. * @brief Convenience macro to get esp_partition_subtype_t value for the i-th OTA partition
  95. */
  96. #define ESP_PARTITION_SUBTYPE_OTA(i) ((esp_partition_subtype_t)(ESP_PARTITION_SUBTYPE_APP_OTA_MIN + ((i) & 0xf)))
  97. /**
  98. * @brief Opaque partition iterator type
  99. */
  100. typedef struct esp_partition_iterator_opaque_* esp_partition_iterator_t;
  101. /**
  102. * @brief partition information structure
  103. *
  104. * This is not the format in flash, that format is esp_partition_info_t.
  105. *
  106. * However, this is the format used by this API.
  107. */
  108. typedef struct {
  109. esp_flash_t* flash_chip; /*!< SPI flash chip on which the partition resides */
  110. esp_partition_type_t type; /*!< partition type (app/data) */
  111. esp_partition_subtype_t subtype; /*!< partition subtype */
  112. uint32_t address; /*!< starting address of the partition in flash */
  113. uint32_t size; /*!< size of the partition, in bytes */
  114. uint32_t erase_size; /*!< size the erase operation should be aligned to */
  115. char label[17]; /*!< partition label, zero-terminated ASCII string */
  116. bool encrypted; /*!< flag is set to true if partition is encrypted */
  117. } esp_partition_t;
  118. /**
  119. * @brief Find partition based on one or more parameters
  120. *
  121. * @param type Partition type, one of esp_partition_type_t values or an 8-bit unsigned integer.
  122. * To find all partitions, no matter the type, use ESP_PARTITION_TYPE_ANY, and set
  123. * subtype argument to ESP_PARTITION_SUBTYPE_ANY.
  124. * @param subtype Partition subtype, one of esp_partition_subtype_t values or an 8-bit unsigned integer.
  125. * To find all partitions of given type, use ESP_PARTITION_SUBTYPE_ANY.
  126. * @param label (optional) Partition label. Set this value if looking
  127. * for partition with a specific name. Pass NULL otherwise.
  128. *
  129. * @return iterator which can be used to enumerate all the partitions found,
  130. * or NULL if no partitions were found.
  131. * Iterator obtained through this function has to be released
  132. * using esp_partition_iterator_release when not used any more.
  133. */
  134. esp_partition_iterator_t esp_partition_find(esp_partition_type_t type, esp_partition_subtype_t subtype, const char* label);
  135. /**
  136. * @brief Find first partition based on one or more parameters
  137. *
  138. * @param type Partition type, one of esp_partition_type_t values or an 8-bit unsigned integer.
  139. * To find all partitions, no matter the type, use ESP_PARTITION_TYPE_ANY, and set
  140. * subtype argument to ESP_PARTITION_SUBTYPE_ANY.
  141. * @param subtype Partition subtype, one of esp_partition_subtype_t values or an 8-bit unsigned integer
  142. * To find all partitions of given type, use ESP_PARTITION_SUBTYPE_ANY.
  143. * @param label (optional) Partition label. Set this value if looking
  144. * for partition with a specific name. Pass NULL otherwise.
  145. *
  146. * @return pointer to esp_partition_t structure, or NULL if no partition is found.
  147. * This pointer is valid for the lifetime of the application.
  148. */
  149. const esp_partition_t* esp_partition_find_first(esp_partition_type_t type, esp_partition_subtype_t subtype, const char* label);
  150. /**
  151. * @brief Get esp_partition_t structure for given partition
  152. *
  153. * @param iterator Iterator obtained using esp_partition_find. Must be non-NULL.
  154. *
  155. * @return pointer to esp_partition_t structure. This pointer is valid for the lifetime
  156. * of the application.
  157. */
  158. const esp_partition_t* esp_partition_get(esp_partition_iterator_t iterator);
  159. /**
  160. * @brief Move partition iterator to the next partition found
  161. *
  162. * Any copies of the iterator will be invalid after this call.
  163. *
  164. * @param iterator Iterator obtained using esp_partition_find. Must be non-NULL.
  165. *
  166. * @return NULL if no partition was found, valid esp_partition_iterator_t otherwise.
  167. */
  168. esp_partition_iterator_t esp_partition_next(esp_partition_iterator_t iterator);
  169. /**
  170. * @brief Release partition iterator
  171. *
  172. * @param iterator Iterator obtained using esp_partition_find.
  173. * The iterator is allowed to be NULL, so it is not necessary to check its value
  174. * before calling this function.
  175. *
  176. */
  177. void esp_partition_iterator_release(esp_partition_iterator_t iterator);
  178. /**
  179. * @brief Verify partition data
  180. *
  181. * Given a pointer to partition data, verify this partition exists in the partition table (all fields match.)
  182. *
  183. * This function is also useful to take partition data which may be in a RAM buffer and convert it to a pointer to the
  184. * permanent partition data stored in flash.
  185. *
  186. * Pointers returned from this function can be compared directly to the address of any pointer returned from
  187. * esp_partition_get(), as a test for equality.
  188. *
  189. * @param partition Pointer to partition data to verify. Must be non-NULL. All fields of this structure must match the
  190. * partition table entry in flash for this function to return a successful match.
  191. *
  192. * @return
  193. * - If partition not found, returns NULL.
  194. * - If found, returns a pointer to the esp_partition_t structure in flash. This pointer is always valid for the lifetime of the application.
  195. */
  196. const esp_partition_t* esp_partition_verify(const esp_partition_t* partition);
  197. /**
  198. * @brief Read data from the partition
  199. *
  200. * Partitions marked with an encryption flag will automatically be
  201. * be read and decrypted via a cache mapping.
  202. *
  203. * @param partition Pointer to partition structure obtained using
  204. * esp_partition_find_first or esp_partition_get.
  205. * Must be non-NULL.
  206. * @param dst Pointer to the buffer where data should be stored.
  207. * Pointer must be non-NULL and buffer must be at least 'size' bytes long.
  208. * @param src_offset Address of the data to be read, relative to the
  209. * beginning of the partition.
  210. * @param size Size of data to be read, in bytes.
  211. *
  212. * @return ESP_OK, if data was read successfully;
  213. * ESP_ERR_INVALID_ARG, if src_offset exceeds partition size;
  214. * ESP_ERR_INVALID_SIZE, if read would go out of bounds of the partition;
  215. * or one of error codes from lower-level flash driver.
  216. */
  217. esp_err_t esp_partition_read(const esp_partition_t* partition,
  218. size_t src_offset, void* dst, size_t size);
  219. /**
  220. * @brief Write data to the partition
  221. *
  222. * Before writing data to flash, corresponding region of flash needs to be erased.
  223. * This can be done using esp_partition_erase_range function.
  224. *
  225. * Partitions marked with an encryption flag will automatically be
  226. * written via the esp_flash_write_encrypted() function. If writing to
  227. * an encrypted partition, all write offsets and lengths must be
  228. * multiples of 16 bytes. See the esp_flash_write_encrypted() function
  229. * for more details. Unencrypted partitions do not have this
  230. * restriction.
  231. *
  232. * @param partition Pointer to partition structure obtained using
  233. * esp_partition_find_first or esp_partition_get.
  234. * Must be non-NULL.
  235. * @param dst_offset Address where the data should be written, relative to the
  236. * beginning of the partition.
  237. * @param src Pointer to the source buffer. Pointer must be non-NULL and
  238. * buffer must be at least 'size' bytes long.
  239. * @param size Size of data to be written, in bytes.
  240. *
  241. * @note Prior to writing to flash memory, make sure it has been erased with
  242. * esp_partition_erase_range call.
  243. *
  244. * @return ESP_OK, if data was written successfully;
  245. * ESP_ERR_INVALID_ARG, if dst_offset exceeds partition size;
  246. * ESP_ERR_INVALID_SIZE, if write would go out of bounds of the partition;
  247. * or one of error codes from lower-level flash driver.
  248. */
  249. esp_err_t esp_partition_write(const esp_partition_t* partition,
  250. size_t dst_offset, const void* src, size_t size);
  251. /**
  252. * @brief Read data from the partition without any transformation/decryption.
  253. *
  254. * @note This function is essentially the same as \c esp_partition_read() above.
  255. * It just never decrypts data but returns it as is.
  256. *
  257. * @param partition Pointer to partition structure obtained using
  258. * esp_partition_find_first or esp_partition_get.
  259. * Must be non-NULL.
  260. * @param dst Pointer to the buffer where data should be stored.
  261. * Pointer must be non-NULL and buffer must be at least 'size' bytes long.
  262. * @param src_offset Address of the data to be read, relative to the
  263. * beginning of the partition.
  264. * @param size Size of data to be read, in bytes.
  265. *
  266. * @return ESP_OK, if data was read successfully;
  267. * ESP_ERR_INVALID_ARG, if src_offset exceeds partition size;
  268. * ESP_ERR_INVALID_SIZE, if read would go out of bounds of the partition;
  269. * or one of error codes from lower-level flash driver.
  270. */
  271. esp_err_t esp_partition_read_raw(const esp_partition_t* partition,
  272. size_t src_offset, void* dst, size_t size);
  273. /**
  274. * @brief Write data to the partition without any transformation/encryption.
  275. *
  276. * @note This function is essentially the same as \c esp_partition_write() above.
  277. * It just never encrypts data but writes it as is.
  278. *
  279. * Before writing data to flash, corresponding region of flash needs to be erased.
  280. * This can be done using esp_partition_erase_range function.
  281. *
  282. * @param partition Pointer to partition structure obtained using
  283. * esp_partition_find_first or esp_partition_get.
  284. * Must be non-NULL.
  285. * @param dst_offset Address where the data should be written, relative to the
  286. * beginning of the partition.
  287. * @param src Pointer to the source buffer. Pointer must be non-NULL and
  288. * buffer must be at least 'size' bytes long.
  289. * @param size Size of data to be written, in bytes.
  290. *
  291. * @note Prior to writing to flash memory, make sure it has been erased with
  292. * esp_partition_erase_range call.
  293. *
  294. * @return ESP_OK, if data was written successfully;
  295. * ESP_ERR_INVALID_ARG, if dst_offset exceeds partition size;
  296. * ESP_ERR_INVALID_SIZE, if write would go out of bounds of the partition;
  297. * or one of the error codes from lower-level flash driver.
  298. */
  299. esp_err_t esp_partition_write_raw(const esp_partition_t* partition,
  300. size_t dst_offset, const void* src, size_t size);
  301. /**
  302. * @brief Erase part of the partition
  303. *
  304. * @param partition Pointer to partition structure obtained using
  305. * esp_partition_find_first or esp_partition_get.
  306. * Must be non-NULL.
  307. * @param offset Offset from the beginning of partition where erase operation
  308. * should start. Must be aligned to partition->erase_size.
  309. * @param size Size of the range which should be erased, in bytes.
  310. * Must be divisible by partition->erase_size.
  311. *
  312. * @return ESP_OK, if the range was erased successfully;
  313. * ESP_ERR_INVALID_ARG, if iterator or dst are NULL;
  314. * ESP_ERR_INVALID_SIZE, if erase would go out of bounds of the partition;
  315. * or one of error codes from lower-level flash driver.
  316. */
  317. esp_err_t esp_partition_erase_range(const esp_partition_t* partition,
  318. size_t offset, size_t size);
  319. /**
  320. * @brief Configure MMU to map partition into data memory
  321. *
  322. * Unlike spi_flash_mmap function, which requires a 64kB aligned base address,
  323. * this function doesn't impose such a requirement.
  324. * If offset results in a flash address which is not aligned to 64kB boundary,
  325. * address will be rounded to the lower 64kB boundary, so that mapped region
  326. * includes requested range.
  327. * Pointer returned via out_ptr argument will be adjusted to point to the
  328. * requested offset (not necessarily to the beginning of mmap-ed region).
  329. *
  330. * To release mapped memory, pass handle returned via out_handle argument to
  331. * esp_partition_munmap function.
  332. *
  333. * @param partition Pointer to partition structure obtained using
  334. * esp_partition_find_first or esp_partition_get.
  335. * Must be non-NULL.
  336. * @param offset Offset from the beginning of partition where mapping should start.
  337. * @param size Size of the area to be mapped.
  338. * @param memory Memory space where the region should be mapped
  339. * @param out_ptr Output, pointer to the mapped memory region
  340. * @param out_handle Output, handle which should be used for esp_partition_munmap call
  341. *
  342. * @return ESP_OK, if successful
  343. */
  344. esp_err_t esp_partition_mmap(const esp_partition_t* partition, size_t offset, size_t size,
  345. esp_partition_mmap_memory_t memory,
  346. const void** out_ptr, esp_partition_mmap_handle_t* out_handle);
  347. /**
  348. * @brief Release region previously obtained using esp_partition_mmap
  349. *
  350. * @note Calling this function will not necessarily unmap memory region.
  351. * Region will only be unmapped when there are no other handles which
  352. * reference this region. In case of partially overlapping regions
  353. * it is possible that memory will be unmapped partially.
  354. *
  355. * @param handle Handle obtained from spi_flash_mmap
  356. */
  357. void esp_partition_munmap(esp_partition_mmap_handle_t handle);
  358. /**
  359. * @brief Get SHA-256 digest for required partition.
  360. *
  361. * For apps with SHA-256 appended to the app image, the result is the appended SHA-256 value for the app image content.
  362. * The hash is verified before returning, if app content is invalid then the function returns ESP_ERR_IMAGE_INVALID.
  363. * For apps without SHA-256 appended to the image, the result is the SHA-256 of all bytes in the app image.
  364. * For other partition types, the result is the SHA-256 of the entire partition.
  365. *
  366. * @param[in] partition Pointer to info for partition containing app or data. (fields: address, size and type, are required to be filled).
  367. * @param[out] sha_256 Returned SHA-256 digest for a given partition.
  368. *
  369. * @return
  370. * - ESP_OK: In case of successful operation.
  371. * - ESP_ERR_INVALID_ARG: The size was 0 or the sha_256 was NULL.
  372. * - ESP_ERR_NO_MEM: Cannot allocate memory for sha256 operation.
  373. * - ESP_ERR_IMAGE_INVALID: App partition doesn't contain a valid app image.
  374. * - ESP_FAIL: An allocation error occurred.
  375. */
  376. esp_err_t esp_partition_get_sha256(const esp_partition_t* partition, uint8_t* sha_256);
  377. /**
  378. * @brief Check for the identity of two partitions by SHA-256 digest.
  379. *
  380. * @param[in] partition_1 Pointer to info for partition 1 containing app or data. (fields: address, size and type, are required to be filled).
  381. * @param[in] partition_2 Pointer to info for partition 2 containing app or data. (fields: address, size and type, are required to be filled).
  382. *
  383. * @return
  384. * - True: In case of the two firmware is equal.
  385. * - False: Otherwise
  386. */
  387. bool esp_partition_check_identity(const esp_partition_t* partition_1, const esp_partition_t* partition_2);
  388. /**
  389. * @brief Register a partition on an external flash chip
  390. *
  391. * This API allows designating certain areas of external flash chips (identified by the esp_flash_t structure)
  392. * as partitions. This allows using them with components which access SPI flash through the esp_partition API.
  393. *
  394. * @param flash_chip Pointer to the structure identifying the flash chip
  395. * @param offset Address in bytes, where the partition starts
  396. * @param size Size of the partition in bytes
  397. * @param label Partition name
  398. * @param type One of the partition types (ESP_PARTITION_TYPE_*), or an integer. Note that applications can not be booted from external flash
  399. * chips, so using ESP_PARTITION_TYPE_APP is not supported.
  400. * @param subtype One of the partition subtypes (ESP_PARTITION_SUBTYPE_*), or an integer.
  401. * @param[out] out_partition Output, if non-NULL, receives the pointer to the resulting esp_partition_t structure
  402. * @return
  403. * - ESP_OK on success
  404. * - ESP_ERR_NO_MEM if memory allocation has failed
  405. * - ESP_ERR_INVALID_ARG if the new partition overlaps another partition on the same flash chip
  406. * - ESP_ERR_INVALID_SIZE if the partition doesn't fit into the flash chip size
  407. */
  408. esp_err_t esp_partition_register_external(esp_flash_t* flash_chip, size_t offset, size_t size,
  409. const char* label, esp_partition_type_t type, esp_partition_subtype_t subtype,
  410. const esp_partition_t** out_partition);
  411. /**
  412. * @brief Deregister the partition previously registered using esp_partition_register_external
  413. * @param partition pointer to the partition structure obtained from esp_partition_register_external,
  414. * @return
  415. * - ESP_OK on success
  416. * - ESP_ERR_NOT_FOUND if the partition pointer is not found
  417. * - ESP_ERR_INVALID_ARG if the partition comes from the partition table
  418. * - ESP_ERR_INVALID_ARG if the partition was not registered using
  419. * esp_partition_register_external function.
  420. */
  421. esp_err_t esp_partition_deregister_external(const esp_partition_t* partition);
  422. #ifdef __cplusplus
  423. }
  424. #endif
  425. #endif /* __ESP_PARTITION_H__ */