Skip to content

Commit

Permalink
fixup! dist/tools/esptools: upgrade to gcc 12.2
Browse files Browse the repository at this point in the history
  • Loading branch information
gschorcht committed May 11, 2023
1 parent 25d6eb3 commit c9a0d6a
Showing 1 changed file with 52 additions and 52 deletions.
104 changes: 52 additions & 52 deletions dist/tools/esptools/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ ESP32_OPENOCD_VERSION_TGZ="0.12.0-esp32-20230313"

# set the tool path to the default if not already set
if [ -z "${IDF_TOOLS_PATH}" ]; then
IDF_TOOLS_PATH=${HOME}/.espressif
IDF_TOOLS_PATH="${HOME}/.espressif"
fi

TOOLS_PATH=${IDF_TOOLS_PATH}/tools
TOOLS_PATH="${IDF_TOOLS_PATH}/tools"

# check the existence of either wget or curl and set the download tool
if [ "$(which curl)" != "" ]; then
Expand All @@ -31,38 +31,38 @@ if [ "$(which python3)" = "" ]; then
fi

# determine the platform using python
PLATFORM_SYSTEM=$(python3 -c "import platform; print(platform.system())")
PLATFORM_MACHINE=$(python3 -c "import platform; print(platform.machine())")
PLATFORM=${PLATFORM_SYSTEM}-${PLATFORM_MACHINE}
PLATFORM_SYSTEM="$(python3 -c "import platform; print(platform.system())")"
PLATFORM_MACHINE="$(python3 -c "import platform; print(platform.machine())")"
PLATFORM="${PLATFORM_SYSTEM}-${PLATFORM_MACHINE}"

# map different platform names to a unique OS name
case ${PLATFORM} in
case "${PLATFORM}" in
linux-amd64|linux64|Linux-x86_64|FreeBSD-amd64|x86_64-linux-gnu)
OS=x86_64-linux-gnu
OS_OCD=linux-amd64
OS="x86_64-linux-gnu"
OS_OCD="linux-amd64"
;;
linux-arm64|Linux-arm64|Linux-aarch64|Linux-armv8l|aarch64)
OS=aarch64-linux
OS_OCD=linux-arm64
OS="aarch64-linux"
OS_OCD="linux-arm64"
;;
linux-armel|Linux-arm|Linux-armv7l|arm-linux-gnueabi)
OS=arm-linux-gnueabi
OS_OCD=linux-armel
OS="arm-linux-gnueabi"
OS_OCD="linux-armel"
;;
linux-armhf|arm-linux-gnueabihf)
OS=arm-linux-gnueabihf
OS_OCD=linux-armhf
OS="arm-linux-gnueabihf"
OS_OCD="linux-armhf"
;;
linux-i686|linux32|Linux-i686|FreeBSD-i386|i586-linux-gnu|i686-linux-gnu)
OS=i686-linux-gnu
OS="i686-linux-gnu"
;;
macos|osx|darwin|Darwin-x86_64|x86_64-apple-darwin)
OS=x86_64-apple-darwin
OS_OCD=macos
OS="x86_64-apple-darwin"
OS_OCD="macos"
;;
macos-arm64|Darwin-arm64|aarch64-apple-darwin|arm64-apple-darwin)
OS=aarch64-apple-darwin
OS_OCD=macos-arm64
OS="aarch64-apple-darwin"
OS_OCD="macos-arm64"
;;
*)
echo "error: OS architecture ${PLATFORM} not supported"
Expand All @@ -83,7 +83,7 @@ download()

install_arch()
{
case $1 in
case "$1" in
esp32)
TARGET_ARCH="xtensa-esp32-elf"
;;
Expand All @@ -101,21 +101,21 @@ install_arch()
exit 1
esac

TOOLS_DIR=${TOOLS_PATH}/${TARGET_ARCH}/${ESP32_GCC_RELEASE}
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}
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} && \
download "${URL}" "${URL_TGZ}" && \
echo "Extracting ${URL_TGZ} in ${TOOLS_DIR} ..." && \
tar xfJ ${URL_TGZ} && \
tar xfJ "${URL_TGZ}" && \
echo "Removing ${URL_TGZ} ..." && \
rm -f ${URL_TGZ} && \
rm -f "${URL_TGZ}" && \
echo "$1 toolchain installed in ${TOOLS_DIR}/$TARGET_ARCH"
}

Expand All @@ -126,54 +126,54 @@ install_openocd()
exit 1
fi

TOOLS_DIR=${TOOLS_PATH}/openocd-esp32/${ESP32_OPENOCD_VERSION}
TOOLS_DIR="${TOOLS_PATH}/openocd-esp32/${ESP32_OPENOCD_VERSION}"

URL_PATH=https://github.com/espressif/openocd-esp32/releases/download
URL_TGZ=openocd-esp32-${OS_OCD}-${ESP32_OPENOCD_VERSION_TGZ}.tar.gz
URL=${URL_PATH}/${ESP32_OPENOCD_VERSION}/${URL_TGZ}
URL_PATH="https://github.com/espressif/openocd-esp32/releases/download"
URL_TGZ="openocd-esp32-${OS_OCD}-${ESP32_OPENOCD_VERSION_TGZ}.tar.gz"
URL="${URL_PATH}/${ESP32_OPENOCD_VERSION}/${URL_TGZ}"

echo "Creating directory ${TOOLS_DIR} ..." && \
mkdir -p "${TOOLS_DIR}" && \
cd "${TOOLS_DIR}" && \
echo "Downloading ${URL_TGZ} ..." && \
download ${URL} ${URL_TGZ} && \
download "${URL}" "${URL_TGZ}" && \
echo "Extracting ${URL_TGZ} in ${TOOLS_DIR} ..." && \
tar xfz ${URL_TGZ} && \
tar xfz "${URL_TGZ}" && \
echo "Removing ${URL_TGZ} ..." && \
rm -f ${URL_TGZ} && \
rm -f "${URL_TGZ}" && \
echo "OpenOCD for ESP32x SoCs installed in ${TOOLS_DIR}/$TARGET_ARCH"
}

install_qemu()
{
if [ ${OS} != "x86_64-linux-gnu" ]; then
if [ "${OS}" != "x86_64-linux-gnu" ]; then
echo "error: QEMU for ESP32 does not support OS ${OS}"
exit 1
fi

# qemu version depends on the version of ncurses lib
if [ "$(ldconfig -p | grep libncursesw.so.6)" != "" ]; then
ESP32_QEMU_VERSION="esp-develop-7.2.0-20230223"
URL_TGZ=esp-qemu-xtensa-softmmu-develop_7.2.0_20230223-${OS}.tar.bz2
URL_TGZ="esp-qemu-xtensa-softmmu-develop_7.2.0_20230223-${OS}.tar.bz2"
else
ESP32_QEMU_VERSION="esp-develop-20210220"
URL_TGZ=qemu-${ESP32_QEMU_VERSION}.tar.bz2
URL_TGZ="qemu-${ESP32_QEMU_VERSION}.tar.bz2"
fi

TOOLS_DIR=${TOOLS_PATH}/qemu-esp32/${ESP32_QEMU_VERSION}
TOOLS_DIR="${TOOLS_PATH}/qemu-esp32/${ESP32_QEMU_VERSION}"

URL_PATH=https://github.com/espressif/qemu/releases/download
URL=${URL_PATH}/${ESP32_QEMU_VERSION}/${URL_TGZ}
URL_PATH="https://github.com/espressif/qemu/releases/download"
URL="${URL_PATH}/${ESP32_QEMU_VERSION}/${URL_TGZ}"

echo "Creating directory ${TOOLS_DIR} ..." && \
mkdir -p "${TOOLS_DIR}" && \
cd "${TOOLS_DIR}" && \
echo "Downloading ${URL_TGZ} ..." && \
download ${URL} ${URL_TGZ} && \
download "${URL}" "${URL_TGZ}" && \
echo "Extracting ${URL_TGZ} in ${TOOLS_DIR} ..." && \
tar xfj ${URL_TGZ} && \
tar xfj "${URL_TGZ}" && \
echo "Removing ${URL_TGZ} ..." && \
rm -f ${URL_TGZ} && \
rm -f "${URL_TGZ}" && \
echo "QEMU for ESP32 installed in ${TOOLS_DIR}"
}

Expand All @@ -193,21 +193,21 @@ install_gdb()

GDB_VERSION="12.1_20221002"

TOOLS_DIR=${TOOLS_PATH}/${GDB_ARCH}/${GDB_VERSION}

URL_PATH=https://github.com/espressif/binutils-gdb/releases/download
URL_TGZ=${GDB_ARCH}-${GDB_VERSION}-${OS}.tar.gz
URL=${URL_PATH}/esp-gdb-v${GDB_VERSION}/${URL_TGZ}
TOOLS_DIR="${TOOLS_PATH}/${GDB_ARCH}/${GDB_VERSION}"

URL_PATH="https://github.com/espressif/binutils-gdb/releases/download"
URL_TGZ="${GDB_ARCH}-${GDB_VERSION}-${OS}.tar.gz"
URL="${URL_PATH}/esp-gdb-v${GDB_VERSION}/${URL_TGZ}"
echo $URL_GET $URL
echo "Creating directory ${TOOLS_DIR} ..." && \
mkdir -p "${TOOLS_DIR}" && \
cd "${TOOLS_DIR}" && \
echo "Downloading ${URL_TGZ} ..." && \
download ${URL} ${URL_TGZ} && \
download "${URL}" "${URL_TGZ}" && \
echo "Extracting ${URL_TGZ} in ${TOOLS_DIR} ..." && \
tar xfz ${URL_TGZ} && \
tar xfz "${URL_TGZ}" && \
echo "Removing ${URL_TGZ} ..." && \
rm -f ${URL_TGZ} && \
rm -f "${URL_TGZ}" && \
echo "GDB for $1 installed in ${TOOLS_DIR}"
}

Expand All @@ -231,7 +231,7 @@ elif [ "$1" = "gdb" ]; then
echo "platform required: xtensa | riscv"
exit 1
fi
install_gdb $2
install_gdb "$2"
elif [ "$1" = "openocd" ]; then
install_openocd
elif [ "$1" = "qemu" ]; then
Expand Down

0 comments on commit c9a0d6a

Please sign in to comment.