diff --git a/targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_LPC55S69/TARGET_M33_NS/prebuilt/README.md b/targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_LPC55S69/TARGET_M33_NS/prebuilt/README.md index 19a78be306..fc1711088f 100644 --- a/targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_LPC55S69/TARGET_M33_NS/prebuilt/README.md +++ b/targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_LPC55S69/TARGET_M33_NS/prebuilt/README.md @@ -9,25 +9,31 @@ These images were compiled by the following command: ## tfm.bin ```sh -mbed compile -t ARMC6 -m LPC55S69_S --app-config tools/psa/tfm/mbed_app.json --profile release +mbed compile -t ARMC6 -m LPC55S69_S --app-config mbed-os/tools/psa/tfm/mbed_app.json --profile release ``` ## spm_smoke.bin ```sh -mbed test --compile -t ARMC6 -m LPC55S69_S --app-config tools/psa/tfm/mbed_app.json -n tests-psa-spm_smoke -DUSE_PSA_TEST_PARTITIONS -DUSE_SMOKE_TESTS_PART1 --profile release +mbed test --compile -t ARMC6 -m LPC55S69_S --app-config mbed-os/tools/psa/tfm/mbed_app.json -n mbed-os-tests-psa-spm_smoke -DUSE_PSA_TEST_PARTITIONS -DUSE_SMOKE_TESTS_PART1 --profile release ``` ## spm_client.bin ```sh -mbed test --compile -t ARMC6 -m LPC55S69_S --app-config tools/psa/tfm/mbed_app.json -n tests-psa-spm_client -DUSE_PSA_TEST_PARTITIONS -DUSE_CLIENT_TESTS_PART1 --profile release +mbed test --compile -t ARMC6 -m LPC55S69_S --app-config mbed-os/tools/psa/tfm/mbed_app.json -n mbed-os-tests-psa-spm_client -DUSE_PSA_TEST_PARTITIONS -DUSE_CLIENT_TESTS_PART1 --profile release ``` ## spm_server.bin ```sh -mbed test --compile -t ARMC6 -m LPC55S69_S --app-config tools/psa/tfm/mbed_app.json -n tests-psa-spm_server -DUSE_PSA_TEST_PARTITIONS -DUSE_SERVER_TESTS_PART1 -DUSE_SERVER_TESTS_PART2 --profile release +mbed test --compile -t ARMC6 -m LPC55S69_S --app-config mbed-os/tools/psa/tfm/mbed_app.json -n mbed-os-tests-psa-spm_server -DUSE_PSA_TEST_PARTITIONS -DUSE_SERVER_TESTS_PART1 -DUSE_SERVER_TESTS_PART2 --profile release +``` + +## crypto_access_control.bin + +```sh +mbed test --compile -t ARMC6 -m LPC55S69_S --app-config mbed-os/tools/psa/tfm/mbed_app.json -n mbed-os-tests-psa-crypto_access_control -DUSE_PSA_TEST_PARTITIONS -DUSE_CRYPTO_ACL_TEST --profile release ``` To update the prebuilt binaries run the previous commands. diff --git a/targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_LPC55S69/TARGET_M33_NS/prebuilt/crypto_access_control.bin b/targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_LPC55S69/TARGET_M33_NS/prebuilt/crypto_access_control.bin new file mode 100644 index 0000000000..6b8607378f Binary files /dev/null and b/targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_LPC55S69/TARGET_M33_NS/prebuilt/crypto_access_control.bin differ diff --git a/targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_LPC55S69/TARGET_M33_NS/prebuilt/spm_client.bin b/targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_LPC55S69/TARGET_M33_NS/prebuilt/spm_client.bin index f46f604f98..e6bbb75a75 100644 Binary files a/targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_LPC55S69/TARGET_M33_NS/prebuilt/spm_client.bin and b/targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_LPC55S69/TARGET_M33_NS/prebuilt/spm_client.bin differ diff --git a/targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_LPC55S69/TARGET_M33_NS/prebuilt/spm_server.bin b/targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_LPC55S69/TARGET_M33_NS/prebuilt/spm_server.bin index 3bffb7f914..048aa4af66 100644 Binary files a/targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_LPC55S69/TARGET_M33_NS/prebuilt/spm_server.bin and b/targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_LPC55S69/TARGET_M33_NS/prebuilt/spm_server.bin differ diff --git a/targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_LPC55S69/TARGET_M33_NS/prebuilt/spm_smoke.bin b/targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_LPC55S69/TARGET_M33_NS/prebuilt/spm_smoke.bin index 969cc1b7c5..dd0f38be65 100644 Binary files a/targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_LPC55S69/TARGET_M33_NS/prebuilt/spm_smoke.bin and b/targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_LPC55S69/TARGET_M33_NS/prebuilt/spm_smoke.bin differ diff --git a/targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_LPC55S69/TARGET_M33_NS/prebuilt/tfm.bin b/targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_LPC55S69/TARGET_M33_NS/prebuilt/tfm.bin index f9fc96255b..a21d55edcb 100644 Binary files a/targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_LPC55S69/TARGET_M33_NS/prebuilt/tfm.bin and b/targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_LPC55S69/TARGET_M33_NS/prebuilt/tfm.bin differ diff --git a/targets/targets.json b/targets/targets.json index 5ef84f5021..33a0bace94 100644 --- a/targets/targets.json +++ b/targets/targets.json @@ -2100,7 +2100,8 @@ "secure-rom-size": "0x30000", "secure-ram-start": "0x30000000", "secure-ram-size": "0x22000" - } + }, + "OUTPUT_EXT": "hex" }, "LPC55S69_S": { "inherits": ["SPE_Target", "LPC55S69"], diff --git a/tools/targets/LPC55S69.py b/tools/targets/LPC55S69.py index a1bb4f4827..e003d910aa 100644 --- a/tools/targets/LPC55S69.py +++ b/tools/targets/LPC55S69.py @@ -15,34 +15,23 @@ # import os -from os.path import abspath, basename, dirname, splitext +from os.path import abspath, dirname from os.path import join as path_join -import tempfile -from tools.psa.tfm.bin_utils.assemble import Assembly +from intelhex import IntelHex SCRIPT_DIR = dirname(abspath(__file__)) MBED_OS_ROOT = abspath(path_join(SCRIPT_DIR, os.pardir, os.pardir)) LPC55S69_BASE = path_join(MBED_OS_ROOT, 'targets', 'TARGET_NXP', 'TARGET_MCUXpresso_MCUS', 'TARGET_LPC55S69') -def lpc55s69_tfm_bin(t_self, non_secure_bin, secure_bin): - tempdir = tempfile.mkdtemp() - flash_layout = path_join(LPC55S69_BASE, 'partition', 'flash_layout.h') - ns_bin_name, ns_bin_ext = splitext(basename(non_secure_bin)) - concatenated_bin = path_join(tempdir, 'tfm_' + ns_bin_name + ns_bin_ext) - assert os.path.isfile(flash_layout) +def lpc55s69_complete(t_self, non_secure_bin, secure_bin): assert os.path.isfile(secure_bin) assert os.path.isfile(non_secure_bin) - #1. Concatenate secure TFM and non-secure mbed binaries - output = Assembly(flash_layout, concatenated_bin) - output.add_image(secure_bin, "SECURE") - output.add_image(non_secure_bin, "NON_SECURE") - - #2. Delete the original binary file name - os.remove(non_secure_bin) - - #3. Rename to new concatenated binary to the original binary file name - os.rename(concatenated_bin, non_secure_bin) + ns_hex = IntelHex(non_secure_bin) + s_hex = IntelHex() + s_hex.loadbin(secure_bin) + s_hex.merge(ns_hex, overlap='ignore') + s_hex.tofile(non_secure_bin, 'hex') diff --git a/tools/targets/__init__.py b/tools/targets/__init__.py index 717c703f32..b122ef1adb 100644 --- a/tools/targets/__init__.py +++ b/tools/targets/__init__.py @@ -603,10 +603,10 @@ class LPC55S69Code: """LPC55S69 Hooks""" @staticmethod def binary_hook(t_self, resources, elf, binf): - from tools.targets.LPC55S69 import lpc55s69_tfm_bin + from tools.targets.LPC55S69 import lpc55s69_complete configured_secure_image_filename = t_self.target.secure_image_filename secure_bin = find_secure_image(t_self.notify, resources, binf, configured_secure_image_filename, FileType.BIN) - lpc55s69_tfm_bin(t_self, binf, secure_bin) + lpc55s69_complete(t_self, binf, secure_bin) ################################################################################