From 0ba7650b846e96ca5a16967410df0f050453fe45 Mon Sep 17 00:00:00 2001 From: Jamie Smith Date: Sat, 2 Apr 2022 21:57:45 -0700 Subject: [PATCH 01/14] Switch mbed-baremetal and mbed-os to be OBJECT libraries. Can reuse the existing create_distro function for this. --- CMakeLists.txt | 38 ++++++++++++--------------------- tools/cmake/create_distro.cmake | 3 +-- 2 files changed, 15 insertions(+), 26 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b3fab59fc05..3a443da71cb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,22 +40,13 @@ if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) endif() endif() -add_library(mbed-core INTERFACE) - -add_library(mbed-os INTERFACE) - -target_link_libraries(mbed-os - INTERFACE - mbed-rtos - mbed-core -) - -add_library(mbed-baremetal INTERFACE) +# These targets are made visible here so their source files which +# are spread in different directories can be referenced and can be linked against +# by libraries that depend on them. +add_library(mbed-device_key INTERFACE) +add_library(mbed-rtos INTERFACE) # Collects source files and flags that are in mbed-os but not mbed-baremetal +add_library(mbed-core INTERFACE) # Collects source files and flags common to mbed-baremetal and mbed-os -target_link_libraries(mbed-baremetal - INTERFACE - mbed-core -) # Validate selected C library type # The C library type selected has to match the library that the target can support if(${CMAKE_CROSSCOMPILING}) @@ -153,13 +144,6 @@ target_include_directories(mbed-core ${CMAKE_CURRENT_SOURCE_DIR} ) -# These targets are made visible here so their source files which -# are spread in different directories can be referenced and can be linked against -# by libraries that depend on them. -# TODO CMake: Should the source files be moved? -add_library(mbed-device_key INTERFACE) -add_library(mbed-rtos INTERFACE) - # Include targets/ first, because any post-build hook needs to be defined # before other parts of Mbed OS can add greentea tests which require # mbed_set_post_build(). @@ -187,10 +171,16 @@ if(${CMAKE_CROSSCOMPILING}) string(TOLOWER ${MBED_TARGET} MBED_TARGET_CONVERTED) string(REPLACE "_" "-" MBED_TARGET_CONVERTED ${MBED_TARGET_CONVERTED}) string(PREPEND MBED_TARGET_CONVERTED "mbed-") - - target_link_libraries(mbed-core INTERFACE ${MBED_TARGET_CONVERTED}) endif() +# Core Mbed OS library +# mbed-baremetal contains baremetal sources + target sources + target compile flags. +# mbed-os will be a superset of mbed-baremetal, also containing the RTOS sources and RTOS flags. +# Note that many different source files will compile differently depending on if the RTOS is in use. +# So, it's needed to compile the core sources twice, once for RTOS and once for non-RTOS. +mbed_create_distro(mbed-baremetal mbed-core ${MBED_TARGET_CONVERTED}) +mbed_create_distro(mbed-os mbed-core mbed-rtos ${MBED_TARGET_CONVERTED}) + # Ninja requires to be forced for response files if ("${CMAKE_GENERATOR}" MATCHES "Ninja") # known issue ARMClang and Ninja with response files for windows diff --git a/tools/cmake/create_distro.cmake b/tools/cmake/create_distro.cmake index 2e518014f7d..c4f396b648f 100644 --- a/tools/cmake/create_distro.cmake +++ b/tools/cmake/create_distro.cmake @@ -32,8 +32,7 @@ endfunction(copy_append_property) # Create a "distribution" of Mbed OS containing the base Mbed and certain modules. # This distribution only needs to be compiled once and can be referenced in an arbitrary amount of targets. function(mbed_create_distro NAME) # ARGN: modules... - add_library(${NAME} OBJECT) - mbed_configure_app_target(${NAME}) + add_library(${NAME} OBJECT EXCLUDE_FROM_ALL) # First link as private dependencies target_link_libraries(${NAME} PRIVATE ${ARGN}) From 7b5e25c3cf99a36a26b38b6db85d3c7822c1806f Mon Sep 17 00:00:00 2001 From: Jamie Smith Date: Sat, 2 Apr 2022 22:33:29 -0700 Subject: [PATCH 02/14] Write defines into a disk file instead of passing 100s of them on the command line directly. Fixes some issues with build commands on my machine, and makes it a lot easier to view the make VERBOSE=1 output. --- CMakeLists.txt | 6 ++-- tools/cmake/app.cmake | 1 + tools/cmake/mbed_generate_config_header.cmake | 36 +++++++++++++++++++ 3 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 tools/cmake/mbed_generate_config_header.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 3a443da71cb..f2f5629346c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -93,8 +93,6 @@ if(${CMAKE_CROSSCOMPILING}) target_compile_definitions(mbed-core INTERFACE TARGET_NAME=${MBED_TARGET} - ${MBED_TARGET_DEFINITIONS} - ${MBED_CONFIG_DEFINITIONS} ) # Add MBED_TEST_MODE for backward compatibility with Greentea tests written for use with Mbed CLI 1 @@ -138,6 +136,10 @@ if(${CMAKE_CROSSCOMPILING}) endif() endif() +# Generate target config header and include it in all files +mbed_write_target_config_header(${CMAKE_CURRENT_BINARY_DIR}/mbed-target-config.h MBED_TARGET_DEFINITIONS MBED_CONFIG_DEFINITIONS) +target_compile_options(mbed-core INTERFACE -include ${CMAKE_CURRENT_BINARY_DIR}/mbed-target-config.h) + # Include mbed.h and config from generate folder target_include_directories(mbed-core INTERFACE diff --git a/tools/cmake/app.cmake b/tools/cmake/app.cmake index e82a25a5b88..5f783572d6f 100644 --- a/tools/cmake/app.cmake +++ b/tools/cmake/app.cmake @@ -12,6 +12,7 @@ endif() include(${MBED_CONFIG_PATH}/mbed_config.cmake) include(mbed_set_post_build) +include(mbed_generate_config_header) # Load toolchain file if(NOT CMAKE_TOOLCHAIN_FILE OR MBED_TOOLCHAIN_FILE_USED) diff --git a/tools/cmake/mbed_generate_config_header.cmake b/tools/cmake/mbed_generate_config_header.cmake new file mode 100644 index 00000000000..92c0b8e06b2 --- /dev/null +++ b/tools/cmake/mbed_generate_config_header.cmake @@ -0,0 +1,36 @@ +# Copyright (c) 2022 ARM Limited. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +# Function to write all Mbed target defines into a header. This makes the build run more smoothly +# by removing the need to pass 100s of #define flags on the command line, which makes debugging difficult +# and can cause issues with command line length limits besides. +function(mbed_write_target_config_header HEADER_PATH) # ARGN: Lists of defines to add to the file. + + set(TARGET_HEADER_CONTENTS +" /* + Mbed OS Target Define Header. + This contains all of the #defines specific to your target and device. + It is prepended to every source file using the -include compiler option. + AUTOGENERATED by cmake. DO NOT EDIT! + */ +") + + foreach(DEFINE_LIST ${ARGN}) + string(APPEND TARGET_HEADER_CONTENTS "\n // Defines from ${DEFINE_LIST}:\n") + + foreach(DEFINE_COMMAND ${${DEFINE_LIST}}) # double dereference needed to get contents of list + + # convert defines in command-line format (VAR=value) to header format (#define VAR value) + if("${DEFINE_COMMAND}" MATCHES "^([^=]+)=(.*)$") + string(APPEND TARGET_HEADER_CONTENTS "#define ${CMAKE_MATCH_1} ${CMAKE_MATCH_2}\n") + else() + # no value given, so follow GCC command line semantics and define it to 1 + string(APPEND TARGET_HEADER_CONTENTS "#define ${DEFINE_COMMAND} 1\n") + endif() + endforeach() + endforeach() + + # Write the file, using file(GENERATE) so that the timestamp is not updated if the contents don't change + file(GENERATE OUTPUT ${HEADER_PATH} CONTENT ${TARGET_HEADER_CONTENTS}) + +endfunction(mbed_write_target_config_header) \ No newline at end of file From a39d51b9590f41340bdc1f4393286da36657d6a2 Mon Sep 17 00:00:00 2001 From: Jamie Smith Date: Sun, 3 Apr 2022 12:05:47 -0700 Subject: [PATCH 03/14] Clean up top-level build file and build options, fix build issues on MinGW --- .gitignore | 3 + CMakeLists.txt | 118 ++++++++++++++---- cmsis/CMakeLists.txt | 2 +- connectivity/CMakeLists.txt | 2 +- connectivity/FEATURE_BLE/CMakeLists.txt | 2 +- connectivity/cellular/CMakeLists.txt | 2 +- connectivity/libraries/CMakeLists.txt | 2 +- connectivity/lorawan/CMakeLists.txt | 2 +- connectivity/mbedtls/CMakeLists.txt | 2 +- connectivity/netsocket/CMakeLists.txt | 2 +- connectivity/nfc/CMakeLists.txt | 2 +- drivers/CMakeLists.txt | 2 +- events/CMakeLists.txt | 2 +- hal/CMakeLists.txt | 2 +- platform/CMakeLists.txt | 2 +- .../TARGET_MBED_PSA_SRV/CMakeLists.txt | 2 +- .../doubles/platform/mbed_retarget.h | 2 +- rtos/CMakeLists.txt | 2 +- storage/blockdevice/CMakeLists.txt | 2 +- .../COMPONENT_QSPIF/CMakeLists.txt | 2 +- storage/filesystem/CMakeLists.txt | 2 +- storage/kvstore/CMakeLists.txt | 2 +- .../kvstore/filesystemstore/CMakeLists.txt | 2 +- storage/kvstore/tdbstore/CMakeLists.txt | 2 +- ..._distro.cmake => mbed_create_distro.cmake} | 0 25 files changed, 117 insertions(+), 48 deletions(-) rename tools/cmake/{create_distro.cmake => mbed_create_distro.cmake} (100%) diff --git a/.gitignore b/.gitignore index 3e907cf52c9..3d4dce2de27 100644 --- a/.gitignore +++ b/.gitignore @@ -104,3 +104,6 @@ cmake_install.cmake CMakeFiles/ cmake_build/ Testing/ + +# CLion +cmake-build-*/ \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index f2f5629346c..f0cbb9471f2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,23 +4,79 @@ # This is the boilerplate for Mbed OS cmake_minimum_required(VERSION 3.19.0 FATAL_ERROR) +cmake_policy(VERSION 3.16...3.22) -option(BUILD_GREENTEA_TESTS "Build greentea tests only." OFF) +# Setup build type (target type, tests/unit tests/real build) ---------------------------------------------------------------------------------- +# This block sets up the following variables for all subdirs to use: +# - MBED_OS_IS_STANDALONE: True if Mbed OS is the top-level project. False if Mbed is being built as part of an application. +# - MBED_IS_NATIVE_BUILD: True if we are building for the host machine. False if we are building for a microcontroller +# - MBED_OS_ENABLE_TESTS: True if we are building *any* internal Mbed OS tests at all. Enabled by -DBUILD_TESTING=TRUE (which is enabled by default when standalone). +# - BUILD_GREENTEA_TESTS: True to build greentea on-target tests. False to build host UNITTESTS. -if(BUILD_GREENTEA_TESTS) - # Usually we rely on the application to set MBED_CONFIG_PATH and include - # app.cmake. They are both required if we're building an application to run - # on an mbed-target. +if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) + # We are the top level project, so tests or unittests are being built. + set(MBED_OS_IS_STANDALONE TRUE) +else() + # Not the top level project + set(MBED_OS_IS_STANDALONE FALSE) +endif() + +if(CMAKE_CROSSCOMPILING) + set(MBED_IS_NATIVE_BUILD FALSE) +else() + set(MBED_IS_NATIVE_BUILD TRUE) +endif() + +if(MBED_IS_NATIVE_BUILD) + # Pick up some include files that are needed later + list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/tools/cmake) +endif() + +if(MBED_IS_NATIVE_BUILD) + # Pick up some include files that are needed later + list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/tools/cmake) + include(mbed_create_distro) +else() + # Grab the Mbed configs for this target + include(${MBED_CONFIG_PATH}/mbed_config.cmake) + include(mbed_set_linker_script) +endif() + +# Set up options for testing +option(BUILD_TESTING "Whether to enable CTest tests in this project" ${MBED_OS_IS_STANDALONE}) # This option is also created by include(CTest) but we need it here earlier on. +if(MBED_OS_IS_STANDALONE AND BUILD_TESTING) + set(MBED_OS_ENABLE_TESTS TRUE) + option(BUILD_GREENTEA_TESTS "Build greentea tests instead of unit tests" ${CMAKE_CROSSCOMPILING}) +endif() + +if(MBED_OS_IS_STANDALONE) + # For standalong builds, look for mbed-config.cmake in the top level mbed os dir set(MBED_CONFIG_PATH ${CMAKE_CURRENT_BINARY_DIR} CACHE STRING "") - # TODO: Remove when https://github.com/ARMmbed/mbed-os/issues/14518 is fixed - include(${CMAKE_CURRENT_LIST_DIR}/tools/cmake/app.cmake) endif() -if(${CMAKE_CROSSCOMPILING}) +if(MBED_IS_NATIVE_BUILD) + # Pick up some include files that are needed later + list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/tools/cmake) + include(mbed_create_distro) +else() + # Grab the Mbed configs for this target include(${MBED_CONFIG_PATH}/mbed_config.cmake) include(mbed_set_linker_script) endif() +# Print build type +if(MBED_OS_ENABLE_TESTS) + if(BUILD_GREENTEA_TESTS) + message(STATUS "Mbed: Compiling Greentea on-target tests for ${MBED_TARGET}") + else() + message(STATUS "Mbed: Compiling host UNITTESTS for native execution") + endif() +else() + message(STATUS "Mbed: Not building any Mbed OS tests.") +endif() + +# Create core Mbed OS targets and set up build flags ---------------------------------------------------------------------------------- + project(mbed-os) # Add all paths to the list files within Mbed OS @@ -30,7 +86,7 @@ list(APPEND CMAKE_MODULE_PATH add_subdirectory(extern) -if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) +if(MBED_OS_IS_STANDALONE) include(CTest) if((NOT BUILD_GREENTEA_TESTS) AND BUILD_TESTING) @@ -49,7 +105,7 @@ add_library(mbed-core INTERFACE) # Collects source files and flags common to mbe # Validate selected C library type # The C library type selected has to match the library that the target can support -if(${CMAKE_CROSSCOMPILING}) +if(NOT MBED_IS_NATIVE_BUILD) if(${MBED_C_LIB} STREQUAL "small") if(NOT "small" IN_LIST MBED_TARGET_SUPPORTED_C_LIBS) if("std" IN_LIST MBED_TARGET_SUPPORTED_C_LIBS) @@ -96,7 +152,7 @@ if(${CMAKE_CROSSCOMPILING}) ) # Add MBED_TEST_MODE for backward compatibility with Greentea tests written for use with Mbed CLI 1 - if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING) + if(MBED_OS_ENABLE_TESTS) if(NOT BUILD_GREENTEA_TESTS) target_compile_definitions(${PROJECT_NAME} INTERFACE @@ -136,9 +192,18 @@ if(${CMAKE_CROSSCOMPILING}) endif() endif() +if(MBED_IS_NATIVE_BUILD) + # Fix issue on Windows with object files hitting a limit for number of sections + if(CMAKE_SYSTEM_NAME STREQUAL "Windows") + add_compile_options(-Wa,-mbig-obj) + endif() +endif() + # Generate target config header and include it in all files -mbed_write_target_config_header(${CMAKE_CURRENT_BINARY_DIR}/mbed-target-config.h MBED_TARGET_DEFINITIONS MBED_CONFIG_DEFINITIONS) -target_compile_options(mbed-core INTERFACE -include ${CMAKE_CURRENT_BINARY_DIR}/mbed-target-config.h) +if(NOT MBED_IS_NATIVE_BUILD) + mbed_write_target_config_header(${CMAKE_CURRENT_BINARY_DIR}/mbed-target-config.h MBED_TARGET_DEFINITIONS MBED_CONFIG_DEFINITIONS) + target_compile_options(mbed-core INTERFACE -include ${CMAKE_CURRENT_BINARY_DIR}/mbed-target-config.h) +endif() # Include mbed.h and config from generate folder target_include_directories(mbed-core @@ -146,6 +211,8 @@ target_include_directories(mbed-core ${CMAKE_CURRENT_SOURCE_DIR} ) +# Recurse to subdirs ---------------------------------------------------------------------------------- + # Include targets/ first, because any post-build hook needs to be defined # before other parts of Mbed OS can add greentea tests which require # mbed_set_post_build(). @@ -167,21 +234,24 @@ add_subdirectory(features EXCLUDE_FROM_ALL) add_subdirectory(cmsis/CMSIS_5/CMSIS/RTOS2 EXCLUDE_FROM_ALL) add_subdirectory(cmsis/device/rtos EXCLUDE_FROM_ALL) +# Create top-level targets ---------------------------------------------------------------------------------- -if(${CMAKE_CROSSCOMPILING}) +if(NOT MBED_IS_NATIVE_BUILD) # Ensure the words that make up the Mbed target name are separated with a hyphen, lowercase, and with the `mbed-` prefix. string(TOLOWER ${MBED_TARGET} MBED_TARGET_CONVERTED) string(REPLACE "_" "-" MBED_TARGET_CONVERTED ${MBED_TARGET_CONVERTED}) string(PREPEND MBED_TARGET_CONVERTED "mbed-") endif() -# Core Mbed OS library -# mbed-baremetal contains baremetal sources + target sources + target compile flags. -# mbed-os will be a superset of mbed-baremetal, also containing the RTOS sources and RTOS flags. -# Note that many different source files will compile differently depending on if the RTOS is in use. -# So, it's needed to compile the core sources twice, once for RTOS and once for non-RTOS. -mbed_create_distro(mbed-baremetal mbed-core ${MBED_TARGET_CONVERTED}) -mbed_create_distro(mbed-os mbed-core mbed-rtos ${MBED_TARGET_CONVERTED}) +if(NOT MBED_IS_NATIVE_BUILD) + # Core Mbed OS library + # mbed-baremetal contains baremetal sources + target sources + target compile flags. + # mbed-os will be a superset of mbed-baremetal, also containing the RTOS sources and RTOS flags. + # Note that many different source files will compile differently depending on if the RTOS is in use. + # So, it's needed to compile the core sources twice, once for RTOS and once for non-RTOS. + mbed_create_distro(mbed-baremetal mbed-core ${MBED_TARGET_CONVERTED}) + mbed_create_distro(mbed-os mbed-core mbed-rtos ${MBED_TARGET_CONVERTED}) +endif() # Ninja requires to be forced for response files if ("${CMAKE_GENERATOR}" MATCHES "Ninja") @@ -192,8 +262,4 @@ if ("${CMAKE_GENERATOR}" MATCHES "Ninja") if((CMAKE_HOST_SYSTEM_NAME MATCHES "Windows") AND ((${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.22.0") OR (NOT CMAKE_CXX_COMPILER_ID MATCHES "ARMClang"))) set(CMAKE_NINJA_FORCE_RESPONSE_FILE 1 CACHE INTERNAL "") endif() -endif() - -# TODO: Remove once all example applications have removed it -function(mbed_configure_app_target target) -endfunction() +endif() \ No newline at end of file diff --git a/cmsis/CMakeLists.txt b/cmsis/CMakeLists.txt index ecfe69c76a6..1dbef1bbd2d 100644 --- a/cmsis/CMakeLists.txt +++ b/cmsis/CMakeLists.txt @@ -4,6 +4,6 @@ add_subdirectory(CMSIS_5) add_subdirectory(device) -if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING) +if(MBED_OS_ENABLE_TESTS) add_subdirectory(tests/UNITTESTS/doubles) endif() diff --git a/connectivity/CMakeLists.txt b/connectivity/CMakeLists.txt index 1a3bfd41c47..edef969a166 100644 --- a/connectivity/CMakeLists.txt +++ b/connectivity/CMakeLists.txt @@ -24,7 +24,7 @@ add_library(mbed-nfc INTERFACE) add_library(mbed-ppp INTERFACE) add_library(mbed-wifi INTERFACE) -if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING) +if(MBED_OS_ENABLE_TESTS) # Add these subdirectories for tests add_subdirectory(cellular) add_subdirectory(drivers) diff --git a/connectivity/FEATURE_BLE/CMakeLists.txt b/connectivity/FEATURE_BLE/CMakeLists.txt index fbd35db9afc..2cb86eef24b 100644 --- a/connectivity/FEATURE_BLE/CMakeLists.txt +++ b/connectivity/FEATURE_BLE/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING) +if(MBED_OS_ENABLE_TESTS) if(NOT BUILD_GREENTEA_TESTS) add_subdirectory(tests/UNITTESTS) endif() diff --git a/connectivity/cellular/CMakeLists.txt b/connectivity/cellular/CMakeLists.txt index 1c87aedf697..1128385d72c 100644 --- a/connectivity/cellular/CMakeLists.txt +++ b/connectivity/cellular/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING) +if(MBED_OS_ENABLE_TESTS) if(BUILD_GREENTEA_TESTS) # add greentea test else() diff --git a/connectivity/libraries/CMakeLists.txt b/connectivity/libraries/CMakeLists.txt index 21af84b3175..d47bbdabead 100644 --- a/connectivity/libraries/CMakeLists.txt +++ b/connectivity/libraries/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING) +if(MBED_OS_ENABLE_TESTS) if(NOT BUILD_GREENTEA_TESTS) add_subdirectory(tests/UNITTESTS) endif() diff --git a/connectivity/lorawan/CMakeLists.txt b/connectivity/lorawan/CMakeLists.txt index d30bdacfbce..9e5a5dcb12f 100644 --- a/connectivity/lorawan/CMakeLists.txt +++ b/connectivity/lorawan/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING) +if(MBED_OS_ENABLE_TESTS) if(BUILD_GREENTEA_TESTS) # add greentea test else() diff --git a/connectivity/mbedtls/CMakeLists.txt b/connectivity/mbedtls/CMakeLists.txt index 7bacaa6d970..68e7e4c76d8 100644 --- a/connectivity/mbedtls/CMakeLists.txt +++ b/connectivity/mbedtls/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING) +if(MBED_OS_ENABLE_TESTS) if(NOT BUILD_GREENTEA_TESTS) add_subdirectory(tests/UNITTESTS) endif() diff --git a/connectivity/netsocket/CMakeLists.txt b/connectivity/netsocket/CMakeLists.txt index d9748a11465..5f463d33c21 100644 --- a/connectivity/netsocket/CMakeLists.txt +++ b/connectivity/netsocket/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING) +if(MBED_OS_ENABLE_TESTS) if(BUILD_GREENTEA_TESTS) # add greentea test else() diff --git a/connectivity/nfc/CMakeLists.txt b/connectivity/nfc/CMakeLists.txt index a1c48ac0453..79964e3f4be 100644 --- a/connectivity/nfc/CMakeLists.txt +++ b/connectivity/nfc/CMakeLists.txt @@ -3,7 +3,7 @@ add_subdirectory(libraries) -if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING) +if(MBED_OS_ENABLE_TESTS) if(BUILD_GREENTEA_TESTS) add_subdirectory(tests/TESTS) endif() diff --git a/drivers/CMakeLists.txt b/drivers/CMakeLists.txt index a0b5feab063..0e92b77d69c 100644 --- a/drivers/CMakeLists.txt +++ b/drivers/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING) +if(MBED_OS_ENABLE_TESTS) if(BUILD_GREENTEA_TESTS) add_subdirectory(tests/TESTS) else() diff --git a/events/CMakeLists.txt b/events/CMakeLists.txt index 6e7a6c6bda9..99feb99e073 100644 --- a/events/CMakeLists.txt +++ b/events/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING) +if(MBED_OS_ENABLE_TESTS) if(BUILD_GREENTEA_TESTS) # add greentea test else() diff --git a/hal/CMakeLists.txt b/hal/CMakeLists.txt index 3af169e0f16..8e1b0905f25 100644 --- a/hal/CMakeLists.txt +++ b/hal/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright (c) 2020-2021 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING) +if(MBED_OS_ENABLE_TESTS) if(BUILD_GREENTEA_TESTS) # add greentea test else() diff --git a/platform/CMakeLists.txt b/platform/CMakeLists.txt index 8d03c0d4129..4831804d235 100644 --- a/platform/CMakeLists.txt +++ b/platform/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING) +if(MBED_OS_ENABLE_TESTS) if(BUILD_GREENTEA_TESTS) add_subdirectory(tests/TESTS) else() 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 ab076952547..d1acd89f053 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 @@ -73,7 +73,7 @@ target_link_libraries(mbed-psa add_subdirectory(test_abstraction_layers) -if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING) +if(MBED_OS_ENABLE_TESTS) if(BUILD_GREENTEA_TESTS) add_subdirectory(TESTS) endif() diff --git a/platform/tests/UNITTESTS/doubles/platform/mbed_retarget.h b/platform/tests/UNITTESTS/doubles/platform/mbed_retarget.h index e99d42150a3..5662a8e77b0 100644 --- a/platform/tests/UNITTESTS/doubles/platform/mbed_retarget.h +++ b/platform/tests/UNITTESTS/doubles/platform/mbed_retarget.h @@ -18,7 +18,7 @@ #ifndef RETARGET_H #define RETARGET_H -#include +#include #include #include diff --git a/rtos/CMakeLists.txt b/rtos/CMakeLists.txt index 2f329764001..3f1f9f6c5b9 100644 --- a/rtos/CMakeLists.txt +++ b/rtos/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING) +if(MBED_OS_ENABLE_TESTS) if(BUILD_GREENTEA_TESTS) add_subdirectory(tests/TESTS) else() diff --git a/storage/blockdevice/CMakeLists.txt b/storage/blockdevice/CMakeLists.txt index 8b77f0fbc05..cf10ad3cc34 100644 --- a/storage/blockdevice/CMakeLists.txt +++ b/storage/blockdevice/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING) +if(MBED_OS_ENABLE_TESTS) if(BUILD_GREENTEA_TESTS) # add greentea test else() diff --git a/storage/blockdevice/COMPONENT_QSPIF/CMakeLists.txt b/storage/blockdevice/COMPONENT_QSPIF/CMakeLists.txt index 54b7d11b377..22f0de6541f 100644 --- a/storage/blockdevice/COMPONENT_QSPIF/CMakeLists.txt +++ b/storage/blockdevice/COMPONENT_QSPIF/CMakeLists.txt @@ -12,7 +12,7 @@ target_sources(mbed-storage-qspif source/QSPIFBlockDevice.cpp ) -if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING) +if(MBED_OS_ENABLE_TESTS) if (NOT BUILD_GREENTEA_TESTS) add_subdirectory(UNITTESTS) endif() diff --git a/storage/filesystem/CMakeLists.txt b/storage/filesystem/CMakeLists.txt index 5d6fca3ec57..c2b2f4fed4b 100644 --- a/storage/filesystem/CMakeLists.txt +++ b/storage/filesystem/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING) +if(MBED_OS_ENABLE_TESTS) if(BUILD_GREENTEA_TESTS) # add greentea test else() diff --git a/storage/kvstore/CMakeLists.txt b/storage/kvstore/CMakeLists.txt index 1d0feeef628..dfb078aa9d4 100644 --- a/storage/kvstore/CMakeLists.txt +++ b/storage/kvstore/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING) +if(MBED_OS_ENABLE_TESTS) if(BUILD_GREENTEA_TESTS) # add greentea test else() diff --git a/storage/kvstore/filesystemstore/CMakeLists.txt b/storage/kvstore/filesystemstore/CMakeLists.txt index 49b2d344d7f..70453fdaf53 100644 --- a/storage/kvstore/filesystemstore/CMakeLists.txt +++ b/storage/kvstore/filesystemstore/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING) +if(MBED_OS_ENABLE_TESTS) if(BUILD_GREENTEA_TESTS) # add greentea test else() diff --git a/storage/kvstore/tdbstore/CMakeLists.txt b/storage/kvstore/tdbstore/CMakeLists.txt index 82cd283761b..f324732f58a 100644 --- a/storage/kvstore/tdbstore/CMakeLists.txt +++ b/storage/kvstore/tdbstore/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING) +if(MBED_OS_ENABLE_TESTS) if(BUILD_GREENTEA_TESTS) # add greentea test else() diff --git a/tools/cmake/create_distro.cmake b/tools/cmake/mbed_create_distro.cmake similarity index 100% rename from tools/cmake/create_distro.cmake rename to tools/cmake/mbed_create_distro.cmake From a341c9c29a2355276feba7d7e521b3d98db24c21 Mon Sep 17 00:00:00 2001 From: Jamie Smith Date: Sun, 3 Apr 2022 17:38:18 -0700 Subject: [PATCH 04/14] - Split mbed-core and mbed-rtos into -sources and -flags targets - Fix some logic errors in top level cmakelists related to building greentea tests - Fix mbed_create_distro() for OBJECT libraries --- CMakeLists.txt | 109 ++++++++++-------- cmsis/CMSIS_5/CMSIS/RTOS2/CMakeLists.txt | 4 +- cmsis/CMSIS_5/CMSIS/RTOS2/RTX/CMakeLists.txt | 6 +- cmsis/device/CMakeLists.txt | 2 +- cmsis/device/RTE/CMakeLists.txt | 2 +- cmsis/device/rtos/CMakeLists.txt | 10 +- connectivity/cellular/CMakeLists.txt | 2 +- .../TARGET_Apollo3/CMakeLists.txt | 2 +- .../nanostack-libservice/CMakeLists.txt | 6 +- drivers/CMakeLists.txt | 4 +- features/CMakeLists.txt | 4 +- .../frameworks/greentea-client/CMakeLists.txt | 7 +- .../mbed-greentea-io/CMakeLists.txt | 6 +- features/frameworks/unity/CMakeLists.txt | 6 +- features/frameworks/utest/CMakeLists.txt | 7 +- hal/CMakeLists.txt | 4 +- hal/usb/CMakeLists.txt | 4 +- platform/CMakeLists.txt | 2 +- .../FEATURE_PSA/CMakeLists.txt | 2 +- platform/cxxsupport/CMakeLists.txt | 4 +- platform/mbed-trace/CMakeLists.txt | 4 +- platform/source/CMakeLists.txt | 6 +- .../source/TARGET_CORTEX_M/CMakeLists.txt | 4 +- platform/source/minimal-printf/CMakeLists.txt | 4 +- rtos/CMakeLists.txt | 6 +- tools/cmake/app.cmake | 4 +- tools/cmake/mbed_create_distro.cmake | 32 ++++- tools/cmake/mbed_greentea.cmake | 13 +-- tools/cmake/mbed_set_linker_script.cmake | 1 + 29 files changed, 155 insertions(+), 112 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f0cbb9471f2..e80610fa845 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,7 +11,8 @@ cmake_policy(VERSION 3.16...3.22) # - MBED_OS_IS_STANDALONE: True if Mbed OS is the top-level project. False if Mbed is being built as part of an application. # - MBED_IS_NATIVE_BUILD: True if we are building for the host machine. False if we are building for a microcontroller # - MBED_OS_ENABLE_TESTS: True if we are building *any* internal Mbed OS tests at all. Enabled by -DBUILD_TESTING=TRUE (which is enabled by default when standalone). -# - BUILD_GREENTEA_TESTS: True to build greentea on-target tests. False to build host UNITTESTS. +# - BUILD_GREENTEA_TESTS: True to build greentea on-target tests. False to build host UNITTESTS. Defaults to false when standalone. + if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) # We are the top level project, so tests or unittests are being built. @@ -21,37 +22,41 @@ else() set(MBED_OS_IS_STANDALONE FALSE) endif() -if(CMAKE_CROSSCOMPILING) - set(MBED_IS_NATIVE_BUILD FALSE) -else() - set(MBED_IS_NATIVE_BUILD TRUE) -endif() - -if(MBED_IS_NATIVE_BUILD) - # Pick up some include files that are needed later - list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/tools/cmake) -endif() - -if(MBED_IS_NATIVE_BUILD) - # Pick up some include files that are needed later - list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/tools/cmake) - include(mbed_create_distro) -else() - # Grab the Mbed configs for this target - include(${MBED_CONFIG_PATH}/mbed_config.cmake) - include(mbed_set_linker_script) -endif() - # Set up options for testing option(BUILD_TESTING "Whether to enable CTest tests in this project" ${MBED_OS_IS_STANDALONE}) # This option is also created by include(CTest) but we need it here earlier on. if(MBED_OS_IS_STANDALONE AND BUILD_TESTING) set(MBED_OS_ENABLE_TESTS TRUE) - option(BUILD_GREENTEA_TESTS "Build greentea tests instead of unit tests" ${CMAKE_CROSSCOMPILING}) + option(BUILD_GREENTEA_TESTS "Build greentea tests instead of unit tests" FALSE) endif() +# Figure out if this is a native build if(MBED_OS_IS_STANDALONE) - # For standalong builds, look for mbed-config.cmake in the top level mbed os dir + + # Standalone build, use BUILD_GREENTEA_TESTS to determine if we are building for native or not (user can select) + if(BUILD_GREENTEA_TESTS) + set(MBED_IS_NATIVE_BUILD FALSE) + else() + set(MBED_IS_NATIVE_BUILD TRUE) + endif() + +else() + + # Building as a subdir. This means that the top-level project will already have called project(), so we can + # rely on CMake's platform detection. + if(CMAKE_CROSSCOMPILING) + set(MBED_IS_NATIVE_BUILD FALSE) + else() + set(MBED_IS_NATIVE_BUILD TRUE) + endif() + +endif() + +if(MBED_OS_IS_STANDALONE AND NOT MBED_IS_NATIVE_BUILD) + # For standalone builds, default to looking for mbed-config.cmake in the binary dir set(MBED_CONFIG_PATH ${CMAKE_CURRENT_BINARY_DIR} CACHE STRING "") + + # Initialize Mbed build system + include(${CMAKE_CURRENT_LIST_DIR}/tools/cmake/app.cmake) endif() if(MBED_IS_NATIVE_BUILD) @@ -77,7 +82,8 @@ endif() # Create core Mbed OS targets and set up build flags ---------------------------------------------------------------------------------- -project(mbed-os) +# Create project and find compilers (if not already found) +project(mbed-os LANGUAGES C CXX ASM) # Add all paths to the list files within Mbed OS list(APPEND CMAKE_MODULE_PATH @@ -100,8 +106,10 @@ endif() # are spread in different directories can be referenced and can be linked against # by libraries that depend on them. add_library(mbed-device_key INTERFACE) -add_library(mbed-rtos INTERFACE) # Collects source files and flags that are in mbed-os but not mbed-baremetal -add_library(mbed-core INTERFACE) # Collects source files and flags common to mbed-baremetal and mbed-os +add_library(mbed-rtos-flags INTERFACE) # Collects source files that are in mbed-os but not mbed-baremetal +add_library(mbed-rtos-sources INTERFACE) # Collects flags that are in mbed-os but not mbed-baremetal +add_library(mbed-core-flags INTERFACE) # Collects flags common to mbed-baremetal and mbed-os +add_library(mbed-core-sources INTERFACE) # Collects source files common to mbed-baremetal and mbed-os # Validate selected C library type # The C library type selected has to match the library that the target can support @@ -132,13 +140,13 @@ if(NOT MBED_IS_NATIVE_BUILD) ) endif() - mbed_set_cpu_core_definitions(mbed-core) + mbed_set_cpu_core_definitions(mbed-core-flags) if(${MBED_TOOLCHAIN_FILE_USED}) - mbed_set_profile_options(mbed-core ${MBED_TOOLCHAIN}) - mbed_set_c_lib(mbed-core ${MBED_C_LIB}) - mbed_set_printf_lib(mbed-core ${MBED_PRINTF_LIB}) + mbed_set_profile_options(mbed-core-flags ${MBED_TOOLCHAIN}) + mbed_set_c_lib(mbed-core-flags ${MBED_C_LIB}) + mbed_set_printf_lib(mbed-core-flags ${MBED_PRINTF_LIB}) - target_compile_features(mbed-core + target_compile_features(mbed-core-flags INTERFACE c_std_11 cxx_std_14 @@ -146,7 +154,7 @@ if(NOT MBED_IS_NATIVE_BUILD) endif() - target_compile_definitions(mbed-core + target_compile_definitions(mbed-core-flags INTERFACE TARGET_NAME=${MBED_TARGET} ) @@ -172,24 +180,31 @@ if(NOT MBED_IS_NATIVE_BUILD) # # TODO: Remove this and find a more idiomatic way of passing compile definitions to CPP without # using response files or global properties. - mbed_generate_options_for_linker(mbed-core RESPONSE_FILE_PATH) + mbed_generate_options_for_linker(mbed-core-flags RESPONSE_FILE_PATH) set_property(GLOBAL PROPERTY COMPILE_DEFS_RESPONSE_FILE ${RESPONSE_FILE_PATH}) # Add compile definitions for backward compatibility with the toolchain # supported. New source files should instead check for __GNUC__ and __clang__ # for the GCC_ARM and ARM toolchains respectively. if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM") - target_compile_definitions(mbed-core + target_compile_definitions(mbed-core-flags INTERFACE TOOLCHAIN_GCC_ARM TOOLCHAIN_GCC ) elseif(${MBED_TOOLCHAIN} STREQUAL "ARM") - target_compile_definitions(mbed-core + target_compile_definitions(mbed-core-flags INTERFACE TOOLCHAIN_ARM ) endif() + + + # Ensure the words that make up the Mbed target name are separated with a hyphen, lowercase, and with the `mbed-` prefix. + string(TOLOWER ${MBED_TARGET} MBED_TARGET_CMAKE_NAME) + string(REPLACE "_" "-" MBED_TARGET_CMAKE_NAME ${MBED_TARGET_CMAKE_NAME}) + string(PREPEND MBED_TARGET_CMAKE_NAME "mbed-") + endif() if(MBED_IS_NATIVE_BUILD) @@ -202,11 +217,11 @@ endif() # Generate target config header and include it in all files if(NOT MBED_IS_NATIVE_BUILD) mbed_write_target_config_header(${CMAKE_CURRENT_BINARY_DIR}/mbed-target-config.h MBED_TARGET_DEFINITIONS MBED_CONFIG_DEFINITIONS) - target_compile_options(mbed-core INTERFACE -include ${CMAKE_CURRENT_BINARY_DIR}/mbed-target-config.h) + target_compile_options(mbed-core-flags INTERFACE -include ${CMAKE_CURRENT_BINARY_DIR}/mbed-target-config.h) endif() # Include mbed.h and config from generate folder -target_include_directories(mbed-core +target_include_directories(mbed-core-flags INTERFACE ${CMAKE_CURRENT_SOURCE_DIR} ) @@ -237,20 +252,20 @@ add_subdirectory(cmsis/device/rtos EXCLUDE_FROM_ALL) # Create top-level targets ---------------------------------------------------------------------------------- if(NOT MBED_IS_NATIVE_BUILD) - # Ensure the words that make up the Mbed target name are separated with a hyphen, lowercase, and with the `mbed-` prefix. - string(TOLOWER ${MBED_TARGET} MBED_TARGET_CONVERTED) - string(REPLACE "_" "-" MBED_TARGET_CONVERTED ${MBED_TARGET_CONVERTED}) - string(PREPEND MBED_TARGET_CONVERTED "mbed-") -endif() -if(NOT MBED_IS_NATIVE_BUILD) - # Core Mbed OS library + # Create a distro for the microcontroller cmake target, ensuring its sources are only compiled once + 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. + target_link_libraries(mbed-core-flags INTERFACE ${MBED_TARGET_CMAKE_NAME}-obj) + + # Core Mbed OS libraries # mbed-baremetal contains baremetal sources + target sources + target compile flags. # mbed-os will be a superset of mbed-baremetal, also containing the RTOS sources and RTOS flags. # Note that many different source files will compile differently depending on if the RTOS is in use. # So, it's needed to compile the core sources twice, once for RTOS and once for non-RTOS. - mbed_create_distro(mbed-baremetal mbed-core ${MBED_TARGET_CONVERTED}) - mbed_create_distro(mbed-os mbed-core mbed-rtos ${MBED_TARGET_CONVERTED}) + mbed_create_distro(mbed-baremetal mbed-core-flags mbed-core-sources) + mbed_create_distro(mbed-os mbed-core-flags mbed-core-sources mbed-rtos-flags mbed-rtos-sources) endif() # Ninja requires to be forced for response files diff --git a/cmsis/CMSIS_5/CMSIS/RTOS2/CMakeLists.txt b/cmsis/CMSIS_5/CMSIS/RTOS2/CMakeLists.txt index 5953cc598e5..b8d93bb19c8 100644 --- a/cmsis/CMSIS_5/CMSIS/RTOS2/CMakeLists.txt +++ b/cmsis/CMSIS_5/CMSIS/RTOS2/CMakeLists.txt @@ -3,12 +3,12 @@ add_subdirectory(RTX) -target_include_directories(mbed-rtos +target_include_directories(mbed-rtos-flags INTERFACE Include ) -target_sources(mbed-rtos +target_sources(mbed-rtos-sources INTERFACE Source/os_systick.c Source/os_tick_ptim.c diff --git a/cmsis/CMSIS_5/CMSIS/RTOS2/RTX/CMakeLists.txt b/cmsis/CMSIS_5/CMSIS/RTOS2/RTX/CMakeLists.txt index e25cbf8067f..b37c34c6b89 100644 --- a/cmsis/CMSIS_5/CMSIS/RTOS2/RTX/CMakeLists.txt +++ b/cmsis/CMSIS_5/CMSIS/RTOS2/RTX/CMakeLists.txt @@ -22,7 +22,7 @@ if(${CMAKE_CROSSCOMPILING}) set(STARTUP_RTX_FILE TARGET_RTOS_M4_M7/irq_cm4f.S) endif() - target_sources(mbed-rtos + target_sources(mbed-rtos-sources INTERFACE Source/${toolchain_dir}/${STARTUP_RTX_FILE} ) @@ -42,7 +42,7 @@ if(${CMAKE_CROSSCOMPILING}) _mbed_get_cortex_m_exception_handlers(TOOLCHAIN_GCC) endif() -target_include_directories(mbed-rtos +target_include_directories(mbed-rtos-flags INTERFACE Config Include @@ -50,7 +50,7 @@ target_include_directories(mbed-rtos Source ) -target_sources(mbed-rtos +target_sources(mbed-rtos-sources INTERFACE Config/RTX_Config.c diff --git a/cmsis/device/CMakeLists.txt b/cmsis/device/CMakeLists.txt index d968802881b..937ff314f9d 100644 --- a/cmsis/device/CMakeLists.txt +++ b/cmsis/device/CMakeLists.txt @@ -3,7 +3,7 @@ add_subdirectory(RTE) -target_include_directories(mbed-core +target_include_directories(mbed-core-flags INTERFACE . ) diff --git a/cmsis/device/RTE/CMakeLists.txt b/cmsis/device/RTE/CMakeLists.txt index f51bf2378f5..f09cf61fc70 100644 --- a/cmsis/device/RTE/CMakeLists.txt +++ b/cmsis/device/RTE/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -target_include_directories(mbed-core +target_include_directories(mbed-core-flags INTERFACE include ) diff --git a/cmsis/device/rtos/CMakeLists.txt b/cmsis/device/rtos/CMakeLists.txt index 34cd1623e43..7c1c6756bdd 100644 --- a/cmsis/device/rtos/CMakeLists.txt +++ b/cmsis/device/rtos/CMakeLists.txt @@ -3,24 +3,24 @@ if(${CMAKE_CROSSCOMPILING}) if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM") - target_sources(mbed-rtos + target_sources(mbed-rtos-sources INTERFACE TOOLCHAIN_GCC_ARM/mbed_boot_gcc_arm.c ) elseif(${MBED_TOOLCHAIN} STREQUAL "ARM") - target_sources(mbed-rtos + target_sources(mbed-rtos-sources INTERFACE TOOLCHAIN_ARM_STD/mbed_boot_arm_std.c ) endif() endif() -target_include_directories(mbed-rtos +target_include_directories(mbed-rtos-flags INTERFACE include ) -target_sources(mbed-rtos +target_sources(mbed-rtos-sources INTERFACE source/mbed_boot.c source/mbed_rtos_rtx.c @@ -28,7 +28,7 @@ target_sources(mbed-rtos source/mbed_rtx_idle.cpp ) -target_compile_definitions(mbed-rtos +target_compile_definitions(mbed-rtos-flags INTERFACE MBED_CONF_RTOS_PRESENT=1 ) diff --git a/connectivity/cellular/CMakeLists.txt b/connectivity/cellular/CMakeLists.txt index 1128385d72c..757ac906e21 100644 --- a/connectivity/cellular/CMakeLists.txt +++ b/connectivity/cellular/CMakeLists.txt @@ -31,5 +31,5 @@ target_compile_definitions(mbed-cellular target_link_libraries(mbed-cellular INTERFACE mbed-netsocket - mbed-core + mbed-core-flags ) diff --git a/connectivity/drivers/ble/FEATURE_BLE/TARGET_Ambiq_Micro/TARGET_Apollo3/CMakeLists.txt b/connectivity/drivers/ble/FEATURE_BLE/TARGET_Ambiq_Micro/TARGET_Apollo3/CMakeLists.txt index dd2d83e6617..eb944c3df11 100644 --- a/connectivity/drivers/ble/FEATURE_BLE/TARGET_Ambiq_Micro/TARGET_Apollo3/CMakeLists.txt +++ b/connectivity/drivers/ble/FEATURE_BLE/TARGET_Ambiq_Micro/TARGET_Apollo3/CMakeLists.txt @@ -14,5 +14,5 @@ target_sources(mbed-ble target_link_libraries(mbed-ble INTERFACE - mbed-core + mbed-core-flags ) diff --git a/connectivity/libraries/nanostack-libservice/CMakeLists.txt b/connectivity/libraries/nanostack-libservice/CMakeLists.txt index 9af5a22b1ff..55026a194c1 100644 --- a/connectivity/libraries/nanostack-libservice/CMakeLists.txt +++ b/connectivity/libraries/nanostack-libservice/CMakeLists.txt @@ -22,16 +22,16 @@ target_sources(mbed-nanostack-libservice # The definition, source files and include directories below # are needed by mbed-trace which is part of the mbed-core CMake target -target_compile_definitions(mbed-core +target_compile_definitions(mbed-core-flags INTERFACE MBED_CONF_NANOSTACK_LIBSERVICE_PRESENT=1 ) -target_include_directories(mbed-core +target_include_directories(mbed-core-flags INTERFACE . ./mbed-client-libservice ) -target_sources(mbed-core +target_sources(mbed-core-sources INTERFACE source/libBits/common_functions.c source/libip6string/ip6tos.c diff --git a/drivers/CMakeLists.txt b/drivers/CMakeLists.txt index 0e92b77d69c..72ca713ebea 100644 --- a/drivers/CMakeLists.txt +++ b/drivers/CMakeLists.txt @@ -9,7 +9,7 @@ if(MBED_OS_ENABLE_TESTS) endif() endif() -target_include_directories(mbed-core +target_include_directories(mbed-core-flags INTERFACE . ./include @@ -17,7 +17,7 @@ target_include_directories(mbed-core ./include/drivers/internal ) -target_sources(mbed-core +target_sources(mbed-core-sources INTERFACE source/AnalogIn.cpp source/AnalogOut.cpp diff --git a/features/CMakeLists.txt b/features/CMakeLists.txt index 12e8c803670..01af5f1dfab 100644 --- a/features/CMakeLists.txt +++ b/features/CMakeLists.txt @@ -4,8 +4,8 @@ # List of all features libraries available. add_library(mbed-fpga-ci-test-shield INTERFACE) add_library(mbed-client-cli INTERFACE) -add_library(mbed-unity INTERFACE) -add_library(mbed-utest INTERFACE) +add_library(mbed-unity OBJECT EXCLUDE_FROM_ALL) +add_library(mbed-utest OBJECT EXCLUDE_FROM_ALL) add_subdirectory(frameworks/COMPONENT_FPGA_CI_TEST_SHIELD) add_subdirectory(frameworks/mbed-client-cli) diff --git a/features/frameworks/greentea-client/CMakeLists.txt b/features/frameworks/greentea-client/CMakeLists.txt index 7e8ebe43034..79bdd8c1a29 100644 --- a/features/frameworks/greentea-client/CMakeLists.txt +++ b/features/frameworks/greentea-client/CMakeLists.txt @@ -1,14 +1,17 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 +add_library(mbed-greentea OBJECT EXCLUDE_FROM_ALL) target_include_directories(mbed-greentea - INTERFACE + PUBLIC . greentea-client ) target_sources(mbed-greentea - INTERFACE + PRIVATE source/greentea_metrics.cpp source/greentea_test_env.cpp ) + +target_link_libraries(mbed-greentea PUBLIC mbed-core-flags) diff --git a/features/frameworks/mbed-greentea-io/CMakeLists.txt b/features/frameworks/mbed-greentea-io/CMakeLists.txt index 8d68931b438..57225f0828a 100644 --- a/features/frameworks/mbed-greentea-io/CMakeLists.txt +++ b/features/frameworks/mbed-greentea-io/CMakeLists.txt @@ -1,6 +1,6 @@ # Copyright (c) 2021 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -add_library(mbed-greentea-io INTERFACE) -target_sources(mbed-greentea-io INTERFACE mbed_io.cpp) -target_link_libraries(mbed-greentea-io INTERFACE mbed-core) +add_library(mbed-greentea-io OBJECT EXCLUDE_FROM_ALL) +target_sources(mbed-greentea-io PRIVATE mbed_io.cpp) +target_link_libraries(mbed-greentea-io PUBLIC mbed-core-flags) diff --git a/features/frameworks/unity/CMakeLists.txt b/features/frameworks/unity/CMakeLists.txt index 96974259d2e..1287f173cdb 100644 --- a/features/frameworks/unity/CMakeLists.txt +++ b/features/frameworks/unity/CMakeLists.txt @@ -2,12 +2,14 @@ # SPDX-License-Identifier: Apache-2.0 target_include_directories(mbed-unity - INTERFACE + PUBLIC . unity ) target_sources(mbed-unity - INTERFACE + PRIVATE source/unity.c ) + +target_link_libraries(mbed-unity PUBLIC mbed-core-flags mbed-utest) diff --git a/features/frameworks/utest/CMakeLists.txt b/features/frameworks/utest/CMakeLists.txt index 6af46a763dd..1000a5634b7 100644 --- a/features/frameworks/utest/CMakeLists.txt +++ b/features/frameworks/utest/CMakeLists.txt @@ -2,13 +2,14 @@ # SPDX-License-Identifier: Apache-2.0 target_include_directories(mbed-utest - INTERFACE + PUBLIC . utest + ../greentea-client ) target_sources(mbed-utest - INTERFACE + PRIVATE mbed-utest-shim.cpp source/unity_handler.cpp source/utest_case.cpp @@ -20,3 +21,5 @@ target_sources(mbed-utest source/utest_stack_trace.cpp source/utest_types.cpp ) + +target_link_libraries(mbed-utest PUBLIC mbed-core-flags) diff --git a/hal/CMakeLists.txt b/hal/CMakeLists.txt index 8e1b0905f25..3cd9f950ccd 100644 --- a/hal/CMakeLists.txt +++ b/hal/CMakeLists.txt @@ -13,13 +13,13 @@ add_subdirectory(TARGET_FLASH_CMSIS_ALGO EXCLUDE_FROM_ALL) add_subdirectory(usb) -target_include_directories(mbed-core +target_include_directories(mbed-core-flags INTERFACE include include/hal ) -target_sources(mbed-core +target_sources(mbed-core-sources INTERFACE source/LowPowerTickerWrapper.cpp source/mbed_compat.c diff --git a/hal/usb/CMakeLists.txt b/hal/usb/CMakeLists.txt index 1215cf1d3f9..7c657759a5b 100644 --- a/hal/usb/CMakeLists.txt +++ b/hal/usb/CMakeLists.txt @@ -1,13 +1,13 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -target_include_directories(mbed-core +target_include_directories(mbed-core-flags INTERFACE include include/usb ) -target_sources(mbed-core +target_sources(mbed-core-sources INTERFACE source/mbed_usb_phy.cpp ) diff --git a/platform/CMakeLists.txt b/platform/CMakeLists.txt index 4831804d235..58be00685e7 100644 --- a/platform/CMakeLists.txt +++ b/platform/CMakeLists.txt @@ -21,7 +21,7 @@ add_subdirectory(mbed-trace) add_subdirectory(randlib) add_subdirectory(source) -target_include_directories(mbed-core +target_include_directories(mbed-core-flags INTERFACE include include/platform diff --git a/platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/CMakeLists.txt b/platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/CMakeLists.txt index 222bd82b4f9..b6e20168d53 100644 --- a/platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/CMakeLists.txt +++ b/platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/CMakeLists.txt @@ -20,7 +20,7 @@ target_sources(mbed-psa src/psa_hrng.c ) -target_link_libraries(mbed-core +target_link_libraries(mbed-core-flags INTERFACE mbed-psa ) diff --git a/platform/cxxsupport/CMakeLists.txt b/platform/cxxsupport/CMakeLists.txt index f9b4651dd76..c7a8a71c3f1 100644 --- a/platform/cxxsupport/CMakeLists.txt +++ b/platform/cxxsupport/CMakeLists.txt @@ -1,12 +1,12 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -target_include_directories(mbed-core +target_include_directories(mbed-core-flags INTERFACE . ) -target_sources(mbed-core +target_sources(mbed-core-sources INTERFACE mstd_mutex.cpp ) diff --git a/platform/mbed-trace/CMakeLists.txt b/platform/mbed-trace/CMakeLists.txt index 8ce73855735..fb43e2df02f 100644 --- a/platform/mbed-trace/CMakeLists.txt +++ b/platform/mbed-trace/CMakeLists.txt @@ -3,13 +3,13 @@ add_subdirectory(source) -target_include_directories(mbed-core +target_include_directories(mbed-core-flags INTERFACE include include/mbed-trace ) -target_sources(mbed-core +target_sources(mbed-core-sources INTERFACE source/mbed_trace.c ) diff --git a/platform/source/CMakeLists.txt b/platform/source/CMakeLists.txt index 2067646dc42..48adbb1212a 100644 --- a/platform/source/CMakeLists.txt +++ b/platform/source/CMakeLists.txt @@ -7,12 +7,12 @@ endif() add_subdirectory(minimal-printf) -target_include_directories(mbed-core +target_include_directories(mbed-core-flags INTERFACE . ) -target_sources(mbed-core +target_sources(mbed-core-sources INTERFACE ATCmdParser.cpp CThunkBase.cpp @@ -50,7 +50,7 @@ target_sources(mbed-core ) if(MBED_TOOLCHAIN STREQUAL "GCC_ARM" AND MBED_C_LIB STREQUAL "small") - target_sources(mbed-core + target_sources(mbed-core-sources INTERFACE newlib_nano_malloc_workaround.c ) diff --git a/platform/source/TARGET_CORTEX_M/CMakeLists.txt b/platform/source/TARGET_CORTEX_M/CMakeLists.txt index 298fa20a28b..d90dc317a86 100644 --- a/platform/source/TARGET_CORTEX_M/CMakeLists.txt +++ b/platform/source/TARGET_CORTEX_M/CMakeLists.txt @@ -1,9 +1,9 @@ # Copyright (c) 2020-2021 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -target_sources(mbed-core INTERFACE TOOLCHAIN_GCC/except.S) +target_sources(mbed-core-sources INTERFACE TOOLCHAIN_GCC/except.S) -target_sources(mbed-core +target_sources(mbed-core-sources INTERFACE mbed_fault_handler.c ) diff --git a/platform/source/minimal-printf/CMakeLists.txt b/platform/source/minimal-printf/CMakeLists.txt index 4c31fb0bef5..1855033499c 100644 --- a/platform/source/minimal-printf/CMakeLists.txt +++ b/platform/source/minimal-printf/CMakeLists.txt @@ -1,12 +1,12 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -target_include_directories(mbed-core +target_include_directories(mbed-core-flags INTERFACE . ) -target_sources(mbed-core +target_sources(mbed-core-sources INTERFACE mbed_printf_armlink_overrides.c mbed_printf_implementation.c diff --git a/rtos/CMakeLists.txt b/rtos/CMakeLists.txt index 3f1f9f6c5b9..a126a935997 100644 --- a/rtos/CMakeLists.txt +++ b/rtos/CMakeLists.txt @@ -9,7 +9,7 @@ if(MBED_OS_ENABLE_TESTS) endif() endif() -target_include_directories(mbed-core +target_include_directories(mbed-core-flags INTERFACE . ./include @@ -18,7 +18,7 @@ target_include_directories(mbed-core ./source ) -target_sources(mbed-core +target_sources(mbed-core-sources INTERFACE source/EventFlags.cpp source/Kernel.cpp @@ -30,7 +30,7 @@ target_sources(mbed-core ) -target_compile_definitions(mbed-core +target_compile_definitions(mbed-core-flags INTERFACE MBED_CONF_RTOS_API_PRESENT=1 ) diff --git a/tools/cmake/app.cmake b/tools/cmake/app.cmake index 5f783572d6f..c51b1e198fd 100644 --- a/tools/cmake/app.cmake +++ b/tools/cmake/app.cmake @@ -13,6 +13,7 @@ endif() include(${MBED_CONFIG_PATH}/mbed_config.cmake) include(mbed_set_post_build) include(mbed_generate_config_header) +include(mbed_create_distro) # Load toolchain file if(NOT CMAKE_TOOLCHAIN_FILE OR MBED_TOOLCHAIN_FILE_USED) @@ -62,6 +63,3 @@ else() message(STATUS "Missing Python dependencies (python3, intelhex, prettytable) so the memory map cannot be printed") endif() -# load mbed_create_distro -include(${CMAKE_CURRENT_LIST_DIR}/create_distro.cmake) - diff --git a/tools/cmake/mbed_create_distro.cmake b/tools/cmake/mbed_create_distro.cmake index c4f396b648f..eb006b0f4a2 100644 --- a/tools/cmake/mbed_create_distro.cmake +++ b/tools/cmake/mbed_create_distro.cmake @@ -34,9 +34,6 @@ endfunction(copy_append_property) function(mbed_create_distro NAME) # ARGN: modules... add_library(${NAME} OBJECT EXCLUDE_FROM_ALL) - # First link as private dependencies - target_link_libraries(${NAME} PRIVATE ${ARGN}) - # Now copy include dirs, compile defs, and compile options (but NOT interface source files) over # to the distribution target so they will be passed into things that link to it. # To do this, we need to recursively traverse the tree of dependencies. @@ -51,6 +48,27 @@ function(mbed_create_distro NAME) # ARGN: modules... copy_append_property(INTERFACE_INCLUDE_DIRECTORIES ${CURR_MODULE} ${NAME}) copy_append_property(INTERFACE_LINK_OPTIONS ${CURR_MODULE} ${NAME}) + # Make sure that linking to the distro pulls in the compiled code from CURR_MODULE + target_link_libraries(${NAME} PRIVATE ${CURR_MODULE}) + + # CMake currently has a limitation that OBJECT libraries cannot link to other OBJECT libraries + # via the LINK_LIBRARIES property -- CMake will not link the objects in properly :/. + # see: https://cmake.org/pipermail/cmake/2019-May/069453.html + # Once the INTERFACE_LINK_LIBRARIES_DIRECT property becomes widely available we could use that instead to fix this. + get_property(CURR_MODULE_TYPE TARGET ${CURR_MODULE} PROPERTY TYPE) + if("${CURR_MODULE_TYPE}" STREQUAL "OBJECT_LIBRARY") + target_sources(${NAME} INTERFACE $) + + # Check if this object library has any other libraries exported through its INTERFACE_SOURCES. + # If it does, we need to propagate those too. + get_property(OBJ_INTERFACE_SOURCES TARGET ${NAME} PROPERTY INTERFACE_SOURCES) + foreach(INTERFACE_SOURCE ${OBJ_INTERFACE_SOURCES}) + if(INTERFACE_SOURCE MATCHES "\\$") + target_sources(${NAME} INTERFACE ${INTERFACE_SOURCE}) + endif() + endforeach() + endif() + list(REMOVE_AT REMAINING_MODULES 0) list(APPEND COMPLETED_MODULES ${CURR_MODULE}) @@ -58,8 +76,12 @@ function(mbed_create_distro NAME) # ARGN: modules... get_property(SUBMODULES TARGET ${CURR_MODULE} PROPERTY INTERFACE_LINK_LIBRARIES) foreach(SUBMODULE ${SUBMODULES}) if(NOT "${SUBMODULE}" MATCHES "::@") # remove CMake internal CMAKE_DIRECTORY_ID_SEP markers - if(NOT ${SUBMODULE} IN_LIST COMPLETED_MODULES) - list(APPEND REMAINING_MODULES ${SUBMODULE}) + # Remove LINK_ONLY genexes from target_link_libraries(... PRIVATE). We can ignore things wrapped in these + # because they will already have been handled by the target_link_libraries earlier on. + if(NOT "${SUBMODULE}" MATCHES "\\$") + if(NOT ${SUBMODULE} IN_LIST COMPLETED_MODULES) + list(APPEND REMAINING_MODULES ${SUBMODULE}) + endif() endif() endif() endforeach() diff --git a/tools/cmake/mbed_greentea.cmake b/tools/cmake/mbed_greentea.cmake index 1c4df556938..d02e2532eea 100644 --- a/tools/cmake/mbed_greentea.cmake +++ b/tools/cmake/mbed_greentea.cmake @@ -78,13 +78,6 @@ function(mbed_greentea_add_test) return() endif() - # TODO: After we convert all greentea tests to use CTest, remove this - # add_subdirectory call. We will attach the tests to the mbed-os project, - # rather than creating a new project for each test that depends on mbed-os. - if(NOT BUILD_GREENTEA_TESTS) - add_subdirectory(${MBED_ROOT} build) - endif() - add_executable(${MBED_GREENTEA_TEST_NAME}) target_include_directories(${MBED_GREENTEA_TEST_NAME} @@ -119,6 +112,12 @@ function(mbed_greentea_add_test) set(MBED_GREENTEA_TEST_IMAGE_NAME "${MBED_GREENTEA_TEST_NAME}.bin") endif() + # User can set this cache variable to supply extra arguments to greentea. + # such as: -d to set the drive path, -p to set the COM port. + if(DEFINED MBED_GREENTEA_EXTRA_HTRUN_ARGUMENTS) + list(APPEND MBED_HTRUN_ARGUMENTS ${MBED_GREENTEA_EXTRA_HTRUN_ARGUMENTS}) + endif() + if(DEFINED MBED_GREENTEA_HOST_TESTS_DIR) list(APPEND MBED_HTRUN_ARGUMENTS "-e;${MBED_GREENTEA_HOST_TESTS_DIR}") endif() diff --git a/tools/cmake/mbed_set_linker_script.cmake b/tools/cmake/mbed_set_linker_script.cmake index 3a29b0873aa..21855f0ea6d 100644 --- a/tools/cmake/mbed_set_linker_script.cmake +++ b/tools/cmake/mbed_set_linker_script.cmake @@ -6,6 +6,7 @@ # Called once for each MCU target in the build system. # function(mbed_set_linker_script input_target raw_linker_script_path) + set(LINKER_SCRIPT_PATH ${CMAKE_CURRENT_BINARY_DIR}/${input_target}.link_script.ld) # To avoid path limits on Windows, we create a "response file" and set the path to it as a # global property. We need this solely to pass the compile definitions to GCC's preprocessor, From 59906406ea2e4096c979c4e463c2074455635669 Mon Sep 17 00:00:00 2001 From: Jamie Smith Date: Sat, 9 Apr 2022 17:11:54 -0700 Subject: [PATCH 05/14] Fix PSA and MUSCA build --- ...un_conditional_ble_feature_compilation.yml | 29 ------------------- CMakeLists.txt | 4 +++ platform/CMakeLists.txt | 3 -- .../FEATURE_PSA/CMakeLists.txt | 16 +++++----- .../TARGET_MBED_PSA_SRV/CMakeLists.txt | 6 ++-- .../TARGET_TFM_LATEST/CMakeLists.txt | 8 ++--- .../scripts/generate_mbed_image.py | 7 +++-- .../TARGET_TFM/TARGET_TFM_V1_0/CMakeLists.txt | 10 +++---- .../TARGET_MUSCA_S1/CMakeLists.txt | 19 +++++++++++- tools/cmake/mbed_create_distro.cmake | 2 ++ 10 files changed, 49 insertions(+), 55 deletions(-) delete mode 100644 .github/workflows/run_conditional_ble_feature_compilation.yml 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 931efda07ca..00000000000 --- 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 e80610fa845..a57507d46de 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -257,6 +257,10 @@ if(NOT MBED_IS_NATIVE_BUILD) 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 58be00685e7..b9a0bd552ee 100644 --- a/platform/CMakeLists.txt +++ b/platform/CMakeLists.txt @@ -9,9 +9,6 @@ if(MBED_OS_ENABLE_TESTS) 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 b6e20168d53..6a87ff7e65d 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 @@ if("TFM" IN_LIST MBED_TARGET_LABELS) 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 d1acd89f053..19cfa29474b 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 @@ target_include_directories(mbed-psa 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 @@ target_sources(mbed-psa 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 f0b07fdb1cd..402518f6aa1 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 @@ if("TFM_DUALCPU" IN_LIST MBED_TARGET_LABELS) 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 @@ if("TFM_V8M" IN_LIST MBED_TARGET_LABELS) ) 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 840aee13b1d..af4b82acb1d 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 @@ def sign_and_merge_tfm_bin(target_name, target_path, non_secure_bin, secure_bin) #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 @@ def sign_and_merge_tfm_bin(target_name, target_path, non_secure_bin, secure_bin) #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 @@ def sign_and_merge_tfm_bin(target_name, target_path, non_secure_bin, secure_bin) #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 48536d99a00..115c0ad76fd 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 @@ if("TFM_DUALCPU" IN_LIST MBED_TARGET_LABELS) 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 @@ if("TFM_V8M" IN_LIST MBED_TARGET_LABELS) ) 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 5e89026a9d3..7b87e74906b 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 @@ target_sources(mbed-arm-musca-s1 ${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 eb006b0f4a2..d11b9ca8c30 100644 --- a/tools/cmake/mbed_create_distro.cmake +++ b/tools/cmake/mbed_create_distro.cmake @@ -41,6 +41,8 @@ function(mbed_create_distro NAME) # ARGN: modules... 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}) From 189ecd2223b96ee2319b04f96acf248330869763 Mon Sep 17 00:00:00 2001 From: Jamie Smith Date: Sun, 10 Apr 2022 17:17:51 -0700 Subject: [PATCH 06/14] Enable running host tests in Github Actions --- .github/workflows/host_tests.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .github/workflows/host_tests.yml diff --git a/.github/workflows/host_tests.yml b/.github/workflows/host_tests.yml new file mode 100644 index 00000000000..b4cfba0810a --- /dev/null +++ b/.github/workflows/host_tests.yml @@ -0,0 +1,20 @@ +name: Run host tests with CMake + +on: [pull_request] + +jobs: + host-tests: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Install dev tools + run: sudo apt-get install -y cmake ninja-build + + - name: Compile and test for host + run: | + mkdir __build && cd __build + cmake .. -GNinja -DBUILD_GREENTEA_TESTS=FALSE -DBUILD_TESTING=TRUE + ninja + ctest . --output-on-failure -V From da83281cbc88f27860d37b6c8ee7a0d20c625131 Mon Sep 17 00:00:00 2001 From: Jamie Smith Date: Tue, 3 May 2022 08:29:14 -0700 Subject: [PATCH 07/14] Enable reset_reason HAL test --- .github/workflows/host_tests.yml | 2 +- hal/CMakeLists.txt | 2 +- hal/tests/TESTS/CMakeLists.txt | 1 + hal/tests/TESTS/mbed_hal/CMakeLists.txt | 1 + .../TESTS/mbed_hal/reset_reason/CMakeLists.txt | 13 ++++--------- hal/tests/TESTS/mbed_hal/reset_reason/main.cpp | 6 +++--- 6 files changed, 11 insertions(+), 14 deletions(-) create mode 100644 hal/tests/TESTS/CMakeLists.txt create mode 100644 hal/tests/TESTS/mbed_hal/CMakeLists.txt diff --git a/.github/workflows/host_tests.yml b/.github/workflows/host_tests.yml index b4cfba0810a..e08328d4434 100644 --- a/.github/workflows/host_tests.yml +++ b/.github/workflows/host_tests.yml @@ -17,4 +17,4 @@ jobs: mkdir __build && cd __build cmake .. -GNinja -DBUILD_GREENTEA_TESTS=FALSE -DBUILD_TESTING=TRUE ninja - ctest . --output-on-failure -V + ctest . --output-on-failure diff --git a/hal/CMakeLists.txt b/hal/CMakeLists.txt index 3cd9f950ccd..f530e8bdb79 100644 --- a/hal/CMakeLists.txt +++ b/hal/CMakeLists.txt @@ -3,7 +3,7 @@ if(MBED_OS_ENABLE_TESTS) if(BUILD_GREENTEA_TESTS) - # add greentea test + add_subdirectory(tests/TESTS) else() add_subdirectory(tests/UNITTESTS) endif() diff --git a/hal/tests/TESTS/CMakeLists.txt b/hal/tests/TESTS/CMakeLists.txt new file mode 100644 index 00000000000..1197616ca34 --- /dev/null +++ b/hal/tests/TESTS/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(mbed_hal) \ No newline at end of file diff --git a/hal/tests/TESTS/mbed_hal/CMakeLists.txt b/hal/tests/TESTS/mbed_hal/CMakeLists.txt new file mode 100644 index 00000000000..403a9c7adac --- /dev/null +++ b/hal/tests/TESTS/mbed_hal/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(reset_reason) \ No newline at end of file diff --git a/hal/tests/TESTS/mbed_hal/reset_reason/CMakeLists.txt b/hal/tests/TESTS/mbed_hal/reset_reason/CMakeLists.txt index e68344df419..deff47f49c7 100644 --- a/hal/tests/TESTS/mbed_hal/reset_reason/CMakeLists.txt +++ b/hal/tests/TESTS/mbed_hal/reset_reason/CMakeLists.txt @@ -1,18 +1,13 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -cmake_minimum_required(VERSION 3.19.0 FATAL_ERROR) - -set(MBED_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../../.. CACHE INTERNAL "") -set(TEST_TARGET mbed-hal-reset-reason) - -include(${MBED_PATH}/tools/cmake/mbed_greentea.cmake) - -project(${TEST_TARGET}) +include(mbed_greentea) mbed_greentea_add_test( TEST_NAME - ${TEST_TARGET} + mbed-hal-reset-reason TEST_SOURCES main.cpp + HOST_TESTS_DIR + ../../host_tests ) diff --git a/hal/tests/TESTS/mbed_hal/reset_reason/main.cpp b/hal/tests/TESTS/mbed_hal/reset_reason/main.cpp index f44996315ca..1717e934a5f 100644 --- a/hal/tests/TESTS/mbed_hal/reset_reason/main.cpp +++ b/hal/tests/TESTS/mbed_hal/reset_reason/main.cpp @@ -27,7 +27,7 @@ #if DEVICE_WATCHDOG # include "hal/watchdog_api.h" # define MSG_VALUE_WATCHDOG_STATUS 1 -# define WDG_TIMEOUT_MS 50UL +# define WDG_TIMEOUT_MS 50ms #else # define MSG_VALUE_WATCHDOG_STATUS 0 #endif @@ -60,7 +60,7 @@ * (1 start_bit + 8 data_bits + 1 stop_bit) * 128 * 1000 / 9600 = 133.3 ms. * To be on the safe side, set the wait time to 150 ms. */ -#define SERIAL_FLUSH_TIME_MS 150 +#define SERIAL_FLUSH_TIME_MS 150ms typedef enum { CMD_STATUS_CONTINUE, @@ -108,7 +108,7 @@ static cmd_status_t handle_command(const char *key, const char *value) if (strcmp(key, MSG_KEY_DEVICE_RESET) == 0 && strcmp(value, MSG_VALUE_DEVICE_RESET_WATCHDOG) == 0) { greentea_send_kv(MSG_KEY_DEVICE_RESET, MSG_VALUE_DEVICE_RESET_ACK); ThisThread::sleep_for(SERIAL_FLUSH_TIME_MS); // Wait for the serial buffers to flush. - watchdog_config_t config = { .timeout_ms = WDG_TIMEOUT_MS }; + watchdog_config_t config = { .timeout_ms = std::chrono::duration_cast(WDG_TIMEOUT_MS).count() }; if (hal_watchdog_init(&config) != WATCHDOG_STATUS_OK) { TEST_ASSERT_MESSAGE(0, "hal_watchdog_init() error."); return CMD_STATUS_ERROR; From 6f6eeec9bcf38464f45cf42c814247fec01b7721 Mon Sep 17 00:00:00 2001 From: Jamie Smith Date: Sat, 7 May 2022 16:02:21 -0700 Subject: [PATCH 08/14] Fix a few more HAL tests --- CMakeLists.txt | 4 ++++ hal/tests/TESTS/mbed_hal/CMakeLists.txt | 7 +++++++ .../mbed_hal/common_tickers/CMakeLists.txt | 19 ++++++----------- .../common_tickers_freq/CMakeLists.txt | 19 ++++++----------- hal/tests/TESTS/mbed_hal/crc/CMakeLists.txt | 21 +++++++------------ .../mbed_hal/critical_section/CMakeLists.txt | 21 +++++++------------ .../flash/functional_tests/CMakeLists.txt | 21 +++++++------------ .../mbed_hal/flash/functional_tests/main.cpp | 2 +- .../TESTS/mbed_hal/lp_ticker/CMakeLists.txt | 21 +++++++------------ .../minimum_requirements/CMakeLists.txt | 19 ++++++----------- .../mbed_hal/reset_reason/CMakeLists.txt | 4 +--- 11 files changed, 59 insertions(+), 99 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a57507d46de..212aa0e27a1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -102,6 +102,10 @@ if(MBED_OS_IS_STANDALONE) endif() endif() +if(BUILD_GREENTEA_TESTS) + include(mbed_greentea) +endif() + # These targets are made visible here so their source files which # are spread in different directories can be referenced and can be linked against # by libraries that depend on them. diff --git a/hal/tests/TESTS/mbed_hal/CMakeLists.txt b/hal/tests/TESTS/mbed_hal/CMakeLists.txt index 403a9c7adac..1be1ec96914 100644 --- a/hal/tests/TESTS/mbed_hal/CMakeLists.txt +++ b/hal/tests/TESTS/mbed_hal/CMakeLists.txt @@ -1 +1,8 @@ +add_subdirectory(common_tickers) +add_subdirectory(common_tickers_freq) +add_subdirectory(crc) +add_subdirectory(critical_section) +add_subdirectory(flash/functional_tests) +add_subdirectory(lp_ticker) +add_subdirectory(minimum_requirements) add_subdirectory(reset_reason) \ No newline at end of file diff --git a/hal/tests/TESTS/mbed_hal/common_tickers/CMakeLists.txt b/hal/tests/TESTS/mbed_hal/common_tickers/CMakeLists.txt index b2e0db5be1b..5af8414f2fc 100644 --- a/hal/tests/TESTS/mbed_hal/common_tickers/CMakeLists.txt +++ b/hal/tests/TESTS/mbed_hal/common_tickers/CMakeLists.txt @@ -1,18 +1,11 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -cmake_minimum_required(VERSION 3.19.0 FATAL_ERROR) - -set(MBED_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../../.. CACHE INTERNAL "") -set(TEST_TARGET mbed-hal-common-tickers) - -include(${MBED_PATH}/tools/cmake/mbed_greentea.cmake) - -project(${TEST_TARGET}) - mbed_greentea_add_test( - TEST_NAME - ${TEST_TARGET} - TEST_SOURCES - main.cpp + TEST_NAME + mbed-hal-common-tickers + TEST_SOURCES + main.cpp + HOST_TESTS_DIR + ${CMAKE_CURRENT_SOURCE_DIR}/../../host_tests ) diff --git a/hal/tests/TESTS/mbed_hal/common_tickers_freq/CMakeLists.txt b/hal/tests/TESTS/mbed_hal/common_tickers_freq/CMakeLists.txt index 8561881f53d..13caf6728a0 100644 --- a/hal/tests/TESTS/mbed_hal/common_tickers_freq/CMakeLists.txt +++ b/hal/tests/TESTS/mbed_hal/common_tickers_freq/CMakeLists.txt @@ -1,18 +1,11 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -cmake_minimum_required(VERSION 3.19.0 FATAL_ERROR) - -set(MBED_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../../.. CACHE INTERNAL "") -set(TEST_TARGET mbed-hal-common-tickers-freq) - -include(${MBED_PATH}/tools/cmake/mbed_greentea.cmake) - -project(${TEST_TARGET}) - mbed_greentea_add_test( - TEST_NAME - ${TEST_TARGET} - TEST_SOURCES - main.cpp + TEST_NAME + mbed-hal-common-tickers-freq + TEST_SOURCES + main.cpp + HOST_TESTS_DIR + ${CMAKE_CURRENT_SOURCE_DIR}/../../host_tests ) diff --git a/hal/tests/TESTS/mbed_hal/crc/CMakeLists.txt b/hal/tests/TESTS/mbed_hal/crc/CMakeLists.txt index 25606ea92ac..15902ac9eb2 100644 --- a/hal/tests/TESTS/mbed_hal/crc/CMakeLists.txt +++ b/hal/tests/TESTS/mbed_hal/crc/CMakeLists.txt @@ -1,18 +1,11 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -cmake_minimum_required(VERSION 3.19.0 FATAL_ERROR) - -set(MBED_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../../.. CACHE INTERNAL "") -set(TEST_TARGET mbed-hal-crc) - -include(${MBED_PATH}/tools/cmake/mbed_greentea.cmake) - -project(${TEST_TARGET}) - mbed_greentea_add_test( - TEST_NAME - ${TEST_TARGET} - TEST_SOURCES - main.cpp -) + TEST_NAME + mbed-hal-crc + TEST_SOURCES + main.cpp + HOST_TESTS_DIR + ${CMAKE_CURRENT_SOURCE_DIR}/../../host_tests +) \ No newline at end of file diff --git a/hal/tests/TESTS/mbed_hal/critical_section/CMakeLists.txt b/hal/tests/TESTS/mbed_hal/critical_section/CMakeLists.txt index 03faeb9c269..c552d66e2dd 100644 --- a/hal/tests/TESTS/mbed_hal/critical_section/CMakeLists.txt +++ b/hal/tests/TESTS/mbed_hal/critical_section/CMakeLists.txt @@ -1,18 +1,11 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -cmake_minimum_required(VERSION 3.19.0 FATAL_ERROR) - -set(MBED_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../../.. CACHE INTERNAL "") -set(TEST_TARGET mbed-hal-critical-section) - -include(${MBED_PATH}/tools/cmake/mbed_greentea.cmake) - -project(${TEST_TARGET}) - mbed_greentea_add_test( - TEST_NAME - ${TEST_TARGET} - TEST_SOURCES - main.cpp -) + TEST_NAME + mbed-hal-critical-section + TEST_SOURCES + main.cpp + HOST_TESTS_DIR + ${CMAKE_CURRENT_SOURCE_DIR}/../../host_tests +) \ No newline at end of file diff --git a/hal/tests/TESTS/mbed_hal/flash/functional_tests/CMakeLists.txt b/hal/tests/TESTS/mbed_hal/flash/functional_tests/CMakeLists.txt index fb04da3f218..33f0730eec0 100644 --- a/hal/tests/TESTS/mbed_hal/flash/functional_tests/CMakeLists.txt +++ b/hal/tests/TESTS/mbed_hal/flash/functional_tests/CMakeLists.txt @@ -1,18 +1,11 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -cmake_minimum_required(VERSION 3.19.0 FATAL_ERROR) - -set(MBED_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../../../.. CACHE INTERNAL "") -set(TEST_TARGET mbed-hal-flash-functional-tests) - -include(${MBED_PATH}/tools/cmake/mbed_greentea.cmake) - -project(${TEST_TARGET}) - mbed_greentea_add_test( - TEST_NAME - ${TEST_TARGET} - TEST_SOURCES - main.cpp -) + TEST_NAME + mbed-hal-flash-functional-tests + TEST_SOURCES + main.cpp + HOST_TESTS_DIR + ${CMAKE_CURRENT_SOURCE_DIR}/../../host_tests +) \ No newline at end of file diff --git a/hal/tests/TESTS/mbed_hal/flash/functional_tests/main.cpp b/hal/tests/TESTS/mbed_hal/flash/functional_tests/main.cpp index 3a64fe0c49c..d2a5a7551d3 100644 --- a/hal/tests/TESTS/mbed_hal/flash/functional_tests/main.cpp +++ b/hal/tests/TESTS/mbed_hal/flash/functional_tests/main.cpp @@ -102,7 +102,7 @@ static int time_cpu_cycles(uint32_t cycles) core_util_critical_section_exit(); - return timer.read_us(); + return std::chrono::duration_cast(timer.elapsed_time()).count(); } void flash_init_test() diff --git a/hal/tests/TESTS/mbed_hal/lp_ticker/CMakeLists.txt b/hal/tests/TESTS/mbed_hal/lp_ticker/CMakeLists.txt index b60c670c3ef..4f48b8fed0a 100644 --- a/hal/tests/TESTS/mbed_hal/lp_ticker/CMakeLists.txt +++ b/hal/tests/TESTS/mbed_hal/lp_ticker/CMakeLists.txt @@ -1,18 +1,11 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -cmake_minimum_required(VERSION 3.19.0 FATAL_ERROR) - -set(MBED_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../../.. CACHE INTERNAL "") -set(TEST_TARGET mbed-hal-lp-ticker) - -include(${MBED_PATH}/tools/cmake/mbed_greentea.cmake) - -project(${TEST_TARGET}) - mbed_greentea_add_test( - TEST_NAME - ${TEST_TARGET} - TEST_SOURCES - main.cpp -) + TEST_NAME + mbed-hal-lp-ticker + TEST_SOURCES + main.cpp + HOST_TESTS_DIR + ${CMAKE_CURRENT_SOURCE_DIR}/../../host_tests +) \ No newline at end of file diff --git a/hal/tests/TESTS/mbed_hal/minimum_requirements/CMakeLists.txt b/hal/tests/TESTS/mbed_hal/minimum_requirements/CMakeLists.txt index 70e8700174c..abee381e10b 100644 --- a/hal/tests/TESTS/mbed_hal/minimum_requirements/CMakeLists.txt +++ b/hal/tests/TESTS/mbed_hal/minimum_requirements/CMakeLists.txt @@ -1,18 +1,11 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -cmake_minimum_required(VERSION 3.19.0 FATAL_ERROR) - -set(MBED_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../../.. CACHE INTERNAL "") -set(TEST_TARGET mbed-hal-minimum-requirements) - -include(${MBED_PATH}/tools/cmake/mbed_greentea.cmake) - -project(${TEST_TARGET}) - mbed_greentea_add_test( - TEST_NAME - ${TEST_TARGET} - TEST_SOURCES - main.cpp + TEST_NAME + mbed-hal-minimum-requirements + TEST_SOURCES + main.cpp + HOST_TESTS_DIR + ${CMAKE_CURRENT_SOURCE_DIR}/../../host_tests ) diff --git a/hal/tests/TESTS/mbed_hal/reset_reason/CMakeLists.txt b/hal/tests/TESTS/mbed_hal/reset_reason/CMakeLists.txt index deff47f49c7..b60c9cb62e8 100644 --- a/hal/tests/TESTS/mbed_hal/reset_reason/CMakeLists.txt +++ b/hal/tests/TESTS/mbed_hal/reset_reason/CMakeLists.txt @@ -1,13 +1,11 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -include(mbed_greentea) - mbed_greentea_add_test( TEST_NAME mbed-hal-reset-reason TEST_SOURCES main.cpp HOST_TESTS_DIR - ../../host_tests + ${CMAKE_CURRENT_SOURCE_DIR}/../../host_tests ) From bd23d105074817ab383247c05a17af0351e58ba4 Mon Sep 17 00:00:00 2001 From: Jamie Smith Date: Sat, 7 May 2022 17:39:03 -0700 Subject: [PATCH 09/14] Convert the rest of the hal tests, convert mbedtls to an OBJECT library --- connectivity/CMakeLists.txt | 2 +- .../FEATURE_CRYPTOCELL310/CMakeLists.txt | 6 ++--- .../TARGET_MCU_NRF52840/CMakeLists.txt | 6 ++--- .../binaries/CMakeLists.txt | 2 +- .../TARGET_MXCRYPTO/CMakeLists.txt | 4 +-- .../TARGET_MXCRYPTO_01/CMakeLists.txt | 2 +- .../TARGET_MXCRYPTO_02/CMakeLists.txt | 2 +- .../TARGET_NUVOTON/TARGET_M480/CMakeLists.txt | 4 +-- .../TARGET_NUC472/CMakeLists.txt | 4 +-- .../TARGET_NUMAKER_PFM_NUC472/CMakeLists.txt | 2 +- .../drivers/mbedtls/TARGET_STM/CMakeLists.txt | 4 +-- .../TARGET_STM32F437xG/CMakeLists.txt | 2 +- .../TARGET_STM32F439xI/CMakeLists.txt | 2 +- .../TARGET_STM32F756xG/CMakeLists.txt | 2 +- .../TARGET_STM32L443xC/CMakeLists.txt | 2 +- .../TARGET_STM32L486xG/CMakeLists.txt | 2 +- .../TARGET_STM32L4S5xI/CMakeLists.txt | 2 +- .../TARGET_STM32L562xx/CMakeLists.txt | 2 +- .../TARGET_STM/TARGET_STM32WB/CMakeLists.txt | 2 +- .../mbedtls/TARGET_Samsung/CMakeLists.txt | 4 +-- .../TARGET_Silicon_Labs/CMakeLists.txt | 4 +-- connectivity/mbedtls/CMakeLists.txt | 8 +++--- hal/tests/TESTS/CMakeLists.txt | 3 ++- hal/tests/TESTS/mbed_hal/CMakeLists.txt | 20 +++++++++++++- hal/tests/TESTS/mbed_hal/crc/CMakeLists.txt | 6 +++++ .../mbed_hal/flash/functional_tests/main.cpp | 11 -------- hal/tests/TESTS/mbed_hal/mpu/CMakeLists.txt | 19 +++++-------- hal/tests/TESTS/mbed_hal/ospi/CMakeLists.txt | 27 +++++++++---------- .../TESTS/mbed_hal/pinmap/CMakeLists.txt | 19 +++++-------- hal/tests/TESTS/mbed_hal/qspi/CMakeLists.txt | 27 +++++++++---------- hal/tests/TESTS/mbed_hal/rtc/CMakeLists.txt | 23 ++++++++-------- .../TESTS/mbed_hal/rtc_reset/CMakeLists.txt | 25 +++++++++-------- .../TESTS/mbed_hal/rtc_time/CMakeLists.txt | 25 +++++++++-------- .../mbed_hal/rtc_time_conv/CMakeLists.txt | 25 +++++++++-------- hal/tests/TESTS/mbed_hal/sleep/CMakeLists.txt | 23 ++++++++-------- .../mbed_hal/sleep_manager/CMakeLists.txt | 23 ++++++++-------- .../CMakeLists.txt | 25 +++++++++-------- .../stack_size_unification/CMakeLists.txt | 25 +++++++++-------- .../TESTS/mbed_hal/ticker/CMakeLists.txt | 21 +++++---------- hal/tests/TESTS/mbed_hal/trng/CMakeLists.txt | 27 ++++++++++--------- .../TESTS/mbed_hal/us_ticker/CMakeLists.txt | 19 +++++-------- .../TESTS/mbed_hal/watchdog/CMakeLists.txt | 24 ++++++++--------- .../mbed_hal/watchdog_reset/CMakeLists.txt | 25 +++++++++-------- .../mbed_hal/watchdog_timing/CMakeLists.txt | 25 +++++++++-------- hal/tests/TESTS/pin_names/CMakeLists.txt | 1 + .../pin_names/arduino_uno/CMakeLists.txt | 15 +++++++++++ tools/cmake/mbed_create_distro.cmake | 2 +- 47 files changed, 272 insertions(+), 283 deletions(-) create mode 100644 hal/tests/TESTS/pin_names/CMakeLists.txt create mode 100644 hal/tests/TESTS/pin_names/arduino_uno/CMakeLists.txt diff --git a/connectivity/CMakeLists.txt b/connectivity/CMakeLists.txt index edef969a166..16ba418808d 100644 --- a/connectivity/CMakeLists.txt +++ b/connectivity/CMakeLists.txt @@ -11,7 +11,7 @@ add_library(mbed-coap INTERFACE) add_library(mbed-emac INTERFACE) add_library(mbed-lorawan INTERFACE) add_library(mbed-lwipstack INTERFACE) -add_library(mbed-mbedtls INTERFACE) +add_library(mbed-mbedtls OBJECT EXCLUDE_FROM_ALL) add_library(mbed-nanostack INTERFACE) add_library(mbed-nanostack-coap_service INTERFACE) add_library(mbed-nanostack-mbed_mesh_api INTERFACE) diff --git a/connectivity/drivers/mbedtls/FEATURE_CRYPTOCELL310/CMakeLists.txt b/connectivity/drivers/mbedtls/FEATURE_CRYPTOCELL310/CMakeLists.txt index 24d8764f371..a7392f162e4 100644 --- a/connectivity/drivers/mbedtls/FEATURE_CRYPTOCELL310/CMakeLists.txt +++ b/connectivity/drivers/mbedtls/FEATURE_CRYPTOCELL310/CMakeLists.txt @@ -8,7 +8,7 @@ endif() add_subdirectory(binaries) target_include_directories(mbed-mbedtls - INTERFACE + PUBLIC . ./include ./include/cryptocell310 @@ -16,7 +16,7 @@ target_include_directories(mbed-mbedtls ) target_sources(mbed-mbedtls - INTERFACE + PRIVATE source/aes_alt.c source/cc_internal.c source/ccm_alt.c @@ -30,6 +30,6 @@ target_sources(mbed-mbedtls ) target_compile_definitions(mbed-mbedtls - INTERFACE + PUBLIC MBED_CONF_CRYPTOCELL310_PRESENT=1 ) diff --git a/connectivity/drivers/mbedtls/FEATURE_CRYPTOCELL310/TARGET_MCU_NRF52840/CMakeLists.txt b/connectivity/drivers/mbedtls/FEATURE_CRYPTOCELL310/TARGET_MCU_NRF52840/CMakeLists.txt index 46726a4969d..f21c2906cc0 100644 --- a/connectivity/drivers/mbedtls/FEATURE_CRYPTOCELL310/TARGET_MCU_NRF52840/CMakeLists.txt +++ b/connectivity/drivers/mbedtls/FEATURE_CRYPTOCELL310/TARGET_MCU_NRF52840/CMakeLists.txt @@ -10,17 +10,17 @@ elseif(${MBED_TOOLCHAIN} STREQUAL "ARM") endif() target_include_directories(mbed-mbedtls - INTERFACE + PUBLIC . ) target_sources(mbed-mbedtls - INTERFACE + PRIVATE crypto_device_platform.c ) target_link_libraries(mbed-mbedtls - INTERFACE + PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/${LIBCC_310_EXT} ${CMAKE_CURRENT_SOURCE_DIR}/${LIBCC_310_TRNG} ) diff --git a/connectivity/drivers/mbedtls/FEATURE_CRYPTOCELL310/binaries/CMakeLists.txt b/connectivity/drivers/mbedtls/FEATURE_CRYPTOCELL310/binaries/CMakeLists.txt index c8c6f7af5f4..b1cfb1bfec6 100644 --- a/connectivity/drivers/mbedtls/FEATURE_CRYPTOCELL310/binaries/CMakeLists.txt +++ b/connectivity/drivers/mbedtls/FEATURE_CRYPTOCELL310/binaries/CMakeLists.txt @@ -8,6 +8,6 @@ elseif(${MBED_TOOLCHAIN} STREQUAL "ARM") endif() target_link_libraries(mbed-mbedtls - INTERFACE + PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/${LIBCC_310_CORE} ) diff --git a/connectivity/drivers/mbedtls/TARGET_Cypress/TARGET_MXCRYPTO/CMakeLists.txt b/connectivity/drivers/mbedtls/TARGET_Cypress/TARGET_MXCRYPTO/CMakeLists.txt index dc352310af9..bdc5235cdc6 100644 --- a/connectivity/drivers/mbedtls/TARGET_Cypress/TARGET_MXCRYPTO/CMakeLists.txt +++ b/connectivity/drivers/mbedtls/TARGET_Cypress/TARGET_MXCRYPTO/CMakeLists.txt @@ -8,12 +8,12 @@ elseif("MXCRYPTO_02" IN_LIST MBED_TARGET_LABELS) endif() target_include_directories(mbed-mbedtls - INTERFACE + PUBLIC . ) target_sources(mbed-mbedtls - INTERFACE + PRIVATE aes_alt.c crypto_common.c ecdsa_alt.c diff --git a/connectivity/drivers/mbedtls/TARGET_Cypress/TARGET_MXCRYPTO/TARGET_MXCRYPTO_01/CMakeLists.txt b/connectivity/drivers/mbedtls/TARGET_Cypress/TARGET_MXCRYPTO/TARGET_MXCRYPTO_01/CMakeLists.txt index 115af52c988..00a3c760c8b 100644 --- a/connectivity/drivers/mbedtls/TARGET_Cypress/TARGET_MXCRYPTO/TARGET_MXCRYPTO_01/CMakeLists.txt +++ b/connectivity/drivers/mbedtls/TARGET_Cypress/TARGET_MXCRYPTO/TARGET_MXCRYPTO_01/CMakeLists.txt @@ -2,6 +2,6 @@ # SPDX-License-Identifier: Apache-2.0 target_include_directories(mbed-mbedtls - INTERFACE + PUBLIC . ) diff --git a/connectivity/drivers/mbedtls/TARGET_Cypress/TARGET_MXCRYPTO/TARGET_MXCRYPTO_02/CMakeLists.txt b/connectivity/drivers/mbedtls/TARGET_Cypress/TARGET_MXCRYPTO/TARGET_MXCRYPTO_02/CMakeLists.txt index 115af52c988..00a3c760c8b 100644 --- a/connectivity/drivers/mbedtls/TARGET_Cypress/TARGET_MXCRYPTO/TARGET_MXCRYPTO_02/CMakeLists.txt +++ b/connectivity/drivers/mbedtls/TARGET_Cypress/TARGET_MXCRYPTO/TARGET_MXCRYPTO_02/CMakeLists.txt @@ -2,6 +2,6 @@ # SPDX-License-Identifier: Apache-2.0 target_include_directories(mbed-mbedtls - INTERFACE + PUBLIC . ) diff --git a/connectivity/drivers/mbedtls/TARGET_NUVOTON/TARGET_M480/CMakeLists.txt b/connectivity/drivers/mbedtls/TARGET_NUVOTON/TARGET_M480/CMakeLists.txt index 23860a7b190..71430adcd26 100644 --- a/connectivity/drivers/mbedtls/TARGET_NUVOTON/TARGET_M480/CMakeLists.txt +++ b/connectivity/drivers/mbedtls/TARGET_NUVOTON/TARGET_M480/CMakeLists.txt @@ -2,7 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 target_include_directories(mbed-mbedtls - INTERFACE + PUBLIC . ./aes ./des @@ -10,7 +10,7 @@ target_include_directories(mbed-mbedtls ) target_sources(mbed-mbedtls - INTERFACE + PRIVATE aes/aes_alt.c des/des_alt.c diff --git a/connectivity/drivers/mbedtls/TARGET_NUVOTON/TARGET_NUC472/CMakeLists.txt b/connectivity/drivers/mbedtls/TARGET_NUVOTON/TARGET_NUC472/CMakeLists.txt index e88183925ab..ceb30750892 100644 --- a/connectivity/drivers/mbedtls/TARGET_NUVOTON/TARGET_NUC472/CMakeLists.txt +++ b/connectivity/drivers/mbedtls/TARGET_NUVOTON/TARGET_NUC472/CMakeLists.txt @@ -6,7 +6,7 @@ if("NUMAKER_PFM_NUC472" IN_LIST MBED_TARGET_LABELS) endif() target_include_directories(mbed-mbedtls - INTERFACE + PUBLIC . ./aes ./des @@ -14,7 +14,7 @@ target_include_directories(mbed-mbedtls ) target_sources(mbed-mbedtls - INTERFACE + PRIVATE aes/aes_alt.c des/des_alt.c diff --git a/connectivity/drivers/mbedtls/TARGET_NUVOTON/TARGET_NUC472/TARGET_NUMAKER_PFM_NUC472/CMakeLists.txt b/connectivity/drivers/mbedtls/TARGET_NUVOTON/TARGET_NUC472/TARGET_NUMAKER_PFM_NUC472/CMakeLists.txt index 115af52c988..00a3c760c8b 100644 --- a/connectivity/drivers/mbedtls/TARGET_NUVOTON/TARGET_NUC472/TARGET_NUMAKER_PFM_NUC472/CMakeLists.txt +++ b/connectivity/drivers/mbedtls/TARGET_NUVOTON/TARGET_NUC472/TARGET_NUMAKER_PFM_NUC472/CMakeLists.txt @@ -2,6 +2,6 @@ # SPDX-License-Identifier: Apache-2.0 target_include_directories(mbed-mbedtls - INTERFACE + PUBLIC . ) diff --git a/connectivity/drivers/mbedtls/TARGET_STM/CMakeLists.txt b/connectivity/drivers/mbedtls/TARGET_STM/CMakeLists.txt index e944974dd25..66b58e6e4e5 100644 --- a/connectivity/drivers/mbedtls/TARGET_STM/CMakeLists.txt +++ b/connectivity/drivers/mbedtls/TARGET_STM/CMakeLists.txt @@ -20,7 +20,7 @@ elseif("STM32WB" IN_LIST MBED_TARGET_LABELS) endif() target_sources(mbed-mbedtls - INTERFACE + PRIVATE aes_alt.cpp aes_alt_stm32l4.c ccm_alt.cpp @@ -33,6 +33,6 @@ target_sources(mbed-mbedtls ) target_include_directories(mbed-mbedtls - INTERFACE + PUBLIC . ) diff --git a/connectivity/drivers/mbedtls/TARGET_STM/TARGET_STM32F437xG/CMakeLists.txt b/connectivity/drivers/mbedtls/TARGET_STM/TARGET_STM32F437xG/CMakeLists.txt index 115af52c988..00a3c760c8b 100644 --- a/connectivity/drivers/mbedtls/TARGET_STM/TARGET_STM32F437xG/CMakeLists.txt +++ b/connectivity/drivers/mbedtls/TARGET_STM/TARGET_STM32F437xG/CMakeLists.txt @@ -2,6 +2,6 @@ # SPDX-License-Identifier: Apache-2.0 target_include_directories(mbed-mbedtls - INTERFACE + PUBLIC . ) diff --git a/connectivity/drivers/mbedtls/TARGET_STM/TARGET_STM32F439xI/CMakeLists.txt b/connectivity/drivers/mbedtls/TARGET_STM/TARGET_STM32F439xI/CMakeLists.txt index 115af52c988..00a3c760c8b 100644 --- a/connectivity/drivers/mbedtls/TARGET_STM/TARGET_STM32F439xI/CMakeLists.txt +++ b/connectivity/drivers/mbedtls/TARGET_STM/TARGET_STM32F439xI/CMakeLists.txt @@ -2,6 +2,6 @@ # SPDX-License-Identifier: Apache-2.0 target_include_directories(mbed-mbedtls - INTERFACE + PUBLIC . ) diff --git a/connectivity/drivers/mbedtls/TARGET_STM/TARGET_STM32F756xG/CMakeLists.txt b/connectivity/drivers/mbedtls/TARGET_STM/TARGET_STM32F756xG/CMakeLists.txt index 115af52c988..00a3c760c8b 100644 --- a/connectivity/drivers/mbedtls/TARGET_STM/TARGET_STM32F756xG/CMakeLists.txt +++ b/connectivity/drivers/mbedtls/TARGET_STM/TARGET_STM32F756xG/CMakeLists.txt @@ -2,6 +2,6 @@ # SPDX-License-Identifier: Apache-2.0 target_include_directories(mbed-mbedtls - INTERFACE + PUBLIC . ) diff --git a/connectivity/drivers/mbedtls/TARGET_STM/TARGET_STM32L443xC/CMakeLists.txt b/connectivity/drivers/mbedtls/TARGET_STM/TARGET_STM32L443xC/CMakeLists.txt index 115af52c988..00a3c760c8b 100644 --- a/connectivity/drivers/mbedtls/TARGET_STM/TARGET_STM32L443xC/CMakeLists.txt +++ b/connectivity/drivers/mbedtls/TARGET_STM/TARGET_STM32L443xC/CMakeLists.txt @@ -2,6 +2,6 @@ # SPDX-License-Identifier: Apache-2.0 target_include_directories(mbed-mbedtls - INTERFACE + PUBLIC . ) diff --git a/connectivity/drivers/mbedtls/TARGET_STM/TARGET_STM32L486xG/CMakeLists.txt b/connectivity/drivers/mbedtls/TARGET_STM/TARGET_STM32L486xG/CMakeLists.txt index 115af52c988..00a3c760c8b 100644 --- a/connectivity/drivers/mbedtls/TARGET_STM/TARGET_STM32L486xG/CMakeLists.txt +++ b/connectivity/drivers/mbedtls/TARGET_STM/TARGET_STM32L486xG/CMakeLists.txt @@ -2,6 +2,6 @@ # SPDX-License-Identifier: Apache-2.0 target_include_directories(mbed-mbedtls - INTERFACE + PUBLIC . ) diff --git a/connectivity/drivers/mbedtls/TARGET_STM/TARGET_STM32L4S5xI/CMakeLists.txt b/connectivity/drivers/mbedtls/TARGET_STM/TARGET_STM32L4S5xI/CMakeLists.txt index 115af52c988..00a3c760c8b 100644 --- a/connectivity/drivers/mbedtls/TARGET_STM/TARGET_STM32L4S5xI/CMakeLists.txt +++ b/connectivity/drivers/mbedtls/TARGET_STM/TARGET_STM32L4S5xI/CMakeLists.txt @@ -2,6 +2,6 @@ # SPDX-License-Identifier: Apache-2.0 target_include_directories(mbed-mbedtls - INTERFACE + PUBLIC . ) diff --git a/connectivity/drivers/mbedtls/TARGET_STM/TARGET_STM32L562xx/CMakeLists.txt b/connectivity/drivers/mbedtls/TARGET_STM/TARGET_STM32L562xx/CMakeLists.txt index 115af52c988..00a3c760c8b 100644 --- a/connectivity/drivers/mbedtls/TARGET_STM/TARGET_STM32L562xx/CMakeLists.txt +++ b/connectivity/drivers/mbedtls/TARGET_STM/TARGET_STM32L562xx/CMakeLists.txt @@ -2,6 +2,6 @@ # SPDX-License-Identifier: Apache-2.0 target_include_directories(mbed-mbedtls - INTERFACE + PUBLIC . ) diff --git a/connectivity/drivers/mbedtls/TARGET_STM/TARGET_STM32WB/CMakeLists.txt b/connectivity/drivers/mbedtls/TARGET_STM/TARGET_STM32WB/CMakeLists.txt index 115af52c988..00a3c760c8b 100644 --- a/connectivity/drivers/mbedtls/TARGET_STM/TARGET_STM32WB/CMakeLists.txt +++ b/connectivity/drivers/mbedtls/TARGET_STM/TARGET_STM32WB/CMakeLists.txt @@ -2,6 +2,6 @@ # SPDX-License-Identifier: Apache-2.0 target_include_directories(mbed-mbedtls - INTERFACE + PUBLIC . ) diff --git a/connectivity/drivers/mbedtls/TARGET_Samsung/CMakeLists.txt b/connectivity/drivers/mbedtls/TARGET_Samsung/CMakeLists.txt index 204b9584a0b..d9da0235ebc 100644 --- a/connectivity/drivers/mbedtls/TARGET_Samsung/CMakeLists.txt +++ b/connectivity/drivers/mbedtls/TARGET_Samsung/CMakeLists.txt @@ -2,13 +2,13 @@ # SPDX-License-Identifier: Apache-2.0 target_include_directories(mbed-mbedtls - INTERFACE + PUBLIC . ./sha ) target_sources(mbed-mbedtls - INTERFACE + PRIVATE sha/sha256_alt.c sha/sha512_alt.c ) diff --git a/connectivity/drivers/mbedtls/TARGET_Silicon_Labs/CMakeLists.txt b/connectivity/drivers/mbedtls/TARGET_Silicon_Labs/CMakeLists.txt index bba96296fff..57d8907fb12 100644 --- a/connectivity/drivers/mbedtls/TARGET_Silicon_Labs/CMakeLists.txt +++ b/connectivity/drivers/mbedtls/TARGET_Silicon_Labs/CMakeLists.txt @@ -2,12 +2,12 @@ # SPDX-License-Identifier: Apache-2.0 target_include_directories(mbed-mbedtls - INTERFACE + PUBLIC . ) target_sources(mbed-mbedtls - INTERFACE + PRIVATE aes_aes.c crypto_aes.c crypto_ecp.c diff --git a/connectivity/mbedtls/CMakeLists.txt b/connectivity/mbedtls/CMakeLists.txt index 68e7e4c76d8..2f6582e91ae 100644 --- a/connectivity/mbedtls/CMakeLists.txt +++ b/connectivity/mbedtls/CMakeLists.txt @@ -8,7 +8,7 @@ if(MBED_OS_ENABLE_TESTS) endif() target_include_directories(mbed-mbedtls - INTERFACE + PUBLIC . ./include ./include/mbedtls @@ -17,7 +17,7 @@ target_include_directories(mbed-mbedtls ) target_sources(mbed-mbedtls - INTERFACE + PRIVATE platform/src/hash_wrappers.c platform/src/mbed_trng.cpp platform/src/platform_alt.cpp @@ -107,7 +107,7 @@ target_sources(mbed-mbedtls ) target_compile_definitions(mbed-mbedtls - INTERFACE + PUBLIC MBED_CONF_MBEDTLS_PRESENT=1 ) @@ -123,7 +123,7 @@ set(partial-thumb2-cores ) if(MBED_CPU_CORE IN_LIST partial-thumb2-cores) target_compile_definitions(mbed-mbedtls - INTERFACE + PUBLIC MULADDC_CANNOT_USE_R7 ) endif() diff --git a/hal/tests/TESTS/CMakeLists.txt b/hal/tests/TESTS/CMakeLists.txt index 1197616ca34..cab1c202385 100644 --- a/hal/tests/TESTS/CMakeLists.txt +++ b/hal/tests/TESTS/CMakeLists.txt @@ -1 +1,2 @@ -add_subdirectory(mbed_hal) \ No newline at end of file +add_subdirectory(mbed_hal) +add_subdirectory(pin_names) \ No newline at end of file diff --git a/hal/tests/TESTS/mbed_hal/CMakeLists.txt b/hal/tests/TESTS/mbed_hal/CMakeLists.txt index 1be1ec96914..d1bafbe1f9c 100644 --- a/hal/tests/TESTS/mbed_hal/CMakeLists.txt +++ b/hal/tests/TESTS/mbed_hal/CMakeLists.txt @@ -5,4 +5,22 @@ add_subdirectory(critical_section) add_subdirectory(flash/functional_tests) add_subdirectory(lp_ticker) add_subdirectory(minimum_requirements) -add_subdirectory(reset_reason) \ No newline at end of file +add_subdirectory(mpu) +add_subdirectory(ospi) +add_subdirectory(pinmap) +add_subdirectory(qspi) +add_subdirectory(reset_reason) +add_subdirectory(rtc) +add_subdirectory(rtc_reset) +add_subdirectory(rtc_time) +add_subdirectory(rtc_time_conv) +add_subdirectory(sleep) +add_subdirectory(sleep_manager) +add_subdirectory(sleep_manager_racecondition) +add_subdirectory(stack_size_unification) +add_subdirectory(ticker) +add_subdirectory(trng) +add_subdirectory(us_ticker) +add_subdirectory(watchdog) +add_subdirectory(watchdog_reset) +add_subdirectory(watchdog_timing) \ No newline at end of file diff --git a/hal/tests/TESTS/mbed_hal/crc/CMakeLists.txt b/hal/tests/TESTS/mbed_hal/crc/CMakeLists.txt index 15902ac9eb2..7beb72b2dd0 100644 --- a/hal/tests/TESTS/mbed_hal/crc/CMakeLists.txt +++ b/hal/tests/TESTS/mbed_hal/crc/CMakeLists.txt @@ -1,6 +1,10 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 +if(NOT "DEVICE_CRC=1" IN_LIST MBED_TARGET_DEFINITIONS) + set(TEST_SKIPPED "CRC is not supported for this target") +endif() + mbed_greentea_add_test( TEST_NAME mbed-hal-crc @@ -8,4 +12,6 @@ mbed_greentea_add_test( main.cpp HOST_TESTS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../host_tests + TEST_SKIPPED + ${TEST_SKIPPED} ) \ No newline at end of file diff --git a/hal/tests/TESTS/mbed_hal/flash/functional_tests/main.cpp b/hal/tests/TESTS/mbed_hal/flash/functional_tests/main.cpp index d2a5a7551d3..46a9a7ba7f0 100644 --- a/hal/tests/TESTS/mbed_hal/flash/functional_tests/main.cpp +++ b/hal/tests/TESTS/mbed_hal/flash/functional_tests/main.cpp @@ -44,17 +44,6 @@ using namespace utest::v1; static int timer_diff_start; -static void erase_range(flash_t *flash, uint32_t addr, uint32_t size) -{ - while (size > 0) { - uint32_t sector_size = flash_get_sector_size(flash, addr); - TEST_ASSERT_NOT_EQUAL(0, sector_size); - int32_t ret = flash_erase_sector(flash, addr); - TEST_ASSERT_EQUAL_INT32(0, ret); - addr += sector_size; - size = size > sector_size ? size - sector_size : 0; - } -} #if defined (__ICCARM__) MBED_NOINLINE static void delay_loop(uint32_t count) diff --git a/hal/tests/TESTS/mbed_hal/mpu/CMakeLists.txt b/hal/tests/TESTS/mbed_hal/mpu/CMakeLists.txt index 13bef3b546d..cae7069d22b 100644 --- a/hal/tests/TESTS/mbed_hal/mpu/CMakeLists.txt +++ b/hal/tests/TESTS/mbed_hal/mpu/CMakeLists.txt @@ -1,18 +1,11 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -cmake_minimum_required(VERSION 3.19.0 FATAL_ERROR) - -set(MBED_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../../.. CACHE INTERNAL "") -set(TEST_TARGET mbed-hal-mpu) - -include(${MBED_PATH}/tools/cmake/mbed_greentea.cmake) - -project(${TEST_TARGET}) - mbed_greentea_add_test( - TEST_NAME - ${TEST_TARGET} - TEST_SOURCES - main.cpp + TEST_NAME + mbed-hal-mpu + TEST_SOURCES + main.cpp + HOST_TESTS_DIR + ${CMAKE_CURRENT_SOURCE_DIR}/../../host_tests ) diff --git a/hal/tests/TESTS/mbed_hal/ospi/CMakeLists.txt b/hal/tests/TESTS/mbed_hal/ospi/CMakeLists.txt index 7fae404ebdd..bf993a98079 100644 --- a/hal/tests/TESTS/mbed_hal/ospi/CMakeLists.txt +++ b/hal/tests/TESTS/mbed_hal/ospi/CMakeLists.txt @@ -1,21 +1,18 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -cmake_minimum_required(VERSION 3.19.0 FATAL_ERROR) - -set(MBED_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../../.. CACHE INTERNAL "") -set(TEST_TARGET mbed-hal-ospi) - -include(${MBED_PATH}/tools/cmake/mbed_greentea.cmake) - -project(${TEST_TARGET}) +if(NOT "DEVICE_OSPI=1" IN_LIST MBED_TARGET_DEFINITIONS) + set(TEST_SKIPPED "OSPI is not supported for this target") +endif() mbed_greentea_add_test( - TEST_NAME - ${TEST_TARGET} - TEST_SOURCES - main.cpp - ospi_test_utils.cpp - TEST_INCLUDE_DIRS - flash_configs + TEST_NAME + mbed-hal-ospi + TEST_SOURCES + main.cpp + ospi_test_utils.cpp + HOST_TESTS_DIR + ${CMAKE_CURRENT_SOURCE_DIR}/../../host_tests + TEST_SKIPPED + ${TEST_SKIPPED} ) diff --git a/hal/tests/TESTS/mbed_hal/pinmap/CMakeLists.txt b/hal/tests/TESTS/mbed_hal/pinmap/CMakeLists.txt index 4b9e2174e03..c4095a9ef9e 100644 --- a/hal/tests/TESTS/mbed_hal/pinmap/CMakeLists.txt +++ b/hal/tests/TESTS/mbed_hal/pinmap/CMakeLists.txt @@ -1,18 +1,11 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -cmake_minimum_required(VERSION 3.19.0 FATAL_ERROR) - -set(MBED_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../../.. CACHE INTERNAL "") -set(TEST_TARGET mbed-hal-pinmap) - -include(${MBED_PATH}/tools/cmake/mbed_greentea.cmake) - -project(${TEST_TARGET}) - mbed_greentea_add_test( - TEST_NAME - ${TEST_TARGET} - TEST_SOURCES - main.cpp + TEST_NAME + mbed-hal-pinmap + TEST_SOURCES + main.cpp + HOST_TESTS_DIR + ${CMAKE_CURRENT_SOURCE_DIR}/../../host_tests ) diff --git a/hal/tests/TESTS/mbed_hal/qspi/CMakeLists.txt b/hal/tests/TESTS/mbed_hal/qspi/CMakeLists.txt index b06f73c19b0..3f53284331c 100644 --- a/hal/tests/TESTS/mbed_hal/qspi/CMakeLists.txt +++ b/hal/tests/TESTS/mbed_hal/qspi/CMakeLists.txt @@ -1,15 +1,6 @@ # Copyright (c) 2020-2021 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -cmake_minimum_required(VERSION 3.19.0 FATAL_ERROR) - -set(MBED_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../../.. CACHE INTERNAL "") -set(TEST_TARGET mbed-hal-qspi) - -include(${MBED_PATH}/tools/cmake/mbed_greentea.cmake) - -project(${TEST_TARGET}) - if(TARGET mbed-ep-agora) set(FLASH_TARGET_CONFIG_HEADER NORDIC/EP_AGORA) elseif(TARGET mbed-nrf52840-dk) @@ -22,6 +13,11 @@ elseif(TARGET mbed-efm32gg11-stk3701) set(FLASH_TARGET_CONFIG_HEADER SiliconLabs/EFM32GG11_STK3701) endif() +if(NOT "DEVICE_QSPI=1" IN_LIST MBED_TARGET_DEFINITIONS) + set(TEST_SKIPPED "QSPI is not supported for this target") +endif() + + list( APPEND TEST_HEADER_DIRS @@ -30,12 +26,15 @@ list( ) mbed_greentea_add_test( - TEST_NAME - ${TEST_TARGET} - TEST_SOURCES - main.cpp + TEST_NAME + mbed-hal-qspi + TEST_SOURCES + main.cpp qspi_test_utils.cpp TEST_INCLUDE_DIRS ${TEST_HEADER_DIRS} + HOST_TESTS_DIR + ${CMAKE_CURRENT_SOURCE_DIR}/../../host_tests + TEST_SKIPPED + ${TEST_SKIPPED} ) - diff --git a/hal/tests/TESTS/mbed_hal/rtc/CMakeLists.txt b/hal/tests/TESTS/mbed_hal/rtc/CMakeLists.txt index 290eaef887a..359b1596c2a 100644 --- a/hal/tests/TESTS/mbed_hal/rtc/CMakeLists.txt +++ b/hal/tests/TESTS/mbed_hal/rtc/CMakeLists.txt @@ -1,18 +1,17 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -cmake_minimum_required(VERSION 3.19.0 FATAL_ERROR) - -set(MBED_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../../.. CACHE INTERNAL "") -set(TEST_TARGET mbed-hal-rtc) - -include(${MBED_PATH}/tools/cmake/mbed_greentea.cmake) - -project(${TEST_TARGET}) +if(NOT "DEVICE_RTC=1" IN_LIST MBED_TARGET_DEFINITIONS) + set(TEST_SKIPPED "RTC is not supported for this target") +endif() mbed_greentea_add_test( - TEST_NAME - ${TEST_TARGET} - TEST_SOURCES - main.cpp + TEST_NAME + mbed-hal-rtc + TEST_SOURCES + main.cpp + HOST_TESTS_DIR + ${CMAKE_CURRENT_SOURCE_DIR}/../../host_tests + TEST_SKIPPED + ${TEST_SKIPPED} ) diff --git a/hal/tests/TESTS/mbed_hal/rtc_reset/CMakeLists.txt b/hal/tests/TESTS/mbed_hal/rtc_reset/CMakeLists.txt index b71ff0006c0..594de38b6b7 100644 --- a/hal/tests/TESTS/mbed_hal/rtc_reset/CMakeLists.txt +++ b/hal/tests/TESTS/mbed_hal/rtc_reset/CMakeLists.txt @@ -1,18 +1,17 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -cmake_minimum_required(VERSION 3.19.0 FATAL_ERROR) - -set(MBED_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../../.. CACHE INTERNAL "") -set(TEST_TARGET mbed-hal-rtc-reset) - -include(${MBED_PATH}/tools/cmake/mbed_greentea.cmake) - -project(${TEST_TARGET}) +if(NOT "DEVICE_RTC=1" IN_LIST MBED_TARGET_DEFINITIONS) + set(TEST_SKIPPED "RTC is not supported for this target") +endif() mbed_greentea_add_test( - TEST_NAME - ${TEST_TARGET} - TEST_SOURCES - main.cpp -) + TEST_NAME + mbed-hal-rtc-reset + TEST_SOURCES + main.cpp + HOST_TESTS_DIR + ${CMAKE_CURRENT_SOURCE_DIR}/../../host_tests + TEST_SKIPPED + ${TEST_SKIPPED} +) \ No newline at end of file diff --git a/hal/tests/TESTS/mbed_hal/rtc_time/CMakeLists.txt b/hal/tests/TESTS/mbed_hal/rtc_time/CMakeLists.txt index 5f7d1f8e305..bdbb47e1bb6 100644 --- a/hal/tests/TESTS/mbed_hal/rtc_time/CMakeLists.txt +++ b/hal/tests/TESTS/mbed_hal/rtc_time/CMakeLists.txt @@ -1,18 +1,17 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -cmake_minimum_required(VERSION 3.19.0 FATAL_ERROR) - -set(MBED_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../../.. CACHE INTERNAL "") -set(TEST_TARGET mbed-hal-rtc-time) - -include(${MBED_PATH}/tools/cmake/mbed_greentea.cmake) - -project(${TEST_TARGET}) +if(NOT "DEVICE_RTC=1" IN_LIST MBED_TARGET_DEFINITIONS) + set(TEST_SKIPPED "RTC is not supported for this target") +endif() mbed_greentea_add_test( - TEST_NAME - ${TEST_TARGET} - TEST_SOURCES - main.cpp -) + TEST_NAME + mbed-hal-rtc-time + TEST_SOURCES + main.cpp + HOST_TESTS_DIR + ${CMAKE_CURRENT_SOURCE_DIR}/../../host_tests + TEST_SKIPPED + ${TEST_SKIPPED} +) \ No newline at end of file diff --git a/hal/tests/TESTS/mbed_hal/rtc_time_conv/CMakeLists.txt b/hal/tests/TESTS/mbed_hal/rtc_time_conv/CMakeLists.txt index 96b56f75f5d..2f319d0180d 100644 --- a/hal/tests/TESTS/mbed_hal/rtc_time_conv/CMakeLists.txt +++ b/hal/tests/TESTS/mbed_hal/rtc_time_conv/CMakeLists.txt @@ -1,18 +1,17 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -cmake_minimum_required(VERSION 3.19.0 FATAL_ERROR) - -set(MBED_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../../.. CACHE INTERNAL "") -set(TEST_TARGET mbed-hal-rtc-time-conv) - -include(${MBED_PATH}/tools/cmake/mbed_greentea.cmake) - -project(${TEST_TARGET}) +if(NOT "DEVICE_RTC=1" IN_LIST MBED_TARGET_DEFINITIONS) + set(TEST_SKIPPED "RTC is not supported for this target") +endif() mbed_greentea_add_test( - TEST_NAME - ${TEST_TARGET} - TEST_SOURCES - main.cpp -) + TEST_NAME + mbed-hal-rtc-time-conv + TEST_SOURCES + main.cpp + HOST_TESTS_DIR + ${CMAKE_CURRENT_SOURCE_DIR}/../../host_tests + TEST_SKIPPED + ${TEST_SKIPPED} +) \ No newline at end of file diff --git a/hal/tests/TESTS/mbed_hal/sleep/CMakeLists.txt b/hal/tests/TESTS/mbed_hal/sleep/CMakeLists.txt index aed5bab8b0c..2f9e4034cc3 100644 --- a/hal/tests/TESTS/mbed_hal/sleep/CMakeLists.txt +++ b/hal/tests/TESTS/mbed_hal/sleep/CMakeLists.txt @@ -1,18 +1,17 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -cmake_minimum_required(VERSION 3.19.0 FATAL_ERROR) - -set(MBED_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../../.. CACHE INTERNAL "") -set(TEST_TARGET mbed-hal-sleep) - -include(${MBED_PATH}/tools/cmake/mbed_greentea.cmake) - -project(${TEST_TARGET}) +if(NOT "DEVICE_SLEEP=1" IN_LIST MBED_TARGET_DEFINITIONS) + set(TEST_SKIPPED "Sleep is not supported for this target") +endif() mbed_greentea_add_test( - TEST_NAME - ${TEST_TARGET} - TEST_SOURCES - main.cpp + TEST_NAME + mbed-hal-sleep + TEST_SOURCES + main.cpp + HOST_TESTS_DIR + ${CMAKE_CURRENT_SOURCE_DIR}/../../host_tests + TEST_SKIPPED + ${TEST_SKIPPED} ) diff --git a/hal/tests/TESTS/mbed_hal/sleep_manager/CMakeLists.txt b/hal/tests/TESTS/mbed_hal/sleep_manager/CMakeLists.txt index 3dc375f1ece..77f36676a6c 100644 --- a/hal/tests/TESTS/mbed_hal/sleep_manager/CMakeLists.txt +++ b/hal/tests/TESTS/mbed_hal/sleep_manager/CMakeLists.txt @@ -1,18 +1,17 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -cmake_minimum_required(VERSION 3.19.0 FATAL_ERROR) - -set(MBED_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../../.. CACHE INTERNAL "") -set(TEST_TARGET mbed-hal-sleep-manager) - -include(${MBED_PATH}/tools/cmake/mbed_greentea.cmake) - -project(${TEST_TARGET}) +if(NOT "DEVICE_SLEEP=1" IN_LIST MBED_TARGET_DEFINITIONS) + set(TEST_SKIPPED "Sleep is not supported for this target") +endif() mbed_greentea_add_test( - TEST_NAME - ${TEST_TARGET} - TEST_SOURCES - main.cpp + TEST_NAME + mbed-hal-sleep-manager + TEST_SOURCES + main.cpp + HOST_TESTS_DIR + ${CMAKE_CURRENT_SOURCE_DIR}/../../host_tests + TEST_SKIPPED + ${TEST_SKIPPED} ) diff --git a/hal/tests/TESTS/mbed_hal/sleep_manager_racecondition/CMakeLists.txt b/hal/tests/TESTS/mbed_hal/sleep_manager_racecondition/CMakeLists.txt index df182d51297..add05e029af 100644 --- a/hal/tests/TESTS/mbed_hal/sleep_manager_racecondition/CMakeLists.txt +++ b/hal/tests/TESTS/mbed_hal/sleep_manager_racecondition/CMakeLists.txt @@ -1,18 +1,17 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -cmake_minimum_required(VERSION 3.19.0 FATAL_ERROR) - -set(MBED_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../../.. CACHE INTERNAL "") -set(TEST_TARGET mbed-hal-sleep-manager-racecondition) - -include(${MBED_PATH}/tools/cmake/mbed_greentea.cmake) - -project(${TEST_TARGET}) +if(NOT "DEVICE_SLEEP=1" IN_LIST MBED_TARGET_DEFINITIONS) + set(TEST_SKIPPED "Sleep is not supported for this target") +endif() mbed_greentea_add_test( - TEST_NAME - ${TEST_TARGET} - TEST_SOURCES - main.cpp -) + TEST_NAME + mbed-hal-sleep-manager-racecondition + TEST_SOURCES + main.cpp + HOST_TESTS_DIR + ${CMAKE_CURRENT_SOURCE_DIR}/../../host_tests + TEST_SKIPPED + ${TEST_SKIPPED} +) \ No newline at end of file diff --git a/hal/tests/TESTS/mbed_hal/stack_size_unification/CMakeLists.txt b/hal/tests/TESTS/mbed_hal/stack_size_unification/CMakeLists.txt index 9f3d5360f8e..a43691b615f 100644 --- a/hal/tests/TESTS/mbed_hal/stack_size_unification/CMakeLists.txt +++ b/hal/tests/TESTS/mbed_hal/stack_size_unification/CMakeLists.txt @@ -1,18 +1,17 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -cmake_minimum_required(VERSION 3.19.0 FATAL_ERROR) - -set(MBED_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../../.. CACHE INTERNAL "") -set(TEST_TARGET mbed-hal-stack-size-unification) - -include(${MBED_PATH}/tools/cmake/mbed_greentea.cmake) - -project(${TEST_TARGET}) +if(NOT "TARGET_CORTEX_A" IN_LIST MBED_TARGET_DEFINITIONS) + set(TEST_SKIPPED "Not supported for Cortex-A targets") +endif() mbed_greentea_add_test( - TEST_NAME - ${TEST_TARGET} - TEST_SOURCES - main.cpp -) + TEST_NAME + mbed-hal-stack-size-unification + TEST_SOURCES + main.cpp + HOST_TESTS_DIR + ${CMAKE_CURRENT_SOURCE_DIR}/../../host_tests + TEST_SKIPPED + ${TEST_SKIPPED} +) \ No newline at end of file diff --git a/hal/tests/TESTS/mbed_hal/ticker/CMakeLists.txt b/hal/tests/TESTS/mbed_hal/ticker/CMakeLists.txt index 4352cba9732..30e215e5bb9 100644 --- a/hal/tests/TESTS/mbed_hal/ticker/CMakeLists.txt +++ b/hal/tests/TESTS/mbed_hal/ticker/CMakeLists.txt @@ -1,18 +1,11 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -cmake_minimum_required(VERSION 3.19.0 FATAL_ERROR) - -set(MBED_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../../.. CACHE INTERNAL "") -set(TEST_TARGET mbed-hal-ticker) - -include(${MBED_PATH}/tools/cmake/mbed_greentea.cmake) - -project(${TEST_TARGET}) - mbed_greentea_add_test( - TEST_NAME - ${TEST_TARGET} - TEST_SOURCES - main.cpp -) + TEST_NAME + mbed-hal-ticker + TEST_SOURCES + main.cpp + HOST_TESTS_DIR + ${CMAKE_CURRENT_SOURCE_DIR}/../../host_tests +) \ No newline at end of file diff --git a/hal/tests/TESTS/mbed_hal/trng/CMakeLists.txt b/hal/tests/TESTS/mbed_hal/trng/CMakeLists.txt index 344d44a3db0..aac007bfb55 100644 --- a/hal/tests/TESTS/mbed_hal/trng/CMakeLists.txt +++ b/hal/tests/TESTS/mbed_hal/trng/CMakeLists.txt @@ -1,14 +1,9 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -cmake_minimum_required(VERSION 3.19.0 FATAL_ERROR) - -set(MBED_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../../.. CACHE INTERNAL "") -set(TEST_TARGET mbed-hal-trng) - -include(${MBED_PATH}/tools/cmake/mbed_greentea.cmake) - -project(${TEST_TARGET}) +if(NOT "DEVICE_TRNG=1" IN_LIST MBED_TARGET_DEFINITIONS) + set(TEST_SKIPPED "True RNG is not supported for this target") +endif() list( APPEND @@ -26,10 +21,16 @@ list( ) mbed_greentea_add_test( - TEST_NAME - ${TEST_TARGET} - TEST_SOURCES - ${TEST_SOURCE_LIST} - TEST_INCLUDE_DIRS + TEST_NAME + mbed-hal-trng + TEST_SOURCES + ${TEST_SOURCE_LIST} + TEST_INCLUDE_DIRS ${TEST_INC_DIRS} + HOST_TESTS_DIR + ${CMAKE_CURRENT_SOURCE_DIR}/../../host_tests + TEST_SKIPPED + ${TEST_SKIPPED} + TEST_REQUIRED_LIBS + mbed-mbedtls ) diff --git a/hal/tests/TESTS/mbed_hal/us_ticker/CMakeLists.txt b/hal/tests/TESTS/mbed_hal/us_ticker/CMakeLists.txt index d04c4969d22..85578939bd3 100644 --- a/hal/tests/TESTS/mbed_hal/us_ticker/CMakeLists.txt +++ b/hal/tests/TESTS/mbed_hal/us_ticker/CMakeLists.txt @@ -1,18 +1,11 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -cmake_minimum_required(VERSION 3.19.0 FATAL_ERROR) - -set(MBED_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../../.. CACHE INTERNAL "") -set(TEST_TARGET mbed-hal-us-ticker) - -include(${MBED_PATH}/tools/cmake/mbed_greentea.cmake) - -project(${TEST_TARGET}) - mbed_greentea_add_test( - TEST_NAME - ${TEST_TARGET} - TEST_SOURCES - main.cpp + TEST_NAME + mbed-hal-us-ticker + TEST_SOURCES + main.cpp + HOST_TESTS_DIR + ${CMAKE_CURRENT_SOURCE_DIR}/../../host_tests ) diff --git a/hal/tests/TESTS/mbed_hal/watchdog/CMakeLists.txt b/hal/tests/TESTS/mbed_hal/watchdog/CMakeLists.txt index e216dfa40cb..5af3f1a2b31 100644 --- a/hal/tests/TESTS/mbed_hal/watchdog/CMakeLists.txt +++ b/hal/tests/TESTS/mbed_hal/watchdog/CMakeLists.txt @@ -1,18 +1,18 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -cmake_minimum_required(VERSION 3.19.0 FATAL_ERROR) +if(NOT "DEVICE_WATCHDOG=1" IN_LIST MBED_TARGET_DEFINITIONS) + set(TEST_SKIPPED "Watchdog is not supported for this target") +endif() -set(MBED_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../../.. CACHE INTERNAL "") -set(TEST_TARGET mbed-hal-watchdog) - -include(${MBED_PATH}/tools/cmake/mbed_greentea.cmake) - -project(${TEST_TARGET}) mbed_greentea_add_test( - TEST_NAME - ${TEST_TARGET} - TEST_SOURCES - main.cpp -) + TEST_NAME + mbed-hal-watchdog + TEST_SOURCES + main.cpp + HOST_TESTS_DIR + ${CMAKE_CURRENT_SOURCE_DIR}/../../host_tests + TEST_SKIPPED + ${TEST_SKIPPED} +) \ No newline at end of file diff --git a/hal/tests/TESTS/mbed_hal/watchdog_reset/CMakeLists.txt b/hal/tests/TESTS/mbed_hal/watchdog_reset/CMakeLists.txt index 347ba68ad2b..acd0f43ea8a 100644 --- a/hal/tests/TESTS/mbed_hal/watchdog_reset/CMakeLists.txt +++ b/hal/tests/TESTS/mbed_hal/watchdog_reset/CMakeLists.txt @@ -1,18 +1,17 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -cmake_minimum_required(VERSION 3.19.0 FATAL_ERROR) - -set(MBED_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../../.. CACHE INTERNAL "") -set(TEST_TARGET mbed-hal-watchdog-reset) - -include(${MBED_PATH}/tools/cmake/mbed_greentea.cmake) - -project(${TEST_TARGET}) +if(NOT "DEVICE_WATCHDOG=1" IN_LIST MBED_TARGET_DEFINITIONS) + set(TEST_SKIPPED "Watchdog is not supported for this target") +endif() mbed_greentea_add_test( - TEST_NAME - ${TEST_TARGET} - TEST_SOURCES - main.cpp -) + TEST_NAME + mbed-hal-watchdog-reset + TEST_SOURCES + main.cpp + HOST_TESTS_DIR + ${CMAKE_CURRENT_SOURCE_DIR}/../../host_tests + TEST_SKIPPED + ${TEST_SKIPPED} +) \ No newline at end of file diff --git a/hal/tests/TESTS/mbed_hal/watchdog_timing/CMakeLists.txt b/hal/tests/TESTS/mbed_hal/watchdog_timing/CMakeLists.txt index 6ecc6f9c137..e5c2df597b5 100644 --- a/hal/tests/TESTS/mbed_hal/watchdog_timing/CMakeLists.txt +++ b/hal/tests/TESTS/mbed_hal/watchdog_timing/CMakeLists.txt @@ -1,18 +1,17 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -cmake_minimum_required(VERSION 3.19.0 FATAL_ERROR) - -set(MBED_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../../.. CACHE INTERNAL "") -set(TEST_TARGET mbed-hal-watchdog-timing) - -include(${MBED_PATH}/tools/cmake/mbed_greentea.cmake) - -project(${TEST_TARGET}) +if(NOT "DEVICE_WATCHDOG=1" IN_LIST MBED_TARGET_DEFINITIONS) + set(TEST_SKIPPED "Watchdog is not supported for this target") +endif() mbed_greentea_add_test( - TEST_NAME - ${TEST_TARGET} - TEST_SOURCES - main.cpp -) + TEST_NAME + mbed-hal-watchdog-timing + TEST_SOURCES + main.cpp + HOST_TESTS_DIR + ${CMAKE_CURRENT_SOURCE_DIR}/../../host_tests + TEST_SKIPPED + ${TEST_SKIPPED} +) \ No newline at end of file diff --git a/hal/tests/TESTS/pin_names/CMakeLists.txt b/hal/tests/TESTS/pin_names/CMakeLists.txt new file mode 100644 index 00000000000..339380cf2e4 --- /dev/null +++ b/hal/tests/TESTS/pin_names/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(arduino_uno) \ No newline at end of file diff --git a/hal/tests/TESTS/pin_names/arduino_uno/CMakeLists.txt b/hal/tests/TESTS/pin_names/arduino_uno/CMakeLists.txt new file mode 100644 index 00000000000..24e1c5f49bd --- /dev/null +++ b/hal/tests/TESTS/pin_names/arduino_uno/CMakeLists.txt @@ -0,0 +1,15 @@ +# Copyright (c) 2022 ARM Limited. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +if(NOT "TARGET_FF_ARDUINO_UNO" IN_LIST MBED_TARGET_DEFINITIONS) + set(TEST_SKIPPED "Target does not claim to implement the Arduino Uno form factor") +endif() + +mbed_greentea_add_test( + TEST_NAME + mbed-hal-verify-arduino-pinmap + TEST_SOURCES + main.cpp + TEST_SKIPPED + ${TEST_SKIPPED} +) \ No newline at end of file diff --git a/tools/cmake/mbed_create_distro.cmake b/tools/cmake/mbed_create_distro.cmake index d11b9ca8c30..a73b71758ab 100644 --- a/tools/cmake/mbed_create_distro.cmake +++ b/tools/cmake/mbed_create_distro.cmake @@ -56,7 +56,7 @@ function(mbed_create_distro NAME) # ARGN: modules... # CMake currently has a limitation that OBJECT libraries cannot link to other OBJECT libraries # via the LINK_LIBRARIES property -- CMake will not link the objects in properly :/. # see: https://cmake.org/pipermail/cmake/2019-May/069453.html - # Once the INTERFACE_LINK_LIBRARIES_DIRECT property becomes widely available we could use that instead to fix this. + # also: https://gitlab.kitware.com/cmake/cmake/-/issues/18090 get_property(CURR_MODULE_TYPE TARGET ${CURR_MODULE} PROPERTY TYPE) if("${CURR_MODULE_TYPE}" STREQUAL "OBJECT_LIBRARY") target_sources(${NAME} INTERFACE $) From c43d248935a26b44d172a2a172a663e35af9fd2c Mon Sep 17 00:00:00 2001 From: Jamie Smith Date: Sat, 7 May 2022 17:49:25 -0700 Subject: [PATCH 10/14] Fix typo preventing unification test from running --- hal/tests/TESTS/mbed_hal/stack_size_unification/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hal/tests/TESTS/mbed_hal/stack_size_unification/CMakeLists.txt b/hal/tests/TESTS/mbed_hal/stack_size_unification/CMakeLists.txt index a43691b615f..3dca815ee0c 100644 --- a/hal/tests/TESTS/mbed_hal/stack_size_unification/CMakeLists.txt +++ b/hal/tests/TESTS/mbed_hal/stack_size_unification/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -if(NOT "TARGET_CORTEX_A" IN_LIST MBED_TARGET_DEFINITIONS) +if("TARGET_CORTEX_A" IN_LIST MBED_TARGET_DEFINITIONS) set(TEST_SKIPPED "Not supported for Cortex-A targets") endif() From c933ec9c255d6a1009ff3020721f846d6d79f481 Mon Sep 17 00:00:00 2001 From: Jamie Smith Date: Sat, 7 May 2022 18:02:27 -0700 Subject: [PATCH 11/14] Fix some tests that weren't being skipped --- .../TESTS/mbed_hal/flash/functional_tests/CMakeLists.txt | 6 ++++++ hal/tests/TESTS/mbed_hal/lp_ticker/CMakeLists.txt | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/hal/tests/TESTS/mbed_hal/flash/functional_tests/CMakeLists.txt b/hal/tests/TESTS/mbed_hal/flash/functional_tests/CMakeLists.txt index 33f0730eec0..d7e3999e1f3 100644 --- a/hal/tests/TESTS/mbed_hal/flash/functional_tests/CMakeLists.txt +++ b/hal/tests/TESTS/mbed_hal/flash/functional_tests/CMakeLists.txt @@ -1,6 +1,10 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 +if(NOT "DEVICE_FLASH=1" IN_LIST MBED_TARGET_DEFINITIONS) + set(TEST_SKIPPED "Flash In-Application Programming is not supported for this target") +endif() + mbed_greentea_add_test( TEST_NAME mbed-hal-flash-functional-tests @@ -8,4 +12,6 @@ mbed_greentea_add_test( main.cpp HOST_TESTS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../host_tests + TEST_SKIPPED + ${TEST_SKIPPED} ) \ No newline at end of file diff --git a/hal/tests/TESTS/mbed_hal/lp_ticker/CMakeLists.txt b/hal/tests/TESTS/mbed_hal/lp_ticker/CMakeLists.txt index 4f48b8fed0a..296d16f3dbf 100644 --- a/hal/tests/TESTS/mbed_hal/lp_ticker/CMakeLists.txt +++ b/hal/tests/TESTS/mbed_hal/lp_ticker/CMakeLists.txt @@ -1,6 +1,10 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 +if(NOT "DEVICE_LPTICKER=1" IN_LIST MBED_TARGET_DEFINITIONS) + set(TEST_SKIPPED "Low-Power Ticker is not supported for this target") +endif() + mbed_greentea_add_test( TEST_NAME mbed-hal-lp-ticker @@ -8,4 +12,6 @@ mbed_greentea_add_test( main.cpp HOST_TESTS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../host_tests + TEST_SKIPPED + ${TEST_SKIPPED} ) \ No newline at end of file From baa77661fa758120a62dad4f5d114b0b90557f13 Mon Sep 17 00:00:00 2001 From: Jamie Smith Date: Sat, 7 May 2022 18:08:20 -0700 Subject: [PATCH 12/14] Add more missed test skips --- hal/tests/TESTS/mbed_hal/mpu/CMakeLists.txt | 6 ++++++ hal/tests/TESTS/mbed_hal/reset_reason/CMakeLists.txt | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/hal/tests/TESTS/mbed_hal/mpu/CMakeLists.txt b/hal/tests/TESTS/mbed_hal/mpu/CMakeLists.txt index cae7069d22b..a85fbe2f82a 100644 --- a/hal/tests/TESTS/mbed_hal/mpu/CMakeLists.txt +++ b/hal/tests/TESTS/mbed_hal/mpu/CMakeLists.txt @@ -1,6 +1,10 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 +if(NOT "DEVICE_MPU=1" IN_LIST MBED_TARGET_DEFINITIONS) + set(TEST_SKIPPED "Memory Protection Unit is not supported for this target") +endif() + mbed_greentea_add_test( TEST_NAME mbed-hal-mpu @@ -8,4 +12,6 @@ mbed_greentea_add_test( main.cpp HOST_TESTS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../host_tests + TEST_SKIPPED + ${TEST_SKIPPED} ) diff --git a/hal/tests/TESTS/mbed_hal/reset_reason/CMakeLists.txt b/hal/tests/TESTS/mbed_hal/reset_reason/CMakeLists.txt index b60c9cb62e8..9d10ae7a733 100644 --- a/hal/tests/TESTS/mbed_hal/reset_reason/CMakeLists.txt +++ b/hal/tests/TESTS/mbed_hal/reset_reason/CMakeLists.txt @@ -1,6 +1,10 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 +if(NOT "DEVICE_RESET_REASON=1" IN_LIST MBED_TARGET_DEFINITIONS) + set(TEST_SKIPPED "Reset Reason is not supported for this target") +endif() + mbed_greentea_add_test( TEST_NAME mbed-hal-reset-reason @@ -8,4 +12,6 @@ mbed_greentea_add_test( main.cpp HOST_TESTS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../host_tests + TEST_SKIPPED + ${TEST_SKIPPED} ) From 96f3035696d4256629ef3d29fe70cbaf0b782bc7 Mon Sep 17 00:00:00 2001 From: Jamie Smith Date: Sat, 7 May 2022 20:45:19 -0700 Subject: [PATCH 13/14] Provide MBED_RAM_SIZE symbol for MUSCA_S1 --- hal/tests/TESTS/mbed_hal/stack_size_unification/main.cpp | 2 +- targets/TARGET_ARM_SSG/TARGET_MUSCA_S1/device/cmsis_nvic.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/hal/tests/TESTS/mbed_hal/stack_size_unification/main.cpp b/hal/tests/TESTS/mbed_hal/stack_size_unification/main.cpp index 60740239187..c430137e221 100644 --- a/hal/tests/TESTS/mbed_hal/stack_size_unification/main.cpp +++ b/hal/tests/TESTS/mbed_hal/stack_size_unification/main.cpp @@ -38,7 +38,7 @@ extern uint32_t mbed_stack_isr_size; #define EXPECTED_USER_THREAD_DEFAULT_STACK_SIZE (MBED_CONF_RTOS_THREAD_STACK_SIZE) #if ((MBED_RAM_SIZE - MBED_CONF_TARGET_BOOT_STACK_SIZE) <= (EXPECTED_MAIN_THREAD_STACK_SIZE + EXPECTED_ISR_STACK_SIZE)) -#error [NOT_SUPPORTED] Insufficient stack for staci_size_unification tests +#error [NOT_SUPPORTED] Insufficient stack for stack_size_unification tests #endif diff --git a/targets/TARGET_ARM_SSG/TARGET_MUSCA_S1/device/cmsis_nvic.h b/targets/TARGET_ARM_SSG/TARGET_MUSCA_S1/device/cmsis_nvic.h index b83a445f9be..7836e2bdd4d 100644 --- a/targets/TARGET_ARM_SSG/TARGET_MUSCA_S1/device/cmsis_nvic.h +++ b/targets/TARGET_ARM_SSG/TARGET_MUSCA_S1/device/cmsis_nvic.h @@ -31,5 +31,6 @@ #define NVIC_RAM_VECTOR_ADDRESS NS_DATA_START #define NVIC_RAM_VECTOR_SIZE (NVIC_NUM_VECTORS * 4) #define NVIC_RAM_VECTOR_LIMIT (NVIC_RAM_VECTOR_ADDRESS + NVIC_RAM_VECTOR_SIZE) +#define MBED_RAM_SIZE NS_DATA_SIZE #endif From 3be8272e710acccb544866f14db2e227b4e5af55 Mon Sep 17 00:00:00 2001 From: Jamie Smith Date: Sat, 7 May 2022 21:03:10 -0700 Subject: [PATCH 14/14] MUSCA_S1 does not actually implement TRNG --- targets/targets.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/targets/targets.json b/targets/targets.json index c09b2dc4d2d..f1800188d38 100644 --- a/targets/targets.json +++ b/targets/targets.json @@ -5653,6 +5653,9 @@ "SLEEP", "USTICKER" ], + "device_has_remove": [ + "TRNG" + ], "macros_add": [ "__STARTUP_CLEAR_BSS", "MBED_FAULT_HANDLER_DISABLED",