Skip to content

Commit b114b57

Browse files
committed
Update to version 1.0.4 + power management + uart bug fix
1 parent 9d045f3 commit b114b57

File tree

352 files changed

+16022
-5929
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

352 files changed

+16022
-5929
lines changed

tools/ci/check-cmakelists.sh renamed to .github/scripts/check-cmakelists.sh

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88

99
set -e
1010

11-
cd "`dirname $0`/.." # cd to arduino-esp32 root
12-
1311
# pull all submodules
1412
git submodule update --init --recursive
1513

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/bash
2+
3+
export ARDUINO_ESP32_PATH="$ARDUINO_USR_PATH/hardware/espressif/esp32"
4+
if [ ! -d "$ARDUINO_ESP32_PATH" ]; then
5+
echo "Installing ESP32 Arduino Core ..."
6+
script_init_path="$PWD"
7+
mkdir -p "$ARDUINO_USR_PATH/hardware/espressif"
8+
cd "$ARDUINO_USR_PATH/hardware/espressif"
9+
10+
echo "Installing Python Serial ..."
11+
pip install pyserial > /dev/null
12+
13+
if [ "$OS_IS_WINDOWS" == "1" ]; then
14+
echo "Installing Python Requests ..."
15+
pip install requests > /dev/null
16+
fi
17+
18+
if [ "$GITHUB_REPOSITORY" == "espressif/arduino-esp32" ]; then
19+
echo "Linking Core..."
20+
ln -s $GITHUB_WORKSPACE esp32
21+
else
22+
echo "Cloning Core Repository..."
23+
git clone https://github.com/espressif/arduino-esp32.git esp32 > /dev/null 2>&1
24+
fi
25+
26+
echo "Updating Submodules ..."
27+
cd esp32
28+
git submodule update --init --recursive > /dev/null 2>&1
29+
30+
echo "Installing Platform Tools ..."
31+
cd tools && python get.py
32+
cd $script_init_path
33+
34+
echo "ESP32 Arduino has been installed in '$ARDUINO_ESP32_PATH'"
35+
echo ""
36+
fi
+217
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,217 @@
1+
#!/bin/bash
2+
3+
#OSTYPE: 'linux-gnu', ARCH: 'x86_64' => linux64
4+
#OSTYPE: 'msys', ARCH: 'x86_64' => win32
5+
#OSTYPE: 'darwin18', ARCH: 'i386' => macos
6+
7+
OSBITS=`arch`
8+
if [[ "$OSTYPE" == "linux"* ]]; then
9+
export OS_IS_LINUX="1"
10+
ARCHIVE_FORMAT="tar.xz"
11+
if [[ "$OSBITS" == "i686" ]]; then
12+
OS_NAME="linux32"
13+
elif [[ "$OSBITS" == "x86_64" ]]; then
14+
OS_NAME="linux64"
15+
elif [[ "$OSBITS" == "armv7l" || "$OSBITS" == "aarch64" ]]; then
16+
OS_NAME="linuxarm"
17+
else
18+
OS_NAME="$OSTYPE-$OSBITS"
19+
echo "Unknown OS '$OS_NAME'"
20+
exit 1
21+
fi
22+
elif [[ "$OSTYPE" == "darwin"* ]]; then
23+
export OS_IS_MACOS="1"
24+
ARCHIVE_FORMAT="zip"
25+
OS_NAME="macosx"
26+
elif [[ "$OSTYPE" == "cygwin" ]] || [[ "$OSTYPE" == "msys" ]] || [[ "$OSTYPE" == "win32" ]]; then
27+
export OS_IS_WINDOWS="1"
28+
ARCHIVE_FORMAT="zip"
29+
OS_NAME="windows"
30+
else
31+
OS_NAME="$OSTYPE-$OSBITS"
32+
echo "Unknown OS '$OS_NAME'"
33+
exit 1
34+
fi
35+
export OS_NAME
36+
37+
ARDUINO_BUILD_DIR="$HOME/.arduino/build.tmp"
38+
ARDUINO_CACHE_DIR="$HOME/.arduino/cache.tmp"
39+
40+
if [ "$OS_IS_MACOS" == "1" ]; then
41+
export ARDUINO_IDE_PATH="/Applications/Arduino.app/Contents/Java"
42+
export ARDUINO_USR_PATH="$HOME/Documents/Arduino"
43+
else
44+
export ARDUINO_IDE_PATH="$HOME/arduino_ide"
45+
export ARDUINO_USR_PATH="$HOME/Arduino"
46+
fi
47+
48+
if [ ! -d "$ARDUINO_IDE_PATH" ]; then
49+
echo "Installing Arduino IDE on $OS_NAME ..."
50+
echo "Downloading 'arduino-nightly-$OS_NAME.$ARCHIVE_FORMAT' to 'arduino.$ARCHIVE_FORMAT' ..."
51+
if [ "$OS_IS_LINUX" == "1" ]; then
52+
wget -O "arduino.$ARCHIVE_FORMAT" "https://www.arduino.cc/download.php?f=/arduino-nightly-$OS_NAME.$ARCHIVE_FORMAT" > /dev/null 2>&1
53+
echo "Extracting 'arduino.$ARCHIVE_FORMAT' ..."
54+
tar xf "arduino.$ARCHIVE_FORMAT" > /dev/null
55+
mv arduino-nightly "$ARDUINO_IDE_PATH"
56+
else
57+
curl -o "arduino.$ARCHIVE_FORMAT" -L "https://www.arduino.cc/download.php?f=/arduino-nightly-$OS_NAME.$ARCHIVE_FORMAT" > /dev/null 2>&1
58+
echo "Extracting 'arduino.$ARCHIVE_FORMAT' ..."
59+
unzip "arduino.$ARCHIVE_FORMAT" > /dev/null
60+
if [ "$OS_IS_MACOS" == "1" ]; then
61+
mv "Arduino.app" "/Applications/Arduino.app"
62+
else
63+
mv arduino-nightly "$ARDUINO_IDE_PATH"
64+
fi
65+
fi
66+
rm -rf "arduino.$ARCHIVE_FORMAT"
67+
68+
mkdir -p "$ARDUINO_USR_PATH/libraries"
69+
mkdir -p "$ARDUINO_USR_PATH/hardware"
70+
71+
echo "Arduino IDE Installed in '$ARDUINO_IDE_PATH'"
72+
echo ""
73+
fi
74+
75+
function build_sketch(){ # build_sketch <fqbn> <path-to-ino> [extra-options]
76+
if [ "$#" -lt 2 ]; then
77+
echo "ERROR: Illegal number of parameters"
78+
echo "USAGE: build_sketch <fqbn> <path-to-ino> [extra-options]"
79+
return 1
80+
fi
81+
82+
local fqbn="$1"
83+
local sketch="$2"
84+
local xtra_opts="$3"
85+
local win_opts=""
86+
if [ "$OS_IS_WINDOWS" == "1" ]; then
87+
local ctags_version=`ls "$ARDUINO_IDE_PATH/tools-builder/ctags/"`
88+
local preprocessor_version=`ls "$ARDUINO_IDE_PATH/tools-builder/arduino-preprocessor/"`
89+
win_opts="-prefs=runtime.tools.ctags.path=$ARDUINO_IDE_PATH/tools-builder/ctags/$ctags_version -prefs=runtime.tools.arduino-preprocessor.path=$ARDUINO_IDE_PATH/tools-builder/arduino-preprocessor/$preprocessor_version"
90+
fi
91+
92+
echo ""
93+
echo "Compiling '"$(basename "$sketch")"' ..."
94+
mkdir -p "$ARDUINO_BUILD_DIR"
95+
mkdir -p "$ARDUINO_CACHE_DIR"
96+
$ARDUINO_IDE_PATH/arduino-builder -compile -logger=human -core-api-version=10810 \
97+
-fqbn=$fqbn \
98+
-warnings="all" \
99+
-tools "$ARDUINO_IDE_PATH/tools-builder" \
100+
-tools "$ARDUINO_IDE_PATH/tools" \
101+
-built-in-libraries "$ARDUINO_IDE_PATH/libraries" \
102+
-hardware "$ARDUINO_IDE_PATH/hardware" \
103+
-hardware "$ARDUINO_USR_PATH/hardware" \
104+
-libraries "$ARDUINO_USR_PATH/libraries" \
105+
-build-cache "$ARDUINO_CACHE_DIR" \
106+
-build-path "$ARDUINO_BUILD_DIR" \
107+
$win_opts $xtra_opts "$sketch"
108+
}
109+
110+
function count_sketches() # count_sketches <examples-path>
111+
{
112+
local examples="$1"
113+
rm -rf sketches.txt
114+
if [ ! -d "$examples" ]; then
115+
touch sketches.txt
116+
return 0
117+
fi
118+
local sketches=$(find $examples -name *.ino)
119+
local sketchnum=0
120+
for sketch in $sketches; do
121+
local sketchdir=$(dirname $sketch)
122+
local sketchdirname=$(basename $sketchdir)
123+
local sketchname=$(basename $sketch)
124+
if [[ "${sketchdirname}.ino" != "$sketchname" ]]; then
125+
continue
126+
fi;
127+
if [[ -f "$sketchdir/.test.skip" ]]; then
128+
continue
129+
fi
130+
echo $sketch >> sketches.txt
131+
sketchnum=$(($sketchnum + 1))
132+
done
133+
return $sketchnum
134+
}
135+
136+
function build_sketches() # build_sketches <fqbn> <examples-path> <chunk> <total-chunks> [extra-options]
137+
{
138+
local fqbn=$1
139+
local examples=$2
140+
local chunk_idex=$3
141+
local chunks_num=$4
142+
local xtra_opts=$5
143+
144+
if [ "$#" -lt 2 ]; then
145+
echo "ERROR: Illegal number of parameters"
146+
echo "USAGE: build_sketches <fqbn> <examples-path> [<chunk> <total-chunks>] [extra-options]"
147+
return 1
148+
fi
149+
150+
if [ "$#" -lt 4 ]; then
151+
chunk_idex="0"
152+
chunks_num="1"
153+
xtra_opts=$3
154+
fi
155+
156+
if [ "$chunks_num" -le 0 ]; then
157+
echo "ERROR: Chunks count must be positive number"
158+
return 1
159+
fi
160+
if [ "$chunk_idex" -ge "$chunks_num" ]; then
161+
echo "ERROR: Chunk index must be less than chunks count"
162+
return 1
163+
fi
164+
165+
set +e
166+
count_sketches "$examples"
167+
local sketchcount=$?
168+
set -e
169+
local sketches=$(cat sketches.txt)
170+
rm -rf sketches.txt
171+
172+
local chunk_size=$(( $sketchcount / $chunks_num ))
173+
local all_chunks=$(( $chunks_num * $chunk_size ))
174+
if [ "$all_chunks" -lt "$sketchcount" ]; then
175+
chunk_size=$(( $chunk_size + 1 ))
176+
fi
177+
178+
local start_index=$(( $chunk_idex * $chunk_size ))
179+
if [ "$sketchcount" -le "$start_index" ]; then
180+
echo "Skipping job"
181+
return 0
182+
fi
183+
184+
local end_index=$(( $(( $chunk_idex + 1 )) * $chunk_size ))
185+
if [ "$end_index" -gt "$sketchcount" ]; then
186+
end_index=$sketchcount
187+
fi
188+
189+
local start_num=$(( $start_index + 1 ))
190+
echo "Found $sketchcount Sketches";
191+
echo "Chunk Count : $chunks_num"
192+
echo "Chunk Size : $chunk_size"
193+
echo "Start Sketch: $start_num"
194+
echo "End Sketch : $end_index"
195+
196+
local sketchnum=0
197+
for sketch in $sketches; do
198+
local sketchdir=$(dirname $sketch)
199+
local sketchdirname=$(basename $sketchdir)
200+
local sketchname=$(basename $sketch)
201+
if [ "${sketchdirname}.ino" != "$sketchname" ] \
202+
|| [ -f "$sketchdir/.test.skip" ]; then
203+
continue
204+
fi
205+
sketchnum=$(($sketchnum + 1))
206+
if [ "$sketchnum" -le "$start_index" ] \
207+
|| [ "$sketchnum" -gt "$end_index" ]; then
208+
continue
209+
fi
210+
build_sketch "$fqbn" "$sketch" "$xtra_opts"
211+
local result=$?
212+
if [ $result -ne 0 ]; then
213+
return $result
214+
fi
215+
done
216+
return 0
217+
}

0 commit comments

Comments
 (0)