Skip to content

Commit b124ab4

Browse files
committed
Refactor: MUSCA targets post binary hook scripts
1 parent 7063044 commit b124ab4

File tree

3 files changed

+12
-163
lines changed

3 files changed

+12
-163
lines changed

tools/targets/ARM_MUSCA_B1.py renamed to tools/targets/ARM_MUSCA.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,21 @@
2323

2424
SCRIPT_DIR = dirname(abspath(__file__))
2525
MBED_OS_ROOT = abspath(path_join(SCRIPT_DIR, os.pardir, os.pardir))
26-
MUSCA_B1_BASE = path_join(MBED_OS_ROOT, 'targets', 'TARGET_ARM_SSG', 'TARGET_MUSCA_B1')
2726

28-
def musca_tfm_bin(t_self, non_secure_bin, secure_bin):
27+
def musca_tfm_bin(t_self, non_secure_bin, secure_bin, target_name):
2928

29+
MUSCA_BASE = path_join(MBED_OS_ROOT, 'targets', 'TARGET_ARM_SSG', ('TARGET_' + target_name))
3030
assert os.path.isfile(secure_bin)
3131
assert os.path.isfile(non_secure_bin)
3232

3333
build_dir = dirname(non_secure_bin)
3434
tempdir = path_join(build_dir, 'temp')
3535
if not isdir(tempdir):
3636
os.makedirs(tempdir)
37-
flash_layout = path_join(MUSCA_B1_BASE, 'partition', 'flash_layout.h')
38-
mcuboot_bin = path_join(MUSCA_B1_BASE, 'bl2.bin')
39-
image_macros_s = path_join(MUSCA_B1_BASE, 'partition', 'signing_layout_s.c')
40-
image_macros_ns = path_join(MUSCA_B1_BASE, 'partition', 'signing_layout_ns.c')
37+
flash_layout = path_join(MUSCA_BASE, 'partition', 'flash_layout.h')
38+
mcuboot_bin = path_join(MUSCA_BASE, 'bl2.bin')
39+
image_macros_s = path_join(MUSCA_BASE, 'partition', 'signing_layout_s.c')
40+
image_macros_ns = path_join(MUSCA_BASE, 'partition', 'signing_layout_ns.c')
4141
s_bin_name, s_bin_ext = splitext(basename(secure_bin))
4242
s_signed_bin = abspath(path_join(tempdir, s_bin_name + '_signed' + s_bin_ext))
4343
ns_bin_name, ns_bin_ext = splitext(basename(non_secure_bin))
@@ -54,7 +54,7 @@ def musca_tfm_bin(t_self, non_secure_bin, secure_bin):
5454
"-v",
5555
'1.2.0',
5656
"-k",
57-
path_join(SCRIPT_DIR, 'musca_b1-root-rsa-3072.pem'),
57+
path_join(SCRIPT_DIR, (target_name.lower() + '-root-rsa-3072.pem')),
5858
"--layout",
5959
image_macros_s,
6060
"--public-key-format",
@@ -83,7 +83,7 @@ def musca_tfm_bin(t_self, non_secure_bin, secure_bin):
8383
"-v",
8484
'1.2.0',
8585
"-k",
86-
path_join(SCRIPT_DIR, 'musca_b1-root-rsa-3072_1.pem'),
86+
path_join(SCRIPT_DIR, (target_name.lower() + '-root-rsa-3072_1.pem')),
8787
"--layout",
8888
image_macros_ns,
8989
"--public-key-format",

tools/targets/ARM_MUSCA_S1.py

Lines changed: 0 additions & 151 deletions
This file was deleted.

tools/targets/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,7 @@ class ArmMuscaB1Code(object):
685685
"""Musca-B1 Hooks"""
686686
@staticmethod
687687
def binary_hook(t_self, resources, elf, binf):
688-
from tools.targets.ARM_MUSCA_B1 import musca_tfm_bin
688+
from tools.targets.ARM_MUSCA import musca_tfm_bin
689689
configured_secure_image_filename = t_self.target.secure_image_filename
690690
secure_bin = find_secure_image(
691691
t_self.notify,
@@ -694,13 +694,13 @@ def binary_hook(t_self, resources, elf, binf):
694694
configured_secure_image_filename,
695695
FileType.BIN
696696
)
697-
musca_tfm_bin(t_self, binf, secure_bin)
697+
musca_tfm_bin(t_self, binf, secure_bin, 'MUSCA_B1')
698698

699699
class ArmMuscaS1Code(object):
700700
"""Musca-S1 Hooks"""
701701
@staticmethod
702702
def binary_hook(t_self, resources, elf, binf):
703-
from tools.targets.ARM_MUSCA_S1 import musca_tfm_bin
703+
from tools.targets.ARM_MUSCA import musca_tfm_bin
704704
configured_secure_image_filename = t_self.target.secure_image_filename
705705
secure_bin = find_secure_image(
706706
t_self.notify,
@@ -709,7 +709,7 @@ def binary_hook(t_self, resources, elf, binf):
709709
configured_secure_image_filename,
710710
FileType.BIN
711711
)
712-
musca_tfm_bin(t_self, binf, secure_bin)
712+
musca_tfm_bin(t_self, binf, secure_bin, 'MUSCA_S1')
713713

714714
def find_secure_image(notify, resources, ns_image_path,
715715
configured_s_image_filename, image_type):

0 commit comments

Comments
 (0)