Skip to content

Commit 401580f

Browse files
Michael Schwarczmmahadevan108
authored andcommitted
LPC55S69: Change post-build hook to create HEX
1 parent ebd9dc8 commit 401580f

File tree

9 files changed

+22
-26
lines changed

9 files changed

+22
-26
lines changed

targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_LPC55S69/TARGET_M33_NS/prebuilt/README.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,31 @@ These images were compiled by the following command:
99
## tfm.bin
1010

1111
```sh
12-
mbed compile -t ARMC6 -m LPC55S69_S --app-config tools/psa/tfm/mbed_app.json --profile release
12+
mbed compile -t ARMC6 -m LPC55S69_S --app-config mbed-os/tools/psa/tfm/mbed_app.json --profile release
1313
```
1414

1515
## spm_smoke.bin
1616

1717
```sh
18-
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
18+
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
1919
```
2020

2121
## spm_client.bin
2222

2323
```sh
24-
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
24+
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
2525
```
2626

2727
## spm_server.bin
2828

2929
```sh
30-
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
30+
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
31+
```
32+
33+
## crypto_access_control.bin
34+
35+
```sh
36+
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
3137
```
3238

3339
To update the prebuilt binaries run the previous commands.

targets/targets.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2100,7 +2100,8 @@
21002100
"secure-rom-size": "0x30000",
21012101
"secure-ram-start": "0x30000000",
21022102
"secure-ram-size": "0x22000"
2103-
}
2103+
},
2104+
"OUTPUT_EXT": "hex"
21042105
},
21052106
"LPC55S69_S": {
21062107
"inherits": ["SPE_Target", "LPC55S69"],

tools/targets/LPC55S69.py

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,34 +15,23 @@
1515
#
1616

1717
import os
18-
from os.path import abspath, basename, dirname, splitext
18+
from os.path import abspath, dirname
1919
from os.path import join as path_join
20-
import tempfile
2120

22-
from tools.psa.tfm.bin_utils.assemble import Assembly
21+
from intelhex import IntelHex
2322

2423
SCRIPT_DIR = dirname(abspath(__file__))
2524
MBED_OS_ROOT = abspath(path_join(SCRIPT_DIR, os.pardir, os.pardir))
2625
LPC55S69_BASE = path_join(MBED_OS_ROOT, 'targets', 'TARGET_NXP', 'TARGET_MCUXpresso_MCUS', 'TARGET_LPC55S69')
2726

28-
def lpc55s69_tfm_bin(t_self, non_secure_bin, secure_bin):
29-
tempdir = tempfile.mkdtemp()
30-
flash_layout = path_join(LPC55S69_BASE, 'partition', 'flash_layout.h')
31-
ns_bin_name, ns_bin_ext = splitext(basename(non_secure_bin))
32-
concatenated_bin = path_join(tempdir, 'tfm_' + ns_bin_name + ns_bin_ext)
3327

34-
assert os.path.isfile(flash_layout)
28+
def lpc55s69_complete(t_self, non_secure_bin, secure_bin):
3529
assert os.path.isfile(secure_bin)
3630
assert os.path.isfile(non_secure_bin)
3731

38-
#1. Concatenate secure TFM and non-secure mbed binaries
39-
output = Assembly(flash_layout, concatenated_bin)
40-
output.add_image(secure_bin, "SECURE")
41-
output.add_image(non_secure_bin, "NON_SECURE")
42-
43-
#2. Delete the original binary file name
44-
os.remove(non_secure_bin)
45-
46-
#3. Rename to new concatenated binary to the original binary file name
47-
os.rename(concatenated_bin, non_secure_bin)
32+
ns_hex = IntelHex(non_secure_bin)
33+
s_hex = IntelHex()
34+
s_hex.loadbin(secure_bin)
4835

36+
s_hex.merge(ns_hex, overlap='ignore')
37+
s_hex.tofile(non_secure_bin, 'hex')

tools/targets/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -603,10 +603,10 @@ class LPC55S69Code:
603603
"""LPC55S69 Hooks"""
604604
@staticmethod
605605
def binary_hook(t_self, resources, elf, binf):
606-
from tools.targets.LPC55S69 import lpc55s69_tfm_bin
606+
from tools.targets.LPC55S69 import lpc55s69_complete
607607
configured_secure_image_filename = t_self.target.secure_image_filename
608608
secure_bin = find_secure_image(t_self.notify, resources, binf, configured_secure_image_filename, FileType.BIN)
609-
lpc55s69_tfm_bin(t_self, binf, secure_bin)
609+
lpc55s69_complete(t_self, binf, secure_bin)
610610

611611
################################################################################
612612

0 commit comments

Comments
 (0)