diff options
author | Sarah Blades <sarah.blades@arm.com> | 2022-10-03 16:38:23 +0100 |
---|---|---|
committer | Sarah Blades <sarah.blades@arm.com> | 2022-10-03 17:17:45 +0100 |
commit | 0048144db8c29822ccb1e1a95ef9a1c9dca154b0 (patch) | |
tree | b59ff1e556a7d7ac29de62504857aa500f584a54 | |
parent | 8b0455c06a91da33a9a3714c2a5d2e1062048845 (diff) | |
download | ml-embedded-evaluation-kit-0048144db8c29822ccb1e1a95ef9a1c9dca154b0.tar.gz |
MLECO-3149: Add CTest driven FVP runs for non-native targets.
Additional CMake configuration parameters required:
* `BUILD_FVP_TESTS`: Selects whether these tests are built, OFF by default.
* `FVP_PATH`: Path to the FVP that MUST be provided for the configuration to succeed.
Change-Id: I741379cd0a6078a3e2c3163e6b253b2f5dc25c58
Signed-off-by: Sarah Blades <sarah.blades@arm.com>
-rw-r--r-- | docs/sections/building.md | 39 | ||||
-rw-r--r-- | scripts/cmake/common_user_options.cmake | 11 | ||||
-rw-r--r-- | scripts/cmake/platforms/mps3/build_configuration.cmake | 22 |
3 files changed, 68 insertions, 4 deletions
diff --git a/docs/sections/building.md b/docs/sections/building.md index 16cfb56..6be51be 100644 --- a/docs/sections/building.md +++ b/docs/sections/building.md @@ -13,6 +13,7 @@ - [Configuring the build for MPS3 SSE-300](./building.md#configuring-the-build-for-mps3-sse_300) - [Using GNU Arm Embedded toolchain](./building.md#using-gnu-arm-embedded-toolchain) - [Using Arm Compiler](./building.md#using-arm-compiler) + - [Configuring applications to run without user interaction](./building.md#configuring-applications-to-run-without-user-interaction) - [Generating project for Arm Development Studio](./building.md#generating-project-for-arm-development-studio) - [Configuring with custom TPIP dependencies](./building.md#configuring-with-custom-tpip-dependencies) - [Configuring the build for MPS3 SSE-310](./building.md#configuring-the-build-for-mps3-sse_310) @@ -271,6 +272,13 @@ The build parameters are: - `USE_SINGLE_INPUT`: Sets whether each use case will use a single default input file, or if a user menu is provided for the user to select which input file to use via a telnet window. Disabled by default. +- `BUILD_FVP_TESTS`: Specifies whether to generate tests for built applications on the Corstone-300 FVP. Tests will +be generated for all use-cases if `USE_SINGLE_INPUT` is set to `ON`, otherwise they will only be generated for the +inference_runner use-case. + +- `FVP_PATH`: The path to the FVP to be used for testing built applications. This option is available only if +`BUILD_FVP_TESTS` option is switched `ON`. + For details on the specific use-case build options, follow the instructions in the use-case specific documentation. Also, when setting any of the CMake configuration parameters that expect a directory, or file, path, **use absolute @@ -460,14 +468,37 @@ cmake .. \ -DCMAKE_BUILD_TYPE=Debug ``` -#### Configuring to use default input data +#### Configuring applications to run without user interaction -To configure the project to use default input data for each use case, you can use the following CMake option `USE_SINGLE_INPUT`. -This will be set to `false` if not specified. Specifying it as `true` will result in each use case automatically running with predefined input data, thus removing the need for the user to use a telnet terminal to specify the input data. For Example: +Default CMake configuration behaviour looks for input samples, for each use case, in the default directory. All these +inputs are baked-in into the application. If the number of files baked in is greater than one, a user menu is displayed +on the application output, where the user is expected to enter their chosen option. See more here: +[Deploying on an FVP emulating MPS3](./deployment.md#deploying-on-an-fvp-emulating-mps3). + +To configure the project to use single input for each use case, CMake option `USE_SINGLE_INPUT` can be set to `ON`. +This will result in each use case automatically running with predefined input data, thus removing the need for the +user to use a telnet terminal to specify the input data. For Example: ```commandline -cmake ../ -DCMAKE_TOOLCHAIN_FILE=scripts/cmake/toolchains/bare-metal-armclang.cmake -DCMAKE_BUILD_TYPE=Debug -DUSE_SINGLE_INPUT=True +cmake ../ -DUSE_SINGLE_INPUT=ON ``` + +When a single input file is used, the non-native targets will also allow FVP tests to be added to the configuration +using the CTest framework. For example: + +```commandline +cmake .. \ + -DUSE_SINGLE_INPUT=ON \ + -DBUILD_FVP_TESTS=ON \ + -DFVP_PATH=/home/user/FVP_Corstone_SSE-300/models/Linux64_GCC-6.4/FVP_Corstone_SSE-300_Ethos-U55 +``` + +This will allow the built application to be executed on the FVP in headless mode using: + +```commandline +ctest --verbose +``` + #### Generating project for Arm Development Studio To import the project into Arm Development Studio, add the Eclipse project generator and `CMAKE_ECLIPSE_VERSION` in the diff --git a/scripts/cmake/common_user_options.cmake b/scripts/cmake/common_user_options.cmake index 7a0b068..008d8f0 100644 --- a/scripts/cmake/common_user_options.cmake +++ b/scripts/cmake/common_user_options.cmake @@ -150,5 +150,16 @@ if (NOT TARGET_PLATFORM STREQUAL native) ${DEFAULT_TA_CONFIG_FILE_PATH} FILEPATH) endif() + + USER_OPTION(BUILD_FVP_TESTS "Build tests for CTest driven FVP runs for built applications" + OFF + BOOL) + + if (BUILD_FVP_TESTS) + USER_OPTION(FVP_PATH "Path to FVP for verifying execution" + "" + FILEPATH) + endif() + endif() endif() diff --git a/scripts/cmake/platforms/mps3/build_configuration.cmake b/scripts/cmake/platforms/mps3/build_configuration.cmake index 7bed48d..f8d4cf1 100644 --- a/scripts/cmake/platforms/mps3/build_configuration.cmake +++ b/scripts/cmake/platforms/mps3/build_configuration.cmake @@ -86,4 +86,26 @@ function(platform_custom_post_build) POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${MPS3_FPGA_CONFIG} ${SECTORS_DIR}) + # Add tests for application on FVP if FVP path specified + if (BUILD_FVP_TESTS) + + # Build for all use cases if USE_SINGLE_INPUT as no telnet interaction required + # otherwise only build for inference runner + if ((USE_SINGLE_INPUT) OR (${use_case} STREQUAL "inference_runner")) + set(AXF_PATH "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${PARSED_TARGET_NAME}.axf") + set(TEST_TARGET_NAME "${use_case}_fvp_test") + + message(STATUS "Adding FVP test for ${use_case}") + + add_test( + NAME "${TEST_TARGET_NAME}" + COMMAND ${FVP_PATH} -a ${AXF_PATH} + -C mps3_board.telnetterminal0.start_telnet=0 + -C mps3_board.uart0.out_file='-' + -C mps3_board.uart0.shutdown_on_eot=1 + -C mps3_board.visualisation.disable-visualisation=1 + --stat) + endif() + endif () + endfunction() |