-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·64 lines (51 loc) · 1.43 KB
/
build.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
#!/bin/bash
# BASEDIR=$(dirname $0)
# cd $BASEDIR
#
# VERSION=$(<VERSION)
# IMAGE_NAME="marcoraddatz/homebridge"
# CONTAINER_NAME=Homebridge
ACTION=$1
PORT=$3
ESPPORT=/dev/cu.usbserial-1410
if [ -z "$ACTION" ];
then
echo "usage: $0 <build|clean|erase|flash|debug>";
exit 1;
fi
# Build
_build() {
docker run -it --rm -v $(pwd):/project -w /project "$@" esp-rtos make -C . ESPPORT=/dev/cu.usbserial-1410 FLASH_SIZE=8 HOMEKIT_SPI_FLASH_BASE_ADDR=0x8c000 HOMEKIT_DEBUG=1 clean
}
# Build
_clean() {
# docker run -it --rm -v $(pwd):/project -w /project "$@" esp-rtos make -C . ESPPORT="$PORT" FLASH_SIZE=8 HOMEKIT_SPI_FLASH_BASE_ADDR=0x8c000 HOMEKIT_DEBUG=1 all
docker run -it --rm -v $(pwd):/project -w /project "$@" esp-rtos make -C . ESPPORT=/dev/cu.usbserial-1410 FLASH_SIZE=8 HOMEKIT_SPI_FLASH_BASE_ADDR=0x8c000 HOMEKIT_DEBUG=1 all
}
# Erase firmware
_erase() {
esptool.py -p /dev/cu.usbserial-1410 --baud 115200 erase_flash;
}
# Flash latest prebuilt OTA firmware
_flash() {
esptool.py -p /dev/cu.usbserial-1410 --baud 115200 write_flash -fs 1MB -fm dout -ff 40m 0x0 firmware_prebuilt/rboot.bin 0x1000 firmware_prebuilt/blank_config.bin 0x2000 firmware_prebuilt/otaboot.bin;
}
_debug() {
screen /dev/cu.usbserial-1410 115200 –L
}
_release() {
echo "WIP: Coming soon..."
echo $PORT
}
# Rebuild firmware
_rebuild() {
_clear
_build
}
# Erase firmware, flash and debug
_rerun() {
_erase
_flash
_debug
}
eval _$ACTION