Skip to content

Commit c4de8a5

Browse files
authored
Merge pull request #1 from espressif/master
Merge upstream
2 parents 1da3138 + cec3fca commit c4de8a5

File tree

1,797 files changed

+213851
-92973
lines changed

Some content is hidden

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

1,797 files changed

+213851
-92973
lines changed

Diff for: .github/ISSUE_TEMPLATE/bug_report.md

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
---
2+
name: Bug report
3+
about: Please fill in the bug report carefully
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
Make your question, not a Statement, inclusive. Include all pertinent information:
11+
12+
What you are trying to do?
13+
Describe your system( Hardware, computer, O/S, core version, environment).
14+
Describe what is failing.
15+
Show the shortest possible code that will duplicate the error.
16+
Show the EXACT error message(it doesn't work is not enough).
17+
All of this work on your part shows us that you have worked to solve YOUR problem. The more complete your issue posting is, the more likely someone will volunteer their time to help you.
18+
19+
If you have a Guru Meditation Error or Backtrace, ***please decode it***:
20+
https://github.com/me-no-dev/EspExceptionDecoder
21+
22+
----------------------------- Remove above -----------------------------
23+
24+
25+
### Hardware:
26+
Board: ?ESP32 Dev Module? ?node32? ?ttgo_lora?
27+
Core Installation version: ?1.0.0? ?1.0.1-rc4? ?1.0.1? ?1.0.1-git? ?1.0.2? ?1.0.3?
28+
IDE name: ?Arduino IDE? ?Platform.io? ?IDF component?
29+
Flash Frequency: ?40Mhz?
30+
PSRAM enabled: ?no? ?yes?
31+
Upload Speed: ?115200?
32+
Computer OS: ?Windows 10? ?Mac OSX? ?Ubuntu?
33+
34+
### Description:
35+
Describe your problem here
36+
37+
38+
### Sketch: (leave the backquotes for [code formatting](https://help.github.com/articles/creating-and-highlighting-code-blocks/))
39+
```cpp
40+
41+
//Change the code below by your sketch
42+
#include <Arduino.h>
43+
44+
void setup() {
45+
}
46+
47+
void loop() {
48+
}
49+
```
50+
51+
### Debug Messages:
52+
```
53+
Enable Core debug level: Debug on tools menu of Arduino IDE, then put the serial output here
54+
```

Diff for: .github/scripts/check-cmakelists.sh

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/bash
2+
#
3+
# This script is for Travis. It checks all non-examples source files in libraries/ and cores/ are listed in
4+
# CMakeLists.txt for the cmake-based IDF component
5+
#
6+
# If you see an error running this script, edit CMakeLists.txt and add any new source files into your PR
7+
#
8+
9+
set -e
10+
11+
# pull all submodules
12+
git submodule update --init --recursive
13+
14+
# find all source files in repo
15+
REPO_SRCS=`find cores/esp32/ libraries/ -name 'examples' -prune -o -name '*.c' -print -o -name '*.cpp' -print | sort`
16+
17+
# find all source files named in CMakeLists.txt COMPONENT_SRCS
18+
CMAKE_SRCS=`cmake --trace-expand -C CMakeLists.txt 2>&1 | grep COMPONENT_SRCS | sed 's/.\+COMPONENT_SRCS //' | sed 's/ )//' | tr ' ;' '\n' | sort`
19+
20+
if ! diff -u0 --label "Repo Files" --label "COMPONENT_SRCS" <(echo "$REPO_SRCS") <(echo "$CMAKE_SRCS"); then
21+
echo "Source files in repo (-) and source files in CMakeLists.txt (+) don't match"
22+
echo "Edit CMakeLists.txt as appropriate to add/remove source files from COMPONENT_SRCS"
23+
exit 1
24+
fi
25+
26+
echo "CMakeLists.txt and repo source files match"
27+
exit 0

Diff for: .github/scripts/install-arduino-core-esp32.sh

+36
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

Diff for: .github/scripts/install-arduino-ide.sh

+220
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,220 @@
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+
elif [ "$OS_IS_WINDOWS" == "1" ]; then
44+
export ARDUINO_IDE_PATH="$HOME/arduino_ide"
45+
export ARDUINO_USR_PATH="$HOME/Documents/Arduino"
46+
else
47+
export ARDUINO_IDE_PATH="$HOME/arduino_ide"
48+
export ARDUINO_USR_PATH="$HOME/Arduino"
49+
fi
50+
51+
if [ ! -d "$ARDUINO_IDE_PATH" ]; then
52+
echo "Installing Arduino IDE on $OS_NAME ..."
53+
echo "Downloading 'arduino-nightly-$OS_NAME.$ARCHIVE_FORMAT' to 'arduino.$ARCHIVE_FORMAT' ..."
54+
if [ "$OS_IS_LINUX" == "1" ]; then
55+
wget -O "arduino.$ARCHIVE_FORMAT" "https://www.arduino.cc/download.php?f=/arduino-nightly-$OS_NAME.$ARCHIVE_FORMAT" > /dev/null 2>&1
56+
echo "Extracting 'arduino.$ARCHIVE_FORMAT' ..."
57+
tar xf "arduino.$ARCHIVE_FORMAT" > /dev/null
58+
mv arduino-nightly "$ARDUINO_IDE_PATH"
59+
else
60+
curl -o "arduino.$ARCHIVE_FORMAT" -L "https://www.arduino.cc/download.php?f=/arduino-nightly-$OS_NAME.$ARCHIVE_FORMAT" > /dev/null 2>&1
61+
echo "Extracting 'arduino.$ARCHIVE_FORMAT' ..."
62+
unzip "arduino.$ARCHIVE_FORMAT" > /dev/null
63+
if [ "$OS_IS_MACOS" == "1" ]; then
64+
mv "Arduino.app" "/Applications/Arduino.app"
65+
else
66+
mv arduino-nightly "$ARDUINO_IDE_PATH"
67+
fi
68+
fi
69+
rm -rf "arduino.$ARCHIVE_FORMAT"
70+
71+
mkdir -p "$ARDUINO_USR_PATH/libraries"
72+
mkdir -p "$ARDUINO_USR_PATH/hardware"
73+
74+
echo "Arduino IDE Installed in '$ARDUINO_IDE_PATH'"
75+
echo ""
76+
fi
77+
78+
function build_sketch(){ # build_sketch <fqbn> <path-to-ino> [extra-options]
79+
if [ "$#" -lt 2 ]; then
80+
echo "ERROR: Illegal number of parameters"
81+
echo "USAGE: build_sketch <fqbn> <path-to-ino> [extra-options]"
82+
return 1
83+
fi
84+
85+
local fqbn="$1"
86+
local sketch="$2"
87+
local xtra_opts="$3"
88+
local win_opts=""
89+
if [ "$OS_IS_WINDOWS" == "1" ]; then
90+
local ctags_version=`ls "$ARDUINO_IDE_PATH/tools-builder/ctags/"`
91+
local preprocessor_version=`ls "$ARDUINO_IDE_PATH/tools-builder/arduino-preprocessor/"`
92+
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"
93+
fi
94+
95+
echo ""
96+
echo "Compiling '"$(basename "$sketch")"' ..."
97+
mkdir -p "$ARDUINO_BUILD_DIR"
98+
mkdir -p "$ARDUINO_CACHE_DIR"
99+
$ARDUINO_IDE_PATH/arduino-builder -compile -logger=human -core-api-version=10810 \
100+
-fqbn=$fqbn \
101+
-warnings="all" \
102+
-tools "$ARDUINO_IDE_PATH/tools-builder" \
103+
-tools "$ARDUINO_IDE_PATH/tools" \
104+
-built-in-libraries "$ARDUINO_IDE_PATH/libraries" \
105+
-hardware "$ARDUINO_IDE_PATH/hardware" \
106+
-hardware "$ARDUINO_USR_PATH/hardware" \
107+
-libraries "$ARDUINO_USR_PATH/libraries" \
108+
-build-cache "$ARDUINO_CACHE_DIR" \
109+
-build-path "$ARDUINO_BUILD_DIR" \
110+
$win_opts $xtra_opts "$sketch"
111+
}
112+
113+
function count_sketches() # count_sketches <examples-path>
114+
{
115+
local examples="$1"
116+
rm -rf sketches.txt
117+
if [ ! -d "$examples" ]; then
118+
touch sketches.txt
119+
return 0
120+
fi
121+
local sketches=$(find $examples -name *.ino)
122+
local sketchnum=0
123+
for sketch in $sketches; do
124+
local sketchdir=$(dirname $sketch)
125+
local sketchdirname=$(basename $sketchdir)
126+
local sketchname=$(basename $sketch)
127+
if [[ "${sketchdirname}.ino" != "$sketchname" ]]; then
128+
continue
129+
fi;
130+
if [[ -f "$sketchdir/.test.skip" ]]; then
131+
continue
132+
fi
133+
echo $sketch >> sketches.txt
134+
sketchnum=$(($sketchnum + 1))
135+
done
136+
return $sketchnum
137+
}
138+
139+
function build_sketches() # build_sketches <fqbn> <examples-path> <chunk> <total-chunks> [extra-options]
140+
{
141+
local fqbn=$1
142+
local examples=$2
143+
local chunk_idex=$3
144+
local chunks_num=$4
145+
local xtra_opts=$5
146+
147+
if [ "$#" -lt 2 ]; then
148+
echo "ERROR: Illegal number of parameters"
149+
echo "USAGE: build_sketches <fqbn> <examples-path> [<chunk> <total-chunks>] [extra-options]"
150+
return 1
151+
fi
152+
153+
if [ "$#" -lt 4 ]; then
154+
chunk_idex="0"
155+
chunks_num="1"
156+
xtra_opts=$3
157+
fi
158+
159+
if [ "$chunks_num" -le 0 ]; then
160+
echo "ERROR: Chunks count must be positive number"
161+
return 1
162+
fi
163+
if [ "$chunk_idex" -ge "$chunks_num" ]; then
164+
echo "ERROR: Chunk index must be less than chunks count"
165+
return 1
166+
fi
167+
168+
set +e
169+
count_sketches "$examples"
170+
local sketchcount=$?
171+
set -e
172+
local sketches=$(cat sketches.txt)
173+
rm -rf sketches.txt
174+
175+
local chunk_size=$(( $sketchcount / $chunks_num ))
176+
local all_chunks=$(( $chunks_num * $chunk_size ))
177+
if [ "$all_chunks" -lt "$sketchcount" ]; then
178+
chunk_size=$(( $chunk_size + 1 ))
179+
fi
180+
181+
local start_index=$(( $chunk_idex * $chunk_size ))
182+
if [ "$sketchcount" -le "$start_index" ]; then
183+
echo "Skipping job"
184+
return 0
185+
fi
186+
187+
local end_index=$(( $(( $chunk_idex + 1 )) * $chunk_size ))
188+
if [ "$end_index" -gt "$sketchcount" ]; then
189+
end_index=$sketchcount
190+
fi
191+
192+
local start_num=$(( $start_index + 1 ))
193+
echo "Found $sketchcount Sketches";
194+
echo "Chunk Count : $chunks_num"
195+
echo "Chunk Size : $chunk_size"
196+
echo "Start Sketch: $start_num"
197+
echo "End Sketch : $end_index"
198+
199+
local sketchnum=0
200+
for sketch in $sketches; do
201+
local sketchdir=$(dirname $sketch)
202+
local sketchdirname=$(basename $sketchdir)
203+
local sketchname=$(basename $sketch)
204+
if [ "${sketchdirname}.ino" != "$sketchname" ] \
205+
|| [ -f "$sketchdir/.test.skip" ]; then
206+
continue
207+
fi
208+
sketchnum=$(($sketchnum + 1))
209+
if [ "$sketchnum" -le "$start_index" ] \
210+
|| [ "$sketchnum" -gt "$end_index" ]; then
211+
continue
212+
fi
213+
build_sketch "$fqbn" "$sketch" "$xtra_opts"
214+
local result=$?
215+
if [ $result -ne 0 ]; then
216+
return $result
217+
fi
218+
done
219+
return 0
220+
}

0 commit comments

Comments
 (0)