# # Copyright (c) 2022 Nordic Semiconductor ASA # # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause """ Generate fw_info for B0N container from .config """ from intelhex import IntelHex import argparse import struct def get_fw_info(input_hex, offset, magic_value, fw_version, fw_valid_val): # 0x0c start of fw_info_total_size # 0x10 start of flash_used # 0x14 start of fw_version # 0x18 the address of the start of the image # 0x1c the address of the boot point (vector table) of the firmware # 0x20 the address Value that can be modified to invalidate the firmware fw_info_bytes = magic_value for i in range(0xc, 0x14): fw_info_bytes += input_hex[offset + i].to_bytes(1, byteorder='little') fw_info_bytes += struct.pack('