]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - processor-sdk/pdk.git/blob - packages/pdksetupenv.sh
Merge branch 'release/CORESDK_07.01.00' of ssh://bitbucket.itg.ti.com/processor-sdk...
[processor-sdk/pdk.git] / packages / pdksetupenv.sh
1 #!/bin/bash
2 # ******************************************************************************
3 # * FILE PURPOSE: Environment Setup for building PDK
4 # ******************************************************************************
5 # * FILE NAME: pdksetupenv.sh
6 # *
7 # * DESCRIPTION:
8 # *  Configures and sets up the Build Environment for PDK.
9 # *
10 # *  The batch file expects an optional argument:PDK_INSTALL_PATH: Location
11 # *  of the PDK package.  If the argument is not specified the batch file
12 # *  assumes that the PDK is installed in the same location where the batch
13 # *  file is located and is being executed.
14 # *
15 # * USAGE:
16 # *  source ./pdksetupenv.sh ~/ti/pdk_<device>_<version>/packages
17 # *     --- OR ---
18 # *  source ./pdksetupenv.sh
19 # *
20 # * Copyright (C) 2012-2018, Texas Instruments, Inc.
21 # *****************************************************************************
23 # *******************************************************************************
24 # ******************* CHECK IF SCRIPT WAS SOURCED OR SIMPLY RUN   ***************
25 # *******************************************************************************
26 # pdksetupenv.sh must always be sourced. Sometimes, peole forget this and can run
27 # it. We display and error and a prompt whe we detect this.
28 if [[ "$(basename -- "$0")" == "pdksetupenv.sh" ]]; then
29     echo "Error!! Don't run $0, source it" >&2
30     echo "USAGE:" >&2
31     echo "    source $0" >&2
32     exit 1
33 fi
35 # *******************************************************************************
36 # ********************** GET PARAMETERS PASSED THROUGH ARGUMENT   ***************
37 # *******************************************************************************
38 # Parameter Validation: Check if the argument was passed to the batch file and
39 # if so we use that else we default to the working directory where the batch
40 # file was invoked from
42 tempVar=$1
43 if [ ! -z $tempVar ];then
44     export PDK_INSTALL_PATH=$tempVar
45 else
46     export PDK_INSTALL_PATH=${PWD}
47 fi
49 # Derive PDK_SOC and PDK_VERSION from the directory name PWD
50 cd ..
51 CURDIR_LAST=${PWD##*/}
52 IFS='_' read -ra ADDR <<< "$CURDIR_LAST"
54 # When pdk folder represents a device family, set a default SOC for that family
55 if [ ${ADDR[1]} == "jacinto" ]; then
56     ADDR[1]="j721e"
57 fi
59 if [ -z $PDK_SOC ]; then
60    export PDK_SOC=${ADDR[1]}
61 fi
63 if [ -z "${ADDR[2]}" ]; then
64     export PDK_VERSION=
65 else
66     export PDK_VERSION=${ADDR[2]}_${ADDR[3]}_${ADDR[4]}
67 fi
68 cd -
70 # TI SDK root directory. Derive from PDK INSTALL PATH
71 if [ -z $SDK_INSTALL_PATH ]; then
72 cd ../../
73 export SDK_INSTALL_PATH=${PWD}
74 cd -
75 fi
77 # *******************************************************************************
78 # ********************** CHECK REQUIRED ENVIRONMENT DEFINES BEGIN ***************
79 # *******************************************************************************
82 # Rules.make location.
83 export RULES_MAKE="${PDK_INSTALL_PATH}/ti/build/Rules.make"
86 echo "**************************************************************************"
87 echo "Environment Configuration:"
88 echo "**************************************************************************"
89 echo "    SDK_INSTALL_PATH        : $SDK_INSTALL_PATH"
90 echo "    PDK_INSTALL_PATH        : $PDK_INSTALL_PATH"
91 echo "    PDK_SOC                 : $PDK_SOC"
92 echo "    PDK_VERSION             : $PDK_VERSION"
93 echo "    RULES_MAKE              : $RULES_MAKE"
94 echo "**************************************************************************"