Skip to content

Commit a807507

Browse files
authored
Backport some fixes from esp-idf-v5.1 (espressif#7762)
1 parent 7f49463 commit a807507

File tree

5 files changed

+110
-32
lines changed

5 files changed

+110
-32
lines changed

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

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/bin/bash
2+
3+
OSBITS=`arch`
4+
if [[ "$OSTYPE" == "linux"* ]]; then
5+
export OS_IS_LINUX="1"
6+
if [[ "$OSBITS" == "i686" ]]; then
7+
OS_NAME="linux32"
8+
elif [[ "$OSBITS" == "x86_64" ]]; then
9+
OS_NAME="linux64"
10+
elif [[ "$OSBITS" == "armv7l" || "$OSBITS" == "aarch64" ]]; then
11+
OS_NAME="linuxarm"
12+
else
13+
OS_NAME="$OSTYPE-$OSBITS"
14+
echo "Unknown OS '$OS_NAME'"
15+
exit 1
16+
fi
17+
elif [[ "$OSTYPE" == "darwin"* ]]; then
18+
export OS_IS_MACOS="1"
19+
OS_NAME="macosx"
20+
elif [[ "$OSTYPE" == "cygwin" ]] || [[ "$OSTYPE" == "msys" ]] || [[ "$OSTYPE" == "win32" ]]; then
21+
export OS_IS_WINDOWS="1"
22+
OS_NAME="windows"
23+
else
24+
OS_NAME="$OSTYPE-$OSBITS"
25+
echo "Unknown OS '$OS_NAME'"
26+
exit 1
27+
fi
28+
export OS_NAME
29+
30+
if [ "$OS_IS_MACOS" == "1" ]; then
31+
export ARDUINO_IDE_PATH="$HOME/bin"
32+
export ARDUINO_USR_PATH="$HOME/Documents/Arduino"
33+
elif [ "$OS_IS_WINDOWS" == "1" ]; then
34+
export ARDUINO_IDE_PATH="$HOME/bin"
35+
export ARDUINO_USR_PATH="$HOME/Documents/Arduino"
36+
else
37+
export ARDUINO_IDE_PATH="$HOME/bin"
38+
export ARDUINO_USR_PATH="$HOME/Arduino"
39+
fi
40+
41+
if [ ! -d "$ARDUINO_IDE_PATH" ] || [ ! -f "$ARDUINO_IDE_PATH/arduino-cli" ]; then
42+
echo "Installing Arduino CLI on $OS_NAME ..."
43+
mkdir -p "$ARDUINO_IDE_PATH"
44+
curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | BINDIR="$ARDUINO_IDE_PATH" sh
45+
fi
46+

Diff for: .github/scripts/on-push.sh

+8-6
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ function build(){
99
local fqbn=$2
1010
local chunk_index=$3
1111
local chunks_cnt=$4
12-
local sketches=$5
12+
shift; shift; shift; shift;
13+
local sketches=$*
1314

1415
local BUILD_SKETCH="${SCRIPTS_DIR}/sketch_utils.sh build"
1516
local BUILD_SKETCHES="${SCRIPTS_DIR}/sketch_utils.sh chunk_build"
@@ -24,15 +25,15 @@ function build(){
2425
${BUILD_SKETCHES} ${args}
2526
else
2627
for sketch in ${sketches}; do
27-
args+=" -s $(dirname $sketch)"
28-
if [ "$OS_IS_WINDOWS" == "1" ]; then
28+
local sargs="$args -s $(dirname $sketch)"
29+
if [ "$OS_IS_WINDOWS" == "1" ] && [ -d "$ARDUINO_IDE_PATH/tools-builder" ]; then
2930
local ctags_version=`ls "$ARDUINO_IDE_PATH/tools-builder/ctags/"`
3031
local preprocessor_version=`ls "$ARDUINO_IDE_PATH/tools-builder/arduino-preprocessor/"`
3132
win_opts="-prefs=runtime.tools.ctags.path=$ARDUINO_IDE_PATH/tools-builder/ctags/$ctags_version
3233
-prefs=runtime.tools.arduino-preprocessor.path=$ARDUINO_IDE_PATH/tools-builder/arduino-preprocessor/$preprocessor_version"
33-
args+=" ${win_opts}"
34+
sargs+=" ${win_opts}"
3435
fi
35-
${BUILD_SKETCH} ${args}
36+
${BUILD_SKETCH} ${sargs}
3637
done
3738
fi
3839
}
@@ -59,7 +60,8 @@ fi
5960

6061
SCRIPTS_DIR="./.github/scripts"
6162
if [ "$BUILD_PIO" -eq 0 ]; then
62-
source ${SCRIPTS_DIR}/install-arduino-ide.sh
63+
#source ${SCRIPTS_DIR}/install-arduino-ide.sh
64+
source ${SCRIPTS_DIR}/install-arduino-cli.sh
6365
source ${SCRIPTS_DIR}/install-arduino-core-esp32.sh
6466

6567
FQBN_ESP32="espressif:esp32:esp32:PSRAM=enabled,PartitionScheme=huge_app"

Diff for: .github/scripts/on-release.sh

+4-4
Original file line numberDiff line numberDiff line change
@@ -197,10 +197,10 @@ find "$PKG_DIR" -name '*.git*' -type f -delete
197197
echo "Generating platform.txt..."
198198
cat "$GITHUB_WORKSPACE/platform.txt" | \
199199
sed "s/version=.*/version=$ver$extent/g" | \
200-
sed 's/runtime.tools.xtensa-esp32-elf-gcc.path={runtime.platform.path}\/tools\/xtensa-esp32-elf//g' | \
201-
sed 's/runtime.tools.xtensa-esp32s2-elf-gcc.path={runtime.platform.path}\/tools\/xtensa-esp32s2-elf//g' | \
202-
sed 's/runtime.tools.xtensa-esp32s3-elf-gcc.path={runtime.platform.path}\/tools\/xtensa-esp32s3-elf//g' | \
203-
sed 's/runtime.tools.riscv32-esp-elf-gcc.path={runtime.platform.path}\/tools\/riscv32-esp-elf//g' | \
200+
sed 's/tools.xtensa-esp32-elf-gcc.path={runtime.platform.path}\/tools\/xtensa-esp32-elf/tools.xtensa-esp32-elf-gcc.path=\{runtime.tools.xtensa-esp32-elf-gcc.path\}/g' | \
201+
sed 's/tools.xtensa-esp32s2-elf-gcc.path={runtime.platform.path}\/tools\/xtensa-esp32s2-elf/tools.xtensa-esp32s2-elf-gcc.path=\{runtime.tools.xtensa-esp32s2-elf-gcc.path\}/g' | \
202+
sed 's/tools.xtensa-esp32s3-elf-gcc.path={runtime.platform.path}\/tools\/xtensa-esp32s3-elf/tools.xtensa-esp32s3-elf-gcc.path=\{runtime.tools.xtensa-esp32s3-elf-gcc.path\}/g' | \
203+
sed 's/tools.riscv32-esp-elf-gcc.path={runtime.platform.path}\/tools\/riscv32-esp-elf/tools.riscv32-esp-elf-gcc.path=\{runtime.tools.riscv32-esp-elf-gcc.path\}/g' | \
204204
sed 's/tools.esptool_py.path={runtime.platform.path}\/tools\/esptool/tools.esptool_py.path=\{runtime.tools.esptool_py.path\}/g' | \
205205
sed 's/debug.server.openocd.path={runtime.platform.path}\/tools\/openocd-esp32\/bin\/openocd/debug.server.openocd.path=\{runtime.tools.openocd-esp32.path\}\/bin\/openocd/g' | \
206206
sed 's/debug.server.openocd.scripts_dir={runtime.platform.path}\/tools\/openocd-esp32\/share\/openocd\/scripts\//debug.server.openocd.scripts_dir=\{runtime.tools.openocd-esp32.path\}\/share\/openocd\/scripts\//g' | \

Diff for: .github/scripts/sketch_utils.sh

+47-17
Original file line numberDiff line numberDiff line change
@@ -121,34 +121,65 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [ex
121121
if [ -n "$ARDUINO_BUILD_DIR" ]; then
122122
build_dir="$ARDUINO_BUILD_DIR"
123123
elif [ $len -eq 1 ]; then
124-
build_dir="$sketchdir/build"
124+
# build_dir="$sketchdir/build"
125+
build_dir="$HOME/.arduino/build.tmp"
125126
fi
126127

127128
mkdir -p "$ARDUINO_CACHE_DIR"
128129
for i in `seq 0 $(($len - 1))`
129130
do
130131
if [ $len -ne 1 ]; then
131-
build_dir="$sketchdir/build$i"
132+
# build_dir="$sketchdir/build$i"
133+
build_dir="$HOME/.arduino/build$i.tmp"
132134
fi
133135
rm -rf $build_dir
134136
mkdir -p $build_dir
135137

136138
currfqbn=`echo $fqbn | jq -r --argjson i $i '.[$i]'`
137139
sketchname=$(basename $sketchdir)
138-
echo "Building $sketchname with FQBN=$currfqbn"
139-
$ide_path/arduino-builder -compile -logger=human -core-api-version=10810 \
140-
-fqbn=\"$currfqbn\" \
141-
-warnings="all" \
142-
-tools "$ide_path/tools-builder" \
143-
-tools "$ide_path/tools" \
144-
-built-in-libraries "$ide_path/libraries" \
145-
-hardware "$ide_path/hardware" \
146-
-hardware "$user_path/hardware" \
147-
-libraries "$user_path/libraries" \
148-
-build-cache "$ARDUINO_CACHE_DIR" \
149-
-build-path "$build_dir" \
150-
$xtra_opts "${sketchdir}/${sketchname}.ino"
140+
141+
if [ -f "$ide_path/arduino-cli" ]; then
142+
echo "Building $sketchname with arduino-cli and FQBN=$currfqbn"
143+
144+
curroptions=`echo "$currfqbn" | cut -d':' -f4`
145+
currfqbn=`echo "$currfqbn" | cut -d':' -f1-3`
146+
$ide_path/arduino-cli compile \
147+
--fqbn "$currfqbn" \
148+
--board-options "$curroptions" \
149+
--warnings "all" \
150+
--build-cache-path "$ARDUINO_CACHE_DIR" \
151+
--build-path "$build_dir" \
152+
$xtra_opts "${sketchdir}"
153+
elif [ -f "$ide_path/arduino-builder" ]; then
154+
echo "Building $sketchname with arduino-builder and FQBN=$currfqbn"
155+
156+
$ide_path/arduino-builder -compile -logger=human -core-api-version=10810 \
157+
-fqbn=\"$currfqbn\" \
158+
-warnings="all" \
159+
-tools "$ide_path/tools-builder" \
160+
-hardware "$user_path/hardware" \
161+
-libraries "$user_path/libraries" \
162+
-build-cache "$ARDUINO_CACHE_DIR" \
163+
-build-path "$build_dir" \
164+
$xtra_opts "${sketchdir}/${sketchname}.ino"
165+
166+
# $ide_path/arduino-builder -compile -logger=human -core-api-version=10810 \
167+
# -fqbn=\"$currfqbn\" \
168+
# -warnings="all" \
169+
# -tools "$ide_path/tools-builder" \
170+
# -tools "$ide_path/tools" \
171+
# -built-in-libraries "$ide_path/libraries" \
172+
# -hardware "$ide_path/hardware" \
173+
# -hardware "$user_path/hardware" \
174+
# -libraries "$user_path/libraries" \
175+
# -build-cache "$ARDUINO_CACHE_DIR" \
176+
# -build-path "$build_dir" \
177+
# $xtra_opts "${sketchdir}/${sketchname}.ino"
178+
fi
151179
done
180+
unset fqbn
181+
unset xtra_opts
182+
unset options
152183
}
153184

154185
function count_sketches(){ # count_sketches <path> [target]
@@ -294,8 +325,7 @@ function build_sketches(){ # build_sketches <ide_path> <user_path> <target> <pat
294325
fi
295326
echo ""
296327
echo "Building Sketch Index $(($sketchnum - 1)) - $sketchdirname"
297-
args+=" -s $sketchdir $xtra_opts"
298-
build_sketch $args
328+
build_sketch $args -s $sketchdir $xtra_opts
299329
local result=$?
300330
if [ $result -ne 0 ]; then
301331
return $result

Diff for: platform.txt

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
name=ESP32 Arduino
22
version=2.0.6
33

4-
runtime.tools.xtensa-esp32-elf-gcc.path={runtime.platform.path}/tools/xtensa-esp32-elf
5-
runtime.tools.xtensa-esp32s2-elf-gcc.path={runtime.platform.path}/tools/xtensa-esp32s2-elf
6-
runtime.tools.xtensa-esp32s3-elf-gcc.path={runtime.platform.path}/tools/xtensa-esp32s3-elf
7-
runtime.tools.riscv32-esp-elf-gcc.path={runtime.platform.path}/tools/riscv32-esp-elf
4+
tools.xtensa-esp32-elf-gcc.path={runtime.platform.path}/tools/xtensa-esp32-elf
5+
tools.xtensa-esp32s2-elf-gcc.path={runtime.platform.path}/tools/xtensa-esp32s2-elf
6+
tools.xtensa-esp32s3-elf-gcc.path={runtime.platform.path}/tools/xtensa-esp32s3-elf
7+
tools.riscv32-esp-elf-gcc.path={runtime.platform.path}/tools/riscv32-esp-elf
88

99
debug.server.openocd.path={runtime.platform.path}/tools/openocd-esp32/bin/openocd
1010
debug.server.openocd.scripts_dir={runtime.platform.path}/tools/openocd-esp32/share/openocd/scripts/
@@ -27,7 +27,7 @@ tools.gen_esp32part.cmd.windows="{runtime.platform.path}/tools/gen_esp32part.exe
2727
tools.gen_insights_pkg.cmd=python3 "{runtime.platform.path}"/tools/gen_insights_package.py
2828
tools.gen_insights_pkg.cmd.windows="{runtime.platform.path}/tools/gen_insights_package.exe"
2929

30-
compiler.path={runtime.tools.{build.tarch}-{build.target}-elf-gcc.path}/bin/
30+
compiler.path={tools.{build.tarch}-{build.target}-elf-gcc.path}/bin/
3131
compiler.sdk.path={runtime.platform.path}/tools/sdk/{build.mcu}
3232
compiler.prefix={build.tarch}-{build.target}-elf-
3333

0 commit comments

Comments
 (0)