Skip to content

Commit c4ad094

Browse files
committed
Properly calculate partition offsets
Resolve platformio#627
1 parent 93b71b6 commit c4ad094

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

builder/main.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,13 @@ def _parse_partitions(env):
7171
"flags": tokens[5] if len(tokens) > 5 else None
7272
}
7373
result.append(partition)
74-
next_offset = (_parse_size(partition['offset']) +
75-
_parse_size(partition['size']))
74+
next_offset = _parse_size(partition["offset"]) + _parse_size(
75+
partition["size"]
76+
)
77+
78+
bound = 0x10000 if partition["type"] in ("0", "app") else 4
79+
next_offset = (next_offset + bound - 1) & ~(bound - 1)
80+
7681
return result
7782

7883

0 commit comments

Comments
 (0)