Skip to content

CI branch to integrate the latest vanilla TF-M with Mbed OS #94

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@ jobs:
git clone --depth=1 --single-branch https://github.com/ARMmbed/mbed-os.git
- compile:
target: "ARM_MUSCA_S1"
- compile:
target: "ARM_MUSCA_B1"
# Temporarily disabled due to target rename in TF-M
# - compile:
# target: "ARM_MUSCA_B1"
7 changes: 4 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ matrix:

# ARM_MUSCA_B1

- <<: *compile-tests
name: "Compile Regression and Compliance tests - ARM_MUSCA_B1"
env: TARGET_NAME=ARM_MUSCA_B1 CACHE_NAME=ARM_MUSCA_B1
# Temporarily disabled due to target rename in TF-M
# - <<: *compile-tests
# name: "Compile Regression and Compliance tests - ARM_MUSCA_B1"
# env: TARGET_NAME=ARM_MUSCA_B1 CACHE_NAME=ARM_MUSCA_B1
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ if ("${MBED_CONFIG_DEFINITIONS}" MATCHES "MBED_CONF_APP_REGRESSION_TEST=1")
tfm_qcbor_test
tfm_t_cose_test
platform_ns
psa_api_ns
tfm_ns_integration_test
tfm_qcbor
tfm_t_cose
Expand Down
24 changes: 20 additions & 4 deletions build_tfm.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ def _clone_tfm_repo(commit):
Clone TF-M git repos and it's dependencies
:param commit: If True then commit VERSION.txt
"""
check_and_clone_repo("trusted-firmware-m", "mbed-tfm", TF_M_BUILD_DIR)
check_and_clone_repo("tf-m-tests", "mbed-tfm", TF_M_BUILD_DIR)
check_and_clone_repo("trusted-firmware-m", "upstream-tfm", TF_M_BUILD_DIR)
check_and_clone_repo("tf-m-tests", "upstream-tfm", TF_M_BUILD_DIR)
check_and_clone_repo(
"psa-arch-tests", "psa-api-compliance", TF_M_BUILD_DIR
)
Expand Down Expand Up @@ -226,7 +226,6 @@ def _run_cmake_build(cmake_build_dir, args, tgt, tfm_config):
[
"-DTEST_NS=ON",
"-DTEST_S=ON",
"-DTFM_IRQ_TEST=ON",
"-DTFM_PERIPH_ACCESS_TEST=ON",
]
)
Expand Down Expand Up @@ -350,7 +349,7 @@ def _copy_binaries(source, destination, toolchain, target):
install_dir = join(install_dir, os.pardir)
head_tail = split(head_tail[0])

tfm_veneer = join(install_dir, "export", "tfm", "lib", "s_veneers.o")
tfm_veneer = join(install_dir, "interface", "lib", "s_veneers.o")
shutil.copy2(tfm_veneer, output_dir)


Expand Down Expand Up @@ -520,6 +519,23 @@ def _copy_library(source, toolchain):

shutil.copy2(src_file, dst_file)

if dst_base == "libplatform_ns.ar":
# TF-M redirects output to serial by declaring its own `FILE __stdout`
# and disables the toolchain's default version of this symbol using
# the flag `-nostdlib`. But stdlib is enabled and required by Mbed OS,
# so we need to disable the one from TF-M's libplatform_ns to avoid
# symbol duplication.
cmd = [
"fromelf",
"--elf",
"--localize",
"__stdout",
dst_file,
"-o",
dst_file,
]
run_cmd_and_return(cmd)


def _build_target(tgt, cmake_build_dir, args):
"""
Expand Down
4 changes: 0 additions & 4 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ int main(void)
GREENTEA_SETUP(600, "default_auto");
#endif

// Use TF-M regression test TIMER1 IRQ handler for the TIMER1 IRQ. The TF-M
// IRQ test requires its own handler to be installed.
NVIC_SetVector(TFM_TIMER1_IRQ, (uint32_t)TIMER1_Handler);

tfm_log_printf("Starting TF-M regression tests\n");

// Disable deep sleep to avoid the TF-M IRQ test causing a hang, as the
Expand Down
80 changes: 44 additions & 36 deletions tfm_ns_import.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,21 @@
"mbed-os": {
"ARM_MUSCA_S1": [
{
"src": "bl2/ext/mcuboot/CMakeFiles/signing_layout_ns.dir/signing_layout_ns.o",
"src": "install/image_signing/layout_files/signing_layout_ns.o",
"dst": "targets/TARGET_ARM_SSG/TARGET_MUSCA_S1/partition/signing_layout_ns.c"
},
{
"src": "bl2/ext/mcuboot/CMakeFiles/signing_layout_s.dir/signing_layout_s.o",
"src": "install/image_signing/layout_files/signing_layout_s.o",
"dst": "targets/TARGET_ARM_SSG/TARGET_MUSCA_S1/partition/signing_layout_s.c"
}
],
"ARM_MUSCA_B1": [
{
"src": "bl2/ext/mcuboot/CMakeFiles/signing_layout_ns.dir/signing_layout_ns.o",
"src": "install/image_signing/layout_files/signing_layout_ns.o",
"dst": "targets/TARGET_ARM_SSG/TARGET_MUSCA_B1/partition/signing_layout_ns.c"
},
{
"src": "bl2/ext/mcuboot/CMakeFiles/signing_layout_s.dir/signing_layout_s.o",
"src": "install/image_signing/layout_files/signing_layout_s.o",
"dst": "targets/TARGET_ARM_SSG/TARGET_MUSCA_B1/partition/signing_layout_s.c"
}
],
Expand All @@ -49,33 +49,37 @@
],
"common": [
{
"src": "install/export/tfm/src/tfm_crypto_ipc_api.c",
"src": "install/interface/src/tfm_crypto_ipc_api.c",
"dst": "platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_LATEST/src/tfm_crypto_ipc_api.c"
},
{
"src": "install/export/tfm/src/tfm_initial_attestation_ipc_api.c",
"src": "install/interface/src/tfm_initial_attestation_ipc_api.c",
"dst": "platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_LATEST/src/tfm_initial_attestation_ipc_api.c"
},
{
"src": "install/export/tfm/src/tfm_ps_ipc_api.c",
"dst": "platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_LATEST/src/tfm_ps_ipc_api.c"
"src": "install/interface/src/tfm_its_ipc_api.c",
"dst": "platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_LATEST/src/tfm_its_ipc_api.c"
},
{
"src": "install/export/tfm/src/tfm_its_ipc_api.c",
"dst": "platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_LATEST/src/tfm_its_ipc_api.c"
"src": "install/interface/src/tfm_ps_ipc_api.c",
"dst": "platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_LATEST/src/tfm_ps_ipc_api.c"
},
{
"src": "install/export/tfm/src/tfm_platform_ipc_api.c",
"src": "install/interface/src/tfm_platform_ipc_api.c",
"dst": "platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_LATEST/src/tfm_platform_ipc_api.c"
},
{
"src": "../bl2/ext/mcuboot/scripts/assemble.py",
"src": "install/image_signing/scripts/assemble.py",
"dst": "tools/psa/tfm/bin_utils/assemble.py"
},
{
"src": "../bl2/ext/mcuboot/scripts/macro_parser.py",
"src": "install/image_signing/scripts/macro_parser.py",
"dst": "tools/psa/tfm/bin_utils/macro_parser.py"
},
{
"src": "install/image_signing/scripts/wrapper/wrapper.py",
"dst": "tools/psa/tfm/bin_utils/wrapper.py"
},
{
"src": "lib/ext/mcuboot-src/scripts/imgtool.py",
"dst": "tools/psa/tfm/bin_utils/imgtool.py"
Expand All @@ -89,23 +93,19 @@
"dst": "tools/psa/tfm/bin_utils/imgtool/keys"
},
{
"src": "../bl2/ext/mcuboot/scripts/wrapper/wrapper.py",
"dst": "tools/psa/tfm/bin_utils/wrapper.py"
},
{
"src": "install/export/tfm/include",
"src": "install/interface/include",
"dst": "platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_LATEST/include"
},
{
"src": "../interface/include/os_wrapper",
"dst": "platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_LATEST/include/os_wrapper"
},
{
"src": "install/export/tfm/include/psa",
"src": "install/interface/include/psa",
"dst": "platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_LATEST/include/psa"
},
{
"src": "install/export/tfm/include/psa_manifest",
"src": "install/interface/include/psa_manifest",
"dst": "platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_LATEST/include/psa_manifest"
},
{
Expand All @@ -115,34 +115,46 @@
],
"v8-m": [
{
"src": "install/export/tfm/src/tfm_psa_ns_api.c",
"src": "install/interface/src/tfm_psa_ns_api.c",
"dst": "platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_LATEST/TARGET_TFM_V8M/src/tfm_psa_ns_api.c"
},
{
"src": "install/export/tfm/src/tfm_ns_interface.c",
"src": "install/interface/src/tfm_ns_interface.c",
"dst": "platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_LATEST/TARGET_TFM_V8M/src/tfm_ns_interface.c"
}
],
"dualcpu": [
{
"src": "install/export/tfm/src/tfm_multi_core_api.c",
"dst": "platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_LATEST/TARGET_TFM_DUALCPU/src/tfm_multi_core_api.c"
"src": "install/interface/src/platform_multicore.c",
"dst": "platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_LATEST/TARGET_TFM_DUALCPU/src/platform_multicore.c"
},
{
"src": "install/export/tfm/src/platform_ns_mailbox.c",
"src": "install/interface/src/platform_ns_mailbox.c",
"dst": "platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_LATEST/TARGET_TFM_DUALCPU/src/platform_ns_mailbox.c"
},
{
"src": "install/export/tfm/src/tfm_multi_core_psa_ns_api.c",
"src": "install/interface/src/tfm_multi_core_ns_api.c",
"dst": "platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_LATEST/TARGET_TFM_DUALCPU/src/tfm_multi_core_ns_api.c"
},
{
"src": "install/interface/src/tfm_multi_core_psa_ns_api.c",
"dst": "platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_LATEST/ARGET_TFM_DUALCPU/src/tfm_multi_core_psa_ns_api.c"
},
{
"src": "install/export/tfm/src/tfm_ns_mailbox.c",
"src": "install/interface/src/tfm_ns_mailbox.c",
"dst": "platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_LATEST/TARGET_TFM_DUALCPU/src/tfm_ns_mailbox.c"
},
{
"src": "install/export/tfm/src/platform_multicore.c",
"dst": "platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_LATEST/TARGET_TFM_DUALCPU/src/platform_multicore.c"
"src": "install/interface/src/tfm_ns_mailbox_rtos_api.c",
"dst": "platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_LATEST/TARGET_TFM_DUALCPU/src/tfm_ns_mailbox_rtos_api.c"
},
{
"src": "install/interface/src/tfm_ns_mailbox_test.c",
"dst": "platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_LATEST/TARGET_TFM_DUALCPU/src/tfm_ns_mailbox_test.c"
},
{
"src": "install/interface/src/tfm_ns_mailbox_thread.c",
"dst": "platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_LATEST/TARGET_TFM_DUALCPU/src/tfm_ns_mailbox_thread.c"
}
]
},
Expand Down Expand Up @@ -178,15 +190,15 @@
"dst": "tfm/platform/include/tfm_plat_ns.h"
},
{
"src": "../../tf-m-tests/test/test_services/tfm_secure_client_service/tfm_secure_client_service_api.h",
"src": "../tf-m-tests/test/test_services/tfm_secure_client_service/tfm_secure_client_service_api.h",
"dst": "test/inc"
},
{
"src": "../../tf-m-tests/test/framework/test_framework_error_codes.h",
"src": "../tf-m-tests/test/framework/test_framework_error_codes.h",
"dst": "test/inc"
},
{
"src": "../../tf-m-tests/test/framework/test_framework_integ_test.h",
"src": "../tf-m-tests/test/framework/test_framework_integ_test.h",
"dst": "test/inc"
}
],
Expand All @@ -195,10 +207,6 @@
"src": "app/libtfm_ns_integration_test.a",
"dst": "test/lib"
},
{
"src": "interface/libpsa_api_ns.a",
"dst": "test/lib"
},
{
"src": "lib/ext/qcbor/libtfm_qcbor.a",
"dst": "test/lib"
Expand Down