Merge pull request #33 in PROCESSOR-SDK/edma3_lld from review_add_build_script_prasad...
[keystone-rtos/edma3_lld.git] / edma3_lld_build.sh
1 #!/bin/bash
3 echo "Edma3lld Build!!"
4 start_time=`date +%s`
5 export PATH=$PATH:/bin
6 date=`date '+%b_%d_%Y_%I_%M_%p'`
7 date_print=`date '+%d-%b-%Y %I:%M:%S %p'`
8 month=`date '+%b_%Y'`
9 year=`date '+%Y'`
10 if [ "$OS" == "" ]; then
11   echo "No OS defined, defaulting to linux"
12   OS=linux
13 fi
15 if [ "$OS" == "linux" ]; then
16   gmake_cmd=make
17 else
18   gmake_cmd=gmake
19 fi
21 git_path="/usr/bin"
23 # Get user input
24 edma_tag=$1
25 if [ "$edma_tag" == "" ]; then
26   edma_tag="j6_master"
27 fi
28 working_dir=$2
29 if [ "$working_dir" == "" ]; then
30   working_dir="/data/datalocal1_videoapps01/user/pdp_jenkin_build/edma_daily_build"
31 fi
33 # Present working directory from where the script runs
34 cd $working_dir
36 output_dir=$working_dir"/logs/"$year"/"$month"/"$date
38 edma_build_log_libs_gcc=$output_dir"/edma_build_libs_gcc.log"
39 edma_build_err_libs_gcc=$output_dir"/edma_build_err_libs_gcc.log"
41 edma_build_log_libs_all_elf=$output_dir"/edma_build_libs_all_elf.log"
42 edma_build_err_libs_all_elf=$output_dir"/edma_build_err_libs_all_elf.log"
43 edma_build_log_libs_all_coff=$output_dir"/edma_build_libs_all_coff.log"
44 edma_build_err_libs_all_coff=$output_dir"/edma_build_err_libs_all_coff.log"
46 edma_build_log_examples_all_elf=$output_dir"/edma_build_examples_all_elf.log"
47 edma_build_err_examples_all_elf=$output_dir"/edma_build_err_examples_all_elf.log"
48 edma_build_log_examples_all_coff=$output_dir"/edma_build_examples_all_coff.log"
49 edma_build_err_examples_all_coff=$output_dir"/edma_build_err_examples_all_coff.log"
51 edma_build_log_xdc_package=$output_dir"/edma_build_xdc_package.log"
52 edma_build_err_xdc_package=$output_dir"/edma_build_err_xdc_package.log"
54 echo "Date              : "$date_print
55 echo "Build Log @       : "$output_dir
56 echo ""
58 # Remove any old directory
59 rm -rf edma3_lld/
60 rm -rf $output_dir
62 # Make directory based on date
63 mkdir -p $working_dir/logs
64 mkdir -p $working_dir/logs/$year/$month
65 mkdir -p $output_dir
67 print_error() {
68     file_size=$( stat -c %s "$2")
69     if [ $file_size -gt 0 ]; then
70         echo ""
71         echo ==============================================================
72         echo "Errors and Warnings for $1 Build..."
73         echo ""
74         cat "$2"
75         echo ==============================================================
76         echo ""
77     else
78         echo "$1 Build Passed!!!"
79     fi
80 }
82 cd $working_dir
84 echo "=== Cloning EDMA3 LLD Repository ..."
86 $git_path/git clone -q -b $edma_tag --single-branch ssh://git@bitbucket.itg.ti.com/processor-sdk/edma3_lld.git edma3_lld
88 cd $working_dir/edma3_lld
90 export ROOTDIR=$working_dir/edma3_lld
92 #update the edma path and the toolchain root path
93 sed -i -e "s|INTERNAL_SW_ROOT ?= E\\:\/EDMA\/edma3_lld_02_12_01_25|INTERNAL_SW_ROOT ?= $ROOTDIR|g" makerules/env.mk
94 sed -i -e "s|EXTERNAL_SW_ROOT ?= C\\:\/PROGRA~2\/TEXASI~1|EXTERNAL_SW_ROOT ?= /datalocal1/ti_components|g" makerules/env.mk
96 # Build the libs
97 cd packages
99 $gmake_cmd -s libs PLATFORM=ti814x-evm TARGET=a8 TOOLCHAIN_a8=GCC FORMAT=ELF 1>$edma_build_log_libs_gcc 2>$edma_build_err_libs_gcc; print_error "ti814x (Gcc Toolchain) " "$edma_build_err_libs_gcc"
100 $gmake_cmd -s libs FORMAT=ELF 1>$edma_build_log_libs_all_elf 2>$edma_build_err_libs_all_elf; print_error "libs all Elf Format " "$edma_build_err_libs_all_elf"
101 $gmake_cmd -s libs FORMAT=COFF 1>$edma_build_log_libs_all_coff 2>$edma_build_err_libs_all_coff; print_error "libs all Coff Format " "$edma_build_err_libs_all_coff"
103 # Make the XDC package for the edma libs
104 export PATH=/datalocal1/ti_components/os_tools/linux/xdctools_3_32_01_22_core:$PATH
105 export XDCPATH=/datalocal1/ti_components/os_tools/bios_6_46_04_53/packages
106 export CGTOOLS=/datalocal1/ti_components/cg_tools/linux/C6000_7.4.2
107 export CGTOOLS_ELF=/datalocal1/ti_components/cg_tools/linux/C6000_7.4.2
108 export TMS470_CGTOOLS=/datalocal1/ti_components/cg_tools/linux/ti-cgt-arm_16.9.2.LTS
110 xdc .interfaces -PR . 1>$edma_build_log_xdc_package 2>$edma_build_err_xdc_package; print_error "edma xdc package create" "$edma_build_err_xdc_package"
112 rm `find . -name ".interfaces"`
113 rm `find . -name ".xdcenv.mak"`
114 rm `find . -name "package.mak"`
116 mv config.bld _config.bld
118 # Build the examples
119 $gmake_cmd -s examples FORMAT=ELF 1>$edma_build_log_examples_all_elf 2>$edma_build_err_examples_all_elf; print_error "examples all Elf Format " "$edma_build_err_examples_all_elf"
120 $gmake_cmd -s examples FORMAT=COFF 1>$edma_build_log_examples_all_coff 2>$edma_build_err_examples_all_coff; print_error "examples all Coff Format " "$edma_build_err_examples_all_coff"
122 end_time=`date +%s`
123 let deltatime=end_time-start_time
124 let hours=deltatime/3600
125 let minutes=deltatime/60
126 let minutes=minutes%60
127 let seconds=deltatime%60
128 printf "Execution Time: %d:%02d:%02d\n" $hours $minutes $seconds
130 exit