Skip to content

Commit 5502879

Browse files
me-no-devSeon RozenblumgeeksvilleatanisoftUnexpectedMaker
authored
v2.0.0 Add support for ESP32S2 and update ESP-IDF to 4.4 (#4996)
This is very much still work in progress and much more will change before the final 2.0.0 Some APIs have changed. New libraries have been added. LittleFS included. Co-authored-by: Seon Rozenblum <[email protected]> Co-authored-by: Me No Dev <[email protected]> Co-authored-by: geeksville <[email protected]> Co-authored-by: Mike Dunston <[email protected]> Co-authored-by: Unexpected Maker <[email protected]> Co-authored-by: Seon Rozenblum <[email protected]> Co-authored-by: microDev <[email protected]> Co-authored-by: tobozo <[email protected]> Co-authored-by: bobobo1618 <[email protected]> Co-authored-by: lorol <[email protected]> Co-authored-by: geeksville <[email protected]> Co-authored-by: Limor "Ladyada" Fried <[email protected]> Co-authored-by: Sweety <[email protected]> Co-authored-by: Loick MAHIEUX <[email protected]> Co-authored-by: Larry Bernstone <[email protected]> Co-authored-by: Valerii Koval <[email protected]> Co-authored-by: 快乐的我531 <[email protected]> Co-authored-by: chegewara <[email protected]> Co-authored-by: Clemens Kirchgatterer <[email protected]> Co-authored-by: Aron Rubin <[email protected]> Co-authored-by: Pete Lewis <[email protected]>
1 parent 46d5afb commit 5502879

File tree

5,209 files changed

+826348
-322804
lines changed

Some content is hidden

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

5,209 files changed

+826348
-322804
lines changed

.github/scripts/check-cmakelists.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ git submodule update --init --recursive
1515
REPO_SRCS=`find cores/esp32/ libraries/ -name 'examples' -prune -o -name '*.c' -print -o -name '*.cpp' -print | sort`
1616

1717
# 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`
18+
CMAKE_SRCS=`cmake --trace-expand -C CMakeLists.txt 2>&1 | grep set\(srcs | cut -d'(' -f3 | sed 's/ )//' | sed 's/srcs //' | tr ' ;' '\n' | sort`
1919

20-
if ! diff -u0 --label "Repo Files" --label "COMPONENT_SRCS" <(echo "$REPO_SRCS") <(echo "$CMAKE_SRCS"); then
20+
if ! diff -u0 --label "Repo Files" --label "srcs" <(echo "$REPO_SRCS") <(echo "$CMAKE_SRCS"); then
2121
echo "Source files in repo (-) and source files in CMakeLists.txt (+) don't match"
2222
echo "Edit CMakeLists.txt as appropriate to add/remove source files from COMPONENT_SRCS"
2323
exit 1

.github/scripts/install-arduino-core-esp32.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ if [ ! -d "$ARDUINO_ESP32_PATH" ]; then
2323
git clone https://github.com/espressif/arduino-esp32.git esp32 > /dev/null 2>&1
2424
fi
2525

26-
echo "Updating Submodules ..."
26+
#echo "Updating Submodules ..."
2727
cd esp32
28-
git submodule update --init --recursive > /dev/null 2>&1
28+
#git submodule update --init --recursive > /dev/null 2>&1
2929

3030
echo "Installing Platform Tools ..."
3131
cd tools && python get.py

.github/scripts/install-arduino-ide.sh

+14-12
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,10 @@ function build_sketch(){ # build_sketch <fqbn> <path-to-ino> [extra-options]
116116
$win_opts $xtra_opts "$sketch"
117117
}
118118

119-
function count_sketches() # count_sketches <examples-path>
119+
function count_sketches() # count_sketches <examples-path> <target-mcu>
120120
{
121121
local examples="$1"
122+
local target="$2"
122123
rm -rf sketches.txt
123124
if [ ! -d "$examples" ]; then
124125
touch sketches.txt
@@ -133,7 +134,7 @@ function count_sketches() # count_sketches <examples-path>
133134
if [[ "${sketchdirname}.ino" != "$sketchname" ]]; then
134135
continue
135136
fi;
136-
if [[ -f "$sketchdir/.test.skip" ]]; then
137+
if [[ -f "$sketchdir/.skip.$target" ]]; then
137138
continue
138139
fi
139140
echo $sketch >> sketches.txt
@@ -142,24 +143,25 @@ function count_sketches() # count_sketches <examples-path>
142143
return $sketchnum
143144
}
144145

145-
function build_sketches() # build_sketches <fqbn> <examples-path> <chunk> <total-chunks> [extra-options]
146+
function build_sketches() # build_sketches <fqbn> <target-mcu> <examples-path> <chunk> <total-chunks> [extra-options]
146147
{
147148
local fqbn=$1
148-
local examples=$2
149-
local chunk_idex=$3
150-
local chunks_num=$4
151-
local xtra_opts=$5
149+
local target="$2"
150+
local examples=$3
151+
local chunk_idex=$4
152+
local chunks_num=$5
153+
local xtra_opts=$6
152154

153-
if [ "$#" -lt 2 ]; then
155+
if [ "$#" -lt 3 ]; then
154156
echo "ERROR: Illegal number of parameters"
155-
echo "USAGE: build_sketches <fqbn> <examples-path> [<chunk> <total-chunks>] [extra-options]"
157+
echo "USAGE: build_sketches <fqbn> <target-mcu <examples-path> [<chunk> <total-chunks>] [extra-options]"
156158
return 1
157159
fi
158160

159-
if [ "$#" -lt 4 ]; then
161+
if [ "$#" -lt 5 ]; then
160162
chunk_idex="0"
161163
chunks_num="1"
162-
xtra_opts=$3
164+
xtra_opts=$4
163165
fi
164166

165167
if [ "$chunks_num" -le 0 ]; then
@@ -208,7 +210,7 @@ function build_sketches() # build_sketches <fqbn> <examples-path> <chunk> <total
208210
local sketchdirname=$(basename $sketchdir)
209211
local sketchname=$(basename $sketch)
210212
if [ "${sketchdirname}.ino" != "$sketchname" ] \
211-
|| [ -f "$sketchdir/.test.skip" ]; then
213+
|| [ -f "$sketchdir/.skip.$target" ]; then
212214
continue
213215
fi
214216
sketchnum=$(($sketchnum + 1))

.github/scripts/install-platformio-esp32.sh

+18-15
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/bin/bash
22

33
export PLATFORMIO_ESP32_PATH="$HOME/.platformio/packages/framework-arduinoespressif32"
4+
PLATFORMIO_ESP32_URL="https://github.com/platformio/platform-espressif32.git#feature/idf-v4.0"
45

56
echo "Installing Python Wheel ..."
67
pip install wheel > /dev/null 2>&1
@@ -9,10 +10,10 @@ echo "Installing PlatformIO ..."
910
pip install -U https://github.com/platformio/platformio/archive/develop.zip > /dev/null 2>&1
1011

1112
echo "Installing Platform ESP32 ..."
12-
python -m platformio platform install https://github.com/platformio/platform-espressif32.git > /dev/null 2>&1
13+
python -m platformio platform install $PLATFORMIO_ESP32_URL > /dev/null 2>&1
1314

1415
echo "Replacing the framework version ..."
15-
python -c "import json; import os; fp=open(os.path.expanduser('~/.platformio/platforms/espressif32/platform.json'), 'r+'); data=json.load(fp); data['packages']['framework-arduinoespressif32']['version'] = '*'; del data['packages']['framework-arduinoespressif32']['owner']; fp.seek(0); fp.truncate(); json.dump(data, fp); fp.close()"
16+
python -c "import json; import os; fp=open(os.path.expanduser('~/.platformio/platforms/espressif32/platform.json'), 'r+'); data=json.load(fp); data['packages']['framework-arduinoespressif32']['version'] = '*'; fp.seek(0); fp.truncate(); json.dump(data, fp); fp.close()"
1617

1718
if [ "$GITHUB_REPOSITORY" == "espressif/arduino-esp32" ]; then
1819
echo "Linking Core..."
@@ -25,19 +26,20 @@ fi
2526
echo "PlatformIO for ESP32 has been installed"
2627
echo ""
2728

28-
function build_pio_sketch(){ # build_pio_sketch <board> <path-to-ino>
29-
if [ "$#" -lt 2 ]; then
29+
function build_pio_sketch(){ # build_pio_sketch <board> <options> <path-to-ino>
30+
if [ "$#" -lt 3 ]; then
3031
echo "ERROR: Illegal number of parameters"
31-
echo "USAGE: build_pio_sketch <board> <path-to-ino>"
32+
echo "USAGE: build_pio_sketch <board> <options> <path-to-ino>"
3233
return 1
3334
fi
3435

3536
local board="$1"
36-
local sketch="$2"
37+
local options="$2"
38+
local sketch="$3"
3739
local sketch_dir=$(dirname "$sketch")
3840
echo ""
3941
echo "Compiling '"$(basename "$sketch")"' ..."
40-
python -m platformio ci --board "$board" "$sketch_dir" --project-option="board_build.partitions = huge_app.csv"
42+
python -m platformio ci --board "$board" "$sketch_dir" --project-option="$options"
4143
}
4244

4345
function count_sketches() # count_sketches <examples-path>
@@ -66,20 +68,21 @@ function count_sketches() # count_sketches <examples-path>
6668
return $sketchnum
6769
}
6870

69-
function build_pio_sketches() # build_pio_sketches <board> <examples-path> <chunk> <total-chunks>
71+
function build_pio_sketches() # build_pio_sketches <board> <options> <examples-path> <chunk> <total-chunks>
7072
{
71-
if [ "$#" -lt 2 ]; then
73+
if [ "$#" -lt 3 ]; then
7274
echo "ERROR: Illegal number of parameters"
73-
echo "USAGE: build_pio_sketches <board> <examples-path> [<chunk> <total-chunks>]"
75+
echo "USAGE: build_pio_sketches <board> <options> <examples-path> [<chunk> <total-chunks>]"
7476
return 1
7577
fi
7678

7779
local board=$1
78-
local examples=$2
79-
local chunk_idex=$3
80-
local chunks_num=$4
80+
local options="$2"
81+
local examples=$3
82+
local chunk_idex=$4
83+
local chunks_num=$5
8184

82-
if [ "$#" -lt 4 ]; then
85+
if [ "$#" -lt 5 ]; then
8386
chunk_idex="0"
8487
chunks_num="1"
8588
fi
@@ -138,7 +141,7 @@ function build_pio_sketches() # build_pio_sketches <board> <examples-path> <chun
138141
|| [ "$sketchnum" -gt "$end_index" ]; then
139142
continue
140143
fi
141-
build_pio_sketch "$board" "$sketch"
144+
build_pio_sketch "$board" "$options" "$sketch"
142145
local result=$?
143146
if [ $result -ne 0 ]; then
144147
return $result

.github/scripts/on-push.sh

+34-14
Original file line numberDiff line numberDiff line change
@@ -30,42 +30,62 @@ elif [ "$CHUNK_INDEX" -eq "$CHUNKS_CNT" ]; then
3030
BUILD_PIO=1
3131
fi
3232

33-
echo "Updating submodules ..."
34-
git -C "$GITHUB_WORKSPACE" submodule update --init --recursive > /dev/null 2>&1
33+
#echo "Updating submodules ..."
34+
#git -C "$GITHUB_WORKSPACE" submodule update --init --recursive > /dev/null 2>&1
3535

3636
if [ "$BUILD_PIO" -eq 0 ]; then
37-
# ArduinoIDE Test
37+
# ArduinoIDE ESP32 Test
38+
TARGET="esp32"
3839
FQBN="espressif:esp32:esp32:PSRAM=enabled,PartitionScheme=huge_app"
3940
source ./.github/scripts/install-arduino-ide.sh
4041
source ./.github/scripts/install-arduino-core-esp32.sh
4142
if [ "$OS_IS_WINDOWS" == "1" ]; then
4243
build_sketch "$FQBN" "$ARDUINO_ESP32_PATH/libraries/WiFiClientSecure/examples/WiFiClientSecure/WiFiClientSecure.ino" && \
4344
build_sketch "$FQBN" "$ARDUINO_ESP32_PATH/libraries/BLE/examples/BLE_server/BLE_server.ino" && \
44-
build_sketch "$FQBN" "$ARDUINO_ESP32_PATH/libraries/AzureIoT/examples/GetStarted/GetStarted.ino" && \
4545
build_sketch "$FQBN" "$ARDUINO_ESP32_PATH/libraries/ESP32/examples/Camera/CameraWebServer/CameraWebServer.ino"
4646
elif [ "$OS_IS_MACOS" == "1" ]; then
4747
build_sketch "$FQBN" "$ARDUINO_ESP32_PATH/libraries/WiFi/examples/WiFiClient/WiFiClient.ino" && \
4848
build_sketch "$FQBN" "$ARDUINO_ESP32_PATH/libraries/WiFiClientSecure/examples/WiFiClientSecure/WiFiClientSecure.ino" && \
4949
build_sketch "$FQBN" "$ARDUINO_ESP32_PATH/libraries/BluetoothSerial/examples/SerialToSerialBT/SerialToSerialBT.ino" && \
5050
build_sketch "$FQBN" "$ARDUINO_ESP32_PATH/libraries/BLE/examples/BLE_server/BLE_server.ino" && \
51-
build_sketch "$FQBN" "$ARDUINO_ESP32_PATH/libraries/AzureIoT/examples/GetStarted/GetStarted.ino" && \
5251
build_sketch "$FQBN" "$ARDUINO_ESP32_PATH/libraries/ESP32/examples/Camera/CameraWebServer/CameraWebServer.ino"
5352
else
5453
# CMake Test
5554
if [ "$CHUNK_INDEX" -eq 0 ]; then
5655
bash "$ARDUINO_ESP32_PATH/.github/scripts/check-cmakelists.sh"
5756
fi
58-
build_sketches "$FQBN" "$ARDUINO_ESP32_PATH/libraries" "$CHUNK_INDEX" "$CHUNKS_CNT"
57+
build_sketches "$FQBN" "$TARGET" "$ARDUINO_ESP32_PATH/libraries" "$CHUNK_INDEX" "$CHUNKS_CNT"
5958
fi
59+
60+
# ArduinoIDE ESP32S2 Test
61+
TARGET="esp32s2"
62+
FQBN="espressif:esp32:esp32s2:PSRAM=enabled,PartitionScheme=huge_app"
63+
if [ "$OS_IS_WINDOWS" == "1" ]; then
64+
build_sketch "$FQBN" "$ARDUINO_ESP32_PATH/libraries/WiFi/examples/WiFiClient/WiFiClient.ino" && \
65+
build_sketch "$FQBN" "$ARDUINO_ESP32_PATH/libraries/WiFiClientSecure/examples/WiFiClientSecure/WiFiClientSecure.ino"
66+
elif [ "$OS_IS_MACOS" == "1" ]; then
67+
build_sketch "$FQBN" "$ARDUINO_ESP32_PATH/libraries/WiFi/examples/WiFiClient/WiFiClient.ino" && \
68+
build_sketch "$FQBN" "$ARDUINO_ESP32_PATH/libraries/WiFiClientSecure/examples/WiFiClientSecure/WiFiClientSecure.ino"
69+
else
70+
build_sketches "$FQBN" "$TARGET" "$ARDUINO_ESP32_PATH/libraries" "$CHUNK_INDEX" "$CHUNKS_CNT"
71+
fi
6072
else
61-
# PlatformIO Test
6273
source ./.github/scripts/install-platformio-esp32.sh
74+
# PlatformIO ESP32 Test
6375
BOARD="esp32dev"
64-
build_pio_sketch "$BOARD" "$PLATFORMIO_ESP32_PATH/libraries/WiFi/examples/WiFiClient/WiFiClient.ino" && \
65-
build_pio_sketch "$BOARD" "$PLATFORMIO_ESP32_PATH/libraries/WiFiClientSecure/examples/WiFiClientSecure/WiFiClientSecure.ino" && \
66-
build_pio_sketch "$BOARD" "$PLATFORMIO_ESP32_PATH/libraries/BluetoothSerial/examples/SerialToSerialBT/SerialToSerialBT.ino" && \
67-
build_pio_sketch "$BOARD" "$PLATFORMIO_ESP32_PATH/libraries/BLE/examples/BLE_server/BLE_server.ino" && \
68-
build_pio_sketch "$BOARD" "$PLATFORMIO_ESP32_PATH/libraries/AzureIoT/examples/GetStarted/GetStarted.ino" && \
69-
build_pio_sketch "$BOARD" "$PLATFORMIO_ESP32_PATH/libraries/ESP32/examples/Camera/CameraWebServer/CameraWebServer.ino"
70-
#build_pio_sketches esp32dev "$PLATFORMIO_ESP32_PATH/libraries"
76+
OPTIONS="board_build.partitions = huge_app.csv"
77+
build_pio_sketch "$BOARD" "$OPTIONS" "$PLATFORMIO_ESP32_PATH/libraries/WiFi/examples/WiFiClient/WiFiClient.ino" && \
78+
build_pio_sketch "$BOARD" "$OPTIONS" "$PLATFORMIO_ESP32_PATH/libraries/WiFiClientSecure/examples/WiFiClientSecure/WiFiClientSecure.ino" && \
79+
build_pio_sketch "$BOARD" "$OPTIONS" "$PLATFORMIO_ESP32_PATH/libraries/BluetoothSerial/examples/SerialToSerialBT/SerialToSerialBT.ino" && \
80+
build_pio_sketch "$BOARD" "$OPTIONS" "$PLATFORMIO_ESP32_PATH/libraries/BLE/examples/BLE_server/BLE_server.ino" && \
81+
build_pio_sketch "$BOARD" "$OPTIONS" "$PLATFORMIO_ESP32_PATH/libraries/ESP32/examples/Camera/CameraWebServer/CameraWebServer.ino"
82+
83+
# PlatformIO ESP32 Test
84+
# OPTIONS="board_build.mcu = esp32s2"
85+
# build_pio_sketch "$BOARD" "$OPTIONS" "$PLATFORMIO_ESP32_PATH/libraries/WiFi/examples/WiFiClient/WiFiClient.ino" && \
86+
# build_pio_sketch "$BOARD" "$OPTIONS" "$PLATFORMIO_ESP32_PATH/libraries/WiFiClientSecure/examples/WiFiClientSecure/WiFiClientSecure.ino"
87+
88+
python -m platformio ci --board "$BOARD" "$PLATFORMIO_ESP32_PATH/libraries/WiFi/examples/WiFiClient" --project-option="board_build.mcu = esp32s2" --project-option="board_build.partitions = huge_app.csv"
89+
90+
#build_pio_sketches "$BOARD" "$OPTIONS" "$PLATFORMIO_ESP32_PATH/libraries"
7191
fi

.github/scripts/on-release.sh

+14-13
Original file line numberDiff line numberDiff line change
@@ -171,19 +171,19 @@ mkdir -p "$PKG_DIR/tools"
171171

172172
# Copy all core files to the package folder
173173
echo "Copying files for packaging ..."
174-
cp -f "$GITHUB_WORKSPACE/boards.txt" "$PKG_DIR/"
175-
cp -f "$GITHUB_WORKSPACE/programmers.txt" "$PKG_DIR/"
176-
cp -Rf "$GITHUB_WORKSPACE/cores" "$PKG_DIR/"
177-
cp -Rf "$GITHUB_WORKSPACE/libraries" "$PKG_DIR/"
178-
cp -Rf "$GITHUB_WORKSPACE/variants" "$PKG_DIR/"
179-
cp -f "$GITHUB_WORKSPACE/tools/espota.exe" "$PKG_DIR/tools/"
180-
cp -f "$GITHUB_WORKSPACE/tools/espota.py" "$PKG_DIR/tools/"
181-
cp -f "$GITHUB_WORKSPACE/tools/esptool.py" "$PKG_DIR/tools/"
182-
cp -f "$GITHUB_WORKSPACE/tools/gen_esp32part.py" "$PKG_DIR/tools/"
183-
cp -f "$GITHUB_WORKSPACE/tools/gen_esp32part.exe" "$PKG_DIR/tools/"
184-
cp -Rf "$GITHUB_WORKSPACE/tools/partitions" "$PKG_DIR/tools/"
185-
cp -Rf "$GITHUB_WORKSPACE/tools/sdk" "$PKG_DIR/tools/"
186-
cp -f "$GITHUB_WORKSPACE/tools/platformio-build.py" "$PKG_DIR/tools/"
174+
cp -f "$GITHUB_WORKSPACE/boards.txt" "$PKG_DIR/"
175+
cp -f "$GITHUB_WORKSPACE/programmers.txt" "$PKG_DIR/"
176+
cp -Rf "$GITHUB_WORKSPACE/cores" "$PKG_DIR/"
177+
cp -Rf "$GITHUB_WORKSPACE/libraries" "$PKG_DIR/"
178+
cp -Rf "$GITHUB_WORKSPACE/variants" "$PKG_DIR/"
179+
cp -f "$GITHUB_WORKSPACE/tools/espota.exe" "$PKG_DIR/tools/"
180+
cp -f "$GITHUB_WORKSPACE/tools/espota.py" "$PKG_DIR/tools/"
181+
cp -f "$GITHUB_WORKSPACE/tools/esptool.py" "$PKG_DIR/tools/"
182+
cp -f "$GITHUB_WORKSPACE/tools/gen_esp32part.py" "$PKG_DIR/tools/"
183+
cp -f "$GITHUB_WORKSPACE/tools/gen_esp32part.exe" "$PKG_DIR/tools/"
184+
cp -Rf "$GITHUB_WORKSPACE/tools/partitions" "$PKG_DIR/tools/"
185+
cp -Rf "$GITHUB_WORKSPACE/tools/sdk" "$PKG_DIR/tools/"
186+
cp -f $GITHUB_WORKSPACE/tools/platformio-build*.py "$PKG_DIR/tools/"
187187

188188
# Remove unnecessary files in the package folder
189189
echo "Cleaning up folders ..."
@@ -195,6 +195,7 @@ echo "Generating platform.txt..."
195195
cat "$GITHUB_WORKSPACE/platform.txt" | \
196196
sed "s/version=.*/version=$ver$extent/g" | \
197197
sed 's/runtime.tools.xtensa-esp32-elf-gcc.path={runtime.platform.path}\/tools\/xtensa-esp32-elf//g' | \
198+
sed 's/runtime.tools.xtensa-esp32s2-elf-gcc.path={runtime.platform.path}\/tools\/xtensa-esp32s2-elf//g' | \
198199
sed 's/tools.esptool_py.path={runtime.platform.path}\/tools\/esptool/tools.esptool_py.path=\{runtime.tools.esptool_py.path\}/g' \
199200
> "$PKG_DIR/platform.txt"
200201

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,6 @@ tools/mklittlefs
1414
__vm/
1515
*.vcxproj*
1616
.vscode/
17+
platform.sloeber.txt
18+
boards.sloeber.txt
19+
tools/mklittlefs

.gitmodules

-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +0,0 @@
1-
[submodule "libraries/AzureIoT"]
2-
path = libraries/AzureIoT
3-
url = https://github.com/VSChina/ESP32_AzureIoT_Arduino

0 commit comments

Comments
 (0)