如何读取 partition table的数据?

ollette
Posts: 3
Joined: Thu Jul 13, 2023 7:34 am

如何读取 partition table的数据?

Postby ollette » Thu Jul 13, 2023 7:46 am

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

ESP_igrr
Posts: 2071
Joined: Tue Dec 01, 2015 8:37 am

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

Postby ESP_igrr » Thu Jul 13, 2023 10:29 am

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(); }

Who is online

Users browsing this forum: No registered users and 126 guests