Skip to content

Commit d289b96

Browse files
committed
Added check for python version before calling post build action. Fixed compilation for Python 2.7.
1 parent 515555e commit d289b96

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

tools/targets/__init__.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -679,9 +679,20 @@ def complete(t_self, resources, elf, binf):
679679
def sign_image(t_self, resources, elf, binf):
680680
"""
681681
Calls sign_image function to add signature to Secure Boot binary file.
682-
"""
683-
from tools.targets.PSOC6 import sign_image as psoc6_sign_image
684-
psoc6_sign_image(t_self, binf)
682+
"""
683+
version = sys.version_info
684+
685+
# check python version before calling post build as is supports only python3+
686+
if((version[0] < 3) is True):
687+
t_self.notify.info("[PSOC6.sing_image] Be careful - produced HEX file was not signed and thus "
688+
"is not compatible with Cypress Secure Boot target. "
689+
"You are using Python " + str(sys.version[:5]) +
690+
" which is not supported by CySecureTools. "
691+
"Consider installing Python 3.7+ and rebuild target. "
692+
"For more information refver to User Guide https://www.cypress.com/secureboot-sdk-user-guide")
693+
else:
694+
from tools.targets.PSOC6 import sign_image as psoc6_sign_image
695+
psoc6_sign_image(t_self, binf)
685696

686697
class ArmMuscaA1Code:
687698
"""Musca-A1 Hooks"""

0 commit comments

Comments
 (0)