Open vshymanskyy opened 1 month ago
Hi @vshymanskyy, if I understand correctly you would like esptool to detect overlaps based on the partition table?
In the current implementation, esptool is detecting overlaps of binary files when running the merge_bin command. However esptool is not trying to understand the data during merging and does not have any information regarding the partition sizes, so I don't think this would be possible. Detecting such overlaps should be done on the upper level, in some tool that integrates esptool and parttool.
I think merge_bin
has everything it needs to validate the input. If the upper infrastructure implements this check, it effectively can merge the bin by itself. Using esptool for this becomes redundant.
@vshymanskyy Could you please clarify, what is the case when esptool.py merge_bin
result would exceed the partition size?
We already validate that the bootloader and the app fit into the partition table, so idf.py build
should fail in the first place. Could you please give a more detailed example illustrating the issue? Thanks.
Yes, for example if i build a single image, and then to merge it with different partition tables (for esp modules with different flash size). Of course, the image headers need to be adjusted, but merge_bin already does this.
I see, thanks for explaining. In this case I'm afraid what @peterdragun mentioned is still the case:
However esptool is not trying to understand the data during merging and does not have any information regarding the partition sizes, so I don't think this would be possible.
Basically, esptool isn't aware of the partition tables, which are an ESP-IDF-specific feature, and it's unlikely that we would add new features into esptool which would be too coupled to ESP-IDF.
The only solution I can recommend now is to run idf.py merge-bin
(https://github.com/espressif/esp-idf/pull/13546) command for each flash size. This will result in the app being rebuilt, but if you use ccache this will happen pretty quickly. This way, partition size issues will be detected.
I'm implementing the check in an outer infrastructure already, i just wanted to bring it to you.
Is your feature request related to a problem?
If the file size exceeds the partition size, the
esptool
still finishes with success, presumably producing a broken firmware.Describe the solution you'd like
No response
Describe alternatives you've considered
No response
Additional context
No response