mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-09 20:41:14 +00:00
fix(partition_table): Check partition size for type APP
The size of partition of type APP should be multiple of 4 KB. Partition generation tool now make this as a mandatory requirement. This is minimum flash erase size. If the size of the APP type partition is not aligned to 4 KB then the last erase operation could go beyond the allocated partition and hence may fail. This issue would only be observed when the firmware size grows very close to the allocated partition size, and hence causing the OTA update to fail. For already deployed devices on-field with the size of APP partition not aligned to flash sector boundary, it is best to ensure that firmware size always remains within the lower 4 KB boundary of the total allocated space. While migrating to ESP-IDF 5.3 release, partition table for an existing project can be adjusted accordingly for the build to succeed. Found during discussion in https://github.com/espressif/esp-idf/pull/12460
This commit is contained in:
@@ -31,9 +31,9 @@ def test_partition_nearly_full_warning(idf_py: IdfPyFunc, test_app_copy: Path, d
|
||||
ret = idf_py('build')
|
||||
# Build a first time to get the binary size and to check that no warning is issued.
|
||||
assert 'partition is nearly full' not in ret.stdout, 'Warning for nearly full smallest partition was given when the condition is not fulfilled'
|
||||
# Get the size of the binary, in KB. Add 1 to the total.
|
||||
# Get the size of the binary, in KB. Convert it to next multiple of 4.
|
||||
# The goal is to create an app partition which is slightly bigger than the binary itself
|
||||
updated_file_size = int(os.stat(test_app_copy / 'build' / 'build_test_app.bin').st_size / 1024) + 1
|
||||
updated_file_size = int((os.stat(test_app_copy / 'build' / 'build_test_app.bin').st_size + 4095) / 4096) * 4
|
||||
idf_path = Path(default_idf_env['IDF_PATH'])
|
||||
shutil.copy2(idf_path / 'components' / 'partition_table' / 'partitions_singleapp.csv', test_app_copy / 'partitions.csv')
|
||||
replace_in_file(test_app_copy / 'partitions.csv',
|
||||
|
Reference in New Issue
Block a user