Skip to content

Commit e12b838

Browse files
committed
fixes missing partitions file
1 parent de2c72f commit e12b838

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
@@ -40,11 +40,8 @@ def get_partition_file_name(otp):
4040
class Partition:
4141

4242
def __init__(self, size):
43-
if not os.path.exists('build'):
44-
os.mkdir('build')
45-
4643
self.save_file_path = (
47-
f'{SCRIPT_DIR}/build/partitions-{flash_size}MiB.'
44+
f'{SCRIPT_DIR}/build/partitions.csv'
4845
)
4946
self.first_offset = 0x9000
5047
self.nvs = 0x6000
@@ -71,7 +68,7 @@ def set_app_size(self, size):
7168

7269
def save(self):
7370
offset = self.first_offset
74-
data = [f'nvs,data, nvs,0x{offset:X},0x{self.nvs:X}']
71+
data = [f'nvs,data,nvs,0x{offset:X},0x{self.nvs:X}']
7572
offset += self.nvs
7673

7774
if ota:
@@ -101,6 +98,9 @@ def save(self):
10198
'There is not enough flash to store the firmware'
10299
)
103100

101+
if not os.path.exists(f'{SCRIPT_DIR}/build'):
102+
os.mkdir(f'{SCRIPT_DIR}/build')
103+
104104
with open(self.save_file_path, 'w') as f:
105105
f.write(PARTITION_HEADER)
106106
f.write('\n'.join(data))
@@ -138,7 +138,7 @@ def get_espidf():
138138
board_variant = None
139139
board = None
140140
skip_partition_resize = False
141-
partition_size = None
141+
partition_size = -1
142142
flash_size = 4
143143
oct_flash = False
144144

@@ -284,7 +284,7 @@ def esp32_s3_args(extra_args):
284284
action='store'
285285
)
286286
esp_argParser.add_argument(
287-
'--USB-OTG',
287+
'--usb-otg',
288288
dest='usb_otg',
289289
default=False,
290290
action='store_true'
@@ -328,7 +328,7 @@ def esp32_s2_args(extra_args):
328328

329329
esp_argParser = ArgumentParser(prefix_chars='-')
330330
esp_argParser.add_argument(
331-
'--USB-OTG',
331+
'--usb-otg',
332332
dest='usb_otg',
333333
default=False,
334334
action='store_true'
@@ -746,7 +746,7 @@ def compile(): # NOQA
746746
base_config.append(f'CONFIG_ESPTOOLPY_FLASHSIZE_{flash_size}MB=y')
747747
base_config.append(''.join([
748748
'CONFIG_PARTITION_TABLE_CUSTOM_FILENAME=',
749-
f'"{SCRIPT_DIR}/build/partitions-{flash_size}MiB.csv"'
749+
f'"{SCRIPT_DIR}/build/partitions.csv"'
750750
]))
751751

752752
if optimize_size:
@@ -890,8 +890,8 @@ def compile(): # NOQA
890890
if ret_code != 0:
891891
sys.exit(ret_code)
892892

893-
elif not skip_partition_resize and partition_size == -1:
894-
if 'build complete' in output:
893+
elif not skip_partition_resize:
894+
if partition_size == -1 and 'build complete' in output:
895895
app_size = output.rsplit('micropython.bin binary size ')[-1]
896896
app_size = int(
897897
app_size.split(' bytes')[0].strip(),
@@ -972,7 +972,7 @@ def compile(): # NOQA
972972
build_bin_file += '.bin'
973973
build_bin_file = os.path.abspath(build_bin_file)
974974

975-
cmd = f'{python_path} {esp_tool_path} {out_cmd}'
975+
cmd = f'{python_path}/python {esp_tool_path} {out_cmd}'
976976
cmd = cmd.replace('write_flash', f'merge_bin -o {build_bin_file}')
977977
cmd = cmd.replace('--flash_freq 80m ', '')
978978
cmd = cmd.replace('-p (PORT) ', '')
@@ -995,7 +995,7 @@ def compile(): # NOQA
995995
if result:
996996
sys.exit(result)
997997

998-
cmd = f'{python_path} {esp_tool_path} {out_cmd}'
998+
cmd = f'{python_path}/python {esp_tool_path} {out_cmd}'
999999
cmd = cmd.split('write_flash', 1)[0]
10001000
cmd += f'write_flash 0x0 {build_bin_file}'
10011001

0 commit comments

Comments
 (0)