Page 1 of 1

如何读取 partition table的数据?

Posted: Thu Jul 13, 2023 7:46 am
by ollette
Image
用分区API ,esp_partition_find_first(); 无法找到partition table分区,只能查到0x9000后面的地址! 只能读取NVS,PHY这些。
有什么方法可以读取 0x8000 -0x9000 的数据吗?partition table 分区的数据。

Re: 如何读取 partition table的数据?

Posted: Thu Jul 13, 2023 10:29 am
by ESP_igrr
Not directly, since the "partition table" is not itself a partition.

You can construct an esp_partition_t structure manually, though, and pass it to esp_partition_read, like this:

Code: Select all

esp_partition_t partition_table = { .address=0x8000, .size=0x1000 };
uint8_t *buffer = (uint8_t*) malloc(partition_table.size);
if (buffer == NULL) { abort(); }
esp_err_t err = esp_partition_read(&partition_table, 0 /*offset */, buffer, partition_table.size);
if (err != ESP_OK) { abort(); }