Skip to content

Commit

Permalink
Add command to build.py for update files generation
Browse files Browse the repository at this point in the history
Signed-off-by: Adam Szczygieł <[email protected]>
  • Loading branch information
adsz-nordic committed Dec 4, 2023
1 parent b3b1151 commit 9b4d785
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions ncs/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

TEMPLATE_CMD = "template"
STORAGE_CMD = "storage"
UPDATE_CMD = "update"


def convert(edt_object):
Expand Down Expand Up @@ -88,6 +89,17 @@ def get_absolute_address(node):
)
cmd_storage_arg_parser.add_argument("--storage-output-file", required=True, help="Input binary SUIT envelope.")

cmd_update_arg_parser = subparsers.add_parser(
UPDATE_CMD, help="Generate files needed for Secure Domain update", parents=[parent_parser])

cmd_update_arg_parser.add_argument("--input-file", required=True, help="SUIT envelope in binary format")
cmd_update_arg_parser.add_argument(
"--storage-output-file", required=True, help="SUIT storage output file in HEX format")
cmd_update_arg_parser.add_argument(
"--dfu-partition-output-file", required=True, help="DFU partition output file in HEX format")
cmd_update_arg_parser.add_argument(
"--dfu-partition-address", required=True, type=lambda x: int(x, 0), help="Start address of DFU partition")

arguments = parser.parse_args()

sys.path.insert(0, os.path.join(arguments.zephyr_base, "scripts", "dts", "python-devicetree", "src"))
Expand All @@ -112,3 +124,12 @@ def get_absolute_address(node):
update_candidate_info_address=ImageCreator.default_update_candidate_info_address,
dfu_max_caches=ImageCreator.default_dfu_max_caches,
)
elif arguments.command == UPDATE_CMD:
ImageCreator.create_files_for_update(
input_file=arguments.input_file,
storage_output_file=arguments.storage_output_file,
dfu_partition_output_file=arguments.dfu_partition_output_file,
update_candidate_info_address=ImageCreator.default_update_candidate_info_address,
dfu_partition_address=arguments.dfu_partition_address,
dfu_max_caches=ImageCreator.default_dfu_max_caches,
)

0 comments on commit 9b4d785

Please sign in to comment.