From 1f7a829e6287b82af8f231cd3f894cb75505a877 Mon Sep 17 00:00:00 2001 From: Michael Schwarcz Date: Wed, 6 Mar 2019 16:24:12 +0200 Subject: [PATCH] Compare non-secure image name without extension - For cases where non-secure image is HEX and secure image is BIN --- tools/psa/__init__.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/psa/__init__.py b/tools/psa/__init__.py index d013da8f58..de252c4073 100644 --- a/tools/psa/__init__.py +++ b/tools/psa/__init__.py @@ -15,7 +15,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from os.path import basename +from os.path import basename, splitext from tools.resources import FileType @@ -29,7 +29,10 @@ def find_secure_image(notify, resources, ns_image_path, configured_s_image_filen assert image_files, 'No image files found for this target' secure_image = next((f for f in image_files if basename(f) == configured_s_image_filename), None) - secure_image = next((f for f in image_files if basename(f) == basename(ns_image_path)), secure_image) + secure_image = next( + (f for f in image_files if splitext(basename(f))[0] == splitext(basename(ns_image_path))[0]), + secure_image + ) if secure_image: notify.debug("Secure image file found: %s." % secure_image)