Skip to content

Commit a8b9d49

Browse files
committed
PSOC6: Fix post build script
Raise an exception in case of a failure to find an image to use for the binary signature. This prevents the method from assuming the image is always successfully retrieved and crash when attempting to print a message
1 parent 29cfcd6 commit a8b9d49

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

targets/TARGET_Cypress/scripts/PSOC6.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,11 @@ def sign_application(message_func, tools, binary, image_id):
249249
# UPGRADE image will be generated automatically by cysecuretools
250250
address, size = tools.flash_map(image_id=image_id, image_type="BOOT")
251251

252+
if not address or not size:
253+
raise AddSignatureError(
254+
f"Cannot find image with id {image_id} and type BOOT in the policy file"
255+
)
256+
252257
tools.sign_image(binary, image_id)
253258
message_func("[PSOC6.sign_image] Slot start address and size for image ID " \
254259
+ str(image_id) + " is " + hex(address) + ", " + hex(size))

0 commit comments

Comments
 (0)