forked from Qorvo/QMatter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlight_qpg6105_development_postbuild.sh
executable file
·51 lines (37 loc) · 2.27 KB
/
light_qpg6105_development_postbuild.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/sh
set -e
SCRIPT_DIR="$(dirname "$(realpath "$0")")"
# determine python interpreter path
if [ -f "`which python3`" ]; then
PYTHON="`which python3`"
else
if [ -f "`which python`" ]; then
PYTHON="`which python`"
else
echo "No python interpreter found."
exit 1
fi
fi
# check python interpreter version
PYTHON_VERSION=`"${PYTHON}" --version | cut -d\ -f 2`
PYTHON_MAJOR=`echo ${PYTHON_VERSION} | cut -d. -f 1`
PYTHON_MINOR=`echo ${PYTHON_VERSION} | cut -d. -f 2`
if [ ! \( ${PYTHON_MAJOR} -eq 3 -o ${PYTHON_MINOR} -lt 6 \) ]; then
echo "Python 3.x (at least 3.6) is required, you have ${PYTHON_VERSION}."
fi
# seed random source
RANDOM=`date +%s`$$
# set variables
OLD_CWD=`pwd`
TEMP_DIR=/tmp
UNIQUE_ID=${RANDOM}
PROJECT_PATH="$1"
TARGET_PATH="$2"
TARGET_BASEPATH="`echo ${TARGET_PATH} | sed -E 's/\.[^.]+$//g'`"
TARGET_BASENAME="`basename ${TARGET_BASEPATH}`"
TARGET_DIR="`dirname ${TARGET_BASEPATH}`"
trap 'cd ${OLD_CWD}' EXIT
# Build steps
"$PYTHON" "${SCRIPT_DIR}"/../../../Tools/Ota/generate_ota_img.py --chip_config_header "${SCRIPT_DIR}"/../../../Applications/Matter/light/include/CHIPProjectConfig.h --chip_root "${SCRIPT_DIR}"/../../../Components/ThirdParty/Matter/repo --compression lzma --factory_data_config "${SCRIPT_DIR}"/../../../Tools/FactoryData/Credentials/test_light.factory_data_config --in_file "${SCRIPT_DIR}"/../../../Work/light_qpg6105_development/light_qpg6105_development.hex --out_file "${SCRIPT_DIR}"/../../../Work/light_qpg6105_development/light_qpg6105_development.ota --pem_file_path "${SCRIPT_DIR}"/../../../Tools/Ota/example_private_key.pem.example --pem_password test1234 --sign
"$PYTHON" "${SCRIPT_DIR}"/../../../Tools/MemoryOverview/memoryoverview.py --logfile "${SCRIPT_DIR}"/../../../Work/light_qpg6105_development/light_qpg6105_development.memoryoverview --only-this "${SCRIPT_DIR}"/../../../Work/light_qpg6105_development/light_qpg6105_development.map
"$PYTHON" "${SCRIPT_DIR}"/../../../Tools/SecureBoot/generate_programmer.py --gpproductid QPG6105 --hexlink "${SCRIPT_DIR}"/../../../Work/light_qpg6105_development/light_qpg6105_development.hex --input "${SCRIPT_DIR}"/../../../Tools/SecureBoot/templates/programmer_info_k8e.tmpl --output "${SCRIPT_DIR}"/../../../Work/light_qpg6105_development/light_qpg6105_development.xml