Skip to content

Commit 8483411

Browse files
committed
NXP: Query precise application names in post build
This removes the need to use "glob" a file extension, and uses precise application names.
1 parent 5353b62 commit 8483411

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

targets/TARGET_NXP/scripts/LPC.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
the first 8 locations in sector 0 of the flash. If the result is 0, then execution control is
2525
transferred to the user code.
2626
"""
27-
import pathlib
2827
import os
2928
import sys
3029
from struct import unpack, pack
@@ -53,13 +52,10 @@ def is_patched(bin_path):
5352

5453

5554
if __name__ == "__main__":
56-
artefacts_location = sys.argv[1]
57-
58-
try:
59-
binary = list(pathlib.Path(artefacts_location).glob("*.bin"))[0]
60-
except IndexError:
55+
binary = sys.argv[1]
56+
if not os.path.isfile(binary):
6157
raise ArtefactsError(
62-
f"Could not find binary file in {artefacts_location}"
58+
f"Could not find binary file {binary}"
6359
)
6460

6561
print("LPC Patch: %s" % os.path.split(binary)[1])

targets/TARGET_NXP/scripts/mbed_set_post_build_nxp.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ function(mbed_post_build_lpc_patch_vtable mbed_target_name)
1111

1212
set(post_build_command
1313
COMMAND ${Python3_EXECUTABLE} ${MBED_PATH}/targets/TARGET_NXP/scripts/LPC.py
14-
${CMAKE_BINARY_DIR}
14+
${CMAKE_BINARY_DIR}/$<TARGET_PROPERTY:mbed-post-build-bin-${mbed_target_name},application>.bin
1515
)
1616

1717
mbed_set_post_build_operation()

0 commit comments

Comments
 (0)