-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·183 lines (168 loc) · 4.57 KB
/
Copy pathbuild.sh
File metadata and controls
executable file
·183 lines (168 loc) · 4.57 KB
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
#!/bin/bash
# IRIS Kit Firmware Build Script
# Support compilation and upload for IREXT and GeekLink hardware versions
set -e
# Color definitions
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Print colored messages
print_info() {
echo -e "${BLUE} $1${NC}"
}
print_success() {
echo -e "${GREEN}✓ $1${NC}"
}
print_warning() {
echo -e "${YELLOW}⚠ $1${NC}"
}
print_error() {
echo -e "${RED}✗ $1${NC}"
}
# Display main menu
show_menu() {
echo ""
echo "=========================================="
echo -e "${GREEN}IRIS Kit Firmware Build Script${NC}"
echo "=========================================="
echo ""
echo "Hardware Versions:"
echo " [1] IRIS_KIT_IREXT -> iris_kit_irext_latest.bin"
echo " [2] IRIS_KIT_GEEKLINK -> iris_kit_geeklink_latest.bin"
echo ""
echo "Build Commands:"
echo " [3] Build IREXT version"
echo " [4] Build GeekLink version"
echo " [5] Build ALL versions"
echo ""
echo "Upload Commands:"
echo " [6] Upload IREXT version"
echo " [7] Upload GeekLink version"
echo ""
echo "Maintenance:"
echo " [8] Clean all builds"
echo " [9] Show build info"
echo " [0] Exit"
echo ""
}
# Build firmware
build_firmware() {
local env_name=$1
local version_name=$2
print_info "Building $version_name firmware..."
if pio run -e "$env_name"; then
print_success "$version_name build completed successfully!"
echo ""
print_info "Output file: .pio/build/$env_name/iris_kit_${version_name,,}_latest.bin"
else
print_error "$version_name build failed!"
return 1
fi
}
# Upload firmware
upload_firmware() {
local env_name=$1
local version_name=$2
print_info "Uploading $version_name firmware..."
if pio run -e "$env_name" -t upload; then
print_success "$version_name firmware uploaded successfully!"
else
print_error "$version_name upload failed!"
return 1
fi
}
# Clean all builds
clean_all() {
print_info "Cleaning all builds..."
if pio run -t clean; then
print_success "All builds cleaned!"
else
print_error "Clean failed!"
return 1
fi
}
# Show build info
show_build_info() {
echo ""
echo "=========================================="
echo -e "${GREEN}Build Information${NC}"
echo "=========================================="
echo ""
print_info "Available environments:"
pio project config 2>&1 | grep "^env:" | sed 's/^/ /'
echo ""
print_info "Firmware files:"
if [ -d ".pio/build" ]; then
find .pio/build -name "*.bin" -type f 2>/dev/null | while read file; do
size=$(du -h "$file" | cut -f1)
echo " [$size] $file"
done
else
echo " No firmware files found. Please build first."
fi
echo ""
}
# Main loop
while true; do
show_menu
read -p "Enter your choice [0-9]: " choice
case $choice in
1)
echo ""
print_info "Environment: esp8266-1m-irext"
print_info "Macro: -DIRIS_KIT_IREXT=1"
print_info "Output: iris_kit_latest.bin"
echo ""
;;
2)
echo ""
print_info "Environment: esp8266-1m-geeklink"
print_info "Macro: -DIRIS_KIT_GEEKLINK=1"
print_info "Output: iris_kit_geeklink_latest.bin"
echo ""
;;
3)
build_firmware "esp8266-1m-irext" "IREXT"
;;
4)
build_firmware "esp8266-1m-geeklink" "GeekLink"
;;
5)
print_info "Building ALL versions..."
echo ""
build_firmware "esp8266-1m-irext" "IREXT"
echo ""
build_firmware "esp8266-1m-geeklink" "GeekLink"
echo ""
print_success "All versions built successfully!"
;;
6)
upload_firmware "esp8266-1m-irext" "IREXT"
;;
7)
upload_firmware "esp8266-1m-geeklink" "GeekLink"
;;
8)
clean_all
;;
9)
show_build_info
;;
0)
echo ""
print_info "Goodbye!"
exit 0
;;
*)
echo ""
print_error "Invalid choice! Please enter a number between 0-9."
;;
esac
# Wait for user to press Enter to continue (except for exit)
if [ "$choice" != "0" ]; then
echo ""
read -p "Press Enter to continue..."
fi
done