Skip to content

Commit

Permalink
NXP: Query precise application names in post build
Browse files Browse the repository at this point in the history
This removes the need to use "glob" a file extension, and uses
precise application names.
  • Loading branch information
LDong-Arm committed Mar 4, 2021
1 parent 5353b62 commit 8483411
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
10 changes: 3 additions & 7 deletions targets/TARGET_NXP/scripts/LPC.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
the first 8 locations in sector 0 of the flash. If the result is 0, then execution control is
transferred to the user code.
"""
import pathlib
import os
import sys
from struct import unpack, pack
Expand Down Expand Up @@ -53,13 +52,10 @@ def is_patched(bin_path):


if __name__ == "__main__":
artefacts_location = sys.argv[1]

try:
binary = list(pathlib.Path(artefacts_location).glob("*.bin"))[0]
except IndexError:
binary = sys.argv[1]
if not os.path.isfile(binary):
raise ArtefactsError(
f"Could not find binary file in {artefacts_location}"
f"Could not find binary file {binary}"
)

print("LPC Patch: %s" % os.path.split(binary)[1])
Expand Down
2 changes: 1 addition & 1 deletion targets/TARGET_NXP/scripts/mbed_set_post_build_nxp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function(mbed_post_build_lpc_patch_vtable mbed_target_name)

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

mbed_set_post_build_operation()
Expand Down

0 comments on commit 8483411

Please sign in to comment.