Skip to content

Commit 918050e

Browse files
committed
still working on application partitions sizes.
1 parent 3b7a6b6 commit 918050e

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

builder/esp32.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -79,16 +79,14 @@ def save(self):
7979
data.append(f'phy_init,data,phy,0x{offset:X},0x{self.phy_init:X}')
8080
offset += self.phy_init
8181

82-
factory = (int(self.factory / 0x1000) + 1) * 0x1000
83-
8482
if ota:
85-
data.append(f'ota_0,app,ota_0,0x{offset:X},0x{factory:X}')
86-
offset += factory
87-
data.append(f'ota_1,app,ota_1,0x{offset:X},0x{factory:X}')
88-
offset += factory
83+
data.append(f'ota_0,app,ota_0,0x{offset:X},0x{self.factory:X}')
84+
offset += self.factory
85+
data.append(f'ota_1,app,ota_1,0x{offset:X},0x{self.factory:X}')
86+
offset += self.factory
8987
else:
90-
data.append(f'factory,app,factory,0x{offset:X},0x{factory:X}')
91-
offset += factory
88+
data.append(f'factory,app,factory,0x{offset:X},0x{self.factory:X}')
89+
offset += self.factory
9290

9391
total_size = int((flash_size * (2 ** 20)) / 0x1000) * 0x1000
9492

@@ -787,7 +785,7 @@ def compile(): # NOQA
787785
)
788786

789787
if partition_size == -1:
790-
p_size = 0x27A000
788+
p_size = 0x267000
791789
else:
792790
p_size = partition_size
793791

@@ -868,7 +866,6 @@ def compile(): # NOQA
868866
sys.exit(ret_code)
869867

870868
if partition_size != -1:
871-
872869
sys.exit(ret_code)
873870

874871
sys.stdout.write('\n\033[31;1m***** Resizing Partition *****\033[0m\n')
@@ -893,11 +890,14 @@ def compile(): # NOQA
893890

894891
elif not skip_partition_resize and partition_size == -1:
895892
if 'build complete' in output:
896-
remaining = output.rsplit('application')[-1]
897-
remaining = int(
898-
remaining.split('(', 1)[-1].split('remaining')[0].strip()
893+
app_size = output.rsplit('micropython.bin binary size ')[-1]
894+
app_size = int(
895+
app_size.split(' bytes')[0].strip(),
896+
16
899897
)
900898

899+
remaining = app_size - partition.get_app_size()
900+
901901
if remaining > 0x1000:
902902
sys.stdout.write(
903903
'\n\033[31;1m***** Resizing Partition *****\033[0m\n'

0 commit comments

Comments
 (0)