2020-07-16 14:33:48 +08:00
|
|
|
#!/bin/bash -x
|
|
|
|
|
2023-02-17 02:21:07 +08:00
|
|
|
# Copyright (c) 2020-2023 Arm Limited
|
2020-07-16 14:33:48 +08:00
|
|
|
#
|
|
|
|
# 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.
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
WORKING_DIRECTORY=/root/work/tfm
|
|
|
|
MCUBOOT_PATH=$WORKING_DIRECTORY/mcuboot
|
2020-11-09 23:42:04 +08:00
|
|
|
TFM_DIR=$WORKING_DIRECTORY/trusted-firmware-m
|
2020-07-16 14:33:48 +08:00
|
|
|
TFM_BUILD_DIR=$TFM_DIR/build
|
2020-11-09 23:42:04 +08:00
|
|
|
|
|
|
|
SKIP_SIZE=$1
|
|
|
|
BUILD_TYPE=$2
|
|
|
|
DAMAGE_TYPE=$3
|
|
|
|
FIH_LEVEL=$4
|
2020-07-16 14:33:48 +08:00
|
|
|
|
2020-11-09 23:42:04 +08:00
|
|
|
if test -z "$FIH_LEVEL"; then
|
|
|
|
# Use the default level
|
|
|
|
CMAKE_FIH_LEVEL=""
|
|
|
|
else
|
|
|
|
CMAKE_FIH_LEVEL="-DMCUBOOT_FIH_PROFILE=\"$FIH_LEVEL\""
|
|
|
|
fi
|
|
|
|
|
2020-07-16 14:33:48 +08:00
|
|
|
# build TF-M with MCUBoot
|
|
|
|
mkdir -p $TFM_BUILD_DIR
|
|
|
|
cd $TFM_DIR
|
|
|
|
cmake -B $TFM_BUILD_DIR \
|
2021-09-20 20:50:52 +08:00
|
|
|
-DTFM_SPM_LOG_LEVEL=TFM_SPM_LOG_LEVEL_INFO \
|
2020-11-09 23:42:04 +08:00
|
|
|
-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
|
2020-07-16 14:33:48 +08:00
|
|
|
-DTFM_TOOLCHAIN_FILE=toolchain_GNUARM.cmake \
|
2021-09-16 14:20:04 +08:00
|
|
|
-DTFM_PLATFORM=arm/mps2/an521 \
|
2020-07-16 14:33:48 +08:00
|
|
|
-DTEST_NS=ON \
|
|
|
|
-DTEST_S=ON \
|
|
|
|
-DTFM_PSA_API=ON \
|
|
|
|
-DMCUBOOT_PATH=$MCUBOOT_PATH \
|
|
|
|
-DMCUBOOT_LOG_LEVEL=INFO \
|
2020-11-09 23:42:04 +08:00
|
|
|
$CMAKE_FIH_LEVEL \
|
2020-07-16 14:33:48 +08:00
|
|
|
.
|
|
|
|
cd $TFM_BUILD_DIR
|
|
|
|
make -j install
|
|
|
|
|
2022-12-08 19:55:46 +08:00
|
|
|
BOOTLOADER_AXF='./install/outputs/bl2.axf'
|
2020-11-09 23:42:04 +08:00
|
|
|
|
|
|
|
$MCUBOOT_PATH/ci/fih_test_docker/run_fi_test.sh $BOOTLOADER_AXF $SKIP_SIZE $DAMAGE_TYPE> fih_test_output.yaml
|
2020-07-16 14:33:48 +08:00
|
|
|
|
2020-11-09 23:42:04 +08:00
|
|
|
echo ""
|
|
|
|
echo "test finished with"
|
|
|
|
echo " - BUILD_TYPE: $BUILD_TYPE"
|
|
|
|
echo " - FIH_LEVEL: $FIH_LEVEL"
|
|
|
|
echo " - SKIP_SIZE: $SKIP_SIZE"
|
|
|
|
echo " - DAMAGE_TYPE: $DAMAGE_TYPE"
|
2020-07-16 14:33:48 +08:00
|
|
|
|
2021-01-05 19:36:49 +08:00
|
|
|
python3 $MCUBOOT_PATH/ci/fih_test_docker/generate_test_report.py fih_test_output.yaml
|
2023-02-17 02:21:07 +08:00
|
|
|
python3 $MCUBOOT_PATH/ci/fih_test_docker/validate_output.py fih_test_output.yaml $SKIP_SIZE $FIH_LEVEL
|