@@ -143,7 +143,7 @@ def _parse_partitions(env):
143
143
144
144
result = []
145
145
next_offset = 0
146
- bound = int (board .get ("upload.offset_address" , "0x10000" ), 16 ) # default 0x10000
146
+ app_offset = int (board .get ("upload.offset_address" , "0x10000" ), 16 ) # default 0x10000
147
147
with open (partitions_csv ) as fp :
148
148
for line in fp .readlines ():
149
149
line = line .strip ()
@@ -152,23 +152,25 @@ def _parse_partitions(env):
152
152
tokens = [t .strip () for t in line .split ("," )]
153
153
if len (tokens ) < 5 :
154
154
continue
155
+ bound = 0x10000 if tokens [1 ] in ("0" , "app" ) else 4
156
+ calculated_offset = (next_offset + bound - 1 ) & ~ (bound - 1 )
155
157
partition = {
156
158
"name" : tokens [0 ],
157
159
"type" : tokens [1 ],
158
160
"subtype" : tokens [2 ],
159
- "offset" : tokens [3 ] or next_offset ,
161
+ "offset" : tokens [3 ] or calculated_offset ,
160
162
"size" : tokens [4 ],
161
163
"flags" : tokens [5 ] if len (tokens ) > 5 else None
162
164
}
163
165
result .append (partition )
164
166
next_offset = _parse_size (partition ["offset" ])
165
167
if (partition ["subtype" ] == "ota_0" ):
166
- bound = next_offset
167
- next_offset = ( next_offset + bound - 1 ) & ~ ( bound - 1 )
168
+ app_offset = next_offset
169
+ next_offset = next_offset + _parse_size ( partition [ "size" ] )
168
170
# Configure application partition offset
169
- env .Replace (ESP32_APP_OFFSET = str (hex (bound )))
171
+ env .Replace (ESP32_APP_OFFSET = str (hex (app_offset )))
170
172
# Propagate application offset to debug configurations
171
- env ["INTEGRATION_EXTRA_DATA" ].update ({"application_offset" : str (hex (bound ))})
173
+ env ["INTEGRATION_EXTRA_DATA" ].update ({"application_offset" : str (hex (app_offset ))})
172
174
return result
173
175
174
176
0 commit comments