Merge branch 'partition_table/warn_partition_nearly_full' into 'master'

partition_table: Add warning when partitions are nearly full

Closes IDF-4533

See merge request espressif/esp-idf!17916
pull/8968/head
Roland Dobai 2022-05-13 16:28:35 +08:00
commit 4bd5c4ef53
2 zmienionych plików z 15 dodań i 2 usunięć

Wyświetl plik

@ -77,8 +77,12 @@ def check_partition(ptype, subtype, partition_table_file, bin_file): # type: (s
smallest_size = min(p.size for p in partitions)
if smallest_size >= bin_size:
free_size = smallest_size - bin_size
print('{} binary size {:#x} bytes. Smallest {} partition is {:#x} bytes. {:#x} bytes ({}%) free.'.format(
bin_name, bin_size, ptype_str, smallest_size, free_size, round(free_size * 100 / smallest_size)))
free_size_relative = free_size / smallest_size
print('{} binary size {:#x} bytes. Smallest {} partition is {:#x} bytes. {:#x} bytes ({:.0%}) free.'.format(
bin_name, bin_size, ptype_str, smallest_size, free_size, free_size_relative))
free_size_relative_critical = 0.05
if free_size_relative < free_size_relative_critical:
print('Warning: The smallest {} partition is nearly full ({:.0%} free space left)!'.format(ptype_str, free_size_relative))
return
too_small_partitions = [p for p in partitions if p.size < bin_size]

Wyświetl plik

@ -814,6 +814,15 @@ endmenu\n" >> ${IDF_PATH}/Kconfig
( idf.py build 2>&1 | grep "does not fit in configured flash size 1MB" ) || failure "Build didn't fail with expected flash size failure message"
mv sdkconfig.bak sdkconfig
print_status "Warning is given if smallest partition is nearly full"
clean_build_dir
cp ${IDF_PATH}/components/partition_table/partitions_singleapp.csv partitions.csv
${SED} -i "s/factory, app, factory, , 1M/factory, app, factory, , 170K/" partitions.csv
echo "CONFIG_PARTITION_TABLE_CUSTOM=y" > sdkconfig
( idf.py build 2>&1 | grep "partition is nearly full" ) || failure "No warning for nearly full smallest partition was given when the condition is fulfilled"
rm -f partitions.csv sdkconfig
( idf.py build 2>&1 | grep "partition is nearly full" ) && failure "Warning for nearly full smallest partition was given when the condition is not fulfilled"
print_status "Flash size is correctly set in the bootloader image header"
# Build with the default 2MB setting
rm sdkconfig