|
17 | 17 |
|
18 | 18 | import os
|
19 | 19 | import sys
|
20 |
| - |
21 |
| -import platform |
22 | 20 | import subprocess
|
23 |
| -import errno |
24 | 21 | from array import array
|
25 | 22 | from struct import (pack, unpack)
|
26 | 23 | from shutil import copy2
|
| 24 | +import json |
27 | 25 | from intelhex import IntelHex, hex2bin, bin2hex
|
28 |
| -from intelhex.compat import asbytes |
29 | 26 |
|
30 | 27 | from ..config import ConfigException
|
31 | 28 |
|
32 |
| -from pathlib import Path, PurePath |
33 |
| -import json |
34 |
| - |
35 | 29 | # The size of the program data in Cypress HEX files is limited to 0x80000000
|
36 | 30 | # Higher addresses contain additional metadata (chip protection, eFuse data, etc..)
|
37 | 31 | CY_PROGRAM_SIZE = 0x80000000
|
@@ -286,6 +280,8 @@ def process_target(toolchain, target):
|
286 | 280 | :param target: Name of target being built
|
287 | 281 | :return: List with all data needed for adding signature
|
288 | 282 | """
|
| 283 | + from pathlib import Path |
| 284 | + |
289 | 285 | targets_json = Path("targets/targets.json")
|
290 | 286 | cy_targets = Path("targets/TARGET_Cypress/TARGET_PSOC6/")
|
291 | 287 | sb_params_file_name = Path("secure_image_parameters.json")
|
@@ -395,6 +391,8 @@ def sign_image(toolchain, binf):
|
395 | 391 | :param toolchain: Toolchain object of current build session
|
396 | 392 | :param binf: Binary file created for target
|
397 | 393 | """
|
| 394 | + from pathlib import PurePath |
| 395 | + |
398 | 396 | target_sig_data = None
|
399 | 397 | # reserve name for separate NSPE image
|
400 | 398 | out_cm4_hex = binf[:-4] + "_cm4.hex"
|
@@ -446,10 +444,10 @@ def sign_image(toolchain, binf):
|
446 | 444 | else:
|
447 | 445 | if slot["slot_data"]["type"] == "UPGRADE":
|
448 | 446 | out_hex_name = binf[:-4] + "_upgrade.hex"
|
449 |
| - out_bin_name = out_hex_name[:-4] + "_signed.bin" |
450 | 447 | else:
|
451 | 448 | out_hex_name = binf
|
452 |
| - out_bin_name = out_hex_name[:-4] + "_signed.bin" |
| 449 | + |
| 450 | + out_bin_name = out_hex_name[:-4] + "_signed.bin" |
453 | 451 |
|
454 | 452 | # call imgtool for signature
|
455 | 453 | args = [sys.executable, str(slot["sdk_path"] / "imgtool/imgtool.py"),
|
|
0 commit comments