Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

assemble: Assemble without image-1 partition #1974

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions scripts/assemble.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,16 @@ def same_keys(a, b):
size_re = re.compile(r"^#define DT_FLASH_AREA_([0-9A-Z_]+)_SIZE(_0)?\s+(0x[0-9a-fA-F]+|[0-9]+)$")

class Assembly():
def __init__(self, output, bootdir, edt):
self.find_slots(edt)
def __init__(self, output, bootdir, edt, is_secondary=True):
self.find_slots(edt, is_secondary)
try:
os.unlink(output)
except OSError as e:
if e.errno != errno.ENOENT:
raise
self.output = output

def find_slots(self, edt):
def find_slots(self, edt, is_secondary):
offsets = {}
sizes = {}

Expand All @@ -74,7 +74,7 @@ def find_slots(self, edt):
if 'image-0' not in offsets:
raise Exception("Board partition table does not have image-0 partition")

if 'image-1' not in offsets:
if ('image-1' not in offsets) and is_secondary:
raise Exception("Board partition table does not have image-1 partition")

self.offsets = offsets
Expand Down Expand Up @@ -137,11 +137,12 @@ def main():
edt = pickle.load(f)
assert isinstance(edt, devicetree.edtlib.EDT)

output = Assembly(args.output, args.bootdir, edt)
is_secondary = args.secondary is not None
output = Assembly(args.output, args.bootdir, edt, is_secondary)

output.add_image(os.path.join(args.bootdir, 'zephyr', 'zephyr.bin'), 'mcuboot')
output.add_image(args.primary, "image-0")
if args.secondary is not None:
if is_secondary:
output.add_image(args.secondary, "image-1")

if __name__ == '__main__':
Expand Down