未验证 提交 a807507c 编写于 作者: M Me No Dev 提交者: GitHub

Backport some fixes from esp-idf-v5.1 (#7762)

上级 7f494637
#!/bin/bash
OSBITS=`arch`
if [[ "$OSTYPE" == "linux"* ]]; then
export OS_IS_LINUX="1"
if [[ "$OSBITS" == "i686" ]]; then
OS_NAME="linux32"
elif [[ "$OSBITS" == "x86_64" ]]; then
OS_NAME="linux64"
elif [[ "$OSBITS" == "armv7l" || "$OSBITS" == "aarch64" ]]; then
OS_NAME="linuxarm"
else
OS_NAME="$OSTYPE-$OSBITS"
echo "Unknown OS '$OS_NAME'"
exit 1
fi
elif [[ "$OSTYPE" == "darwin"* ]]; then
export OS_IS_MACOS="1"
OS_NAME="macosx"
elif [[ "$OSTYPE" == "cygwin" ]] || [[ "$OSTYPE" == "msys" ]] || [[ "$OSTYPE" == "win32" ]]; then
export OS_IS_WINDOWS="1"
OS_NAME="windows"
else
OS_NAME="$OSTYPE-$OSBITS"
echo "Unknown OS '$OS_NAME'"
exit 1
fi
export OS_NAME
if [ "$OS_IS_MACOS" == "1" ]; then
export ARDUINO_IDE_PATH="$HOME/bin"
export ARDUINO_USR_PATH="$HOME/Documents/Arduino"
elif [ "$OS_IS_WINDOWS" == "1" ]; then
export ARDUINO_IDE_PATH="$HOME/bin"
export ARDUINO_USR_PATH="$HOME/Documents/Arduino"
else
export ARDUINO_IDE_PATH="$HOME/bin"
export ARDUINO_USR_PATH="$HOME/Arduino"
fi
if [ ! -d "$ARDUINO_IDE_PATH" ] || [ ! -f "$ARDUINO_IDE_PATH/arduino-cli" ]; then
echo "Installing Arduino CLI on $OS_NAME ..."
mkdir -p "$ARDUINO_IDE_PATH"
curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | BINDIR="$ARDUINO_IDE_PATH" sh
fi
...@@ -9,7 +9,8 @@ function build(){ ...@@ -9,7 +9,8 @@ function build(){
local fqbn=$2 local fqbn=$2
local chunk_index=$3 local chunk_index=$3
local chunks_cnt=$4 local chunks_cnt=$4
local sketches=$5 shift; shift; shift; shift;
local sketches=$*
local BUILD_SKETCH="${SCRIPTS_DIR}/sketch_utils.sh build" local BUILD_SKETCH="${SCRIPTS_DIR}/sketch_utils.sh build"
local BUILD_SKETCHES="${SCRIPTS_DIR}/sketch_utils.sh chunk_build" local BUILD_SKETCHES="${SCRIPTS_DIR}/sketch_utils.sh chunk_build"
...@@ -24,15 +25,15 @@ function build(){ ...@@ -24,15 +25,15 @@ function build(){
${BUILD_SKETCHES} ${args} ${BUILD_SKETCHES} ${args}
else else
for sketch in ${sketches}; do for sketch in ${sketches}; do
args+=" -s $(dirname $sketch)" local sargs="$args -s $(dirname $sketch)"
if [ "$OS_IS_WINDOWS" == "1" ]; then if [ "$OS_IS_WINDOWS" == "1" ] && [ -d "$ARDUINO_IDE_PATH/tools-builder" ]; then
local ctags_version=`ls "$ARDUINO_IDE_PATH/tools-builder/ctags/"` local ctags_version=`ls "$ARDUINO_IDE_PATH/tools-builder/ctags/"`
local preprocessor_version=`ls "$ARDUINO_IDE_PATH/tools-builder/arduino-preprocessor/"` local preprocessor_version=`ls "$ARDUINO_IDE_PATH/tools-builder/arduino-preprocessor/"`
win_opts="-prefs=runtime.tools.ctags.path=$ARDUINO_IDE_PATH/tools-builder/ctags/$ctags_version 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" -prefs=runtime.tools.arduino-preprocessor.path=$ARDUINO_IDE_PATH/tools-builder/arduino-preprocessor/$preprocessor_version"
args+=" ${win_opts}" sargs+=" ${win_opts}"
fi fi
${BUILD_SKETCH} ${args} ${BUILD_SKETCH} ${sargs}
done done
fi fi
} }
...@@ -59,7 +60,8 @@ fi ...@@ -59,7 +60,8 @@ fi
SCRIPTS_DIR="./.github/scripts" SCRIPTS_DIR="./.github/scripts"
if [ "$BUILD_PIO" -eq 0 ]; then if [ "$BUILD_PIO" -eq 0 ]; then
source ${SCRIPTS_DIR}/install-arduino-ide.sh #source ${SCRIPTS_DIR}/install-arduino-ide.sh
source ${SCRIPTS_DIR}/install-arduino-cli.sh
source ${SCRIPTS_DIR}/install-arduino-core-esp32.sh source ${SCRIPTS_DIR}/install-arduino-core-esp32.sh
FQBN_ESP32="espressif:esp32:esp32:PSRAM=enabled,PartitionScheme=huge_app" FQBN_ESP32="espressif:esp32:esp32:PSRAM=enabled,PartitionScheme=huge_app"
......
...@@ -197,10 +197,10 @@ find "$PKG_DIR" -name '*.git*' -type f -delete ...@@ -197,10 +197,10 @@ find "$PKG_DIR" -name '*.git*' -type f -delete
echo "Generating platform.txt..." echo "Generating platform.txt..."
cat "$GITHUB_WORKSPACE/platform.txt" | \ cat "$GITHUB_WORKSPACE/platform.txt" | \
sed "s/version=.*/version=$ver$extent/g" | \ sed "s/version=.*/version=$ver$extent/g" | \
sed 's/runtime.tools.xtensa-esp32-elf-gcc.path={runtime.platform.path}\/tools\/xtensa-esp32-elf//g' | \ 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' | \
sed 's/runtime.tools.xtensa-esp32s2-elf-gcc.path={runtime.platform.path}\/tools\/xtensa-esp32s2-elf//g' | \ 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' | \
sed 's/runtime.tools.xtensa-esp32s3-elf-gcc.path={runtime.platform.path}\/tools\/xtensa-esp32s3-elf//g' | \ 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' | \
sed 's/runtime.tools.riscv32-esp-elf-gcc.path={runtime.platform.path}\/tools\/riscv32-esp-elf//g' | \ 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' | \
sed 's/tools.esptool_py.path={runtime.platform.path}\/tools\/esptool/tools.esptool_py.path=\{runtime.tools.esptool_py.path\}/g' | \ sed 's/tools.esptool_py.path={runtime.platform.path}\/tools\/esptool/tools.esptool_py.path=\{runtime.tools.esptool_py.path\}/g' | \
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' | \ 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' | \
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' | \ 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' | \
......
...@@ -121,34 +121,65 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [ex ...@@ -121,34 +121,65 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [ex
if [ -n "$ARDUINO_BUILD_DIR" ]; then if [ -n "$ARDUINO_BUILD_DIR" ]; then
build_dir="$ARDUINO_BUILD_DIR" build_dir="$ARDUINO_BUILD_DIR"
elif [ $len -eq 1 ]; then elif [ $len -eq 1 ]; then
build_dir="$sketchdir/build" # build_dir="$sketchdir/build"
build_dir="$HOME/.arduino/build.tmp"
fi fi
mkdir -p "$ARDUINO_CACHE_DIR" mkdir -p "$ARDUINO_CACHE_DIR"
for i in `seq 0 $(($len - 1))` for i in `seq 0 $(($len - 1))`
do do
if [ $len -ne 1 ]; then if [ $len -ne 1 ]; then
build_dir="$sketchdir/build$i" # build_dir="$sketchdir/build$i"
build_dir="$HOME/.arduino/build$i.tmp"
fi fi
rm -rf $build_dir rm -rf $build_dir
mkdir -p $build_dir mkdir -p $build_dir
currfqbn=`echo $fqbn | jq -r --argjson i $i '.[$i]'` currfqbn=`echo $fqbn | jq -r --argjson i $i '.[$i]'`
sketchname=$(basename $sketchdir) sketchname=$(basename $sketchdir)
echo "Building $sketchname with FQBN=$currfqbn"
$ide_path/arduino-builder -compile -logger=human -core-api-version=10810 \ if [ -f "$ide_path/arduino-cli" ]; then
-fqbn=\"$currfqbn\" \ echo "Building $sketchname with arduino-cli and FQBN=$currfqbn"
-warnings="all" \
-tools "$ide_path/tools-builder" \ curroptions=`echo "$currfqbn" | cut -d':' -f4`
-tools "$ide_path/tools" \ currfqbn=`echo "$currfqbn" | cut -d':' -f1-3`
-built-in-libraries "$ide_path/libraries" \ $ide_path/arduino-cli compile \
-hardware "$ide_path/hardware" \ --fqbn "$currfqbn" \
-hardware "$user_path/hardware" \ --board-options "$curroptions" \
-libraries "$user_path/libraries" \ --warnings "all" \
-build-cache "$ARDUINO_CACHE_DIR" \ --build-cache-path "$ARDUINO_CACHE_DIR" \
-build-path "$build_dir" \ --build-path "$build_dir" \
$xtra_opts "${sketchdir}/${sketchname}.ino" $xtra_opts "${sketchdir}"
elif [ -f "$ide_path/arduino-builder" ]; then
echo "Building $sketchname with arduino-builder and FQBN=$currfqbn"
$ide_path/arduino-builder -compile -logger=human -core-api-version=10810 \
-fqbn=\"$currfqbn\" \
-warnings="all" \
-tools "$ide_path/tools-builder" \
-hardware "$user_path/hardware" \
-libraries "$user_path/libraries" \
-build-cache "$ARDUINO_CACHE_DIR" \
-build-path "$build_dir" \
$xtra_opts "${sketchdir}/${sketchname}.ino"
# $ide_path/arduino-builder -compile -logger=human -core-api-version=10810 \
# -fqbn=\"$currfqbn\" \
# -warnings="all" \
# -tools "$ide_path/tools-builder" \
# -tools "$ide_path/tools" \
# -built-in-libraries "$ide_path/libraries" \
# -hardware "$ide_path/hardware" \
# -hardware "$user_path/hardware" \
# -libraries "$user_path/libraries" \
# -build-cache "$ARDUINO_CACHE_DIR" \
# -build-path "$build_dir" \
# $xtra_opts "${sketchdir}/${sketchname}.ino"
fi
done done
unset fqbn
unset xtra_opts
unset options
} }
function count_sketches(){ # count_sketches <path> [target] function count_sketches(){ # count_sketches <path> [target]
...@@ -294,8 +325,7 @@ function build_sketches(){ # build_sketches <ide_path> <user_path> <target> <pat ...@@ -294,8 +325,7 @@ function build_sketches(){ # build_sketches <ide_path> <user_path> <target> <pat
fi fi
echo "" echo ""
echo "Building Sketch Index $(($sketchnum - 1)) - $sketchdirname" echo "Building Sketch Index $(($sketchnum - 1)) - $sketchdirname"
args+=" -s $sketchdir $xtra_opts" build_sketch $args -s $sketchdir $xtra_opts
build_sketch $args
local result=$? local result=$?
if [ $result -ne 0 ]; then if [ $result -ne 0 ]; then
return $result return $result
......
name=ESP32 Arduino name=ESP32 Arduino
version=2.0.6 version=2.0.6
runtime.tools.xtensa-esp32-elf-gcc.path={runtime.platform.path}/tools/xtensa-esp32-elf tools.xtensa-esp32-elf-gcc.path={runtime.platform.path}/tools/xtensa-esp32-elf
runtime.tools.xtensa-esp32s2-elf-gcc.path={runtime.platform.path}/tools/xtensa-esp32s2-elf tools.xtensa-esp32s2-elf-gcc.path={runtime.platform.path}/tools/xtensa-esp32s2-elf
runtime.tools.xtensa-esp32s3-elf-gcc.path={runtime.platform.path}/tools/xtensa-esp32s3-elf tools.xtensa-esp32s3-elf-gcc.path={runtime.platform.path}/tools/xtensa-esp32s3-elf
runtime.tools.riscv32-esp-elf-gcc.path={runtime.platform.path}/tools/riscv32-esp-elf tools.riscv32-esp-elf-gcc.path={runtime.platform.path}/tools/riscv32-esp-elf
debug.server.openocd.path={runtime.platform.path}/tools/openocd-esp32/bin/openocd debug.server.openocd.path={runtime.platform.path}/tools/openocd-esp32/bin/openocd
debug.server.openocd.scripts_dir={runtime.platform.path}/tools/openocd-esp32/share/openocd/scripts/ 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 ...@@ -27,7 +27,7 @@ tools.gen_esp32part.cmd.windows="{runtime.platform.path}/tools/gen_esp32part.exe
tools.gen_insights_pkg.cmd=python3 "{runtime.platform.path}"/tools/gen_insights_package.py tools.gen_insights_pkg.cmd=python3 "{runtime.platform.path}"/tools/gen_insights_package.py
tools.gen_insights_pkg.cmd.windows="{runtime.platform.path}/tools/gen_insights_package.exe" tools.gen_insights_pkg.cmd.windows="{runtime.platform.path}/tools/gen_insights_package.exe"
compiler.path={runtime.tools.{build.tarch}-{build.target}-elf-gcc.path}/bin/ compiler.path={tools.{build.tarch}-{build.target}-elf-gcc.path}/bin/
compiler.sdk.path={runtime.platform.path}/tools/sdk/{build.mcu} compiler.sdk.path={runtime.platform.path}/tools/sdk/{build.mcu}
compiler.prefix={build.tarch}-{build.target}-elf- compiler.prefix={build.tarch}-{build.target}-elf-
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册