@@ -38,17 +38,14 @@ def get_partition_file_name(otp):
38
38
class Partition :
39
39
40
40
def __init__ (self , file_path ):
41
- self .file_path = file_path
41
+ self .load_file_path = file_path
42
+ self .save_file_path = f'"{ SCRIPT_DIR } /build/partitions-{ flash_size } MiB.csv"'
42
43
self ._saved_data = None
43
44
self .csv_data = self .read_csv ()
44
45
last_partition = self .csv_data [- 1 ]
45
46
46
47
self .total_space = last_partition [- 2 ] + last_partition [- 3 ]
47
48
48
- def revert_to_original (self ):
49
- with open (self .file_path , 'w' ) as f :
50
- f .write (self ._saved_data )
51
-
52
49
def get_app_size (self ) -> int :
53
50
for part in self .csv_data :
54
51
if part [1 ] in ('app' , 'factory' ):
@@ -77,7 +74,7 @@ def set_app_size(self, size):
77
74
if next_offset > self .total_space :
78
75
raise RuntimeError (
79
76
f'Board does not have enough space, overflow of '
80
- f'{ next_offset - self .total_space } bytes ({ self .file_path } )\n '
77
+ f'{ next_offset - self .total_space } bytes ({ self .load_file_path } )\n '
81
78
)
82
79
83
80
def save (self ):
@@ -91,12 +88,12 @@ def convert_to_hex(itm):
91
88
for line in self .csv_data :
92
89
otp .append (',' .join (convert_to_hex (item ) for item in line ))
93
90
94
- with open (self .file_path , 'w' ) as f :
91
+ with open (self .save_file_path , 'w' ) as f :
95
92
f .write (PARTITION_HEADER )
96
93
f .write ('\n ' .join (otp ))
97
94
98
95
def read_csv (self ):
99
- with open (self .file_path , 'r' ) as f :
96
+ with open (self .load_file_path , 'r' ) as f :
100
97
csv_data = f .read ()
101
98
102
99
self ._saved_data = csv_data
@@ -682,10 +679,7 @@ def compile(): # NOQA
682
679
'CONFIG_ESPTOOLPY_FLASHSIZE_16MB=n' ,
683
680
'CONFIG_ESPTOOLPY_FLASHSIZE_32MB=n' ,
684
681
'CONFIG_ESPTOOLPY_FLASHSIZE_64MB=n' ,
685
- 'CONFIG_ESPTOOLPY_FLASHSIZE_128MB=n' ,
686
- f'CONFIG_ESPTOOLPY_FLASHSIZE_{ flash_size } MB=y' ,
687
- 'CONFIG_PARTITION_TABLE_CUSTOM_FILENAME='
688
- f'"{ SCRIPT_DIR } /build/partitions-{ flash_size } MiB.csv"' ,
682
+ 'CONFIG_ESPTOOLPY_FLASHSIZE_128MB=n'
689
683
]
690
684
691
685
if DEBUG :
@@ -718,12 +712,14 @@ def compile(): # NOQA
718
712
719
713
base_config .append ('' )
720
714
721
- if onboard_mem_speed == 120 :
722
- base_config .append ('CONFIG_ESPTOOLPY_FLASHFREQ_120M=y' )
723
- base_config .append ('CONFIG_SPIRAM_SPEED_120M=y' )
724
- else :
725
- base_config .append ('CONFIG_ESPTOOLPY_FLASHFREQ_80M=y' )
726
- base_config .append ('CONFIG_SPIRAM_SPEED_80M=y' )
715
+ base_config .append (f'CONFIG_ESPTOOLPY_FLASHSIZE_{ flash_size } MB=y' )
716
+ base_config .append ('' .join ([
717
+ 'CONFIG_PARTITION_TABLE_CUSTOM_FILENAME=' ,
718
+ f'"{ SCRIPT_DIR } /build/partitions-{ flash_size } MiB.csv"'
719
+ ]))
720
+
721
+ base_config .append ('CONFIG_ESPTOOLPY_FLASHFREQ_{onboard_mem_speed}M=y' )
722
+ base_config .append ('CONFIG_SPIRAM_SPEED_{onboard_mem_speed}M=y' )
727
723
728
724
if oct_flash :
729
725
base_config .append ('CONFIG_ESPTOOLPY_OCT_FLASH=y' )
0 commit comments