Skip to content

Commit 0661307

Browse files
gergkvaggarg
authored andcommitted
build: Integration tests with split-build
Signed-off-by: Gergely Kovacs <[email protected]>
1 parent b76a128 commit 0661307

File tree

4 files changed

+43
-44
lines changed

4 files changed

+43
-44
lines changed

applications/freertos_iot_libraries_tests/CMakeLists.txt

Lines changed: 24 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -4,33 +4,18 @@
44

55
cmake_minimum_required(VERSION 3.21.0 FATAL_ERROR)
66

7+
set(NS_TARGET_NAME freertos-iot-libraries-tests)
8+
set(APPLICATION_PATH "${IOT_REFERENCE_ARM_CORSTONE3XX_SOURCE_DIR}/applications/freertos_iot_libraries_tests" CACHE STRING "Path to the application folder")
79
set(AWS_OTA_SIGNATURE_TYPE "RSA-3072" CACHE STRING "Supported algorithms for signature validation [RSA-2048, RSA-3072, EC-P256, EC-P384]")
810

9-
set(MCUBOOT_IMAGE_VERSION_NS "0.0.1+10")
10-
set(MCUBOOT_IMAGE_NUMBER 2 CACHE STRING "Total number of firmware images")
11-
set(DEFAULT_MCUBOOT_FLASH_MAP ON)
12-
13-
set(APPLICATION_PATH "${IOT_REFERENCE_ARM_CORSTONE3XX_SOURCE_DIR}/applications/freertos_iot_libraries_tests" CACHE STRING "Path to the application folder")
11+
# Toolchain file has to be included before the very first project() call
12+
include(${IOT_REFERENCE_ARM_CORSTONE3XX_SOURCE_DIR}/components/security/trusted_firmware-m/integration/cmake/TfmNsToolchain.cmake)
1413

15-
# Trusted Firmware-M setup
16-
set(TFM_CMAKE_APP_ARGS
17-
-DPROJECT_CONFIG_HEADER_FILE=${IOT_REFERENCE_ARM_CORSTONE3XX_SOURCE_DIR}/applications/freertos_iot_libraries_tests/configs/tfm_config/project_config.h
18-
-DMCUBOOT_DATA_SHARING=ON
19-
-DMCUBOOT_CONFIRM_IMAGE=ON
20-
-DMCUBOOT_UPGRADE_STRATEGY=SWAP_USING_SCRATCH
21-
-DMCUBOOT_IMAGE_VERSION_NS=${MCUBOOT_IMAGE_VERSION_NS}
22-
-DPLATFORM_HAS_FIRMWARE_UPDATE_SUPPORT=ON
23-
-DTFM_PARTITION_FIRMWARE_UPDATE=ON
24-
)
2514

2615
project(freertos-iot-libraries-tests LANGUAGES C)
2716

28-
# Set global optimization level to reduce code size while keeping the debug experience.
29-
if(${CMAKE_C_COMPILER_ID} STREQUAL "GNU")
30-
add_compile_options(-Og)
31-
elseif(${CMAKE_C_COMPILER_ID} STREQUAL "ARMClang")
32-
add_compile_options(-O1)
33-
endif()
17+
set_compiler_and_linker_flags()
18+
include(${CONFIG_SPE_PATH}/config/cp_check.cmake)
3419

3520
# This variable is checked to apply configurations specific to FreeRTOS Libraries Integrations Tests
3621
set(FREERTOS_LIBRARIES_INTEGRATION_TESTS 1)
@@ -74,15 +59,13 @@ target_link_libraries(freertos-libraries-integration-tests-config
7459
add_executable(${CMAKE_PROJECT_NAME}
7560
main.c
7661
integration_tests_platform_function.c
62+
${CONFIG_SPE_PATH}/interface/src/os_wrapper/tfm_ns_interface_rtos.c
7763
)
7864

79-
# Trusted Firmware-M must be built before the application, because
80-
# the application depends on the NS interface and the BL2 signing scripts,
81-
# both of which are generated as parts of the Trusted Firmware-M build process.
82-
add_dependencies(${CMAKE_PROJECT_NAME} trusted_firmware-m-build)
8365
# The provision data must be built before the application because
8466
# it provides credentials to connect to AWS
8567
add_dependencies(${CMAKE_PROJECT_NAME} provisioning_data_bin)
68+
8669
target_link_libraries(${CMAKE_PROJECT_NAME}
8770
PRIVATE
8871
backoff-algorithm
@@ -97,30 +80,35 @@ target_link_libraries(${CMAKE_PROJECT_NAME}
9780
helpers-events
9881
provisioning-lib
9982
mbedtls
100-
tfm-ns-interface
83+
toolchain-override
84+
tfm_api_ns
85+
# FRI always uses TrustZone
86+
tfm_api_ns_tz
10187
)
10288

10389
set_linker_script(${CMAKE_PROJECT_NAME})
10490

10591
list(APPEND CMAKE_MODULE_PATH ${IOT_REFERENCE_ARM_CORSTONE3XX_SOURCE_DIR}/tools/cmake)
10692
include(ConvertElfToBin)
107-
include(ExternalProject)
108-
ExternalProject_Get_Property(trusted_firmware-m-build BINARY_DIR)
10993

11094
extract_sections_from_axf(
11195
${CMAKE_PROJECT_NAME}
11296
SECTIONS_NAMES "ddr.bin"
11397
OUTPUT_BIN_NAME "ns_image"
11498
)
11599

116-
# The non-secure application image should be padded while being signed
117-
iot_reference_arm_corstone3xx_tf_m_sign_image(
118-
${CMAKE_PROJECT_NAME}
119-
"ns_image"
120-
${CMAKE_PROJECT_NAME}_signed
121-
${MCUBOOT_IMAGE_VERSION_NS}
122-
"${BINARY_DIR}/api_ns/image_signing/layout_files/signing_layout_ns.o"
123-
TRUE
100+
# Copy the binary flash content to the location expected by default signing
101+
# Signing is implemented in the exported TF-M NS CMakeLists.txt (in the
102+
# ${CONFIG_SPE_PATH} directory)
103+
add_custom_target(freertos-iot-libraries-tests_bin
104+
SOURCES ${CMAKE_BINARY_DIR}/freertos-iot-libraries-tests.bin
105+
DEPENDS freertos-iot-libraries-tests
106+
)
107+
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/freertos-iot-libraries-tests.bin
108+
DEPENDS freertos-iot-libraries-tests
109+
COMMAND ${CMAKE_COMMAND}
110+
-E copy ${SECTORS_BIN_DIR}/ns_image.bin
111+
${CMAKE_BINARY_DIR}/freertos-iot-libraries-tests.bin
124112
)
125113

126114
# A user project that consumes the ARM FRI needs to explicitly provide
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Copyright 2025 Arm Limited and/or its affiliates
2+
3+
# SPDX-License-Identifier: MIT
4+
5+
include(${ROOT}/cmake/TfmInitialCacheCommon.cmake)
6+
7+
# Trusted Firmware-M setup
8+
set(TFM_MBEDCRYPTO_CONFIG_CLIENT_PATH "${ROOT}/applications/freertos_iot_libraries_tests/configs/mbedtls_config/aws_mbedtls_config.h" CACHE FILEPATH "TFM_MBEDCRYPTO_CONFIG_CLIENT_PATH" FORCE)
9+
set(PROJECT_CONFIG_HEADER_FILE ${ROOT}/applications/freertos_iot_libraries_tests/configs/tfm_config/project_config.h CACHE FILEPATH "PROJECT_CONFIG_HEADER_FILE" FORCE)
10+
set(MCUBOOT_IMAGE_NUMBER 2 CACHE STRING "MCUBOOT_IMAGE_NUMBER" FORCE)
11+
set(DEFAULT_MCUBOOT_FLASH_MAP ON CACHE BOOL "DEFAULT_MCUBOOT_FLASH_MAP" FORCE)
12+
set(MCUBOOT_DATA_SHARING ON CACHE BOOL "MCUBOOT_DATA_SHARING" FORCE)
13+
set(MCUBOOT_UPGRADE_STRATEGY "SWAP_USING_SCRATCH" CACHE STRING "MCUBOOT_UPGRADE_STRATEGY" FORCE)
14+
set(MCUBOOT_IMAGE_VERSION_NS "0.0.1+10" CACHE STRING "MCUBOOT_IMAGE_VERSION_NS" FORCE)
15+
set(PLATFORM_HAS_FIRMWARE_UPDATE_SUPPORT ON CACHE BOOL "PLATFORM_HAS_FIRMWARE_UPDATE_SUPPORT" FORCE)
16+
set(TFM_PARTITION_FIRMWARE_UPDATE ON CACHE BOOL "TFM_PARTITION_FIRMWARE_UPDATE" FORCE)

applications/freertos_iot_libraries_tests/configs/freertos_config/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2023-2024 Arm Limited and/or its affiliates
1+
# Copyright 2023-2025 Arm Limited and/or its affiliates
22
33
# SPDX-License-Identifier: MIT
44

@@ -14,6 +14,6 @@ target_compile_definitions(freertos_config
1414

1515
target_link_libraries(freertos_config
1616
INTERFACE
17-
tfm-ns-interface
17+
tfm_api_ns
1818
app-config
1919
)

applications/freertos_iot_libraries_tests/configs/mbedtls_config/CMakeLists.txt

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2023-2024 Arm Limited and/or its affiliates
1+
# Copyright 2023-2025 Arm Limited and/or its affiliates
22
33
# SPDX-License-Identifier: MIT
44

@@ -7,11 +7,6 @@ target_include_directories(mbedtls-config
77
.
88
)
99

10-
target_compile_definitions(mbedtls-config
11-
INTERFACE
12-
MBEDTLS_CONFIG_FILE="aws_mbedtls_config.h"
13-
)
14-
1510
target_link_libraries(mbedtls-config
1611
INTERFACE
1712
freertos_kernel

0 commit comments

Comments
 (0)