[DSS M2M Driver]Fixed Doxygen API Guide Warnings
[processor-sdk/pdk.git] / packages / pdkAppImageCreate.sh
1 #!/bin/bash
2 # ******************************************************************************
3 # * FILE PURPOSE: Creates the bootable application binary
4 # ******************************************************************************
5 # * FILE NAME: pdkAppImageCreate.sh
6 # *
7 # * DESCRIPTION:
8 # *  Creates bootable application binary from the .out file generated by the
9 # *  CCS projects.
10 # *
11 # * USAGE:
12 # *  pdkAppImageCreate.sh [PDK_PATH] [CG_TOOL_PATH] [APP_PATH] [APP_NAME] [SOC] [PROCESSOR] [SECUREMODE=yes/no]
13 # *
14 # *  SECUREMODE parameter is optional. Will fall back to GP build if not specified
15 # *
16 # * Copyright (C) 2016 - 2018, Texas Instruments, Inc.
17 # *****************************************************************************
19 export PDK_PATH=$1
20 export PDK_INSTALL_PATH=$PDK_PATH
21 export CG_TOOL_PATH=$2
22 export APP_PATH=$3
23 export APP_NAME=$4
24 export SOC=$5
25 export PROCESSOR=$6
26 export SECUREMODE=$7
28 if [ $SOC == AM437x ] || [ $SOC == AM335x ]; then
29         $CG_TOOL_PATH/bin/arm-none-eabi-objcopy -O binary $APP_NAME.out $APP_NAME.bin
30         $PDK_PATH/ti/starterware/tools/ti_image/tiimage_bin/tiimage 0x80000000 NONE $APP_NAME.bin app
32         if [ "$SECUREMODE" == "SECUREMODE=yes" ]; then
34             # setting the TI_SECURE_SEC_DEV_PKG variable
35             source $PDK_PATH/pdksetupenv.sh
37             if [ ! -z $TI_SECURE_DEV_PKG ]; then
38                 echo TI_SECURE_DEV_PKG set. Secure the app ...
39                 $TI_SECURE_DEV_PKG/scripts/secure-binary-image.sh $APP_NAME.bin "$APP_NAME"_signed.bin
40                 $PDK_PATH/ti/starterware/tools/ti_image/tiimage_bin/tiimage 0x80000000 NONE "$APP_NAME"_signed.bin "$APP_NAME"_signed_ti.bin
41                 echo "$APP_NAME"_signed.bin can be loaded by SBL UART boot
42                 echo "$APP_NAME"_signed_ti.bin can be loaded by SBL MMCSD boot
43             else
44                 echo "SECURE mode requested but TI_SECURE_DEV_PKG is not defined..."
45             fi
46         fi
47 fi
49 if [ $SOC == AM572x ] || [ $SOC == AM571x ] || [ $SOC == AM574x ]; then
50     if [ "$PROCESSOR" == "arm" ]; then
51         export BIN_PATH=$APP_PATH
52         export APP_MPU_CPU0=$APP_PATH/$APP_NAME.out
53         export TOOLS_PATH=$PDK_PATH/ti/boot/sbl/tools
54         . $PDK_PATH/ti/boot/sbl/tools/scripts/AM57xImageGen.sh
55     elif [ "$PROCESSOR" == "dsp" ]; then
56         export BIN_PATH=$APP_PATH
57         export APP_DSP1=$APP_PATH/$APP_NAME.out
58         export TOOLS_PATH=$PDK_PATH/ti/boot/sbl/tools
59         . $PDK_PATH/ti/boot/sbl/tools/scripts/AM57xImageGen.sh
60     elif [ "$PROCESSOR" == "m4" ]; then
61         export BIN_PATH=$APP_PATH
62         export APP_IPU1_CPU0=$APP_PATH/$APP_NAME.out
63         export TOOLS_PATH=$PDK_PATH/ti/boot/sbl/tools
64         . $PDK_PATH/ti/boot/sbl/tools/scripts/AM57xImageGen.sh
65     else
66         echo Invalid Processor core
67     fi
68 fi
70 if [ $SOC == K2G ]; then
71     if [ "$PROCESSOR" == "arm" ]; then
72         export BIN_PATH=$APP_PATH
73         export APP_MPU_CPU0=$APP_PATH/$APP_NAME.out
74         export TOOLS_PATH=$PDK_PATH/ti/boot/sbl/tools
75         . $PDK_PATH/ti/boot/sbl/tools/scripts/K2GImageGen.sh
76     elif [ "$PROCESSOR" == "dsp" ]; then
77         export BIN_PATH=$APP_PATH
78         export APP_DSP0=$APP_PATH/$APP_NAME.out
79         export TOOLS_PATH=$PDK_PATH/ti/boot/sbl/tools
80         . $PDK_PATH/ti/boot/sbl/tools/scripts/K2GImageGen.sh
81     else
82         echo Invalid Processor core
83     fi
84 fi
86 if [ $SOC == OMAPL137 ] || [ $SOC == OMAPL138 ]; then
87     if [ "$PROCESSOR" == "arm" ]; then
88         export BIN_PATH=$APP_PATH
89         export APP_MPU_CPU0=$APP_PATH/$APP_NAME.out
90         export TOOLS_PATH=$PDK_PATH/ti/boot/sbl/tools
91         . $PDK_PATH/ti/boot/sbl/tools/scripts/OMAPL13xImageGen.sh
92     elif [ "$PROCESSOR" == "dsp" ]; then
93         export BIN_PATH=$APP_PATH
94         export APP_DSP0=$APP_PATH/$APP_NAME.out
95         export TOOLS_PATH=$PDK_PATH/ti/boot/sbl/tools
96         . $PDK_PATH/ti/boot/sbl/tools/scripts/OMAPL13xImageGen.sh
97     else
98         echo Invalid Processor core
99     fi
100 fi
103 if [ $SOC == am65xx ] || [ $SOC == j721e ] || [ $SOC == am64x ]; then
104     export CORE_ID=""
105     #Refer to SBL document for core ID value (0, or 4 bellow).
106     if [ "$PROCESSOR" == "mpu" ]; then
107         export CORE_ID=4
108     elif [ "$PROCESSOR" == "mcu" ]; then
109         export CORE_ID=0
110     elif [ "$PROCESSOR" == "mpu1_0" ]; then
111         export CORE_ID=0
112     elif [ "$PROCESSOR" == "mpu1_1" ]; then
113         export CORE_ID=1
114     elif [ "$PROCESSOR" == "mpu2_0" ]; then
115         export CORE_ID=2
116     elif [ "$PROCESSOR" == "mpu2_1" ]; then
117         export CORE_ID=3
118     elif [ "$PROCESSOR" == "mcu1_0" ]; then
119         export CORE_ID=4
120     elif [ "$PROCESSOR" == "mcu1_1" ]; then
121         export CORE_ID=5
122     elif [ "$PROCESSOR" == "mcu2_0" ]; then
123         export CORE_ID=6
124     elif [ "$PROCESSOR" == "mcu2_1" ]; then
125         export CORE_ID=7
126     elif [ "$PROCESSOR" == "mcu3_0" ]; then
127         export CORE_ID=8
128     elif [ "$PROCESSOR" == "mcu3_1" ]; then
129         export CORE_ID=9
130     elif [ "$PROCESSOR" == "c66xdsp_1" ]; then
131         export CORE_ID=10
132     elif [ "$PROCESSOR" == "c66xdsp_2" ]; then
133         export CORE_ID=11
134     elif [ "$PROCESSOR" == "c7x_1" ]; then
135         export CORE_ID=12
136     elif [ "$PROCESSOR" == "c7x_1" ]; then
137         export CORE_ID=13
138     elif [ "$PROCESSOR" == "m4f_0" ]; then
139         export CORE_ID=14
140     fi
142     if [ "$CORE_ID" == "" ]; then
143         echo Invalid Processor core
144     else
145         export BIN_PATH=$APP_PATH
146         export TOOLS_PATH=$PDK_PATH/ti/boot/sbl/tools
147         export PDK_INSTALL_PATH=$PDK_PATH
148         . $PDK_PATH/ti/boot/sbl/tools/scripts/K3ImageGen.sh $CORE_ID $APP_PATH/$APP_NAME
149     fi
150 fi