1d209f22b2570d94fcc629a198e4a4f2f96f3bb9
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 CG_TOOL_PATH=$2
21 export APP_PATH=$3
22 export APP_NAME=$4
23 export SOC=$5
24 export PROCESSOR=$6
25 export SECUREMODE=$7
27 if [ $SOC == AM437x ] || [ $SOC == AM335x ]; then
28 $CG_TOOL_PATH/bin/arm-none-eabi-objcopy -O binary $APP_NAME.out $APP_NAME.bin
29 $PDK_PATH/ti/starterware/tools/ti_image/tiimage_bin/tiimage 0x80000000 NONE $APP_NAME.bin app
31 if [ "$SECUREMODE" == "SECUREMODE=yes" ]; then
33 # setting the TI_SECURE_SEC_DEV_PKG variable
34 source $PDK_PATH/pdksetupenv.sh
36 if [ ! -z $TI_SECURE_DEV_PKG ]; then
37 echo TI_SECURE_DEV_PKG set. Secure the app ...
38 $TI_SECURE_DEV_PKG/scripts/secure-binary-image.sh $APP_NAME.bin "$APP_NAME"_signed.bin
39 $PDK_PATH/ti/starterware/tools/ti_image/tiimage_bin/tiimage 0x80000000 NONE "$APP_NAME"_signed.bin "$APP_NAME"_signed_ti.bin
40 echo "$APP_NAME"_signed.bin can be loaded by SBL UART boot
41 echo "$APP_NAME"_signed_ti.bin can be loaded by SBL MMCSD boot
42 else
43 echo "SECURE mode requested but TI_SECURE_DEV_PKG is not defined..."
44 fi
45 fi
46 fi
48 if [ $SOC == AM572x ] || [ $SOC == AM571x ] || [ $SOC == AM574x ]; then
49 if [ "$PROCESSOR" == "arm" ]; then
50 export BIN_PATH=$APP_PATH
51 export APP_MPU_CPU0=$APP_PATH/$APP_NAME.out
52 export TOOLS_PATH=$PDK_PATH/ti/boot/sbl/tools
53 . $PDK_PATH/ti/boot/sbl/tools/scripts/AM57xImageGen.sh
54 elif [ "$PROCESSOR" == "dsp" ]; then
55 export BIN_PATH=$APP_PATH
56 export APP_DSP1=$APP_PATH/$APP_NAME.out
57 export TOOLS_PATH=$PDK_PATH/ti/boot/sbl/tools
58 . $PDK_PATH/ti/boot/sbl/tools/scripts/AM57xImageGen.sh
59 elif [ "$PROCESSOR" == "m4" ]; then
60 export BIN_PATH=$APP_PATH
61 export APP_IPU1_CPU0=$APP_PATH/$APP_NAME.out
62 export TOOLS_PATH=$PDK_PATH/ti/boot/sbl/tools
63 . $PDK_PATH/ti/boot/sbl/tools/scripts/AM57xImageGen.sh
64 else
65 echo Invalid Processor core
66 fi
67 fi
69 if [ $SOC == K2G ]; then
70 if [ "$PROCESSOR" == "arm" ]; then
71 export BIN_PATH=$APP_PATH
72 export APP_MPU_CPU0=$APP_PATH/$APP_NAME.out
73 export TOOLS_PATH=$PDK_PATH/ti/boot/sbl/tools
74 . $PDK_PATH/ti/boot/sbl/tools/scripts/K2GImageGen.sh
75 elif [ "$PROCESSOR" == "dsp" ]; then
76 export BIN_PATH=$APP_PATH
77 export APP_DSP0=$APP_PATH/$APP_NAME.out
78 export TOOLS_PATH=$PDK_PATH/ti/boot/sbl/tools
79 . $PDK_PATH/ti/boot/sbl/tools/scripts/K2GImageGen.sh
80 else
81 echo Invalid Processor core
82 fi
83 fi
85 if [ $SOC == OMAPL137 ] || [ $SOC == OMAPL138 ]; then
86 if [ "$PROCESSOR" == "arm" ]; then
87 export BIN_PATH=$APP_PATH
88 export APP_MPU_CPU0=$APP_PATH/$APP_NAME.out
89 export TOOLS_PATH=$PDK_PATH/ti/boot/sbl/tools
90 . $PDK_PATH/ti/boot/sbl/tools/scripts/OMAPL13xImageGen.sh
91 elif [ "$PROCESSOR" == "dsp" ]; then
92 export BIN_PATH=$APP_PATH
93 export APP_DSP0=$APP_PATH/$APP_NAME.out
94 export TOOLS_PATH=$PDK_PATH/ti/boot/sbl/tools
95 . $PDK_PATH/ti/boot/sbl/tools/scripts/OMAPL13xImageGen.sh
96 else
97 echo Invalid Processor core
98 fi
99 fi
102 if [ $SOC == am65xx ] || [ $SOC == j721e ] || [ $SOC == am64x ]; then
103 export CORE_ID=""
104 #Refer to SBL document for core ID value (0, or 4 bellow).
105 if [ "$PROCESSOR" == "mpu" ]; then
106 export CORE_ID=4
107 elif [ "$PROCESSOR" == "mcu" ]; then
108 export CORE_ID=0
109 elif [ "$PROCESSOR" == "mpu1_0" ]; then
110 export CORE_ID=0
111 elif [ "$PROCESSOR" == "mpu1_1" ]; then
112 export CORE_ID=1
113 elif [ "$PROCESSOR" == "mpu2_0" ]; then
114 export CORE_ID=2
115 elif [ "$PROCESSOR" == "mpu2_1" ]; then
116 export CORE_ID=3
117 elif [ "$PROCESSOR" == "mcu1_0" ]; then
118 export CORE_ID=4
119 elif [ "$PROCESSOR" == "mcu1_1" ]; then
120 export CORE_ID=5
121 elif [ "$PROCESSOR" == "mcu2_0" ]; then
122 export CORE_ID=6
123 elif [ "$PROCESSOR" == "mcu2_1" ]; then
124 export CORE_ID=7
125 elif [ "$PROCESSOR" == "mcu3_0" ]; then
126 export CORE_ID=8
127 elif [ "$PROCESSOR" == "mcu3_1" ]; then
128 export CORE_ID=9
129 elif [ "$PROCESSOR" == "c66xdsp_1" ]; then
130 export CORE_ID=10
131 elif [ "$PROCESSOR" == "c66xdsp_2" ]; then
132 export CORE_ID=11
133 elif [ "$PROCESSOR" == "c7x_1" ]; then
134 export CORE_ID=12
135 elif [ "$PROCESSOR" == "c7x_1" ]; then
136 export CORE_ID=13
137 fi
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