esp_ota_get_running_partition() does not return the running partition - Documentation update (IDFGH-18374)
Answers checklist.
- I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
- I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
- I have searched the issue tracker for a similar issue and not found a similar issue.
IDF version.
6.1
Espressif SoC revision.
esp32-s3
Operating System used.
Windows
How did you build your project?
Other (please specify in More Information)
If you are using Windows, please specify command line type.
None
Development Kit.
custom board
Power Supply used.
USB
What is the expected behavior?
I expected the command to return the details of the partition the app is actually currently running from.
What is the actual behavior?
Its not that much of a "bug" but should require a documentation update to reflect the true behaviour.
The command does not "get the running partition" - it reads the partition table it was configured for, and returns a value from that.
The command appears to actually look for a partition table at the offset specified in the config file, it then reads this partition table & returns the details from this table. The issue is if you write a NEW partition table to a new location, which runs the new app, and build the app with the previous partition table offset. It will return an old app partition, not the actual one its running from.
Steps to reproduce.
- Initial config: Partition table offset 0x8000, app 0x10000
- Update the bootloader & partition table via OTA with a partition table offset of 0x10000, app 0x30000
- Build an app with the old partition table offset 0x8000
- Install that new app via OTA to 0x30000
- When the app runs and executes esp_ota_get_running_partition(), it will read the partition table at 0x8000, and return 0x10000, but the application is actually running from 0x30000 ...
Debug Logs.
output from process:
OTA update process, writing app with get_running_partition() command:
I (86554) esp_https_ota: Starting OTA...
I (86554) esp_https_ota: Writing to <app1> partition at offset 0x330000
After reboot, running new App:
I (396) Utilities: Iterating through app partitions...
I (396) Utilities: found partition 'app0' at offset 0x30000 with size 0x300000
I (406) Utilities: found partition 'app1' at offset 0x330000 with size 0x300000
.............
I (833) Utilities: Getting running partition
I (833) Utilities: Running from partition: app1 at 0x00310000Diagnostic report archive.
No response
More Information.
No response
Source: espressif/esp-idf