blob: 3ffec0d1a543f7f20f3c50de55e9900868f3bef7 [file] [log] [blame]
Mate Toth-Pal5495f202020-07-16 08:33:48 +02001#!/bin/bash -x
2
Sherry Zhang3c4f69c2021-09-16 14:20:04 +08003# Copyright (c) 2020-2021 Arm Limited
Mate Toth-Pal5495f202020-07-16 08:33:48 +02004#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16
17set -e
18
19WORKING_DIRECTORY=/root/work/tfm
20MCUBOOT_PATH=$WORKING_DIRECTORY/mcuboot
Mate Toth-Pal62980672020-11-09 16:42:04 +010021TFM_DIR=$WORKING_DIRECTORY/trusted-firmware-m
Mate Toth-Pal5495f202020-07-16 08:33:48 +020022TFM_BUILD_DIR=$TFM_DIR/build
Mate Toth-Pal62980672020-11-09 16:42:04 +010023
24SKIP_SIZE=$1
25BUILD_TYPE=$2
26DAMAGE_TYPE=$3
27FIH_LEVEL=$4
Mate Toth-Pal5495f202020-07-16 08:33:48 +020028
Mate Toth-Pal62980672020-11-09 16:42:04 +010029if test -z "$FIH_LEVEL"; then
30 # Use the default level
31 CMAKE_FIH_LEVEL=""
32else
33 CMAKE_FIH_LEVEL="-DMCUBOOT_FIH_PROFILE=\"$FIH_LEVEL\""
34fi
35
Mate Toth-Pal5495f202020-07-16 08:33:48 +020036# build TF-M with MCUBoot
37mkdir -p $TFM_BUILD_DIR
38cd $TFM_DIR
39cmake -B $TFM_BUILD_DIR \
Mate Toth-Pal62980672020-11-09 16:42:04 +010040 -DCMAKE_BUILD_TYPE=$BUILD_TYPE \
Mate Toth-Pal5495f202020-07-16 08:33:48 +020041 -DTFM_TOOLCHAIN_FILE=toolchain_GNUARM.cmake \
Sherry Zhang3c4f69c2021-09-16 14:20:04 +080042 -DTFM_PLATFORM=arm/mps2/an521 \
Mate Toth-Pal5495f202020-07-16 08:33:48 +020043 -DTEST_NS=ON \
44 -DTEST_S=ON \
45 -DTFM_PSA_API=ON \
46 -DMCUBOOT_PATH=$MCUBOOT_PATH \
47 -DMCUBOOT_LOG_LEVEL=INFO \
Mate Toth-Pal62980672020-11-09 16:42:04 +010048 $CMAKE_FIH_LEVEL \
Mate Toth-Pal5495f202020-07-16 08:33:48 +020049 .
50cd $TFM_BUILD_DIR
51make -j install
52
Sherry Zhang3c4f69c2021-09-16 14:20:04 +080053BOOTLOADER_AXF='./install/outputs/ARM/MPS2/AN521/bl2.axf'
Mate Toth-Pal5495f202020-07-16 08:33:48 +020054
Mate Toth-Pal62980672020-11-09 16:42:04 +010055$MCUBOOT_PATH/ci/fih_test_docker/run_fi_test.sh $BOOTLOADER_AXF $SKIP_SIZE $DAMAGE_TYPE> fih_test_output.yaml
Mate Toth-Pal5495f202020-07-16 08:33:48 +020056
Mate Toth-Pal62980672020-11-09 16:42:04 +010057echo ""
58echo "test finished with"
59echo " - BUILD_TYPE: $BUILD_TYPE"
60echo " - FIH_LEVEL: $FIH_LEVEL"
61echo " - SKIP_SIZE: $SKIP_SIZE"
62echo " - DAMAGE_TYPE: $DAMAGE_TYPE"
63
Raef Colesf6847382021-01-05 11:36:49 +000064python3 $MCUBOOT_PATH/ci/fih_test_docker/generate_test_report.py fih_test_output.yaml