Skip to content

Commit bfe1d04

Browse files
committed
Removed import of version specific python modules, improved imports organization in PSOC6.py, fixed per PR comments
1 parent d289b96 commit bfe1d04

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,3 @@ wmi==1.4.9;platform_system=='Windows'
2828
psutil==5.6.2
2929
cryptography>=2.4.x,<2.5
3030
Click>=7.0,<7.1
31-
pathlib>=1.0.1

tools/targets/PSOC6.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,15 @@
1717

1818
import os
1919
import sys
20-
21-
import platform
2220
import subprocess
23-
import errno
2421
from array import array
2522
from struct import (pack, unpack)
2623
from shutil import copy2
24+
import json
2725
from intelhex import IntelHex, hex2bin, bin2hex
28-
from intelhex.compat import asbytes
2926

3027
from ..config import ConfigException
3128

32-
from pathlib import Path, PurePath
33-
import json
34-
3529
# The size of the program data in Cypress HEX files is limited to 0x80000000
3630
# Higher addresses contain additional metadata (chip protection, eFuse data, etc..)
3731
CY_PROGRAM_SIZE = 0x80000000
@@ -286,6 +280,8 @@ def process_target(toolchain, target):
286280
:param target: Name of target being built
287281
:return: List with all data needed for adding signature
288282
"""
283+
from pathlib import Path
284+
289285
targets_json = Path("targets/targets.json")
290286
cy_targets = Path("targets/TARGET_Cypress/TARGET_PSOC6/")
291287
sb_params_file_name = Path("secure_image_parameters.json")
@@ -395,6 +391,8 @@ def sign_image(toolchain, binf):
395391
:param toolchain: Toolchain object of current build session
396392
:param binf: Binary file created for target
397393
"""
394+
from pathlib import PurePath
395+
398396
target_sig_data = None
399397
# reserve name for separate NSPE image
400398
out_cm4_hex = binf[:-4] + "_cm4.hex"
@@ -446,10 +444,10 @@ def sign_image(toolchain, binf):
446444
else:
447445
if slot["slot_data"]["type"] == "UPGRADE":
448446
out_hex_name = binf[:-4] + "_upgrade.hex"
449-
out_bin_name = out_hex_name[:-4] + "_signed.bin"
450447
else:
451448
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"
453451

454452
# call imgtool for signature
455453
args = [sys.executable, str(slot["sdk_path"] / "imgtool/imgtool.py"),

0 commit comments

Comments
 (0)