1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00

dist/tools/esptools: add support for installing esp8266 toolchain

This commit is contained in:
Benjamin Valentin 2024-12-17 14:34:11 +01:00
parent a4026b78b8
commit 2959725f32
2 changed files with 31 additions and 16 deletions

View File

@ -1,6 +1,7 @@
#!/bin/sh
ESP32_GCC_RELEASE="esp-12.2.0_20230208"
ESP8266_GCC_RELEASE="esp-5.2.0_20191018"
ESP32_OPENOCD_VERSION="v0.12.0-esp32-20230313"
@ -13,6 +14,10 @@ TOOLS_PATH="${IDF_TOOLS_PATH}/tools"
export_arch()
{
case $1 in
esp8266)
TARGET_ARCH="xtensa-esp8266-elf"
ESP32_GCC_RELEASE=${ESP8266_GCC_RELEASE}
;;
esp32)
TARGET_ARCH="xtensa-esp32-elf"
;;
@ -130,7 +135,7 @@ if [ -z "$1" ]; then
echo "<tool> = all | esp32 | esp32c3 | esp32s2 | esp32s3 | gdb | openocd | qemu"
echo "<platform> = xtensa | riscv"
elif [ "$1" = "all" ]; then
ARCH_ALL="esp32 esp32c3 esp32s2 esp32s3"
ARCH_ALL="esp8266 esp32 esp32c3 esp32s2 esp32s3"
for arch in ${ARCH_ALL}; do
export_arch "$arch"
done

View File

@ -4,6 +4,8 @@ ESP32_GCC_RELEASE="esp-12.2.0_20230208"
ESP32_GCC_VERSION_DIR="12.2.0"
ESP32_GCC_VERSION_DOWNLOAD="12.2.0_20230208"
ESP8266_GCC_RELEASE="esp-5.2.0_20191018"
ESP32_OPENOCD_VERSION="v0.12.0-esp32-20230313"
ESP32_OPENOCD_VERSION_TGZ="0.12.0-esp32-20230313"
@ -84,6 +86,10 @@ download()
install_arch()
{
case "$1" in
esp8266)
TARGET_ARCH="xtensa-esp8266-elf"
ESP32_GCC_RELEASE=${ESP8266_GCC_RELEASE}
;;
esp32)
TARGET_ARCH="xtensa-esp32-elf"
;;
@ -103,19 +109,23 @@ install_arch()
TOOLS_DIR="${TOOLS_PATH}/${TARGET_ARCH}/${ESP32_GCC_RELEASE}"
URL_PATH="https://github.com/espressif/crosstool-NG/releases/download"
URL_TGZ="${TARGET_ARCH}-${ESP32_GCC_VERSION_DOWNLOAD}-${OS}.tar.xz"
URL="${URL_PATH}/${ESP32_GCC_RELEASE}/${URL_TGZ}"
if [ "$1" = "esp8266" ]; then
git clone https://github.com/gschorcht/xtensa-esp8266-elf ${TOOLS_DIR}/${TARGET_ARCH}
else
URL_PATH="https://github.com/espressif/crosstool-NG/releases/download"
URL_TGZ="${TARGET_ARCH}-${ESP32_GCC_VERSION_DOWNLOAD}-${OS}.tar.xz"
URL="${URL_PATH}/${ESP32_GCC_RELEASE}/${URL_TGZ}"
echo "Creating directory ${TOOLS_DIR} ..." && \
mkdir -p "${TOOLS_DIR}" && \
cd "${TOOLS_DIR}" && \
echo "Downloading ${URL_TGZ} ..." && \
download "${URL}" "${URL_TGZ}" && \
echo "Extracting ${URL_TGZ} in ${TOOLS_DIR} ..." && \
tar xfJ "${URL_TGZ}" && \
echo "Removing ${URL_TGZ} ..." && \
rm -f "${URL_TGZ}" && \
echo "Creating directory ${TOOLS_DIR} ..." && \
mkdir -p "${TOOLS_DIR}" && \
cd "${TOOLS_DIR}" && \
echo "Downloading ${URL_TGZ} ..." && \
download "${URL}" "${URL_TGZ}" && \
echo "Extracting ${URL_TGZ} in ${TOOLS_DIR} ..." && \
tar xfJ "${URL_TGZ}" && \
echo "Removing ${URL_TGZ} ..." && \
rm -f "${URL_TGZ}"
fi
echo "$1 toolchain installed in ${TOOLS_DIR}/$TARGET_ARCH"
}
@ -214,11 +224,11 @@ echo $URL_GET $URL
if [ -z "$1" ]; then
echo "Usage: install.sh <tool>"
echo " install.sh gdb <platform>"
echo "<tool> = all | esp32 | esp32c3 | esp32s2 | esp32s3 | gdb | openocd | qemu"
echo "<tool> = all | esp8266 | esp32 | esp32c3 | esp32s2 | esp32s3 | gdb | openocd | qemu"
echo "<platform> = xtensa | riscv"
exit 1
elif [ "$1" = "all" ]; then
ARCH_ALL="esp32 esp32c3 esp32s2 esp32s3"
ARCH_ALL="esp8266 esp32 esp32c3 esp32s2 esp32s3"
for arch in ${ARCH_ALL}; do
install_arch "$arch"
done
@ -241,4 +251,4 @@ else
fi
echo "Use following command to extend the PATH variable:"
echo ". $(dirname "$0")/export.sh"
echo ". $(dirname "$0")/export.sh $1"