Skip to content

Commit 4573d22

Browse files
committed
LPC55S69: Add post processing script
Signed-off-by: Mahesh Mahadevan <[email protected]>
1 parent c607b8a commit 4573d22

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed

tools/targets/LPC55S69.py

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#
2+
# Copyright (c) 2018 Arm Limited
3+
#
4+
# Licensed under the Apache License Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing software
11+
# distributed under the License is distributed on an "AS IS" BASIS
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
17+
import os
18+
from os.path import abspath, basename, dirname, splitext
19+
from os.path import join as path_join
20+
import tempfile
21+
22+
from tools.psa.tfm.bin_utils.assemble import Assembly
23+
24+
SCRIPT_DIR = dirname(abspath(__file__))
25+
MBED_OS_ROOT = abspath(path_join(SCRIPT_DIR, os.pardir, os.pardir))
26+
LPC55S69_BASE = path_join(MBED_OS_ROOT, 'targets', 'TARGET_NXP', 'TARGET_MCUXpresso_MCUS', 'TARGET_LPC55S69')
27+
28+
def lpc55s69_tfm_bin(t_self, non_secure_bin):
29+
tempdir = tempfile.mkdtemp()
30+
flash_layout = path_join(LPC55S69_BASE, 'partition', 'flash_layout.h')
31+
secure_bin = path_join(LPC55S69_BASE, 'TARGET_M33_NS', 'device', 'tfm.bin')
32+
ns_bin_name, ns_bin_ext = splitext(basename(non_secure_bin))
33+
concatenated_bin = path_join(tempdir, 'tfm_' + ns_bin_name + ns_bin_ext)
34+
35+
#1. Concatenate secure TFM and non-secure mbed binaries
36+
output = Assembly(flash_layout, concatenated_bin)
37+
output.add_image(secure_bin, "SECURE")
38+
output.add_image(non_secure_bin, "NON_SECURE")
39+
40+
#2. Delete the original binary file name
41+
os.remove(non_secure_bin)
42+
43+
#3. Rename to new concatenated binary to the original binary file name
44+
os.rename(concatenated_bin, non_secure_bin)
45+

tools/targets/__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -598,6 +598,13 @@ def complete(t_self, resources, elf, binf):
598598
else:
599599
psoc6_complete(t_self, elf, binf)
600600

601+
class LPC55S69Code:
602+
"""LPC55S69 Hooks"""
603+
@staticmethod
604+
def binary_hook(t_self, resources, elf, binf):
605+
from tools.targets.LPC55S69 import lpc55s69_tfm_bin
606+
lpc55s69_tfm_bin(t_self, binf)
607+
601608
################################################################################
602609

603610
# Instantiate all public targets

0 commit comments

Comments
 (0)