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):
108108 return
109109
110110 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
112114 with open (partitions_csv ) as fp :
113115 for line in fp .readlines ():
114116 line = line .strip ()
@@ -117,11 +119,14 @@ def _parse_partitions(env):
117119 tokens = [t .strip () for t in line .split ("," )]
118120 if len (tokens ) < 5 :
119121 continue
122+
123+ bound = 0x10000 if tokens [1 ] in ("0" , "app" ) else 4
124+ calculated_offset = (next_offset + bound - 1 ) & ~ (bound - 1 )
120125 partition = {
121126 "name" : tokens [0 ],
122127 "type" : tokens [1 ],
123128 "subtype" : tokens [2 ],
124- "offset" : tokens [3 ] or next_offset ,
129+ "offset" : tokens [3 ] or calculated_offset ,
125130 "size" : tokens [4 ],
126131 "flags" : tokens [5 ] if len (tokens ) > 5 else None
127132 }
@@ -130,9 +135,6 @@ def _parse_partitions(env):
130135 partition ["size" ]
131136 )
132137
133- bound = 0x10000 if partition ["type" ] in ("0" , "app" ) else 4
134- next_offset = (next_offset + bound - 1 ) & ~ (bound - 1 )
135-
136138 return result
137139
138140
You can’t perform that action at this time.
0 commit comments