@@ -40,11 +40,8 @@ def get_partition_file_name(otp):
40
40
class Partition :
41
41
42
42
def __init__ (self , size ):
43
- if not os .path .exists ('build' ):
44
- os .mkdir ('build' )
45
-
46
43
self .save_file_path = (
47
- f'{ SCRIPT_DIR } /build/partitions- { flash_size } MiB. '
44
+ f'{ SCRIPT_DIR } /build/partitions.csv '
48
45
)
49
46
self .first_offset = 0x9000
50
47
self .nvs = 0x6000
@@ -71,7 +68,7 @@ def set_app_size(self, size):
71
68
72
69
def save (self ):
73
70
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} ' ]
75
72
offset += self .nvs
76
73
77
74
if ota :
@@ -101,6 +98,9 @@ def save(self):
101
98
'There is not enough flash to store the firmware'
102
99
)
103
100
101
+ if not os .path .exists (f'{ SCRIPT_DIR } /build' ):
102
+ os .mkdir (f'{ SCRIPT_DIR } /build' )
103
+
104
104
with open (self .save_file_path , 'w' ) as f :
105
105
f .write (PARTITION_HEADER )
106
106
f .write ('\n ' .join (data ))
@@ -138,7 +138,7 @@ def get_espidf():
138
138
board_variant = None
139
139
board = None
140
140
skip_partition_resize = False
141
- partition_size = None
141
+ partition_size = - 1
142
142
flash_size = 4
143
143
oct_flash = False
144
144
@@ -284,7 +284,7 @@ def esp32_s3_args(extra_args):
284
284
action = 'store'
285
285
)
286
286
esp_argParser .add_argument (
287
- '--USB-OTG ' ,
287
+ '--usb-otg ' ,
288
288
dest = 'usb_otg' ,
289
289
default = False ,
290
290
action = 'store_true'
@@ -328,7 +328,7 @@ def esp32_s2_args(extra_args):
328
328
329
329
esp_argParser = ArgumentParser (prefix_chars = '-' )
330
330
esp_argParser .add_argument (
331
- '--USB-OTG ' ,
331
+ '--usb-otg ' ,
332
332
dest = 'usb_otg' ,
333
333
default = False ,
334
334
action = 'store_true'
@@ -746,7 +746,7 @@ def compile(): # NOQA
746
746
base_config .append (f'CONFIG_ESPTOOLPY_FLASHSIZE_{ flash_size } MB=y' )
747
747
base_config .append ('' .join ([
748
748
'CONFIG_PARTITION_TABLE_CUSTOM_FILENAME=' ,
749
- f'"{ SCRIPT_DIR } /build/partitions- { flash_size } MiB .csv"'
749
+ f'"{ SCRIPT_DIR } /build/partitions.csv"'
750
750
]))
751
751
752
752
if optimize_size :
@@ -890,8 +890,8 @@ def compile(): # NOQA
890
890
if ret_code != 0 :
891
891
sys .exit (ret_code )
892
892
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 :
895
895
app_size = output .rsplit ('micropython.bin binary size ' )[- 1 ]
896
896
app_size = int (
897
897
app_size .split (' bytes' )[0 ].strip (),
@@ -972,7 +972,7 @@ def compile(): # NOQA
972
972
build_bin_file += '.bin'
973
973
build_bin_file = os .path .abspath (build_bin_file )
974
974
975
- cmd = f'{ python_path } { esp_tool_path } { out_cmd } '
975
+ cmd = f'{ python_path } /python { esp_tool_path } { out_cmd } '
976
976
cmd = cmd .replace ('write_flash' , f'merge_bin -o { build_bin_file } ' )
977
977
cmd = cmd .replace ('--flash_freq 80m ' , '' )
978
978
cmd = cmd .replace ('-p (PORT) ' , '' )
@@ -995,7 +995,7 @@ def compile(): # NOQA
995
995
if result :
996
996
sys .exit (result )
997
997
998
- cmd = f'{ python_path } { esp_tool_path } { out_cmd } '
998
+ cmd = f'{ python_path } /python { esp_tool_path } { out_cmd } '
999
999
cmd = cmd .split ('write_flash' , 1 )[0 ]
1000
1000
cmd += f'write_flash 0x0 { build_bin_file } '
1001
1001
0 commit comments