partition_table: warn if data partition offset is not 4kB aligned

If a partition offset is not aligned to 4 kB, erase operations will
fail, even if they are aligned to 4 kB relative to the partition
start. This is because the underlying esp_flash_erase_range function
only works when the address is aligned to 4 kB.

Not making this an error for now, since applications might be using
read-only non-4kB aligned partitions, which still work fine.
Will change this behavior in IDF 5.0, requiring 4 kB alignment for all
partitions.

Closes https://github.com/espressif/esp-idf/issues/7295
Closes https://github.com/espressif/esp-idf/issues/7350
This commit is contained in:
Ivan Grokhotkov
2021-08-23 08:09:28 +02:00
parent 54595887f6
commit b56c9aafe4
2 changed files with 33 additions and 7 deletions

View File

@@ -451,6 +451,19 @@ ota_1, 0, ota_1, , 1M,
self.assertIn('WARNING', sys.stderr.getvalue())
self.assertIn('partition subtype', sys.stderr.getvalue())
sys.stderr = io.StringIO()
csv_3 = 'nvs, data, nvs, 0x8800, 32k'
gen_esp32part.PartitionTable.from_csv(csv_3).verify()
self.assertIn('WARNING', sys.stderr.getvalue())
self.assertIn('not aligned to 0x1000', sys.stderr.getvalue())
sys.stderr = io.StringIO()
csv_4 = 'factory, app, factory, 0x10000, 0x100100\n' \
'nvs, data, nvs, , 32k'
gen_esp32part.PartitionTable.from_csv(csv_4).verify()
self.assertIn('WARNING', sys.stderr.getvalue())
self.assertIn('not aligned to 0x1000', sys.stderr.getvalue())
finally:
sys.stderr = sys.__stderr__