Backport some fixes from esp-idf-v5.1 (#7762)
This commit is contained in:
parent
7f4946375f
commit
a807507c64
5 changed files with 110 additions and 32 deletions
46
.github/scripts/install-arduino-cli.sh
vendored
Executable file
46
.github/scripts/install-arduino-cli.sh
vendored
Executable file
|
|
@ -0,0 +1,46 @@
|
|||
#!/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
|
||||
|
||||
14
.github/scripts/on-push.sh
vendored
14
.github/scripts/on-push.sh
vendored
|
|
@ -9,7 +9,8 @@ function build(){
|
|||
local fqbn=$2
|
||||
local chunk_index=$3
|
||||
local chunks_cnt=$4
|
||||
local sketches=$5
|
||||
shift; shift; shift; shift;
|
||||
local sketches=$*
|
||||
|
||||
local BUILD_SKETCH="${SCRIPTS_DIR}/sketch_utils.sh build"
|
||||
local BUILD_SKETCHES="${SCRIPTS_DIR}/sketch_utils.sh chunk_build"
|
||||
|
|
@ -24,15 +25,15 @@ function build(){
|
|||
${BUILD_SKETCHES} ${args}
|
||||
else
|
||||
for sketch in ${sketches}; do
|
||||
args+=" -s $(dirname $sketch)"
|
||||
if [ "$OS_IS_WINDOWS" == "1" ]; then
|
||||
local sargs="$args -s $(dirname $sketch)"
|
||||
if [ "$OS_IS_WINDOWS" == "1" ] && [ -d "$ARDUINO_IDE_PATH/tools-builder" ]; then
|
||||
local ctags_version=`ls "$ARDUINO_IDE_PATH/tools-builder/ctags/"`
|
||||
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
|
||||
-prefs=runtime.tools.arduino-preprocessor.path=$ARDUINO_IDE_PATH/tools-builder/arduino-preprocessor/$preprocessor_version"
|
||||
args+=" ${win_opts}"
|
||||
sargs+=" ${win_opts}"
|
||||
fi
|
||||
${BUILD_SKETCH} ${args}
|
||||
${BUILD_SKETCH} ${sargs}
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
|
@ -59,7 +60,8 @@ fi
|
|||
|
||||
SCRIPTS_DIR="./.github/scripts"
|
||||
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
|
||||
|
||||
FQBN_ESP32="espressif:esp32:esp32:PSRAM=enabled,PartitionScheme=huge_app"
|
||||
|
|
|
|||
8
.github/scripts/on-release.sh
vendored
8
.github/scripts/on-release.sh
vendored
|
|
@ -197,10 +197,10 @@ find "$PKG_DIR" -name '*.git*' -type f -delete
|
|||
echo "Generating platform.txt..."
|
||||
cat "$GITHUB_WORKSPACE/platform.txt" | \
|
||||
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/runtime.tools.xtensa-esp32s2-elf-gcc.path={runtime.platform.path}\/tools\/xtensa-esp32s2-elf//g' | \
|
||||
sed 's/runtime.tools.xtensa-esp32s3-elf-gcc.path={runtime.platform.path}\/tools\/xtensa-esp32s3-elf//g' | \
|
||||
sed 's/runtime.tools.riscv32-esp-elf-gcc.path={runtime.platform.path}\/tools\/riscv32-esp-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/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/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/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/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' | \
|
||||
|
|
|
|||
64
.github/scripts/sketch_utils.sh
vendored
64
.github/scripts/sketch_utils.sh
vendored
|
|
@ -121,34 +121,65 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [ex
|
|||
if [ -n "$ARDUINO_BUILD_DIR" ]; then
|
||||
build_dir="$ARDUINO_BUILD_DIR"
|
||||
elif [ $len -eq 1 ]; then
|
||||
build_dir="$sketchdir/build"
|
||||
# build_dir="$sketchdir/build"
|
||||
build_dir="$HOME/.arduino/build.tmp"
|
||||
fi
|
||||
|
||||
mkdir -p "$ARDUINO_CACHE_DIR"
|
||||
for i in `seq 0 $(($len - 1))`
|
||||
do
|
||||
if [ $len -ne 1 ]; then
|
||||
build_dir="$sketchdir/build$i"
|
||||
# build_dir="$sketchdir/build$i"
|
||||
build_dir="$HOME/.arduino/build$i.tmp"
|
||||
fi
|
||||
rm -rf $build_dir
|
||||
mkdir -p $build_dir
|
||||
|
||||
currfqbn=`echo $fqbn | jq -r --argjson i $i '.[$i]'`
|
||||
sketchname=$(basename $sketchdir)
|
||||
echo "Building $sketchname with FQBN=$currfqbn"
|
||||
$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"
|
||||
|
||||
if [ -f "$ide_path/arduino-cli" ]; then
|
||||
echo "Building $sketchname with arduino-cli and FQBN=$currfqbn"
|
||||
|
||||
curroptions=`echo "$currfqbn" | cut -d':' -f4`
|
||||
currfqbn=`echo "$currfqbn" | cut -d':' -f1-3`
|
||||
$ide_path/arduino-cli compile \
|
||||
--fqbn "$currfqbn" \
|
||||
--board-options "$curroptions" \
|
||||
--warnings "all" \
|
||||
--build-cache-path "$ARDUINO_CACHE_DIR" \
|
||||
--build-path "$build_dir" \
|
||||
$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
|
||||
unset fqbn
|
||||
unset xtra_opts
|
||||
unset options
|
||||
}
|
||||
|
||||
function count_sketches(){ # count_sketches <path> [target]
|
||||
|
|
@ -294,8 +325,7 @@ function build_sketches(){ # build_sketches <ide_path> <user_path> <target> <pat
|
|||
fi
|
||||
echo ""
|
||||
echo "Building Sketch Index $(($sketchnum - 1)) - $sketchdirname"
|
||||
args+=" -s $sketchdir $xtra_opts"
|
||||
build_sketch $args
|
||||
build_sketch $args -s $sketchdir $xtra_opts
|
||||
local result=$?
|
||||
if [ $result -ne 0 ]; then
|
||||
return $result
|
||||
|
|
|
|||
10
platform.txt
10
platform.txt
|
|
@ -1,10 +1,10 @@
|
|||
name=ESP32 Arduino
|
||||
version=2.0.6
|
||||
|
||||
runtime.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
|
||||
runtime.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.xtensa-esp32-elf-gcc.path={runtime.platform.path}/tools/xtensa-esp32-elf
|
||||
tools.xtensa-esp32s2-elf-gcc.path={runtime.platform.path}/tools/xtensa-esp32s2-elf
|
||||
tools.xtensa-esp32s3-elf-gcc.path={runtime.platform.path}/tools/xtensa-esp32s3-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.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
|
|||
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"
|
||||
|
||||
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.prefix={build.tarch}-{build.target}-elf-
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue