From fb7aea8675f09ba4067048552129736da15571a1 Mon Sep 17 00:00:00 2001 From: ATmobica Date: Thu, 29 Jun 2023 09:21:22 +0000 Subject: [PATCH] [OIS] Update Open IoT SDK version Update OIS version to the latest. Update TF-M platform and settings. Update MDH components file naming and targets. Update toolchain library version. Create build-type profiles to set proper compiler and linker flags. Fix inet test issue - skip TestInetLayer test. Signed-off-by: ATmobica --- config/openiotsdk/cmake/linker.cmake | 4 +- config/openiotsdk/cmake/profile.cmake | 53 ++++++++ config/openiotsdk/cmake/profiles/debug.cmake | 95 ++++++++++++++ .../openiotsdk/cmake/profiles/release.cmake | 97 +++++++++++++++ config/openiotsdk/cmake/sdk.cmake | 117 ++++++++---------- config/openiotsdk/cmake/tf-m.patch | 116 ++++++++++++++++- config/openiotsdk/cmake/toolchain.cmake | 2 +- .../platform/openiotsdk/app/CMakeLists.txt | 3 +- .../openiotsdk/app/openiotsdk_platform.cpp | 6 +- .../openiotsdk/app/openiotsdk_startup_gcc.cpp | 6 +- .../tf-m/targets/an552/tfm_hal_isolation.c | 2 +- .../tf-m/targets/an552/tfm_interrupts.c | 2 +- src/inet/tests/BUILD.gn | 2 +- third_party/open-iot-sdk/sdk | 2 +- 14 files changed, 423 insertions(+), 84 deletions(-) create mode 100644 config/openiotsdk/cmake/profile.cmake create mode 100644 config/openiotsdk/cmake/profiles/debug.cmake create mode 100644 config/openiotsdk/cmake/profiles/release.cmake diff --git a/config/openiotsdk/cmake/linker.cmake b/config/openiotsdk/cmake/linker.cmake index fc3429ffd78656..6dad96aed455c0 100644 --- a/config/openiotsdk/cmake/linker.cmake +++ b/config/openiotsdk/cmake/linker.cmake @@ -21,10 +21,10 @@ function(set_target_link target) target_link_libraries(${target} - mdh-arm-corstone-300-startup + mdh-arm-startup-an552 ) - if (NOT LINKER_SCRIPT) + if (NOT LINKER_SCRIPT) set(LINKER_SCRIPT ${OPEN_IOT_SDK_CONFIG}/ld/cs300_gcc.ld) endif() target_link_options(${target} PRIVATE -T ${LINKER_SCRIPT}) diff --git a/config/openiotsdk/cmake/profile.cmake b/config/openiotsdk/cmake/profile.cmake new file mode 100644 index 00000000000000..6d6583598155d3 --- /dev/null +++ b/config/openiotsdk/cmake/profile.cmake @@ -0,0 +1,53 @@ +# +# Copyright (c) 2023 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# +# @file +# CMake profile configuration for target +# + +# Set the default build type if none is specified +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE "Release" CACHE + STRING "The build type" FORCE + ) +endif() + +set(SUPPORTED_BUILD_TYPES Debug Release) + +# Force the build types to be case-insensitive for checking +set(LOWERCASE_SUPPORTED_BUILD_TYPES ${SUPPORTED_BUILD_TYPES}) +list(TRANSFORM LOWERCASE_SUPPORTED_BUILD_TYPES TOLOWER) +string(TOLOWER ${CMAKE_BUILD_TYPE} LOWERCASE_CMAKE_BUILD_TYPE) + +# Mapping CMAKE_BUILD_TYPE into SUPPORTED_BUILD_TYPES, as we understand only 2 profiles +get_property(multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(multi_config) + # Provide only a list as multi configuration generators do not support build type + set(CMAKE_CONFIGURATION_TYPES "${SUPPORTED_BUILD_TYPES}" CACHE STRING "List of supported build types" FORCE) +else() + # Set the possible values of build type for cmake-gui + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "${SUPPORTED_BUILD_TYPES}") + + if(NOT LOWERCASE_CMAKE_BUILD_TYPE IN_LIST LOWERCASE_SUPPORTED_BUILD_TYPES) + message(FATAL_ERROR "Invalid build type '${CMAKE_BUILD_TYPE}'. Possible values:\n ${SUPPORTED_BUILD_TYPES}") + endif() +endif() + +include(profiles/${LOWERCASE_CMAKE_BUILD_TYPE}) + +add_library(project_profile INTERFACE) +set_profile_options(project_profile) diff --git a/config/openiotsdk/cmake/profiles/debug.cmake b/config/openiotsdk/cmake/profiles/debug.cmake new file mode 100644 index 00000000000000..c763da5cbba232 --- /dev/null +++ b/config/openiotsdk/cmake/profiles/debug.cmake @@ -0,0 +1,95 @@ +# Copyright (c) 2020-2021 Arm Limited +# SPDX-License-Identifier: Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Sets profile options +function(set_profile_options target) + set(profile_link_options "") + + if(${CMAKE_C_COMPILER_ID} STREQUAL GNU) + list(APPEND profile_c_compile_options + "-c" + "-O0" + "-g3" + ) + target_compile_options(${target} + INTERFACE + $<$:${profile_c_compile_options}> + ) + + list(APPEND profile_cxx_compile_options + "-c" + "-fno-rtti" + "-Wvla" + "-O0" + "-g3" + ) + target_compile_options(${target} + INTERFACE + $<$:${profile_cxx_compile_options}> + ) + + list(APPEND profile_asm_compile_options + "-c" + "-x" "assembler-with-cpp" + ) + target_compile_options(${target} + INTERFACE + $<$:${profile_asm_compile_options}> + ) + + list(APPEND profile_link_options + "-Wl,--gc-sections" + "-Wl,-n" + ) + elseif(${CMAKE_C_COMPILER_ID} STREQUAL ARMClang) + list(APPEND profile_c_compile_options + "-O0" + "-gdwarf-4" + ) + target_compile_options(${target} + INTERFACE + $<$:${profile_c_compile_options}> + ) + + list(APPEND profile_cxx_compile_options + "-fno-rtti" + "-fno-c++-static-destructors" + "-O0" + "-gdwarf-4" + ) + target_compile_options(${target} + INTERFACE + $<$:${profile_cxx_compile_options}> + ) + + list(APPEND profile_link_options + "--verbose" + "--remove" + "--show_full_path" + "--legacyalign" + "--any_contingency" + ) + + target_compile_definitions(${target} + INTERFACE + __ASSERT_MSG + ) + endif() + + target_link_options(${target} + INTERFACE + ${profile_link_options} + ) +endfunction() diff --git a/config/openiotsdk/cmake/profiles/release.cmake b/config/openiotsdk/cmake/profiles/release.cmake new file mode 100644 index 00000000000000..824368bdeaae87 --- /dev/null +++ b/config/openiotsdk/cmake/profiles/release.cmake @@ -0,0 +1,97 @@ +# Copyright (c) 2020-2021 Arm Limited +# SPDX-License-Identifier: Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Sets profile options +function(set_profile_options target) + set(profile_link_options "") + + if(${CMAKE_C_COMPILER_ID} STREQUAL GNU) + list(APPEND profile_c_compile_options + "-c" + "-O2" + "-g3" + ) + target_compile_options(${target} + INTERFACE + $<$:${profile_c_compile_options}> + ) + + list(APPEND profile_cxx_compile_options + "-c" + "-fno-rtti" + "-Wvla" + "-O2" + "-g3" + ) + target_compile_options(${target} + INTERFACE + $<$:${profile_cxx_compile_options}> + ) + + list(APPEND profile_asm_compile_options + "-c" + "-x" "assembler-with-cpp" + ) + target_compile_options(${target} + INTERFACE + $<$:${profile_asm_compile_options}> + ) + + list(APPEND profile_link_options + "-Wl,--gc-sections" + "-Wl,-n" + ) + elseif(${CMAKE_C_COMPILER_ID} STREQUAL ARMClang) + list(APPEND profile_c_compile_options + "-Oz" + ) + target_compile_options(${target} + INTERFACE + $<$:${profile_c_compile_options}> + ) + + list(APPEND profile_cxx_compile_options + "-fno-rtti" + "-fno-c++-static-destructors" + "-Oz" + ) + target_compile_options(${target} + INTERFACE + $<$:${profile_cxx_compile_options}> + ) + + list(APPEND profile_link_options + "--show_full_path" + "--legacyalign" + "--inline" + "--any_contingency" + ) + + target_compile_definitions(${target} + INTERFACE + __ASSERT_MSG + ) + endif() + + target_compile_definitions(${target} + INTERFACE + NDEBUG + ) + + target_link_options(${target} + INTERFACE + ${profile_link_options} + ) +endfunction() diff --git a/config/openiotsdk/cmake/sdk.cmake b/config/openiotsdk/cmake/sdk.cmake index cee548ae457d19..71ffc48f1522da 100644 --- a/config/openiotsdk/cmake/sdk.cmake +++ b/config/openiotsdk/cmake/sdk.cmake @@ -23,15 +23,17 @@ include(FetchContent) get_filename_component(OPEN_IOT_SDK_SOURCE ${CHIP_ROOT}/third_party/open-iot-sdk/sdk REALPATH) +include(profile) + # Open IoT SDK targets passed to CHIP build -list(APPEND CONFIG_CHIP_EXTERNAL_TARGETS) +list(APPEND CONFIG_CHIP_EXTERNAL_TARGETS project_profile) # Additional Open IoT SDK build configuration set(TFM_NS_APP_VERSION "0.0.0" CACHE STRING "TF-M non-secure application version (in the x.x.x format)") set(CONFIG_CHIP_OPEN_IOT_SDK_LWIP_DEBUG NO CACHE BOOL "Enable LwIP debug logs") # Default LwIP options directory (should contain user_lwipopts.h file) -if (NOT LWIP_PROJECT_OPTS_DIR) +if (NOT LWIP_PROJECT_OPTS_DIR) set(LWIP_PROJECT_OPTS_DIR ${OPEN_IOT_SDK_CONFIG}/lwip) endif() @@ -50,7 +52,7 @@ FetchContent_Declare( FetchContent_Declare( trusted-firmware-m GIT_REPOSITORY https://git.trustedfirmware.org/TF-M/trusted-firmware-m.git - GIT_TAG d0c0a67f1b412e89d09b0987091c12998c4e4660 + GIT_TAG TF-Mv1.8.0 GIT_SHALLOW OFF GIT_PROGRESS ON # Note: This prevents FetchContent_MakeAvailable() from calling @@ -65,28 +67,48 @@ FetchContent_Declare( # Open IoT SDK configuration set(IOTSDK_FETCH_LIST mcu-driver-reference-platforms-for-arm + mbed-critical cmsis-5 cmsis-freertos mbedtls lwip - cmsis-sockets-api trusted-firmware-m ) set(MDH_PLATFORM ARM_AN552_MPS3) set(VARIANT "FVP") set(FETCHCONTENT_QUIET OFF) -set(TFM_PLATFORM ${OPEN_IOT_SDK_EXAMPLE_COMMON}/tf-m/targets/an552) -set(TFM_PSA_FIRMWARE_UPDATE ON) -set(MCUBOOT_IMAGE_VERSION_NS ${TFM_NS_APP_VERSION}) -set(TFM_CMAKE_ARGS "-DCONFIG_TFM_ENABLE_FP=ON;-DTFM_PROFILE=profile_medium;-DTFM_EXCEPTION_INFO_DUMP=ON;-DCONFIG_TFM_HALT_ON_CORE_PANIC=ON;-DTFM_ISOLATION_LEVEL=1;-DTFM_MBEDCRYPTO_PLATFORM_EXTRA_CONFIG_PATH=${OPEN_IOT_SDK_CONFIG}/mbedtls/mbedtls_config_psa.h;-DMBEDCRYPTO_BUILD_TYPE=${CMAKE_BUILD_TYPE};-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}") +set(TFM_CMAKE_ARGS + -D TFM_PLATFORM=${OPEN_IOT_SDK_EXAMPLE_COMMON}/tf-m/targets/an552 + -D TFM_PROFILE=profile_medium + -D CONFIG_TFM_ENABLE_FP=ON + -D TFM_PARTITION_FIRMWARE_UPDATE=ON + -D PLATFORM_HAS_FIRMWARE_UPDATE_SUPPORT=ON + -D MCUBOOT_DATA_SHARING=ON + -D MCUBOOT_IMAGE_VERSION_NS=${TFM_NS_APP_VERSION} + -D TFM_EXCEPTION_INFO_DUMP=ON + -D CONFIG_TFM_HALT_ON_CORE_PANIC=ON + -D TFM_ISOLATION_LEVEL=1 + -D TFM_MBEDCRYPTO_PLATFORM_EXTRA_CONFIG_PATH=${OPEN_IOT_SDK_CONFIG}/mbedtls/mbedtls_config_psa.h +) + if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") - set(TFM_CMAKE_ARGS "${TFM_CMAKE_ARGS};-DMCUBOOT_LOG_LEVEL=INFO;-DTFM_SPM_LOG_LEVEL=TFM_SPM_LOG_LEVEL_DEBUG;-DTFM_PARTITION_LOG_LEVEL=TFM_PARTITION_LOG_LEVEL_INFO") + list(APPEND TFM_CMAKE_ARGS + -D MCUBOOT_LOG_LEVEL=INFO + -D TFM_SPM_LOG_LEVEL=TFM_SPM_LOG_LEVEL_DEBUG + -D TFM_PARTITION_LOG_LEVEL=TFM_PARTITION_LOG_LEVEL_INFO + ) else() - set(TFM_CMAKE_ARGS "${TFM_CMAKE_ARGS};-DMCUBOOT_LOG_LEVEL=ERROR;-DTFM_SPM_LOG_LEVEL=TFM_SPM_LOG_LEVEL_DEBUG;-DTFM_PARTITION_LOG_LEVEL=TFM_PARTITION_LOG_LEVEL_ERROR") + list(APPEND TFM_CMAKE_ARGS + -D MCUBOOT_LOG_LEVEL=ERROR + -D TFM_SPM_LOG_LEVEL=TFM_SPM_LOG_LEVEL_DEBUG + -D TFM_PARTITION_LOG_LEVEL=TFM_PARTITION_LOG_LEVEL_ERROR + ) endif() if(TFM_PROJECT_CONFIG_HEADER_FILE) - set(TFM_CMAKE_ARGS "${TFM_CMAKE_ARGS};-DPROJECT_CONFIG_HEADER_FILE=${TFM_PROJECT_CONFIG_HEADER_FILE}") + list(APPEND TFM_CMAKE_ARGS + -D PROJECT_CONFIG_HEADER_FILE=${TFM_PROJECT_CONFIG_HEADER_FILE} + ) endif() # Add Open IoT SDK source @@ -98,50 +120,36 @@ list(APPEND CMAKE_MODULE_PATH ${open-iot-sdk_SOURCE_DIR}/components/trusted-firm # Configure component properties -# CMSIS 5 require projects to provide configuration macros via RTE_Components.h -# and CMSIS_device_header. The macro CMSIS_device_header is not automatically set -# based on CMAKE_SYSTEM_PROCESSOR in the place where cmsis-core is first defined, -# because a project may want to provide its own device header. -if(TARGET cmsis-core) - target_compile_definitions(cmsis-core +if(TARGET mcu-driver-hal-api) + # It is required to pass to mcu-driver-hal-api that it is compiled in NS mode + target_compile_definitions(mcu-driver-hal-api INTERFACE - $<$:CMSIS_device_header="ARMCM55.h"> + DOMAIN_NS=1 ) endif() # Add RTOS configuration headers # Link cmsis-rtos-api against a concrete implementation if(TARGET cmsis-rtos-api) - target_include_directories(cmsis-core + target_include_directories(cmsis-config INTERFACE cmsis-config ) - target_compile_definitions(cmsis-rtos-api - PUBLIC - DOMAIN_NS=1 - ) - - if(TARGET freertos-kernel) - target_include_directories(freertos-kernel - PUBLIC + if(TARGET freertos-cmsis-rtos) + target_include_directories(freertos-config + INTERFACE freertos-config ) - target_link_libraries(freertos-kernel - PUBLIC - cmsis-core + target_link_libraries(freertos-config + INTERFACE + cmsis-config ) - target_link_libraries(cmsis-rtos-api PUBLIC freertos-cmsis-rtos ) - elseif(TARGET cmsis-rtx) - target_link_libraries(cmsis-rtos-api - INTERFACE - cmsis-rtx - ) endif() endif() @@ -178,22 +186,6 @@ if(TARGET ethernet-lan91c111) ) endif() -if(TARGET mcu-driver-hal) - target_compile_definitions(mcu-driver-hal - INTERFACE - DOMAIN_NS=1 - ) - - # Fixing the optimization issue for mcu-driver-hal target in the release build. - # The default -Os optimization causes performance issues for the application. - # We need to replace it with -O2 which is suitable for performance. - # This fix can be removed in the future when the issue will be fixed in SDK directly. - if ("${CMAKE_BUILD_TYPE}" STREQUAL "Release") - target_compile_options(mcu-driver-hal INTERFACE $<$:-O2>) - target_compile_options(mcu-driver-hal INTERFACE $<$:-O2>) - endif() -endif() - # Mbedtls config if(TARGET mbedtls-config) target_include_directories(mbedtls-config @@ -219,16 +211,14 @@ endif() if("mcu-driver-reference-platforms-for-arm" IN_LIST IOTSDK_FETCH_LIST) list(APPEND CONFIG_CHIP_EXTERNAL_TARGETS - mcu-driver-bootstrap - mcu-driver-hal - mdh-arm-corstone-300-common - target-interface + mcu-driver-hal-api + mdh-arm-hal-impl-an552 ) endif() if("cmsis-5" IN_LIST IOTSDK_FETCH_LIST) list(APPEND CONFIG_CHIP_EXTERNAL_TARGETS - cmsis-core + iotsdk-cmsis-core-device cmsis-rtos-api iotsdk-ip-network-api ) @@ -250,13 +240,6 @@ if("lwip" IN_LIST IOTSDK_FETCH_LIST) ) endif() -if("cmsis-sockets-api" IN_LIST IOTSDK_FETCH_LIST) - list(APPEND CONFIG_CHIP_EXTERNAL_TARGETS - cmsis-sockets-api - lwip-sockets - ) -endif() - if("trusted-firmware-m" IN_LIST IOTSDK_FETCH_LIST) list(APPEND CONFIG_CHIP_EXTERNAL_TARGETS tfm-ns-interface @@ -289,7 +272,7 @@ function(sdk_post_build target) # Sign the non-secure (application) image for TF-M bootloader (BL2)" python3 ${BINARY_DIR}/install/image_signing/scripts/wrapper/wrapper.py --layout ${BINARY_DIR}/install/image_signing/layout_files/signing_layout_ns.o - -v ${MCUBOOT_IMAGE_VERSION_NS} + -v ${TFM_NS_APP_VERSION} -k ${BINARY_DIR}/install/image_signing/keys/root-RSA-3072_1.pem --public-key-format full --align 1 --pad --pad-header -H 0x400 -s auto -d "(0, 0.0.0+0)" @@ -311,7 +294,7 @@ if(CONFIG_CHIP_OPEN_IOT_SDK_OTA_ENABLE) # Sign the update image python3 ${BINARY_DIR}/install/image_signing/scripts/wrapper/wrapper.py --layout ${BINARY_DIR}/install/image_signing/layout_files/signing_layout_ns.o - -v ${MCUBOOT_IMAGE_VERSION_NS} + -v ${TFM_NS_APP_VERSION} -k ${BINARY_DIR}/install/image_signing/keys/root-RSA-3072_1.pem --public-key-format full --align 1 --pad-header -H 0x400 -s auto -d "(0, 0.0.0+0)" @@ -360,7 +343,7 @@ endif() COMMAND rm ARGS -Rf $/${target}.bin - $/${target}_signed.bin + $/${target}_signed.bin $/${target}_merged.hex $/${target}_merged.elf VERBATIM diff --git a/config/openiotsdk/cmake/tf-m.patch b/config/openiotsdk/cmake/tf-m.patch index 975696d5e63752..ed4d99da8d1516 100644 --- a/config/openiotsdk/cmake/tf-m.patch +++ b/config/openiotsdk/cmake/tf-m.patch @@ -1,12 +1,122 @@ +diff --git a/bl2/CMakeLists.txt b/bl2/CMakeLists.txt +index 2005714..99ab9fc 100644 +--- a/bl2/CMakeLists.txt ++++ b/bl2/CMakeLists.txt +@@ -15,6 +15,7 @@ + $<$:src/default_flash_map.c> + $<$:src/shared_data.c> + $<$:src/provisioning.c> ++ $<$:${CMAKE_SOURCE_DIR}/platform/ext/common/syscalls_stub.c> + ) + + add_subdirectory(ext/mcuboot) +diff --git a/docs/getting_started/tfm_getting_started.rst b/docs/getting_started/tfm_getting_started.rst +index a11de46..b9a620e 100644 +--- a/docs/getting_started/tfm_getting_started.rst ++++ b/docs/getting_started/tfm_getting_started.rst +@@ -217,9 +217,6 @@ + support. The bug is reported in `here `__. + Select other GNU Arm compiler versions instead. + +- GNU Arm compiler version greater and equal than *11.3.Rel1* has a linker issue in syscall. +- Select other GNU Arm compiler versions instead. +- + - IAR Arm compiler v8.42.x, v8.50.x + + .. tabs:: +diff --git a/platform/ext/common/syscalls_stub.c b/platform/ext/common/syscalls_stub.c +new file mode 100755 +index 0000000..42986c0 +--- /dev/null ++++ b/platform/ext/common/syscalls_stub.c +@@ -0,0 +1,49 @@ ++/* ++ * Copyright (c) 2023, Arm Limited. All rights reserved. ++ * ++ * SPDX-License-Identifier: BSD-3-Clause ++ * ++ */ ++ ++#include ++#include ++ ++__attribute__((weak)) ++void _close(void) ++{ ++} ++ ++__attribute__((weak)) ++void _fstat(void) ++{ ++} ++ ++__attribute__((weak)) ++void _getpid(void) ++{ ++} ++ ++__attribute__((weak)) ++void _isatty(void) ++{ ++} ++ ++__attribute__((weak)) ++void _kill(void) ++{ ++} ++ ++__attribute__((weak)) ++void _lseek(void) ++{ ++} ++ ++__attribute__((weak)) ++void _read(void) ++{ ++} ++ ++__attribute__((weak)) ++void _write(void) ++{ ++} +diff --git a/secure_fw/partitions/lib/runtime/CMakeLists.txt b/secure_fw/partitions/lib/runtime/CMakeLists.txt +index cfb9978..d2627c0 100644 +--- a/secure_fw/partitions/lib/runtime/CMakeLists.txt ++++ b/secure_fw/partitions/lib/runtime/CMakeLists.txt +@@ -18,6 +18,8 @@ + ) + + target_sources(tfm_sprt ++ PUBLIC ++ $<$:${CMAKE_SOURCE_DIR}/platform/ext/common/syscalls_stub.c> + PRIVATE + ./crt_memcmp.c + ./crt_memmove.c diff --git a/toolchain_GNUARM.cmake b/toolchain_GNUARM.cmake -index d044ed4a5..3d8f64d17 100644 +index 798971851..c0b71570e 100644 --- a/toolchain_GNUARM.cmake +++ b/toolchain_GNUARM.cmake -@@ -71,7 +71,6 @@ macro(tfm_toolchain_reset_linker_flags) +@@ -71,7 +71,7 @@ macro(tfm_toolchain_reset_linker_flags) --entry=Reset_Handler - --specs=nano.specs + -specs=nano.specs LINKER:-check-sections - LINKER:-fatal-warnings ++ #LINKER:-fatal-warnings LINKER:--gc-sections LINKER:--no-wchar-size-warning ${MEMORY_USAGE_FLAG} +@@ -170,9 +170,12 @@ macro(tfm_toolchain_reload_compiler) + " See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99157 for the issue detail.") + endif() + ++ # GNU Arm compiler version greater equal than *11.3.Rel1* ++ # has a linker issue that required system calls are missing, ++ # such as _read and _write. Add stub functions of required ++ # system calls to solve this issue. + if (GCC_VERSION VERSION_GREATER_EQUAL 11.3.1) +- message(FATAL_ERROR "GNU Arm compiler version greater and equal than *11.3.Rel1* has a linker issue in syscall." +- " Select other GNU Arm compiler versions instead.") ++ set(CONFIG_GNU_SYSCALL_STUB_ENABLED TRUE) + endif() + + unset(CMAKE_C_FLAGS_INIT) diff --git a/config/openiotsdk/cmake/toolchain.cmake b/config/openiotsdk/cmake/toolchain.cmake index ef0a8d1a3995a9..80d555686e9526 100644 --- a/config/openiotsdk/cmake/toolchain.cmake +++ b/config/openiotsdk/cmake/toolchain.cmake @@ -23,7 +23,7 @@ include(FetchContent) FetchContent_Declare(iotsdk-toolchains GIT_REPOSITORY https://git.gitlab.arm.com/iot/open-iot-sdk/toolchain.git - GIT_TAG v2022.09 + GIT_TAG 053f05d49dffec4e90b61a59e93687067c22d0fb SOURCE_DIR ${CMAKE_BINARY_DIR}/toolchains ) FetchContent_MakeAvailable(iotsdk-toolchains) diff --git a/examples/platform/openiotsdk/app/CMakeLists.txt b/examples/platform/openiotsdk/app/CMakeLists.txt index f7cc06f9fa14d1..1ae5e48480315e 100644 --- a/examples/platform/openiotsdk/app/CMakeLists.txt +++ b/examples/platform/openiotsdk/app/CMakeLists.txt @@ -27,7 +27,8 @@ target_link_libraries(openiotsdk-startup # iotsdk-serial-retarget contains the UART but we don't need the retarget part $,EXCLUDE,.*gcc_retarget.*> cmsis-rtos-api - mcu-driver-hal + mcu-driver-hal-api + mbed-critical tfm-ns-interface ) diff --git a/examples/platform/openiotsdk/app/openiotsdk_platform.cpp b/examples/platform/openiotsdk/app/openiotsdk_platform.cpp index 29662d6e8df4e9..3c674c8f4b94bb 100644 --- a/examples/platform/openiotsdk/app/openiotsdk_platform.cpp +++ b/examples/platform/openiotsdk/app/openiotsdk_platform.cpp @@ -129,10 +129,10 @@ static void post_network_connect() * * @param event network up or down event. */ -static void network_state_callback(network_state_callback_event_t event) +static void network_state_callback(const network_state_event_args_t * event_args) { - uint32_t event_flag = (event == NETWORK_UP) ? NETWORK_UP_FLAG : NETWORK_DOWN_FLAG; - ChipLogDetail(NotSpecified, "Network %s", (event == NETWORK_UP) ? "UP" : "DOWN"); + uint32_t event_flag = (event_args->event == NETWORK_UP) ? NETWORK_UP_FLAG : NETWORK_DOWN_FLAG; + ChipLogDetail(NotSpecified, "Network %s", (event_args->event == NETWORK_UP) ? "UP" : "DOWN"); int res = osEventFlagsSet(event_flags_id, event_flag); if (res < 0) { diff --git a/examples/platform/openiotsdk/app/openiotsdk_startup_gcc.cpp b/examples/platform/openiotsdk/app/openiotsdk_startup_gcc.cpp index abe68ff3fc3c09..1551caf3085f59 100644 --- a/examples/platform/openiotsdk/app/openiotsdk_startup_gcc.cpp +++ b/examples/platform/openiotsdk/app/openiotsdk_startup_gcc.cpp @@ -17,7 +17,7 @@ */ #include -#include +#include CMSIS_device_header #include #include #include @@ -26,8 +26,8 @@ #include #include -#include "bootstrap/mbed_critical.h" #include "cmsis_os2.h" +#include "mbed_critical/mbed_critical.h" extern "C" { #include "hal/serial_api.h" } @@ -143,7 +143,7 @@ static RingBuffer<128> rx_buffer; * - initialize RTOS * - Start the RTOS with the main thread */ -extern "C" void mbed_sdk_init(void) +extern "C" void software_init_hook(void) { serial = get_example_serial(); mdh_serial_set_baud(serial, IOT_SDK_APP_SERIAL_BAUDRATE); diff --git a/examples/platform/openiotsdk/tf-m/targets/an552/tfm_hal_isolation.c b/examples/platform/openiotsdk/tf-m/targets/an552/tfm_hal_isolation.c index 2083f80a1369ae..a8d1f7308badff 100755 --- a/examples/platform/openiotsdk/tf-m/targets/an552/tfm_hal_isolation.c +++ b/examples/platform/openiotsdk/tf-m/targets/an552/tfm_hal_isolation.c @@ -172,7 +172,7 @@ enum tfm_hal_status_t tfm_hal_bind_boundary(const struct partition_load_info_t * privileged = IS_PARTITION_PSA_ROT(p_ldinf); #endif - ns_agent = IS_PARTITION_NS_AGENT(p_ldinf); + ns_agent = IS_NS_AGENT(p_ldinf); p_asset = LOAD_INFO_ASSET(p_ldinf); /* diff --git a/examples/platform/openiotsdk/tf-m/targets/an552/tfm_interrupts.c b/examples/platform/openiotsdk/tf-m/targets/an552/tfm_interrupts.c index cbd41dc221d4a6..3923e289c289e5 100755 --- a/examples/platform/openiotsdk/tf-m/targets/an552/tfm_interrupts.c +++ b/examples/platform/openiotsdk/tf-m/targets/an552/tfm_interrupts.c @@ -14,7 +14,7 @@ #include "device_definition.h" #include "ffm/interrupt.h" #include "load/interrupt_defs.h" -#include "spm_ipc.h" +#include "spm.h" #include "tfm_hal_interrupt.h" #include "tfm_peripherals_def.h" #include "tfm_plat_test.h" diff --git a/src/inet/tests/BUILD.gn b/src/inet/tests/BUILD.gn index 774d6af52d2a54..eff7219ac27c9b 100644 --- a/src/inet/tests/BUILD.gn +++ b/src/inet/tests/BUILD.gn @@ -39,7 +39,7 @@ static_library("helpers") { "TestSetupSignallingPosix.cpp", ] - if (current_os != "mbed") { + if (current_os != "mbed" && chip_device_platform != "openiotsdk") { sources += [ "TestInetLayer.cpp" ] } diff --git a/third_party/open-iot-sdk/sdk b/third_party/open-iot-sdk/sdk index 152061529ebeca..783f4c789d3a33 160000 --- a/third_party/open-iot-sdk/sdk +++ b/third_party/open-iot-sdk/sdk @@ -1 +1 @@ -Subproject commit 152061529ebeca4488c81f2562a0db9c60b7b325 +Subproject commit 783f4c789d3a33a0ced83eae6fe4bcfa11a6956d