File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -108,7 +108,9 @@ def _parse_partitions(env):
108
108
return
109
109
110
110
result = []
111
- next_offset = 0
111
+ # The first offset is 0x9000 because partition table is flashed to 0x8000 and
112
+ # occupies an entire flash sector, which size is 0x1000
113
+ next_offset = 0x9000
112
114
with open (partitions_csv ) as fp :
113
115
for line in fp .readlines ():
114
116
line = line .strip ()
@@ -117,11 +119,14 @@ def _parse_partitions(env):
117
119
tokens = [t .strip () for t in line .split ("," )]
118
120
if len (tokens ) < 5 :
119
121
continue
122
+
123
+ bound = 0x10000 if tokens [1 ] in ("0" , "app" ) else 4
124
+ calculated_offset = (next_offset + bound - 1 ) & ~ (bound - 1 )
120
125
partition = {
121
126
"name" : tokens [0 ],
122
127
"type" : tokens [1 ],
123
128
"subtype" : tokens [2 ],
124
- "offset" : tokens [3 ] or next_offset ,
129
+ "offset" : tokens [3 ] or calculated_offset ,
125
130
"size" : tokens [4 ],
126
131
"flags" : tokens [5 ] if len (tokens ) > 5 else None
127
132
}
@@ -130,9 +135,6 @@ def _parse_partitions(env):
130
135
partition ["size" ]
131
136
)
132
137
133
- bound = 0x10000 if partition ["type" ] in ("0" , "app" ) else 4
134
- next_offset = (next_offset + bound - 1 ) & ~ (bound - 1 )
135
-
136
138
return result
137
139
138
140
You can’t perform that action at this time.
0 commit comments