LPC55S69: Add post processing script

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
pull/9910/head
Mahesh Mahadevan 2019-02-28 12:42:02 -06:00
parent c607b8ab1a
commit 4573d22299
2 changed files with 52 additions and 0 deletions

45
tools/targets/LPC55S69.py Normal file
View File

@ -0,0 +1,45 @@
#
# Copyright (c) 2018 Arm Limited
#
# Licensed under the Apache License Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing software
# distributed under the License is distributed on an "AS IS" BASIS
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
import os
from os.path import abspath, basename, dirname, splitext
from os.path import join as path_join
import tempfile
from tools.psa.tfm.bin_utils.assemble import Assembly
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):
tempdir = tempfile.mkdtemp()
flash_layout = path_join(LPC55S69_BASE, 'partition', 'flash_layout.h')
secure_bin = path_join(LPC55S69_BASE, 'TARGET_M33_NS', 'device', 'tfm.bin')
ns_bin_name, ns_bin_ext = splitext(basename(non_secure_bin))
concatenated_bin = path_join(tempdir, 'tfm_' + ns_bin_name + ns_bin_ext)
#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)

View File

@ -598,6 +598,13 @@ class PSOC6Code:
else: else:
psoc6_complete(t_self, elf, binf) psoc6_complete(t_self, elf, binf)
class LPC55S69Code:
"""LPC55S69 Hooks"""
@staticmethod
def binary_hook(t_self, resources, elf, binf):
from tools.targets.LPC55S69 import lpc55s69_tfm_bin
lpc55s69_tfm_bin(t_self, binf)
################################################################################ ################################################################################
# Instantiate all public targets # Instantiate all public targets