mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-09 12:35:28 +00:00
partition_table: Add warning when partitions are nearly full
This adds a warning in cases where the smallest partition is nearly full. A test with a specially crafted partition table is created for the smallest partition warning. If the threshold or the template itself change, change the factory app partition size as well.
This commit is contained in:
@@ -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]
|
||||
|
Reference in New Issue
Block a user