-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmkatrium.sh
executable file
·119 lines (103 loc) · 3.13 KB
/
mkatrium.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
#!/bin/bash
#
# Copyright (C) 2018-2023, Thomas Maier-Komor
# Atrium Firmware Package for ESP
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# check settings
if [ ! -f settings.sh ]; then
echo settings.sh not found. Please run setupenv.sh.
exit 1
fi
source settings.sh
# look for project config
if [ ! -f projects/$1 ]; then
echo Unable to find project config.
exit 1
fi
# setup build dir
export BUILD_DIR=build.$1
if [ ! -d "$BUILD_DIR" ]; then
mkdir -p "$BUILD_DIR"
fi
# source settings
export FWCFG=$1
export SDKCONFIG=`pwd`/projects/$1
export SDKCONFIG_DEFAULTS=$SDKCONFIG
source $SDKCONFIG
export CONFIG_INTEGRATED_HELP
if [ "$CONFIG_IDF_TARGET_ESP32" == "y" ]; then
export IDF_PATH=$IDF_ESP32
export ESP_FAM=32
export IDF_TARGET=esp32
elif [ "$CONFIG_IDF_TARGET_ESP32S2" == "y" ]; then
export IDF_PATH=$IDF_ESP32
export ESP_FAM=32
export IDF_TARGET=esp32s2
elif [ "$CONFIG_IDF_TARGET_ESP32S3" == "y" ]; then
export IDF_PATH=$IDF_ESP32
export ESP_FAM=32
export IDF_TARGET=esp32s3
elif [ "$CONFIG_IDF_TARGET_ESP32C3" == "y" ]; then
export IDF_PATH=$IDF_ESP32
export ESP_FAM=32
export IDF_TARGET=esp32c3
elif [ "$CONFIG_IDF_TARGET_ESP32C6" == "y" ]; then
export IDF_PATH=$IDF_ESP32
export ESP_FAM=32
export IDF_TARGET=esp32c6
elif [ "$CONFIG_IDF_TARGET_ESP8266" == "y" ]; then
make PROJECT=$1 $2
exit
else
echo Unknown or invalid IDF_TARGET.
exit 1
fi
if [ ! -d "$IDF_PATH" ]; then
echo IDF_PATH is not a directory.
exit 1
fi
pushd $IDF_PATH
IDF_VERSION=`git describe --tags 2>/dev/null | sed 's/\.//;s/v//;s/-.*//;s/\..*//'`
export IDF_VERSION
popd > /dev/null
IDF_PY=$IDF_PATH/tools/idf.py
if [ ! -x $IDF_PY ]; then
echo Unable to find idf.py. Please source $IDF_PATH/export.sh.
exit 1
fi
eval `python3 $IDF_PATH/tools/idf_tools.py export`
bin/genmemfiles.sh || exit 1
bin/mkversion.sh main/versions.h || exit 1
if [ "$CONFIG_IDF_TARGET_ESP32" == "y" ]; then
IDF_TARGET=esp32
elif [ "$CONFIG_IDF_TARGET_ESP32S2" == "y" ]; then
IDF_TARGET=esp32s2
elif [ "$CONFIG_IDF_TARGET_ESP32S3" == "y" ]; then
IDF_TARGET=esp32s3
elif [ "$CONFIG_IDF_TARGET_ESP32C3" == "y" ]; then
IDF_TARGET=esp32c3
elif [ "$CONFIG_IDF_TARGET_ESP32C6" == "y" ]; then
IDF_TARGET=esp32c6
fi
export WFC_TARGET=$CONFIG_WFC_TARGET
export CONFIG_WFC_TARGET
ATRIUM_VER=`cat "$BUILD_DIR/version.txt"`
export TIMESTAMP=`date +%s`
if [ "$2" != "" ]; then
$IDF_PY -B "$BUILD_DIR" -DIDF_TARGET=$IDF_TARGET -DSDKCONFIG=$SDKCONFIG "-DPROJECT_VER=$ATRIUM_VER" $2
else
$IDF_PY -B "$BUILD_DIR" -DIDF_TARGET=$IDF_TARGET -DSDKCONFIG=$SDKCONFIG "-DPROJECT_VER=$ATRIUM_VER" build
fi