1104 lines
44 KiB
Bash
Executable File
1104 lines
44 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
CUR_DIR=$(cd `dirname $0`; pwd)
|
|
TOP_DIR=$CUR_DIR/../..
|
|
PSRAM_ENABLE_GEN=$(echo $psram_enable)
|
|
FLASH_LAYOUT_INDEX=$(echo $layout_index)
|
|
PROTO_TYPE=$(echo ${PROTO_TYPE} | tr '[a-z]' '[A-Z]')
|
|
RF_ENABLE=$(echo ${rf_enable})
|
|
DUAL_ENABLE=$(echo ${dual_enable})
|
|
NEW_TYPE_CCO=$(echo ${new_type_cco})
|
|
SEC_CPU_ENABLE=$(echo ${sec_cpu_enable})
|
|
while getopts "d:c:i:r:m:s:a:b:v:h:p:t:f:" arg
|
|
do
|
|
case $arg in
|
|
c)
|
|
echo "c's arg: $OPTARG"
|
|
BOARD_LOWER=$OPTARG
|
|
;;
|
|
d)
|
|
echo "d's arg: $OPTARG"
|
|
CHIP_ID=$OPTARG
|
|
;;
|
|
i)
|
|
echo "i's arg: $OPTARG"
|
|
IMG_LOWER=$OPTARG
|
|
;;
|
|
r)
|
|
echo "r's arg: $OPTARG"
|
|
RUN_LOWER=$OPTARG
|
|
;;
|
|
m)
|
|
echo "m's arg: $OPTARG"
|
|
MODE_LOWER=$OPTARG
|
|
;;
|
|
s)
|
|
echo "s's arg: $OPTARG"
|
|
SIZE_LOWER=$OPTARG
|
|
;;
|
|
a)
|
|
echo "a's arg: $OPTARG"
|
|
APP_LOWER=$OPTARG
|
|
;;
|
|
b)
|
|
echo "b's arg: $OPTARG"
|
|
CHIP_VER_LOWER=$OPTARG
|
|
;;
|
|
v)
|
|
echo "v's arg: $OPTARG"
|
|
DB_LOWER=$OPTARG
|
|
;;
|
|
p)
|
|
echo "p's arg: $OPTARG"
|
|
PSRAM_SIZE=$OPTARG
|
|
;;
|
|
t)
|
|
echo "t's arg: $OPTARG"
|
|
CORE_TYPE_LOWER=$OPTARG
|
|
;;
|
|
f)
|
|
echo "f's arg: $OPTARG"
|
|
FAST_BOOT=$OPTARG
|
|
;;
|
|
h)
|
|
echo "[Usage]"
|
|
echo "$0 -d (hw chip id) -c (custom name) -i (image type) -r (run environment) -m (mode type) -s (flash size) -a (app_name)"
|
|
exit 1
|
|
;;
|
|
?)
|
|
echo "unsupport argument"
|
|
echo "[Usage]"
|
|
echo "$0 -d (hw chip id) -c (custom name) -i (image type) -r (run environment) -s (flash size) -a (app_name)"
|
|
exit 1
|
|
;;
|
|
esac
|
|
done
|
|
|
|
if [ "$BOARD_LOWER" == "" ] || [ "$CHIP_ID" == "" ] || [ "$IMG_LOWER" == "" ] || [ "$RUN_LOWER" == "" ]; then
|
|
echo "input argument error"
|
|
echo "[Usage]"
|
|
echo "$0 -d (hw chip id) -c (custom name) -i (image type) -r (run environment)"
|
|
exit 1
|
|
fi
|
|
|
|
#get iot_ver from iot_version.h.
|
|
IOT_VER_FILE="${TOP_DIR}/inc/iot_version.h"
|
|
get_iot_ver() {
|
|
ver_file=$1
|
|
major_ver=`cat ${ver_file} |grep " AP_FIRMWARE_VERSION_MAJOR"|awk '{print $3}'`
|
|
mionor_ver=`cat ${ver_file} |grep " AP_FIRMWARE_VERSION_MINOR"|awk '{print $3}'`
|
|
micro_ver=`cat ${ver_file} |grep " AP_FIRMWARE_VERSION_MICRO"|awk '{print $3}'`
|
|
build_ver=`cat ${ver_file} |grep " AP_FIRMWARE_VERSION_BUILD"|awk '{print $3}'`
|
|
|
|
major_ver=${major_ver//(/}
|
|
major_ver=${major_ver//)/}
|
|
mionor_ver=${mionor_ver//(/}
|
|
mionor_ver=${mionor_ver//)/}
|
|
micro_ver=${micro_ver//(/}
|
|
micro_ver=${micro_ver//)/}
|
|
build_ver=${build_ver//(/}
|
|
build_ver=${build_ver//)/}
|
|
|
|
IOT_VER="${major_ver}.${mionor_ver}.${micro_ver}.${build_ver}"
|
|
return
|
|
}
|
|
|
|
if [ "$PSRAM_ENABLE_GEN" == "1" ]; then
|
|
if [ "$PSRAM_SIZE" == "" ] || [ "$PSRAM_SIZE" == "4" ]; then
|
|
# the default psram size is 4m
|
|
PSRAM_SIZE_STR="F"
|
|
PSRAM_SIZE_PARAM="P4"
|
|
elif [ "$PSRAM_SIZE" == "8" ]; then
|
|
PSRAM_SIZE_STR="E"
|
|
PSRAM_SIZE_PARAM="P8"
|
|
else
|
|
PSRAM_SIZE_STR="T"
|
|
PSRAM_SIZE_PARAM="P2"
|
|
fi
|
|
else
|
|
PSRAM_SIZE="0"
|
|
PSRAM_SIZE_PARAM="P0"
|
|
fi
|
|
|
|
#distinguish iot or sg app.
|
|
if [ "$APP_LOWER" == "plc_uart" ] || [ "$APP_LOWER" == "demo" ] || [ "$APP_LOWER" == "ge" ] || [ "$APP_LOWER" == "ge_ckq" ] \
|
|
|| [ "$APP_LOWER" == "ge_lwip" ] || [ "$APP_LOWER" == "ge_ext" ] || [ "$APP_LOWER" == "cus_at" ] \
|
|
|| [ "$APP_LOWER" == "demo_lwip" ] || [ "$APP_LOWER" == "iot_sniffer" ] \
|
|
|| [ "$APP_LOWER" == "ge_micro" ] || [ "$APP_LOWER" == "sila" ] || [ "$APP_LOWER" == "at_micro" ] || [ "$APP_LOWER" == "iot_dl645" ]; then
|
|
IOT_SMART_BUILD=1
|
|
APP_UPPER=$(echo $APP_LOWER | tr '[a-z]' '[A-Z]')
|
|
else
|
|
IOT_SMART_BUILD=0
|
|
if [ "$APP_LOWER" == "brm" ] || [ "$APP_LOWER" == "brk" ] || [ "$APP_LOWER" == "tfm" ] || [ "$APP_LOWER" == "bsrm" ] \
|
|
|| [ "$APP_LOWER" == "bsrm_cus" ] || [ "$APP_LOWER" == "solr" ] || [ "$APP_LOWER" == "sg_ext" ] \
|
|
|| [ "$APP_LOWER" == "sg_meter" ] || [ "$APP_LOWER" == "sniffer" ]; then
|
|
APP_UPPER=$(echo $APP_LOWER | tr '[a-z]' '[A-Z]')
|
|
else
|
|
APP_UPPER="SG"
|
|
fi
|
|
fi
|
|
|
|
if [ "$DB_LOWER" == "release" ]; then
|
|
DB_RLS_FLAG="R"
|
|
else
|
|
DB_LOWER="debug"
|
|
DB_RLS_FLAG="D"
|
|
fi
|
|
|
|
BOARD_UPPER=$(echo $BOARD_LOWER | tr '[a-z]' '[A-Z]')
|
|
IMG_UPPER=$(echo $IMG_LOWER | tr '[a-z]' '[A-Z]')
|
|
RUN_UPPER=$(echo $RUN_LOWER | tr '[a-z]' '[A-Z]')
|
|
MODE_UPPER=$(echo $MODE_LOWER | tr '[a-z]' '[A-Z]')
|
|
SIZE_UPPER=$(echo $SIZE_LOWER | tr '[a-z]' '[A-Z]')
|
|
CHIP_VER_UPPER=$(echo $CHIP_VER_LOWER | tr '[a-z]' '[A-Z]')
|
|
CORE_TYPE_UPPER=$(echo $CORE_TYPE_LOWER | tr '[a-z]' '[A-Z]')
|
|
|
|
# cleanup old file.
|
|
rm -f $CUR_DIR/sbl.bin
|
|
rm -f $CUR_DIR/pib.bin
|
|
rm -f $CUR_DIR/sp.bin
|
|
rm -f $CUR_DIR/oem.bin
|
|
rm -f $CUR_DIR/ht.bin
|
|
rm -f $CUR_DIR/ht_1p.bin
|
|
rm -f $CUR_DIR/ht*.fw
|
|
|
|
if [ "x${CHIP_VER_UPPER}" == "x3" ]; then
|
|
# clear files and generate folders
|
|
if [ "x${CORE_TYPE_UPPER}" == "xAMPPLC" ]; then
|
|
rm -f $CUR_DIR/ht_cus.bin
|
|
rm -f $CUR_DIR/ht_cus.bin.fw
|
|
rm -f $CUR_DIR/ht_cus_ori.bin
|
|
fi
|
|
rm -f $CUR_DIR/ht_ori.bin
|
|
|
|
if [[ "${BOARD_LOWER}" == "fpga"* ]]; then
|
|
BIN_PATH=${CUR_DIR}/customer/${SIZE_UPPER}/fpga/${IMG_LOWER}/bin/
|
|
OUT_PATH=${CUR_DIR}/customer/${SIZE_UPPER}/fpga/${IMG_LOWER}/out/
|
|
elif [[ "${BOARD_LOWER}" == "evb32"* ]]; then
|
|
BIN_PATH=${CUR_DIR}/customer/${SIZE_UPPER}/hz_evb/${IMG_LOWER}/bin/
|
|
OUT_PATH=${CUR_DIR}/customer/${SIZE_UPPER}/hz_evb/${IMG_LOWER}/out/
|
|
elif [[ "${BOARD_LOWER}" == "evb558"* ]]; then
|
|
BIN_PATH=${CUR_DIR}/customer/${SIZE_UPPER}/qj_evb/${IMG_LOWER}/bin/
|
|
OUT_PATH=${CUR_DIR}/customer/${SIZE_UPPER}/qj_evb/${IMG_LOWER}/out/
|
|
elif [[ "${BOARD_LOWER}" == "evb671"* ]]; then
|
|
BIN_PATH=${CUR_DIR}/customer/${SIZE_UPPER}/flx_evb/${IMG_LOWER}/bin/
|
|
OUT_PATH=${CUR_DIR}/customer/${SIZE_UPPER}/flx_evb/${IMG_LOWER}/out/
|
|
elif [[ "${BOARD_LOWER}" == "htzd3211pt03" ]]; then
|
|
BIN_PATH=${CUR_DIR}/customer/${SIZE_UPPER}/pt/${IMG_LOWER}/bin/
|
|
OUT_PATH=${CUR_DIR}/customer/${SIZE_UPPER}/pt/${IMG_LOWER}/out/
|
|
elif [[ "${BOARD_LOWER}" == "htzd"* ]]; then
|
|
BIN_PATH=${CUR_DIR}/customer/${SIZE_UPPER}/htzd/${IMG_LOWER}/bin/
|
|
OUT_PATH=${CUR_DIR}/customer/${SIZE_UPPER}/htzd/${IMG_LOWER}/out/
|
|
elif [[ "${BOARD_LOWER}" == "qj"* ]]; then
|
|
BIN_PATH=${CUR_DIR}/customer/${SIZE_UPPER}/qj/${IMG_LOWER}/bin/
|
|
OUT_PATH=${CUR_DIR}/customer/${SIZE_UPPER}/qj/${IMG_LOWER}/out/
|
|
elif [[ "${BOARD_LOWER}" == "flx"* ]]; then
|
|
BIN_PATH=${CUR_DIR}/customer/${SIZE_UPPER}/flx/${IMG_LOWER}/bin/
|
|
OUT_PATH=${CUR_DIR}/customer/${SIZE_UPPER}/flx/${IMG_LOWER}/out/
|
|
elif [[ "${BOARD_LOWER}" == "spe"* ]]; then
|
|
BIN_PATH=${CUR_DIR}/customer/${SIZE_UPPER}/spe/${IMG_LOWER}/bin/
|
|
OUT_PATH=${CUR_DIR}/customer/${SIZE_UPPER}/spe/${IMG_LOWER}/out/
|
|
elif [[ "${BOARD_LOWER}" == "gx"* ]]; then
|
|
BIN_PATH=${CUR_DIR}/customer/${SIZE_UPPER}/gx/${IMG_LOWER}/bin/
|
|
OUT_PATH=${CUR_DIR}/customer/${SIZE_UPPER}/gx/${IMG_LOWER}/out/
|
|
elif [[ "${BOARD_LOWER}" == "dt"* ]]; then
|
|
BIN_PATH=${CUR_DIR}/customer/${SIZE_UPPER}/dt/${IMG_LOWER}/bin/
|
|
OUT_PATH=${CUR_DIR}/customer/${SIZE_UPPER}/dt/${IMG_LOWER}/out/
|
|
elif [[ "${BOARD_LOWER}" == "evb5202"* ]]; then
|
|
BIN_PATH=${CUR_DIR}/customer/${SIZE_UPPER}/evb5202/${IMG_LOWER}/bin/
|
|
OUT_PATH=${CUR_DIR}/customer/${SIZE_UPPER}/evb5202/${IMG_LOWER}/out/
|
|
elif [[ "${BOARD_LOWER}" == "goldfinger_17p"* ]]; then
|
|
BIN_PATH=${CUR_DIR}/customer/${SIZE_UPPER}/goldfinger_17p/${IMG_LOWER}/bin/
|
|
OUT_PATH=${CUR_DIR}/customer/${SIZE_UPPER}/goldfinger_17p/${IMG_LOWER}/out/
|
|
elif [[ "${BOARD_LOWER}" == "stamp"* ]]; then
|
|
BIN_PATH=${CUR_DIR}/customer/${SIZE_UPPER}/stamp/${IMG_LOWER}/bin/
|
|
OUT_PATH=${CUR_DIR}/customer/${SIZE_UPPER}/stamp/${IMG_LOWER}/out/
|
|
elif [[ "${BOARD_LOWER}" == "ledc"* ]]; then
|
|
BIN_PATH=${CUR_DIR}/customer/${SIZE_UPPER}/ledc/${IMG_LOWER}/bin/
|
|
OUT_PATH=${CUR_DIR}/customer/${SIZE_UPPER}/ledc/${IMG_LOWER}/out/
|
|
elif [[ "${BOARD_LOWER}" == "yp"* ]]; then
|
|
BIN_PATH=${CUR_DIR}/customer/${SIZE_UPPER}/yp/${IMG_LOWER}/bin/
|
|
OUT_PATH=${CUR_DIR}/customer/${SIZE_UPPER}/yp/${IMG_LOWER}/out/
|
|
else
|
|
BIN_PATH=${CUR_DIR}/customer/${SIZE_UPPER}/${BOARD_LOWER}/${IMG_LOWER}/bin/
|
|
OUT_PATH=${CUR_DIR}/customer/${SIZE_UPPER}/${BOARD_LOWER}/${IMG_LOWER}/out/
|
|
fi
|
|
|
|
mkdir -p $BIN_PATH
|
|
mkdir -p $OUT_PATH
|
|
|
|
if [ "x${CORE_TYPE_UPPER}" == "xAMPPLC" ]; then
|
|
CFG_DIR=${TOP_DIR}"/build/cfg3"
|
|
else
|
|
CFG_DIR=${TOP_DIR}"/build/cfg3_plc"
|
|
fi
|
|
LDS_DIR=${TOP_DIR}"/startup/ldscripts/riscv3"
|
|
|
|
if [ "${RUN_UPPER}" == "UPGRADE" ]; then
|
|
if [ "${SIZE_UPPER}" != "" ]; then
|
|
if [ "$PSRAM_ENABLE_GEN" == "1" ]; then
|
|
CFG_NAME=${CFG_DIR}"/"${SIZE_LOWER}"_"${IMG_LOWER}"_upgrade_psram.cfg"
|
|
else
|
|
CFG_NAME=${CFG_DIR}"/"${SIZE_LOWER}"_"${IMG_LOWER}"_upgrade.cfg"
|
|
fi
|
|
else
|
|
CFG_NAME=${CFG_DIR}"/"${IMG_LOWER}"_upgrade.cfg"
|
|
fi
|
|
else
|
|
if [ ${IOT_SMART_BUILD} == 1 ]; then
|
|
if [ "${SIZE_UPPER}" == "2M" ] || [ "${SIZE_UPPER}" == "4M" ]; then
|
|
if [ "${RUN_UPPER}" == "PSRAM" ]; then
|
|
CFG_NAME=${CFG_DIR}"/smart_"${SIZE_LOWER}"_"${IMG_LOWER}_psram.cfg
|
|
else
|
|
CFG_NAME=${CFG_DIR}"/smart_"${SIZE_LOWER}"_"${IMG_LOWER}.cfg
|
|
fi
|
|
else
|
|
CFG_NAME=${CFG_DIR}"/smart_"${IMG_LOWER}.cfg
|
|
fi
|
|
else
|
|
if [ "${SIZE_UPPER}" != "" ]; then
|
|
if [ "${RUN_UPPER}" == "PSRAM" ]; then
|
|
CFG_NAME=${CFG_DIR}"/"${SIZE_LOWER}"_"${IMG_LOWER}_psram.cfg
|
|
else
|
|
CFG_NAME=${CFG_DIR}"/"${SIZE_LOWER}"_"${IMG_LOWER}.cfg
|
|
fi
|
|
else
|
|
if [ "${RUN_UPPER}" == "PSRAM" ]; then
|
|
CFG_NAME=${CFG_DIR}"/"${IMG_LOWER}_psram.cfg
|
|
else
|
|
CFG_NAME=${CFG_DIR}"/"${IMG_LOWER}.cfg
|
|
fi
|
|
fi
|
|
fi
|
|
fi
|
|
|
|
TMP_CFG_NAME=${CFG_DIR}"/"${BOARD_LOWER}_${IMG_LOWER}_tmp.cfg
|
|
cp ${CFG_NAME} ${TMP_CFG_NAME}
|
|
|
|
if [ "x${FAST_BOOT}" == "x1" ]; then
|
|
OPT_KEYWORD="FB-"
|
|
else
|
|
OPT_KEYWORD=""
|
|
fi
|
|
|
|
if [ "x${DUAL_ENABLE}" == "x1" ]; then
|
|
OPT_KEYWORD=DUAL-${OPT_KEYWORD}
|
|
fi
|
|
|
|
if [ "x${RF_ENABLE}" == "x1" ]; then
|
|
OPT_KEYWORD=RF-${OPT_KEYWORD}
|
|
fi
|
|
|
|
#set option keyword to fw name for kl3.
|
|
OPT_KEYWORD=${PROTO_TYPE}-${OPT_KEYWORD}
|
|
if [ "x${CORE_TYPE_UPPER}" == "xAMPPLC" ]; then
|
|
OPT_KEYWORD="AMPPLC-${OPT_KEYWORD}"
|
|
fi
|
|
|
|
# prepare ht.bin
|
|
if [ "${IMG_UPPER}" == "CKB" ]; then
|
|
HT_FILE="ht_sta.bin"
|
|
else
|
|
HT_FILE="ht_"${IMG_LOWER}".bin"
|
|
fi
|
|
if [ "x${CORE_TYPE_UPPER}" == "xAMPPLC" ]; then
|
|
cp ${TOP_DIR}/ap/.output/cus/lib/${HT_FILE} $CUR_DIR/ht_cus.bin
|
|
fi
|
|
|
|
if [[ "${BOARD_LOWER}" == "*3201*" ]]; then
|
|
chip_ver=3201
|
|
fi
|
|
|
|
if [[ "${BOARD_LOWER}" == "*3211*" ]]; then
|
|
chip_ver=3211
|
|
fi
|
|
|
|
if [[ "${BOARD_LOWER}" == "*3031*" ]]; then
|
|
chip_ver=3031
|
|
fi
|
|
|
|
if [ "${IMG_UPPER}" == "CCO" ]; then
|
|
if [ ${IOT_SMART_BUILD} == 1 ]; then
|
|
if [ "${chip_ver}" == "3201" ]; then
|
|
cp $CUR_DIR/iot_ht_3p.bin $CUR_DIR/ht.bin
|
|
fi
|
|
cp $CUR_DIR/iot_ht_1p.bin $CUR_DIR/ht_1p.bin
|
|
else
|
|
cp $CUR_DIR/iot_ht_3p.bin $CUR_DIR/ht.bin
|
|
fi
|
|
else
|
|
cp ${TOP_DIR}/ap/.output/plc/lib/${HT_FILE} $CUR_DIR/ht.bin
|
|
fi
|
|
|
|
sed -i "/img_type=./a layout_index=${FLASH_LAYOUT_INDEX}" ${TMP_CFG_NAME}
|
|
|
|
#config run address and little header of img.
|
|
sbl_lds_file="${LDS_DIR}/link_sbl.lds"
|
|
sbl_run_addr=`grep -ri "iram\ (rxai\!w)" ${sbl_lds_file}|awk '{print $6}'|awk -F, '{print $1}'`
|
|
sed -i "/path=\.\/sbl.bin/a run_addr=${sbl_run_addr}" ${TMP_CFG_NAME}
|
|
|
|
if [ "x${FAST_BOOT}" == "x1" ]; then
|
|
sed -i "s/fastboot=./fastboot=1/g" ${TMP_CFG_NAME}
|
|
fi
|
|
|
|
if [ "x${CORE_TYPE_UPPER}" == "xAMPPLC" ]; then
|
|
# add run addr
|
|
cus_lds_file=$CUR_DIR/tmp_cus.lds
|
|
lds_file=$CUR_DIR/tmp_plc.lds
|
|
|
|
sed -i "/flash_size=./a psram_size=${PSRAM_SIZE}" ${TMP_CFG_NAME}
|
|
plc_run_addr=`grep -ri "flash\ (rxai\!w)" ${lds_file}|awk '{print $6}'|awk -F, '{print $1}'`
|
|
cus_run_addr=`grep -ri "flash\ (rxai\!w)" ${cus_lds_file} |awk '{print $6}'|awk -F, '{print $1}'`
|
|
sed -i "/path=\.\/ht.bin/a run_addr=${plc_run_addr}" ${TMP_CFG_NAME}
|
|
sed -i "/path=\.\/ht_cus.bin/a run_addr=${cus_run_addr}" ${TMP_CFG_NAME}
|
|
|
|
# add iot version
|
|
get_iot_ver ${IOT_VER_FILE}
|
|
sed -i "s/version=.*/version=${IOT_VER}/g" ${TMP_CFG_NAME}
|
|
|
|
if [ "${IMG_UPPER}" == "CCO" ] && [ ${IOT_SMART_BUILD} == 1 ]; then
|
|
sed -i "s/ht.bin/ht_1p.bin/g" ${TMP_CFG_NAME}
|
|
# add header
|
|
./ah -a ${TMP_CFG_NAME}
|
|
sed -i "s/ht_1p.bin/ht.bin/g" ${TMP_CFG_NAME}
|
|
if [ "${chip_ver}" == "3201" ]; then
|
|
#avoid ht_cus.bin add head twice
|
|
sed -i "s/ht_cus.bin/ht_cus_tmp.bin/g" ${TMP_CFG_NAME}
|
|
# add header
|
|
./ah -a ${TMP_CFG_NAME}
|
|
sed -i "s/ht_cus_tmp.bin/ht_cus.bin/g" ${TMP_CFG_NAME}
|
|
fi
|
|
else
|
|
# add header
|
|
./ah -a ${TMP_CFG_NAME}
|
|
fi
|
|
else
|
|
# add run addr
|
|
lds_file=$CUR_DIR/tmp_plc.lds
|
|
|
|
sed -i "/flash_size=./a psram_size=${PSRAM_SIZE}" ${TMP_CFG_NAME}
|
|
plc_run_addr=`grep -ri "flash\ (rxai\!w)" ${lds_file}|awk '{print $6}'|awk -F, '{print $1}'`
|
|
sed -i "/path=\.\/ht.bin/a run_addr=${plc_run_addr}" ${TMP_CFG_NAME}
|
|
|
|
# add iot version
|
|
get_iot_ver ${IOT_VER_FILE}
|
|
sed -i "s/version=.*/version=${IOT_VER}/g" ${TMP_CFG_NAME}
|
|
|
|
if [ "${IMG_UPPER}" == "CCO" ] && [ ${IOT_SMART_BUILD} == 1 ]; then
|
|
sed -i "s/ht.bin/ht_1p.bin/g" ${TMP_CFG_NAME}
|
|
# add header
|
|
./ah -a ${TMP_CFG_NAME}
|
|
sed -i "s/ht_1p.bin/ht.bin/g" ${TMP_CFG_NAME}
|
|
if [ "${chip_ver}" == "3201" ]; then
|
|
# add header
|
|
./ah -a ${TMP_CFG_NAME}
|
|
fi
|
|
else
|
|
# add header
|
|
./ah -a ${TMP_CFG_NAME}
|
|
fi
|
|
fi
|
|
|
|
#config lzma.
|
|
if [ "${MODE_UPPER}" == "LZMA" ]; then
|
|
if [ "x${CORE_TYPE_UPPER}" == "xAMPPLC" ] && [ "x${FAST_BOOT}" != "x1" ]; then
|
|
./elzma e $CUR_DIR/ht_cus.bin $CUR_DIR/ht_cus.bin.lzma
|
|
cp $CUR_DIR/ht_cus.bin $CUR_DIR/ht_cus.bin.fw
|
|
mv $CUR_DIR/ht_cus.bin.lzma $CUR_DIR/ht_cus.bin
|
|
fi
|
|
|
|
if [ "${IMG_UPPER}" == "CCO" ] && [ ${IOT_SMART_BUILD} == 1 ]; then
|
|
./elzma e $CUR_DIR/ht_1p.bin $CUR_DIR/ht_1p.bin.lzma
|
|
cp $CUR_DIR/ht_1p.bin $CUR_DIR/ht_1p.bin.fw
|
|
mv $CUR_DIR/ht_1p.bin.lzma $CUR_DIR/ht_1p.bin
|
|
if [ "${chip_ver}" == "3201" ]; then
|
|
./elzma e $CUR_DIR/ht.bin $CUR_DIR/ht.bin.lzma
|
|
cp $CUR_DIR/ht.bin $CUR_DIR/ht.bin.fw
|
|
mv $CUR_DIR/ht.bin.lzma $CUR_DIR/ht.bin
|
|
fi
|
|
else
|
|
./elzma e $CUR_DIR/ht.bin $CUR_DIR/ht.bin.lzma
|
|
cp $CUR_DIR/ht.bin $CUR_DIR/ht.bin.fw
|
|
mv $CUR_DIR/ht.bin.lzma $CUR_DIR/ht.bin
|
|
fi
|
|
fi
|
|
|
|
cp $TOP_DIR/sbl/.output/plc/lib/kunlun_sbl.bin $CUR_DIR/sbl.bin
|
|
# Kl3 compiles ram.bin separately to improve compilation speed, so do not need process ram.bin here.
|
|
|
|
if [ "${BOARD_UPPER}" == "QJ5580DCCO03" ] || [ "${BOARD_UPPER}" == "QJ5580DCKB03" ] || [ "${BOARD_UPPER}" == "QJ5582DSTA03" ] || [ "${BOARD_UPPER}" == "QJ5582DIIC03" ] ||
|
|
[ "${BOARD_UPPER}" == "QJ5582D3PS03" ] || [ "${BOARD_UPPER}" == "EVB5580DCCO03" ] || [ "${BOARD_UPPER}" == "EVB5582DSTA03" ] || [ "${BOARD_UPPER}" == "EVB5582D3PS03" ]; then
|
|
sed -i "s,encrypt_mode=0x0,encrypt_mode=0x3,g" ${TMP_CFG_NAME}
|
|
sed -i "s,encrypt_pattern=0x55,encrypt_pattern=0x66,g" ${TMP_CFG_NAME}
|
|
sed -i "s,vendor_id=18516,vendor_id=20810,g" ${TMP_CFG_NAME}
|
|
fi
|
|
|
|
if [ "${BOARD_UPPER}" == "FLX6710CCO03" ] || [ "${BOARD_UPPER}" == "FLX6710CKB03" ] || [ "${BOARD_UPPER}" == "FLX6711STA03" ] || [ "${BOARD_UPPER}" == "FLX6711IIC03" ] ||
|
|
[ "${BOARD_UPPER}" == "FLX67113PS03" ] || [ "${BOARD_UPPER}" == "EVB6710CCO03" ] || [ "${BOARD_UPPER}" == "EVB6711STA03" ] || [ "${BOARD_UPPER}" == "EVB67113PS03" ]; then
|
|
sed -i "s,encrypt_mode=0x0,encrypt_mode=0x3,g" ${TMP_CFG_NAME}
|
|
sed -i "s,encrypt_pattern=0x55,encrypt_pattern=0x99,g" ${TMP_CFG_NAME}
|
|
sed -i "s,vendor_id=18516,vendor_id=20552,g" ${TMP_CFG_NAME}
|
|
fi
|
|
|
|
if [ "${BOARD_UPPER}" == "SPE7303CCO03" ] || [ "${BOARD_UPPER}" == "SPE7303CKB03" ] || [ "${BOARD_UPPER}" == "SPE7301STA03" ] || [ "${BOARD_UPPER}" == "SPE7301IIC03" ] ||
|
|
[ "${BOARD_UPPER}" == "SPE73013PS03" ]; then
|
|
sed -i "s,encrypt_mode=0x0,encrypt_mode=0x3,g" ${TMP_CFG_NAME}
|
|
sed -i "s,encrypt_pattern=0x55,encrypt_pattern=0xcc,g" ${TMP_CFG_NAME}
|
|
sed -i "s,vendor_id=18516,vendor_id=20549,g" ${TMP_CFG_NAME}
|
|
fi
|
|
|
|
if [ "${BOARD_UPPER}" == "GX2001CCO03" ] || [ "${BOARD_UPPER}" == "GX2001CKB03" ] || [ "${BOARD_UPPER}" == "GX2011STA03" ] || [ "${BOARD_UPPER}" == "GX2011IIC03" ] ||
|
|
[ "${BOARD_UPPER}" == "GX20113PS03" ]; then
|
|
sed -i "s,encrypt_mode=0x0,encrypt_mode=0x3,g" ${TMP_CFG_NAME}
|
|
sed -i "s,encrypt_pattern=0x55,encrypt_pattern=0x33,g" ${TMP_CFG_NAME}
|
|
sed -i "s,vendor_id=18516,vendor_id=18264,g" ${TMP_CFG_NAME}
|
|
fi
|
|
|
|
if [ "${BOARD_UPPER}" == "DT0530CCO03" ] || [ "${BOARD_UPPER}" == "DT0531STA03" ] || [ "${BOARD_UPPER}" == "DT0531IIC03" ] || [ "${BOARD_UPPER}" == "DT05313PS03" ] ||
|
|
[ "${BOARD_UPPER}" == "DT0530CKB03" ]; then
|
|
sed -i "s,encrypt_mode=0x0,encrypt_mode=0x3,g" ${TMP_CFG_NAME}
|
|
sed -i "s,encrypt_pattern=0x55,encrypt_pattern=0xdd,g" ${TMP_CFG_NAME}
|
|
sed -i "s,vendor_id=18516,vendor_id=17492,g" ${TMP_CFG_NAME}
|
|
fi
|
|
|
|
if [ "${BOARD_UPPER}" == "YP8801CCO03" ] || [ "${BOARD_UPPER}" == "YP8811STA03" ] || [ "${BOARD_UPPER}" == "YP88113PS03" ] || [ "${BOARD_UPPER}" == "YP8801CKB03" ] ||
|
|
[ "${BOARD_UPPER}" == "YP8811IIC03" ]; then
|
|
sed -i "s,encrypt_mode=0x0,encrypt_mode=0x3,g" ${TMP_CFG_NAME}
|
|
sed -i "s,encrypt_pattern=0x55,encrypt_pattern=0xa9,g" ${TMP_CFG_NAME}
|
|
sed -i "s,vendor_id=18516,vendor_id=22864,g" ${TMP_CFG_NAME}
|
|
fi
|
|
|
|
# prepare oem.bin
|
|
if [ "x${CORE_TYPE_UPPER}" == "xAMPPLC" ]; then
|
|
if [ ${IOT_SMART_BUILD} == 1 ]; then
|
|
OEM_CFG=${BOARD_UPPER}"_AMPIOT_OEM.ini"
|
|
OEM_FILE=${BOARD_UPPER}"_AMPIOT_OEM.bin"
|
|
else
|
|
OEM_CFG=${BOARD_UPPER}"_AMPSG_OEM.ini"
|
|
OEM_FILE=${BOARD_UPPER}"_AMPSG_OEM.bin"
|
|
fi
|
|
else
|
|
OEM_CFG=${BOARD_UPPER}"_OEM.ini"
|
|
OEM_FILE=${BOARD_UPPER}"_OEM.bin"
|
|
fi
|
|
cp $TOP_DIR/tools/oem/$OEM_CFG ./tmp_oem.ini
|
|
#set mid for iot board(cco and sta use same oem.ini)
|
|
if [ ${IOT_SMART_BUILD} == 1 ]; then
|
|
if [ "${IMG_UPPER}" == "CCO" ]; then
|
|
sed -i "s/mid.*/mid 1/g" ./tmp_oem.ini
|
|
elif [ "${IMG_UPPER}" == "STA" ]; then
|
|
sed -i "s/mid.*/mid 0/g" ./tmp_oem.ini
|
|
fi
|
|
fi
|
|
if [ "${RUN_UPPER}" != "UPGRADE" ]; then
|
|
./oem_tool --input=./tmp_oem.ini --output=$TOP_DIR/tools/oem/$OEM_FILE
|
|
fi
|
|
rm ./tmp_oem.ini
|
|
cp $TOP_DIR/tools/oem/$OEM_FILE $CUR_DIR/oem.bin
|
|
|
|
# prepare pib file
|
|
PIB_IMG=${BOARD_UPPER}
|
|
|
|
#BRM BSRM BSRM_CUS BRMT.
|
|
if [ "${BOARD_UPPER}" == "HTZD3201BSRM03" ] || [ "${BOARD_UPPER}" == "HTZD3201BRMT03" ]; then
|
|
PIB_IMG="EVB5202STA03"
|
|
fi
|
|
|
|
# HTZD + EVB.
|
|
if [ "${BOARD_UPPER}" == "HTZD3201CCO03" ] || [ "${BOARD_UPPER}" == "EVB3201CCO03" ] || [ "${BOARD_UPPER}" == "EVB3201CCO03_RFIN" ]; then
|
|
PIB_IMG=HTZDCCO
|
|
elif [ "${BOARD_UPPER}" == "HTZD3211IIC03" ] || [ "${BOARD_UPPER}" == "EVB3211IIC03" ]; then
|
|
PIB_IMG=HTZDIIC
|
|
elif [ "${BOARD_UPPER}" == "HTZD32113PS03" ] || [ "${BOARD_UPPER}" == "EVB32113PS03" ] ||
|
|
[ "${BOARD_UPPER}" == "HTZD3211STA03" ] || [ "${BOARD_UPPER}" == "EVB3211STA03" ] ||
|
|
[ "${BOARD_UPPER}" == "EVB3211STA03_RFIN" ] || [ "${BOARD_UPPER}" == "HTZD3211PT03" ]; then
|
|
PIB_IMG=HTZDSTA
|
|
fi
|
|
|
|
if [[ "${BOARD_UPPER}" == *"CKB03" ]]; then
|
|
# CKB.
|
|
PIB_IMG=HTZDSTA01_PIB
|
|
fi
|
|
|
|
if [[ "${BOARD_UPPER}" == "EVB32"* ]]; then
|
|
BOARD_UPPER=${BOARD_UPPER/EVB/HZEVB}
|
|
fi
|
|
BOARD_UPPER=${BOARD_UPPER/3201/}
|
|
BOARD_UPPER=${BOARD_UPPER/3211/}
|
|
BOARD_UPPER=${BOARD_UPPER/3031/}
|
|
|
|
# QJ + EVB.
|
|
if [ "${BOARD_UPPER}" == "QJ5580DCCO03" ] || [ "${BOARD_UPPER}" == "EVB5580DCCO03" ]; then
|
|
PIB_IMG=HTZDCCO
|
|
elif [ "${BOARD_UPPER}" == "QJ5582D3PS03" ] || [ "${BOARD_UPPER}" == "EVB5582D3PS03" ] || \
|
|
[ "${BOARD_UPPER}" == "QJ5582DSTA03" ] || [ "${BOARD_UPPER}" == "EVB5582DSTA03" ] || \
|
|
[ "${BOARD_UPPER}" == "QJ5582DIIC03" ]; then
|
|
PIB_IMG=HTZDSTA
|
|
fi
|
|
if [[ "${BOARD_UPPER}" == "EVB558"* ]]; then
|
|
BOARD_UPPER=${BOARD_UPPER/EVB/QJEVB}
|
|
fi
|
|
BOARD_UPPER=${BOARD_UPPER/5580D/}
|
|
BOARD_UPPER=${BOARD_UPPER/5582D/}
|
|
|
|
# FLX + EVB.
|
|
if [ "${BOARD_UPPER}" == "FLX6710CCO03" ] || [ "${BOARD_UPPER}" == "EVB6710CCO03" ]; then
|
|
PIB_IMG=HTZDCCO
|
|
elif [ "${BOARD_UPPER}" == "FLX67113PS03" ] || [ "${BOARD_UPPER}" == "EVB67113PS03" ] || \
|
|
[ "${BOARD_UPPER}" == "FLX6711IIC03" ] || \
|
|
[ "${BOARD_UPPER}" == "FLX6711STA03" ] || [ "${BOARD_UPPER}" == "EVB6711STA03" ]; then
|
|
PIB_IMG=HTZDSTA
|
|
fi
|
|
if [[ "${BOARD_UPPER}" == "EVB671"* ]]; then
|
|
BOARD_UPPER=${BOARD_UPPER/EVB/FLXEVB}
|
|
fi
|
|
BOARD_UPPER=${BOARD_UPPER/6710/}
|
|
BOARD_UPPER=${BOARD_UPPER/6711/}
|
|
|
|
# SPE.
|
|
if [ "${BOARD_UPPER}" == "SPE7303CCO03" ]; then
|
|
PIB_IMG=HTZDCCO
|
|
elif [ "${BOARD_UPPER}" == "SPE73013PS03" ] || [ "${BOARD_UPPER}" == "SPE7301IIC03" ] || \
|
|
[ "${BOARD_UPPER}" == "SPE7301STA03" ] ; then
|
|
PIB_IMG=HTZDSTA
|
|
fi
|
|
BOARD_UPPER=${BOARD_UPPER/7303/}
|
|
BOARD_UPPER=${BOARD_UPPER/7301/}
|
|
|
|
# GX.
|
|
if [ "${BOARD_UPPER}" == "GX2001CCO03" ]; then
|
|
PIB_IMG=HTZDCCO
|
|
elif [ "${BOARD_UPPER}" == "GX20113PS03" ] || [ "${BOARD_UPPER}" == "GX2011IIC03" ] || \
|
|
[ "${BOARD_UPPER}" == "GX2011STA03" ] ; then
|
|
PIB_IMG=HTZDSTA
|
|
fi
|
|
BOARD_UPPER=${BOARD_UPPER/2001/}
|
|
BOARD_UPPER=${BOARD_UPPER/2011/}
|
|
|
|
# DT.
|
|
if [ "${BOARD_UPPER}" == "DT0530CCO03" ]; then
|
|
PIB_IMG=HTZDCCO
|
|
elif [ "${BOARD_UPPER}" == "DT05313PS03" ] || [ "${BOARD_UPPER}" == "DT0531STA03" ] || \
|
|
[ "${BOARD_UPPER}" == "DT0531IIC03" ] ; then
|
|
PIB_IMG=HTZDSTA
|
|
fi
|
|
BOARD_UPPER=${BOARD_UPPER/0530/}
|
|
BOARD_UPPER=${BOARD_UPPER/0531/}
|
|
|
|
# YP.
|
|
if [ "${BOARD_UPPER}" == "YP8801CCO03" ]; then
|
|
PIB_IMG=HTZDCCO
|
|
elif [ "${BOARD_UPPER}" == "YP88113PS03" ] || [ "${BOARD_UPPER}" == "YP8811STA03" ] || \
|
|
[ "${BOARD_UPPER}" == "YP8811IIC03" ] ; then
|
|
PIB_IMG=HTZDSTA
|
|
fi
|
|
BOARD_UPPER=${BOARD_UPPER/8801/}
|
|
BOARD_UPPER=${BOARD_UPPER/8811/}
|
|
|
|
# GOLDFINGER.
|
|
if [ "${BOARD_UPPER}" == "GOLDFINGER_17P03" ]; then
|
|
if [ "${IMG_UPPER}" == "CCO" ]; then
|
|
PIB_IMG=${BOARD_UPPER/GOLDFINGER_17P/HTZD3201CCO}
|
|
BOARD_UPPER=${BOARD_UPPER/GOLDFINGER_17P/GOLDFINGER_17PCCO}
|
|
else
|
|
PIB_IMG=${BOARD_UPPER/GOLDFINGER_17P/HTZD3211STA}
|
|
BOARD_UPPER=${BOARD_UPPER/GOLDFINGER_17P/GOLDFINGER_17PSTA}
|
|
fi
|
|
fi
|
|
|
|
# STAMP.
|
|
if [ "${BOARD_UPPER}" == "STAMP03" ]; then
|
|
if [ "${IMG_UPPER}" == "CCO" ]; then
|
|
PIB_IMG=${BOARD_UPPER/STAMP/HTZD3201CCO}
|
|
BOARD_UPPER=${BOARD_UPPER/STAMP/STAMPCCO}
|
|
else
|
|
PIB_IMG=${BOARD_UPPER/STAMP/HTZD3211STA}
|
|
BOARD_UPPER=${BOARD_UPPER/STAMP/STAMPSTA}
|
|
fi
|
|
fi
|
|
|
|
# LEDC.
|
|
if [ "${BOARD_UPPER}" == "LEDC03" ]; then
|
|
if [ "${IMG_UPPER}" == "CCO" ]; then
|
|
PIB_IMG=${BOARD_UPPER/LEDC/HTZD3201CCO}
|
|
BOARD_UPPER=${BOARD_UPPER/LEDC/LEDCCCO}
|
|
else
|
|
PIB_IMG=${BOARD_UPPER/LEDC/HTZD3211STA}
|
|
BOARD_UPPER=${BOARD_UPPER/LEDC/LEDCSTA}
|
|
fi
|
|
fi
|
|
|
|
PIB_SRC_PATH=${TOP_DIR}/tools/pib/
|
|
cd ${PIB_SRC_PATH}
|
|
|
|
#kl3 pt board only need two general pib files
|
|
if [ "${BOARD_UPPER}" == "HTZDPT03" ]; then
|
|
PIB_FILE=HTZDSTA01_PIB.bin
|
|
LP_PIB_FILE=HTZDSTA01_LP_PIB.bin
|
|
else
|
|
PIB_FILE=`ls ${PIB_SRC_PATH} | grep "${PIB_IMG}" | grep "PIB"`
|
|
if [ "${IOT_SMART_BUILD}" == "0" ]; then
|
|
LP_PIB_FILE=`ls ${PIB_SRC_PATH} | grep "${PIB_IMG}" | grep "LP_PIB"`
|
|
fi
|
|
fi
|
|
|
|
cd -
|
|
|
|
#kl3 need to modify the FTM firmware name.
|
|
if [ "${IMG_UPPER}" == "FTM" ]; then
|
|
APP_UPPER="FTM"
|
|
fi
|
|
|
|
if [ ${IOT_SMART_BUILD} == 1 ]; then
|
|
if [ "${RUN_UPPER}" == "PSRAM" ]; then
|
|
sed -i "s,key_word=IOT-,key_word=${CHIP_ID}-${APP_UPPER}-${BOARD_UPPER}-${RUN_UPPER}-${PSRAM_SIZE_STR}-${OPT_KEYWORD}${DB_RLS_FLAG}-,g" ${TMP_CFG_NAME}
|
|
else
|
|
sed -i "s,key_word=IOT-,key_word=${CHIP_ID}-${APP_UPPER}-${BOARD_UPPER}-${OPT_KEYWORD}${DB_RLS_FLAG}-,g" ${TMP_CFG_NAME}
|
|
fi
|
|
else
|
|
if [ "${RUN_UPPER}" == "PSRAM" ]; then
|
|
sed -i "s,key_word=SG-,key_word=${CHIP_ID}-${APP_UPPER}-${BOARD_UPPER}-${RUN_UPPER}-${PSRAM_SIZE_STR}-${OPT_KEYWORD},g" ${TMP_CFG_NAME}
|
|
elif [ "${RUN_UPPER}" == "UPGRADE" ]; then
|
|
if [ "$PSRAM_ENABLE_GEN" == "1" ]; then
|
|
sed -i "s,key_word=SG-,key_word=${CHIP_ID}-${APP_UPPER}-${BOARD_UPPER}-${RUN_UPPER}-PSRAM-${PSRAM_SIZE_STR}-${OPT_KEYWORD},g" ${TMP_CFG_NAME}
|
|
else
|
|
sed -i "s,key_word=SG-,key_word=${CHIP_ID}-${APP_UPPER}-${BOARD_UPPER}-${RUN_UPPER}-${OPT_KEYWORD},g" ${TMP_CFG_NAME}
|
|
fi
|
|
else
|
|
sed -i "s,key_word=SG-,key_word=${CHIP_ID}-${APP_UPPER}-${BOARD_UPPER}-${OPT_KEYWORD},g" ${TMP_CFG_NAME}
|
|
fi
|
|
fi
|
|
|
|
if [ "${SIZE_UPPER}" == "4M" ]; then
|
|
sed -i "s,key_word=${CHIP_ID}-${APP_UPPER}-${BOARD_UPPER}-,key_word=${CHIP_ID}-${APP_UPPER}-${BOARD_UPPER}-F-,g" ${TMP_CFG_NAME}
|
|
else
|
|
sed -i "s,key_word=${CHIP_ID}-${APP_UPPER}-${BOARD_UPPER}-,key_word=${CHIP_ID}-${APP_UPPER}-${BOARD_UPPER}-T-,g" ${TMP_CFG_NAME}
|
|
fi
|
|
|
|
#define img_type
|
|
if [ "x${DUAL_ENABLE}" == "x1" ]; then
|
|
if [ "${APP_UPPER}" == "BRM" ]; then
|
|
sed -i "s/img_type=./img_type=7/" ${TMP_CFG_NAME}
|
|
elif [ "${APP_UPPER}" == "BSRM_CUS" ]; then
|
|
sed -i "s/img_type=./img_type=8/" ${TMP_CFG_NAME}
|
|
else
|
|
sed -i "s/img_type=./img_type=2/" ${TMP_CFG_NAME}
|
|
fi
|
|
|
|
if [ "${IMG_UPPER}" == "CKB" ]; then
|
|
sed -i "s/img_type=./img_type=6/" ${TMP_CFG_NAME}
|
|
fi
|
|
|
|
if [ "x${NEW_TYPE_CCO}" == "x1" ]; then
|
|
sed -i "s/img_type=./img_type=10/" ${TMP_CFG_NAME}
|
|
fi
|
|
else
|
|
if [ "${APP_UPPER}" == "BRM" ]; then
|
|
sed -i "s/img_type=./img_type=12/" ${TMP_CFG_NAME}
|
|
elif [ "${APP_UPPER}" == "BSRM_CUS" ]; then
|
|
sed -i "s/img_type=./img_type=13/" ${TMP_CFG_NAME}
|
|
else
|
|
sed -i "s/img_type=./img_type=11/" ${TMP_CFG_NAME}
|
|
fi
|
|
|
|
if [ "${IMG_UPPER}" == "CKB" ] || [ "x${NEW_TYPE_CCO}" == "x1" ]; then
|
|
echo "Something wrong!!!, stop generate firmware."
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
set -o errexit
|
|
array=("${PIB_FILE// / }" "${LP_PIB_FILE// / }")
|
|
for var in ${array[@]}
|
|
do
|
|
echo "pib:${var}"
|
|
cp ${TOP_DIR}/tools/pib/$var $CUR_DIR/pib.bin
|
|
cp ${TOP_DIR}/tools/pib/$var ${OUT_PATH}
|
|
|
|
left=${var#*_}
|
|
append=""
|
|
while [ "$left"x != "PIB.bin"x ]; do
|
|
val=`echo $left | awk -F '_' '{print $1}'`
|
|
left=${left#*_}
|
|
append=$append$val"-"
|
|
done
|
|
|
|
cp ${TMP_CFG_NAME} ./tmp.cfg
|
|
if [ "${IMG_UPPER}" == "CCO" ]; then
|
|
if [ ${IOT_SMART_BUILD} == 1 ]; then
|
|
sed -i "s,key_word=${CHIP_ID}-${APP_UPPER}-${BOARD_UPPER}-,key_word=${CHIP_ID}-${APP_UPPER}-${BOARD_UPPER}-1P-${append},g" ./tmp.cfg
|
|
sed -i "s/ht.bin/ht_1p.bin/g" ./tmp.cfg
|
|
./ah -c ./tmp.cfg
|
|
#board-3201 need extra 3p-cco.
|
|
if [ "${chip_ver}" == "3201" ]; then
|
|
sed -i "s/ht_1p.bin/ht.bin/g" ./tmp.cfg
|
|
sed -i "s/-${BOARD_UPPER}-1P-/-${BOARD_UPPER}-3P-/" ./tmp.cfg
|
|
./ah -c ./tmp.cfg
|
|
fi
|
|
else
|
|
sed -i "s,key_word=${CHIP_ID}-${APP_UPPER}-${BOARD_UPPER}-,key_word=${CHIP_ID}-${APP_UPPER}-${BOARD_UPPER}-${append},g" ./tmp.cfg
|
|
if [ "x${NEW_TYPE_CCO}" == "x1" ]; then
|
|
sed -i "/key_word/s/CCO/NEW_TYPE_CCO/g" ./tmp.cfg
|
|
fi
|
|
./ah -c ./tmp.cfg
|
|
fi
|
|
else
|
|
sed -i "s,key_word=${CHIP_ID}-${APP_UPPER}-${BOARD_UPPER}-,key_word=${CHIP_ID}-${APP_UPPER}-${BOARD_UPPER}-${append},g" ./tmp.cfg
|
|
./ah -c ./tmp.cfg
|
|
#extra lp only pib upgrade file.
|
|
if [ "${BOARD_UPPER}X" == "HTZDSTA03X" ] || [ "${BOARD_UPPER}X" == "FPGASTA03X" ] || [ "${BOARD_UPPER}X" == "QJSTA03X" ] \
|
|
|| [ "${BOARD_UPPER}X" == "FLXSTA03X" ] || [ "${BOARD_UPPER}X" == "SPESTA03X" ] || [ "${BOARD_UPPER}X" == "GXSTA03X" ] \
|
|
|| [ "${BOARD_UPPER}X" == "DTSTA03X" ] || [ "${BOARD_UPPER}X" == "YPSTA03X" ]; then
|
|
left=${var#*_}
|
|
if [ "$left"x == "LP_PIB.bin"x ] && [ "${RUN_UPPER}X" == "UPGRADEX" ]; then
|
|
sed -i "s/image_num=.*/image_num=0x1/g" ./tmp.cfg
|
|
sed -i "s/${BOARD_UPPER}/${BOARD_UPPER}-ONLYPIB/g" ./tmp.cfg
|
|
./ah -c ./tmp.cfg
|
|
fi
|
|
fi
|
|
fi
|
|
|
|
rm ./tmp.cfg
|
|
done
|
|
|
|
rm ${TMP_CFG_NAME}
|
|
|
|
#prepare .out file.
|
|
if [ "x${CORE_TYPE_UPPER}" == "xAMPPLC" ]; then
|
|
if [ ! -d ${OUT_PATH}/amp_plc ]; then
|
|
mkdir -p ${OUT_PATH}/amp_plc
|
|
fi
|
|
cp ${TOP_DIR}/ap/.output/plc/lib/* ${OUT_PATH}/amp_plc
|
|
cp ${TOP_DIR}/sbl/.output/plc/lib/* ${OUT_PATH}/amp_plc
|
|
if [ "x${DUAL_ENABLE}" == "x1" ]; then
|
|
cp -f ${TOP_DIR}/bb_cpu/.output/plc/lib/* ${OUT_PATH}/amp_plc
|
|
fi
|
|
|
|
if [ -d "${TOP_DIR}/ap/.output/cus/lib" ]; then
|
|
if [ ! -d ${OUT_PATH}/amp_cus ]; then
|
|
mkdir -p ${OUT_PATH}/amp_cus
|
|
fi
|
|
cp ${TOP_DIR}/ap/.output/cus/lib/* ${OUT_PATH}/amp_cus
|
|
fi
|
|
else
|
|
if [ ! -d ${OUT_PATH}/plc_only ]; then
|
|
mkdir -p ${OUT_PATH}/plc_only
|
|
fi
|
|
cp ${TOP_DIR}/ap/.output/plc/lib/* ${OUT_PATH}/plc_only
|
|
cp ${TOP_DIR}/sbl/.output/plc/lib/* ${OUT_PATH}/plc_only
|
|
if [ "x${DUAL_ENABLE}" == "x1" ]; then
|
|
cp -f ${TOP_DIR}/bb_cpu/.output/plc/lib/* ${OUT_PATH}/plc_only
|
|
fi
|
|
if [ "x${SEC_CPU_ENABLE}" == "x1" ]; then
|
|
cp -f ${TOP_DIR}/sec_cpu/.output/plc/lib/* ${OUT_PATH}/plc_only
|
|
fi
|
|
fi
|
|
|
|
cp ${TOP_DIR}/tools/oem/${OEM_FILE} ${OUT_PATH}
|
|
mv ./${CHIP_ID}-${APP_UPPER}-* $BIN_PATH
|
|
|
|
else
|
|
|
|
if [ "$SIZE_LOWER" == "" ]; then
|
|
BIN_PATH=${CUR_DIR}/customer/1M/${BOARD_LOWER}/${IMG_LOWER}/bin/
|
|
OUT_PATH=${CUR_DIR}/customer/1M/${BOARD_LOWER}/${IMG_LOWER}/out/
|
|
else
|
|
BIN_PATH=${CUR_DIR}/customer/${SIZE_UPPER}/${BOARD_LOWER}/${IMG_LOWER}/bin/
|
|
OUT_PATH=${CUR_DIR}/customer/${SIZE_UPPER}/${BOARD_LOWER}/${IMG_LOWER}/out/
|
|
fi
|
|
|
|
mkdir -p $BIN_PATH
|
|
mkdir -p $OUT_PATH
|
|
|
|
if [ "${IMG_UPPER}" == "3PS" ] || [ "${IMG_UPPER}" == "CKB" ]; then
|
|
IMG_LOWER="sta"
|
|
fi
|
|
|
|
if [ "${product_line}" == "PLC" ] && [ "${target}" == "kunlun2" ]; then
|
|
CFG_DIR=${TOP_DIR}"/build/cfg2_plc"
|
|
else
|
|
CFG_DIR=${TOP_DIR}"/build/cfg"
|
|
fi
|
|
|
|
if [ "${RUN_UPPER}" == "UPGRADE" ]; then
|
|
if [ "${SIZE_UPPER}" != "" ]; then
|
|
if [ "$PSRAM_ENABLE_GEN" == "1" ] && [[ "${IMG_LOWER}" == "sta" || "${IMG_LOWER}" == "iic" ]]; then
|
|
CFG_NAME=${CFG_DIR}"/"${SIZE_LOWER}"_"${IMG_LOWER}"_upgrade_psram.cfg"
|
|
else
|
|
CFG_NAME=${CFG_DIR}"/"${SIZE_LOWER}"_"${IMG_LOWER}"_upgrade.cfg"
|
|
fi
|
|
else
|
|
CFG_NAME=${CFG_DIR}"/"${IMG_LOWER}"_upgrade.cfg"
|
|
fi
|
|
else
|
|
if [ ${IOT_SMART_BUILD} == 1 ]; then
|
|
if [ "${SIZE_UPPER}" == "2M" ] || [ "${SIZE_UPPER}" == "4M" ]; then
|
|
if [ "${RUN_UPPER}" == "PSRAM" ]; then
|
|
CFG_NAME=${CFG_DIR}"/smart_"${SIZE_LOWER}"_"${IMG_LOWER}_psram.cfg
|
|
else
|
|
CFG_NAME=${CFG_DIR}"/smart_"${SIZE_LOWER}"_"${IMG_LOWER}.cfg
|
|
fi
|
|
else
|
|
CFG_NAME=${CFG_DIR}"/smart_"${IMG_LOWER}.cfg
|
|
fi
|
|
else
|
|
if [ "${SIZE_UPPER}" != "" ]; then
|
|
if [ "${RUN_UPPER}" == "PSRAM" ] && [[ "${IMG_LOWER}" == "sta" || "${IMG_LOWER}" == "iic" || "${IMG_LOWER}" == "ftm" ]]; then
|
|
CFG_NAME=${CFG_DIR}"/"${SIZE_LOWER}"_"${IMG_LOWER}_psram.cfg
|
|
else
|
|
CFG_NAME=${CFG_DIR}"/"${SIZE_LOWER}"_"${IMG_LOWER}.cfg
|
|
fi
|
|
else
|
|
if [ "${RUN_UPPER}" == "PSRAM" ] && [ "${IMG_LOWER}" == "sta" ]; then
|
|
CFG_NAME=${CFG_DIR}"/"${IMG_LOWER}_psram.cfg
|
|
else
|
|
CFG_NAME=${CFG_DIR}"/"${IMG_LOWER}.cfg
|
|
fi
|
|
fi
|
|
fi
|
|
fi
|
|
|
|
if [ "${CHIP_VER_UPPER}" == "" ]; then
|
|
CHIP_VER_UPPER="1"
|
|
fi
|
|
|
|
TMP_CFG_NAME=${CFG_DIR}"/"${BOARD_LOWER}_${IMG_LOWER}_tmp.cfg
|
|
cp ${CFG_NAME} ${TMP_CFG_NAME}
|
|
|
|
if [ ${IOT_SMART_BUILD} == 1 ]; then
|
|
if [ "${RUN_UPPER}" == "PSRAM" ]; then
|
|
sed -i "s,key_word=IOT-,key_word=${CHIP_ID}-${APP_UPPER}-${BOARD_UPPER}${IMG_UPPER}0${CHIP_VER_UPPER}-${RUN_UPPER}-${PSRAM_SIZE_STR}-${DB_RLS_FLAG}-,g" ${TMP_CFG_NAME}
|
|
else
|
|
sed -i "s,key_word=IOT-,key_word=${CHIP_ID}-${APP_UPPER}-${BOARD_UPPER}${IMG_UPPER}0${CHIP_VER_UPPER}-${DB_RLS_FLAG}-,g" ${TMP_CFG_NAME}
|
|
fi
|
|
else
|
|
if [ "${RUN_UPPER}" == "PSRAM" ]; then
|
|
sed -i "s,key_word=SG-,key_word=${CHIP_ID}-${APP_UPPER}-${BOARD_UPPER}${IMG_UPPER}0${CHIP_VER_UPPER}-${RUN_UPPER}-${PSRAM_SIZE_STR}-,g" ${TMP_CFG_NAME}
|
|
elif [ "${RUN_UPPER}" == "UPGRADE" ]; then
|
|
if [ "$PSRAM_ENABLE_GEN" == "1" ]; then
|
|
sed -i "s,key_word=SG-,key_word=${CHIP_ID}-${APP_UPPER}-${BOARD_UPPER}${IMG_UPPER}0${CHIP_VER_UPPER}-${RUN_UPPER}-PSRAM-${PSRAM_SIZE_STR}-,g" ${TMP_CFG_NAME}
|
|
else
|
|
sed -i "s,key_word=SG-,key_word=${CHIP_ID}-${APP_UPPER}-${BOARD_UPPER}${IMG_UPPER}0${CHIP_VER_UPPER}-${RUN_UPPER}-,g" ${TMP_CFG_NAME}
|
|
fi
|
|
else
|
|
if [ "$IMG_UPPER" == "CCO" ]; then
|
|
sed -i "s,key_word=SG-,key_word=${CHIP_ID}-${APP_UPPER}-${BOARD_UPPER}${IMG_UPPER}0${CHIP_VER_UPPER}-PSRAM-${PSRAM_SIZE_STR}-,g" ${TMP_CFG_NAME}
|
|
else
|
|
sed -i "s,key_word=SG-,key_word=${CHIP_ID}-${APP_UPPER}-${BOARD_UPPER}${IMG_UPPER}0${CHIP_VER_UPPER}-,g" ${TMP_CFG_NAME}
|
|
fi
|
|
fi
|
|
fi
|
|
|
|
#config scramble.
|
|
if [ "${BOARD_UPPER}" == "JSMT" ]; then
|
|
sed -i "s,encrypt_mode=0x0,encrypt_mode=0x3,g" ${TMP_CFG_NAME}
|
|
sed -i "s,encrypt_pattern=0x55,encrypt_pattern=0xaa,g" ${TMP_CFG_NAME}
|
|
sed -i "s,vendor_id=18516,vendor_id=19796,g" ${TMP_CFG_NAME}
|
|
fi
|
|
|
|
if [ "${BOARD_UPPER}" == "FLX" ]; then
|
|
sed -i "s,encrypt_mode=0x0,encrypt_mode=0x3,g" ${TMP_CFG_NAME}
|
|
sed -i "s,encrypt_pattern=0x55,encrypt_pattern=0x99,g" ${TMP_CFG_NAME}
|
|
sed -i "s,vendor_id=18516,vendor_id=20552,g" ${TMP_CFG_NAME}
|
|
fi
|
|
|
|
# prepare ht.bin
|
|
if [ "${IMG_UPPER}" == "IIC" ] || [ "${IMG_UPPER}" == "3PS" ] || [ "${IMG_UPPER}" == "I3C" ]; then
|
|
HT_FILE="ht_sta.bin"
|
|
else
|
|
HT_FILE="ht_"${IMG_LOWER}".bin"
|
|
fi
|
|
|
|
if [ ${IOT_SMART_BUILD} == 1 ] && [ "${IMG_UPPER}" == "CCO" ]; then
|
|
cp $CUR_DIR/iot_ht_3p.bin $CUR_DIR/ht.bin
|
|
cp $CUR_DIR/iot_ht_1p.bin $CUR_DIR/ht_1p.bin
|
|
fi
|
|
if [ ! -f $CUR_DIR/ht.bin ]; then
|
|
cp ${TOP_DIR}/ap/.output/lib/${HT_FILE} $CUR_DIR/ht.bin
|
|
fi
|
|
|
|
sed -i "/img_type=./a layout_index=${FLASH_LAYOUT_INDEX}" ${TMP_CFG_NAME}
|
|
|
|
if [ "x${NEW_TYPE_CCO}" == "x1" ]; then
|
|
sed -i "s/img_type=./img_type=9/" ${TMP_CFG_NAME}
|
|
fi
|
|
|
|
#config lzma.
|
|
if [ "${MODE_UPPER}" == "LZMA" ]; then
|
|
./elzma e $CUR_DIR/ht.bin $CUR_DIR/ht.bin.lzma
|
|
cp $CUR_DIR/ht.bin $CUR_DIR/ht.bin.fw
|
|
mv $CUR_DIR/ht.bin.lzma $CUR_DIR/ht.bin
|
|
|
|
if [ -f $CUR_DIR/ht_1p.bin ]; then
|
|
./elzma e $CUR_DIR/ht_1p.bin $CUR_DIR/ht_1p.bin.lzma
|
|
cp $CUR_DIR/ht_1p.bin $CUR_DIR/ht_1p.bin.fw
|
|
mv $CUR_DIR/ht_1p.bin.lzma $CUR_DIR/ht_1p.bin
|
|
fi
|
|
fi
|
|
|
|
# prepare oem.bin
|
|
cp $TOP_DIR/sbl/.output/lib/kunlun_sbl.bin $CUR_DIR/sbl.bin
|
|
cp $TOP_DIR/mfgtool/ram/.output/lib/kl_ram.bin $CUR_DIR/ram.bin
|
|
cp $TOP_DIR/mfgtool/ram/.output/lib/kl_ram*.bin $CUR_DIR
|
|
cp $TOP_DIR/sp/boot/.output/lib/sp_fw.bin $CUR_DIR/sp.bin
|
|
|
|
if [ "${IMG_UPPER}" == "FTM" ] || [ "${IMG_UPPER}" == "CKB" ]; then
|
|
OEM_CFG=${BOARD_UPPER}"STA01_OEM.ini"
|
|
OEM_FILE=${BOARD_UPPER}"STA01_OEM.bin"
|
|
elif [ "${BOARD_UPPER}" == "STAMP_22P" ] || [ "${BOARD_UPPER}" == "SI301X_30P" ] \
|
|
|| [ "${BOARD_UPPER}" == "GOLDFINGER_17P" ] \
|
|
|| [ "${BOARD_UPPER}" == "MPPT" ] || [ "${BOARD_UPPER}" == "HTR" ]; then
|
|
#cco and sta share one oem for STAMP_22P SI301X_30P GOLDFINGER_17P MPPT HTR.
|
|
OEM_CFG=${BOARD_UPPER}"_OEM.ini"
|
|
OEM_FILE=${BOARD_UPPER}"_OEM.bin"
|
|
else
|
|
OEM_CFG=${BOARD_UPPER}${IMG_UPPER}"0"${CHIP_VER_UPPER}"_OEM.ini"
|
|
OEM_FILE=${BOARD_UPPER}${IMG_UPPER}"0"${CHIP_VER_UPPER}"_OEM.bin"
|
|
fi
|
|
|
|
cp $TOP_DIR/tools/oem/$OEM_CFG ./tmp_oem.ini
|
|
#set mid for iot board(cco and sta use same oem.ini)
|
|
if [ ${IOT_SMART_BUILD} == 1 ]; then
|
|
if [ "${IMG_UPPER}" == "CCO" ]; then
|
|
sed -i "s/mid.*/mid 1/g" ./tmp_oem.ini
|
|
elif [ "${IMG_UPPER}" == "STA" ]; then
|
|
sed -i "s/mid.*/mid 0/g" ./tmp_oem.ini
|
|
fi
|
|
fi
|
|
if [ "${RUN_UPPER}" != "UPGRADE" ]; then
|
|
./oem_tool --input=./tmp_oem.ini --output=$TOP_DIR/tools/oem/$OEM_FILE
|
|
fi
|
|
rm ./tmp_oem.ini
|
|
cp $TOP_DIR/tools/oem/$OEM_FILE $CUR_DIR/oem.bin
|
|
|
|
# prepare pib file
|
|
PIB_SRC_PATH=${TOP_DIR}/tools/pib/
|
|
|
|
if [ "${BOARD_UPPER}" == "FLX" ] || [ "${BOARD_UPPER}" == "STAMP_22P" ] \
|
|
|| [ "${BOARD_UPPER}" == "SI301X_30P" ] || [ "${BOARD_UPPER}" == "LEDC_3P0" ] \
|
|
|| [ "${BOARD_UPPER}" == "GOLDFINGER_17P" ] || [ "${BOARD_UPPER}" == "D2D" ] \
|
|
|| [ "${BOARD_UPPER}" == "CCTT" ] || [ "${BOARD_UPPER}" == "MPPT" ] \
|
|
|| [ "${BOARD_UPPER}" == "HTR" ]; then
|
|
BOARD_UPPER_PIB="HTZD"
|
|
else
|
|
BOARD_UPPER_PIB=${BOARD_UPPER}
|
|
fi
|
|
|
|
if [ "${IMG_UPPER}" == "FTM" ] || [ "${IMG_UPPER}" == "CKB" ]; then
|
|
PIB_IMG="STA"
|
|
else
|
|
PIB_IMG=${IMG_UPPER}
|
|
PIB_FILE=${BOARD_UPPER_PIB}${IMG_UPPER}"01_PIB.bin"
|
|
fi
|
|
|
|
if [ "${IMG_UPPER}" == "3PS" ]; then
|
|
PIB_IMG="STA"
|
|
PIB_FILE=${BOARD_UPPER_PIB}"STA01_PIB.bin"
|
|
fi
|
|
|
|
cd ${PIB_SRC_PATH}
|
|
if [ ${IOT_SMART_BUILD} == 1 ]; then
|
|
PIB_FILE=`ls ${PIB_SRC_PATH} | grep "${BOARD_UPPER_PIB}" | grep "${PIB_IMG}0${CHIP_VER_UPPER}_PIB"`
|
|
LP_PIB_FILE=`ls ${PIB_SRC_PATH} | grep "${BOARD_UPPER_PIB}" | grep "${PIB_IMG}0${CHIP_VER_UPPER}_LP_PIB"`
|
|
else
|
|
PIB_FILE=`ls ${PIB_SRC_PATH} | grep "${BOARD_UPPER_PIB}" | grep "${PIB_IMG}" | grep "PIB"`
|
|
fi
|
|
cd -
|
|
|
|
set -o errexit
|
|
array=("${PIB_FILE// / }" "${LP_PIB_FILE// / }")
|
|
for var in ${array[@]}
|
|
do
|
|
echo "pib:${var}"
|
|
cp ${TOP_DIR}/tools/pib/$var $CUR_DIR/pib.bin
|
|
cp ${TOP_DIR}/tools/pib/$var ${OUT_PATH}
|
|
|
|
left=${var#*_}
|
|
append=""
|
|
while [ "$left"x != "PIB.bin"x ]; do
|
|
val=`echo $left | awk -F '_' '{print $1}'`
|
|
left=${left#*_}
|
|
append=$append$val"-"
|
|
done
|
|
|
|
cp ${TMP_CFG_NAME} ./tmp.cfg
|
|
|
|
if [ "${IMG_UPPER}" == "CCO" ] && [ ${IOT_SMART_BUILD} == 1 ]; then
|
|
if [ "${SIZE_UPPER}" == "COMBO" ]; then
|
|
sed -i "s,key_word=${CHIP_ID}-${APP_UPPER}-${BOARD_UPPER}${IMG_UPPER}0${CHIP_VER_UPPER}-,key_word=${CHIP_ID}-${APP_UPPER}-${BOARD_UPPER}${IMG_UPPER}0${CHIP_VER_UPPER}-3P-${append},g" ./tmp.cfg
|
|
elif [ "${SIZE_UPPER}" == "4M" ]; then
|
|
sed -i "s,key_word=${CHIP_ID}-${APP_UPPER}-${BOARD_UPPER}${IMG_UPPER}0${CHIP_VER_UPPER}-,key_word=${CHIP_ID}-${APP_UPPER}-${BOARD_UPPER}${IMG_UPPER}0${CHIP_VER_UPPER}-3P-${append}F-,g" ./tmp.cfg
|
|
elif [ "${SIZE_UPPER}" == "2M" ]; then
|
|
sed -i "s,key_word=${CHIP_ID}-${APP_UPPER}-${BOARD_UPPER}${IMG_UPPER}0${CHIP_VER_UPPER}-,key_word=${CHIP_ID}-${APP_UPPER}-${BOARD_UPPER}${IMG_UPPER}0${CHIP_VER_UPPER}-3P-${append}T-,g" ./tmp.cfg
|
|
else
|
|
sed -i "s,key_word=${CHIP_ID}-${APP_UPPER}-${BOARD_UPPER}${IMG_UPPER}0${CHIP_VER_UPPER}-,key_word=${CHIP_ID}-${APP_UPPER}-${BOARD_UPPER}${IMG_UPPER}0${CHIP_VER_UPPER}-3P-${append}O-,g" ./tmp.cfg
|
|
fi
|
|
else
|
|
if [ "${SIZE_UPPER}" == "COMBO" ]; then
|
|
sed -i "s,key_word=${CHIP_ID}-${APP_UPPER}-${BOARD_UPPER}${IMG_UPPER}0${CHIP_VER_UPPER}-,key_word=${CHIP_ID}-${APP_UPPER}-${BOARD_UPPER}${IMG_UPPER}0${CHIP_VER_UPPER}-${append},g" ./tmp.cfg
|
|
elif [ "${SIZE_UPPER}" == "4M" ]; then
|
|
sed -i "s,key_word=${CHIP_ID}-${APP_UPPER}-${BOARD_UPPER}${IMG_UPPER}0${CHIP_VER_UPPER}-,key_word=${CHIP_ID}-${APP_UPPER}-${BOARD_UPPER}${IMG_UPPER}0${CHIP_VER_UPPER}-${append}F-,g" ./tmp.cfg
|
|
elif [ "${SIZE_UPPER}" == "2M" ]; then
|
|
sed -i "s,key_word=${CHIP_ID}-${APP_UPPER}-${BOARD_UPPER}${IMG_UPPER}0${CHIP_VER_UPPER}-,key_word=${CHIP_ID}-${APP_UPPER}-${BOARD_UPPER}${IMG_UPPER}0${CHIP_VER_UPPER}-${append}T-,g" ./tmp.cfg
|
|
else
|
|
sed -i "s,key_word=${CHIP_ID}-${APP_UPPER}-${BOARD_UPPER}${IMG_UPPER}0${CHIP_VER_UPPER}-,key_word=${CHIP_ID}-${APP_UPPER}-${BOARD_UPPER}${IMG_UPPER}0${CHIP_VER_UPPER}-${append}O-,g" ./tmp.cfg
|
|
fi
|
|
fi
|
|
|
|
if [ "${APP_UPPER}" == "BSRM" ]; then
|
|
sed -i "s/img_type=./img_type=3/" ./tmp.cfg
|
|
elif [ "${APP_UPPER}" == "BSRM_CUS" ]; then
|
|
sed -i "s/img_type=./img_type=4/" ./tmp.cfg
|
|
fi
|
|
|
|
if [ "x${NEW_TYPE_CCO}" == "x1" ]; then
|
|
sed -i "/key_word/s/CCO/NEW_TYPE_CCO/g" ./tmp.cfg
|
|
fi
|
|
|
|
#structure fw package.
|
|
./ah -c ./tmp.cfg ${PSRAM_SIZE_PARAM}
|
|
if [ ${IOT_SMART_BUILD} == 1 ] && [ "${IMG_UPPER}" == "CCO" ]; then
|
|
sed -i "s/ht.bin/ht_1p.bin/g" ./tmp.cfg
|
|
sed -i "s/-${BOARD_UPPER}${IMG_UPPER}0${CHIP_VER_UPPER}-3P-/-${BOARD_UPPER}${IMG_UPPER}0${CHIP_VER_UPPER}-1P-/" ./tmp.cfg
|
|
./ah -c ./tmp.cfg ${PSRAM_SIZE_PARAM}
|
|
fi
|
|
|
|
#extra lp only pib upgrade file for kl1 htzd sta and kl3 fpga sta.
|
|
if [ "${BOARD_UPPER}${IMG_UPPER}X" == "HTZDSTAX" ] || [ "${BOARD_UPPER}${IMG_UPPER}X" == "FPGASTAX" ]; then
|
|
left=${var#*_}
|
|
if [ "$left"x == "LP_PIB.bin"x ] && [ "${RUN_UPPER}X" == "UPGRADEX" ]; then
|
|
sed -i "s/image_num=.*/image_num=0x1/g" ./tmp.cfg
|
|
sed -i "s/${BOARD_UPPER}${IMG_UPPER}../${BOARD_UPPER}${IMG_UPPER}0${CHIP_VER_UPPER}-ONLYPIB/g" ./tmp.cfg
|
|
./ah -c ./tmp.cfg ${PSRAM_SIZE_PARAM}
|
|
fi
|
|
fi
|
|
rm ./tmp.cfg
|
|
done
|
|
|
|
rm ${TMP_CFG_NAME}
|
|
rm -f *.lds
|
|
|
|
#prepare .out file.
|
|
cp ${TOP_DIR}/sbl/.output/lib/* ${OUT_PATH}
|
|
cp ${TOP_DIR}/mfgtool/ram/.output/lib/* ${OUT_PATH}
|
|
cp ${TOP_DIR}/ap/.output/lib/* ${OUT_PATH}
|
|
cp ${TOP_DIR}/sp/boot/.output/lib/* ${OUT_PATH}
|
|
cp ${TOP_DIR}/tools/oem/${OEM_FILE} ${OUT_PATH}
|
|
mv ./${CHIP_ID}-${APP_UPPER}-${BOARD_UPPER}* $BIN_PATH
|
|
|
|
if [ ${IOT_SMART_BUILD} == 1 ]; then
|
|
if [ "${SIZE_LOWER}" == "" ]; then
|
|
SPECIAL_OUT_FD="${OUT_PATH}/../out_${CHIP_ID}_${APP_LOWER}_${BOARD_LOWER}_${IMG_LOWER}_${RUN_LOWER}_1m_${DB_LOWER}"
|
|
else
|
|
SPECIAL_OUT_FD="${OUT_PATH}/../out_${CHIP_ID}_${APP_LOWER}_${BOARD_LOWER}_${IMG_LOWER}_${RUN_LOWER}_${SIZE_LOWER}_${DB_LOWER}"
|
|
fi
|
|
|
|
if [ -d ${SPECIAL_OUT_FD} ]; then
|
|
rm -rf ${SPECIAL_OUT_FD}/*
|
|
fi
|
|
mv ${OUT_PATH} ${SPECIAL_OUT_FD}
|
|
fi
|
|
fi
|
|
|
|
echo "genarate image finished."
|