1#-------------------------------------------------------------------------------
2# Copyright (c) 2001-2019, Arm Limited. All rights reserved.
3#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6#-------------------------------------------------------------------------------
7
8#!/usr/bin/env bash
9
10# This script defines only the necessary environment variables for TestAL makefile.
11# Note that it does not run our internal script set_toolchain.sh as it is
12# supposed to be used by external users (e.g. costumers) or another projects
13# makefiles, which usually configures their own environment.
14
15choice=$1
16
17SUPPORTED_CONFIGURATIONS="SUPPORTED CONFIGURATIONS
18|----------------------------------------------------------------------|
19|ConfNum|    OS    |    CPU     |      Toolchain      | Device | Board |
20|----------------------------------------------------------------------|
21|   1   |  linux   | cortex-a9  |      arm-xilinx     | target | Zynq  |
22|   2   |          |            |     Deprecated      |        |       |
23|   3   |  linux   |    x86     |        native       |  host  |       |
24|   4   | freertos | cortex-m3  |    arm-compiler-5   | target | MPS2+ |
25|   5   |          |            |     Deprecated      |        |       |
26|   6   |  no_os   | cortex-m3  |    arm-compiler-5   | target | MPS2+ |
27|   7   | freertos | cortex-m33 |     arm-none-eabi   | target | MPS2+ |
28|   8   |  linux   | cortex-a9  |      arm-br-7.3     | target | Zynq  |
29|   9   | freertos | cortex-m3  |     arm-none-eabi   | target | MPS2+ |
30|   10  |  linux   |  a72 a53   |    aarch64-br-7.3   | target | Juno  |
31|   11  | freertos | cortex-m33 |    arm-compiler-6   | target | MPS2+ |
32|   12  | freertos | cortex-m3  |    arm-compiler-6   | target | MPS2+ |
33|----------------------------------------------------------------------|
34
35There is an option to run this script with ConfNum as an argument.
36
37Please enter your choice: "
38
39if [ -z $1 ]; then echo "$SUPPORTED_CONFIGURATIONS"; read choice; fi
40
41make clean
42make clrconfig
43
44case $choice in
451)
46#set_toolchain arm-xilinx-14.7
47make setconfig_testal_linux_ca9
48;;
492)
50echo "Deprecated configuration!"
51exit 0;
52;;
533)
54#set_toolchain native
55make setconfig_testal_linux_x86
56;;
574)
58#set_toolchain arm-compiler-5
59make setconfig_testal_freertos_cm3
60if [ -z $KERNEL_DIR ]; then echo "Please enter freertos KERNEL_DIR path:"; read KERNEL_DIR;
61export KERNEL_DIR; fi
62;;
635)
64echo "Deprecated configuration!"
65exit 0;
66;;
676)
68#set_toolchain arm-compiler-5
69make setconfig_testal_no_os_cm3
70;;
717)
72#set_toolchain arm-none-eabi
73make setconfig_testal_freertos_cm33
74if [ -z $KERNEL_DIR ]; then echo "Please enter freertos KERNEL_DIR path:"; read KERNEL_DIR;
75export KERNEL_DIR; fi
76;;
778)
78#set_toolchain arm-br-7.3
79make setconfig_testal_linux_ca9
80;;
819)
82#set_toolchain arm-none-eabi
83make setconfig_testal_freertos_cm3
84if [ -z $KERNEL_DIR ]; then echo "Please enter freertos KERNEL_DIR path:"; read KERNEL_DIR;
85export KERNEL_DIR; fi
86;;
8710)
88#set_toolchain aarch64-br-7.3
89make setconfig_testal_linux_ca72.ca53
90;;
9111)
92#set_toolchain arm-compiler-6
93make setconfig_testal_freertos_cm33
94;;
9512)
96#set_toolchain arm-compiler-6
97make setconfig_testal_freertos_cm3
98;;
99*)
100echo "Configuration number $1 is undefined"
101exit 1;
102;;
103esac
104
105echo
106
107make
108if [ $? -gt 0 ]; then
109	status=1
110	echo -e "\033[1;41m========\033[0m"
111	echo -e "\033[1;41m= FAIL =\033[0m"
112	echo -e "\033[1;41m========\033[0m"
113	exit 1
114fi
115make clean
116make clrconfig
117
118echo
119