diff --git a/.github/workflows/run_conditional_ble_feature_compilation.yml b/.github/workflows/run_conditional_ble_feature_compilation.yml deleted file mode 100644 index 931efda..0000000 --- a/.github/workflows/run_conditional_ble_feature_compilation.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: run conditional BLE feature compilation -on: - workflow_dispatch: - pull_request: - paths: - - 'connectivity/FEATURE_BLE/**' -jobs: - run-conditional-feature-compilation-test: - name: Conditional BLE features compilation tested - runs-on: ubuntu-latest - container: mbedos/mbed-os-env:latest - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - path: mbed-os - - - name: Build - run: | - git clone https://github.com/ARMmbed/mbed-os-example-ble.git - cd mbed-os-example-ble/BLE_SupportedFeatures - ln -s ../../mbed-os mbed-os - for f in ../resources/test_configs/*; do - echo "Configuration file ${f}: " - echo "-------------------------------------------------------------------------" - cat "${f}" - echo "-------------------------------------------------------------------------" - mbed compile -t GCC_ARM -m NRF52840_DK --app-config "${f}" - done diff --git a/CMakeLists.txt b/CMakeLists.txt index e80610f..a57507d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -257,6 +257,10 @@ mbed_create_distro(${MBED_TARGET_CMAKE_NAME}-obj ${MBED_TARGET_CMAKE_NAME} mbed-core-flags) # Now make core flags depend on that distro, ensuring everything has access to the uC's flags and objects. + # Note that this enforces a hard restriction: none of the libraries folded into the mbed target cmake target can link to + # mbed-core-flags, because otherwise there would be a circular dependency. I'm not sure if that limit will + # be a dealbreaker or not in the future. If it is, we might need to also split each mbed target cmake target + # into a -flags and a -sources version. target_link_libraries(mbed-core-flags INTERFACE ${MBED_TARGET_CMAKE_NAME}-obj) # Core Mbed OS libraries diff --git a/platform/CMakeLists.txt b/platform/CMakeLists.txt index 58be006..b9a0bd5 100644 --- a/platform/CMakeLists.txt +++ b/platform/CMakeLists.txt @@ -9,9 +9,6 @@ endif() endif() -# List of all optional platform libraries available. -add_library(mbed-psa INTERFACE) - if("EXPERIMENTAL_API" IN_LIST MBED_TARGET_LABELS) add_subdirectory(FEATURE_EXPERIMENTAL_API) endif() diff --git a/platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/CMakeLists.txt b/platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/CMakeLists.txt index b6e2016..6a87ff7 100644 --- a/platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/CMakeLists.txt +++ b/platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/CMakeLists.txt @@ -1,6 +1,9 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 +add_library(mbed-psa-headers INTERFACE) +add_library(mbed-psa-sources INTERFACE) + if("MBED_PSA_SRV" IN_LIST MBED_TARGET_LABELS) add_subdirectory(TARGET_MBED_PSA_SRV) endif() @@ -9,18 +12,17 @@ add_subdirectory(TARGET_TFM) endif() -target_include_directories(mbed-psa +target_include_directories(mbed-psa-headers INTERFACE inc inc/psa ) -target_sources(mbed-psa - INTERFACE +target_sources(mbed-psa-sources + PRIVATE src/psa_hrng.c ) -target_link_libraries(mbed-core-flags - INTERFACE - mbed-psa -) +# For now, on devices with PSA, PSA functions are used by the HAL so PSA needs to be included in the core Mbed build. +target_link_libraries(mbed-core-flags INTERFACE mbed-psa-headers) +target_link_libraries(mbed-core-sources INTERFACE mbed-psa-sources) \ No newline at end of file diff --git a/platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_MBED_PSA_SRV/CMakeLists.txt b/platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_MBED_PSA_SRV/CMakeLists.txt index d1acd89..19cfa29 100644 --- a/platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_MBED_PSA_SRV/CMakeLists.txt +++ b/platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_MBED_PSA_SRV/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -target_include_directories(mbed-psa +target_include_directories(mbed-psa-headers INTERFACE inc inc/psa @@ -18,7 +18,7 @@ services/storage/its ) -target_sources(mbed-psa +target_sources(mbed-psa-sources INTERFACE mbedtls/psa_crypto.c mbedtls/psa_crypto_se.c @@ -62,7 +62,7 @@ src/default_random_seed.cpp ) -target_link_libraries(mbed-psa +target_link_libraries(mbed-psa-sources INTERFACE mbed-mbedtls mbed-storage-kvstore diff --git a/platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_LATEST/CMakeLists.txt b/platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_LATEST/CMakeLists.txt index f0b07fd..402518f 100644 --- a/platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_LATEST/CMakeLists.txt +++ b/platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_LATEST/CMakeLists.txt @@ -2,7 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 if("TFM_DUALCPU" IN_LIST MBED_TARGET_LABELS) - target_sources(mbed-psa + target_sources(mbed-psa-sources INTERFACE TARGET_TFM_DUALCPU/src/platform_multicore.c TARGET_TFM_DUALCPU/src/platform_ns_mailbox.c @@ -14,7 +14,7 @@ endif() if("TFM_V8M" IN_LIST MBED_TARGET_LABELS) - target_sources(mbed-psa + target_sources(mbed-psa-sources INTERFACE TARGET_TFM_V8M/src/cmsis_nvic_virtual.c TARGET_TFM_V8M/src/tfm_mbed_boot.c @@ -22,14 +22,14 @@ ) endif() -target_include_directories(mbed-psa +target_include_directories(mbed-psa-headers INTERFACE include include/psa include/psa_manifest ) -target_sources(mbed-psa +target_sources(mbed-psa-sources INTERFACE src/os_wrapper_cmsis_rtos_v2.c src/tfm_crypto_ipc_api.c diff --git a/platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_LATEST/scripts/generate_mbed_image.py b/platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_LATEST/scripts/generate_mbed_image.py index 840aee1..af4b82a 100644 --- a/platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_LATEST/scripts/generate_mbed_image.py +++ b/platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_LATEST/scripts/generate_mbed_image.py @@ -16,6 +16,7 @@ # limitations under the License. import os +import sys from os.path import abspath, basename, dirname, splitext, isdir from os.path import join as path_join import re @@ -50,7 +51,7 @@ #1. Run wrapper to sign the TF-M secure binary cmd = [ - "python3", + sys.executable, path_join(MBED_OS_ROOT, "tools", "psa","tfm", "bin_utils","wrapper.py"), "-v", '1.2.0', @@ -82,7 +83,7 @@ #2. Run wrapper to sign the non-secure mbed binary cmd = [ - "python3", + sys.executable, path_join(MBED_OS_ROOT, "tools", "psa","tfm", "bin_utils","wrapper.py"), "-v", '1.2.0', @@ -114,7 +115,7 @@ #3. Concatenate signed secure TFM and non-secure mbed binaries cmd = [ - "python3", + sys.executable, path_join(MBED_OS_ROOT, "tools", "psa","tfm", "bin_utils","assemble.py"), "--layout", image_macros_s, diff --git a/platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_V1_0/CMakeLists.txt b/platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_V1_0/CMakeLists.txt index 48536d9..115c0ad 100644 --- a/platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_V1_0/CMakeLists.txt +++ b/platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_V1_0/CMakeLists.txt @@ -2,7 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 if("TFM_DUALCPU" IN_LIST MBED_TARGET_LABELS) - target_sources(mbed-psa + target_sources(mbed-psa-sources INTERFACE TARGET_TFM_DUALCPU/src/platform_multicore.c TARGET_TFM_DUALCPU/src/platform_ns_mailbox.c @@ -14,7 +14,7 @@ endif() if("TFM_V8M" IN_LIST MBED_TARGET_LABELS) - target_sources(mbed-psa + target_sources(mbed-psa-sources INTERFACE TARGET_TFM_V8M/src/cmsis_nvic_virtual.c TARGET_TFM_V8M/src/tfm_mbed_boot.c @@ -23,14 +23,14 @@ ) endif() -target_include_directories(mbed-psa - INTERFACE +target_include_directories(mbed-psa-headers + PUBLIC include include/psa include/psa_manifest ) -target_sources(mbed-psa +target_sources(mbed-psa-sources INTERFACE src/tfm_crypto_ipc_api.c src/tfm_initial_attestation_ipc_api.c diff --git a/targets/TARGET_ARM_SSG/TARGET_MUSCA_S1/CMakeLists.txt b/targets/TARGET_ARM_SSG/TARGET_MUSCA_S1/CMakeLists.txt index 5e89026..7b87e74 100644 --- a/targets/TARGET_ARM_SSG/TARGET_MUSCA_S1/CMakeLists.txt +++ b/targets/TARGET_ARM_SSG/TARGET_MUSCA_S1/CMakeLists.txt @@ -65,8 +65,25 @@ ${STARTUP_FILE} ) +# Create a library to wrap the veneers object (which is closed source) +# This is needed because if we just added the .o file to the sources, it would get lost by the create_distro() call. +add_library(mbed-arm-musca-s1-veneers STATIC EXCLUDE_FROM_ALL ${CMAKE_CURRENT_SOURCE_DIR}/s_veneers.o) +set_property(TARGET mbed-arm-musca-s1-veneers PROPERTY LINKER_LANGUAGE C) # Force to C since it has no sources of any language + target_link_libraries(mbed-arm-musca-s1 INTERFACE - ${CMAKE_CURRENT_SOURCE_DIR}/s_veneers.o mbed-arm-ssg + mbed-psa-headers + mbed-arm-musca-s1-veneers ) + +# pick up rtx_lib.h +# Not quite sure why this code seems to need RTX headers even on baremetal, but... +target_include_directories(mbed-arm-musca-s1 + INTERFACE + ../../../cmsis/CMSIS_5/CMSIS/RTOS2/RTX/Source + ../../../cmsis/CMSIS_5/CMSIS/RTOS2/RTX/Include + ../../../cmsis/CMSIS_5/CMSIS/RTOS2/RTX/Config + ../../../cmsis/CMSIS_5/CMSIS/RTOS2/Include +) + diff --git a/tools/cmake/mbed_create_distro.cmake b/tools/cmake/mbed_create_distro.cmake index eb006b0..d11b9ca 100644 --- a/tools/cmake/mbed_create_distro.cmake +++ b/tools/cmake/mbed_create_distro.cmake @@ -41,6 +41,8 @@ set(COMPLETED_MODULES ${ARGN}) while(NOT "${REMAINING_MODULES}" STREQUAL "") + #message("Distro: ${NAME}. REMAINING_MODULES: ${REMAINING_MODULES}") + list(GET REMAINING_MODULES 0 CURR_MODULE) copy_append_property(INTERFACE_COMPILE_DEFINITIONS ${CURR_MODULE} ${NAME})