blob: 9c49bcea4b7ac478aabb12fec5ad2b862cce37bd [file] [log] [blame]
Dean Birch62c4f082020-01-17 16:13:26 +00001#!/bin/bash
2#-------------------------------------------------------------------------------
3# Copyright (c) 2020, Arm Limited and Contributors. All rights reserved.
4#
5# SPDX-License-Identifier: BSD-3-Clause
6#
7#-------------------------------------------------------------------------------
8
9#
10# Builds a single configuration on Trusted Firmware M.
11# Relies on environment variables pre-populated.
12# These variables can be obtained using configs.py.
13# Expected to have trusted-firmware-m cloned to same level as this git tree
14#
15
16set -ex
17mkdir trusted-firmware-m/build
18cd trusted-firmware-m/build
19cmake -G "Unix Makefiles" -DPROJ_CONFIG=`readlink -f ../configs/$PROJ_CONFIG.cmake` -DTARGET_PLATFORM=$TARGET_PLATFORM -DCOMPILER=$COMPILER -DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE -DBL2=$BL2 ..
20cmake --build ./ -- -j 2 install
21if [ "$TARGET_PLATFORM" == "MUSCA_A" ] ; then
22 export OFFSET1=0x200000
23 export OFFSET2=0x220000
24elif [ "$TARGET_PLATFORM" == "MUSCA_B1" ] ; then
25 export OFFSET1=0xA000000
26 export OFFSET2=0xA020000
27fi
28if [ ! -z "$OFFSET1" ] && [ ! -z "$OFFSET2" ] ; then
29 # Cleanup offset(s)?
30 srec_cat install/outputs/$TARGET_PLATFORM/mcuboot.bin -Binary -offset $OFFSET1 install/outputs/$TARGET_PLATFORM/tfm_sign.bin -Binary -offset $OFFSET2 -o install/outputs/$TARGET_PLATFORM/tfm.hex -Intel
31fi