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 4ead466 commit 25d6eb3
Showing 1 changed file with 38 additions and 36 deletions.
74 changes: 38 additions & 36 deletions dist/tools/esptools/export.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ ESP32_GCC_RELEASE="esp-12.2.0_20230208"

ESP32_OPENOCD_VERSION="v0.12.0-esp32-20230313"

if [ -z ${IDF_TOOLS_PATH} ]; then
IDF_TOOLS_PATH=${HOME}/.espressif
if [ -z "${IDF_TOOLS_PATH}" ]; then
IDF_TOOLS_PATH="${HOME}/.espressif"
fi

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

export_arch()
{
Expand All @@ -27,29 +27,29 @@ export_arch()
;;
*)
echo "Unknown architecture $1"
exit 1
return
esac

TOOLS_DIR=${TOOLS_PATH}/${TARGET_ARCH}/${ESP32_GCC_RELEASE}/${TARGET_ARCH}
TOOLS_DIR_IN_PATH=`echo $PATH | grep ${TOOLS_DIR}`
TOOLS_DIR="${TOOLS_PATH}/${TARGET_ARCH}/${ESP32_GCC_RELEASE}/${TARGET_ARCH}"
TOOLS_DIR_IN_PATH="$(echo $PATH | grep "${TOOLS_DIR}")"

if [ -e ${TOOLS_DIR} ] && [ -z ${TOOLS_DIR_IN_PATH} ]; then
if [ -e "${TOOLS_DIR}" ] && [ -z "${TOOLS_DIR_IN_PATH}" ]; then
echo "Extending PATH by ${TOOLS_DIR}/bin"
export PATH=${TOOLS_DIR}/bin:${PATH}
export PATH="${TOOLS_DIR}/bin:${PATH}"
fi

unset TOOLS_DIR
}

export_openocd()
{
TOOLS_DIR=${TOOLS_PATH}/openocd-esp32/${ESP32_OPENOCD_VERSION}
TOOLS_DIR_IN_PATH=`echo $PATH | grep ${TOOLS_DIR}`
OPENOCD_DIR=${TOOLS_DIR}/openocd-esp32
TOOLS_DIR="${TOOLS_PATH}/openocd-esp32/${ESP32_OPENOCD_VERSION}"
TOOLS_DIR_IN_PATH="$(echo $PATH | grep "${TOOLS_DIR}")"
OPENOCD_DIR="${TOOLS_DIR}/openocd-esp32"

if [ -e ${OPENOCD_DIR} ] && [ -z ${TOOLS_DIR_IN_PATH} ]; then
if [ -e "${OPENOCD_DIR}" ] && [ -z "${TOOLS_DIR_IN_PATH}" ]; then
echo "Extending PATH by ${TOOLS_DIR}/bin"
export PATH=${OPENOCD_DIR}/bin:${PATH}
export PATH="${OPENOCD_DIR}/bin:${PATH}"
export OPENOCD="${OPENOCD_DIR}/bin/openocd -s ${OPENOCD_DIR}/share/openocd/scripts"
fi

Expand All @@ -60,18 +60,18 @@ export_openocd()
export_qemu()
{
# 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)
OS=linux-amd64
OS="linux-amd64"
;;
*)
echo "error: OS architecture ${PLATFORM} not supported"
exit 1
return
;;
esac

Expand All @@ -82,24 +82,24 @@ export_qemu()
ESP32_QEMU_VERSION="esp-develop-20210220"
fi

if [ -z ${IDF_TOOLS_PATH} ]; then
IDF_TOOLS_PATH=${HOME}/.espressif
if [ -z "${IDF_TOOLS_PATH}" ]; then
IDF_TOOLS_PATH="${HOME}/.espressif"
fi

TOOLS_DIR=${TOOLS_PATH}/qemu-esp32/${ESP32_QEMU_VERSION}/qemu
TOOLS_DIR_IN_PATH=`echo $PATH | grep ${TOOLS_DIR}`
TOOLS_DIR="${TOOLS_PATH}/qemu-esp32/${ESP32_QEMU_VERSION}/qemu"
TOOLS_DIR_IN_PATH="$(echo $PATH | grep "${TOOLS_DIR}")"

if [ -e ${TOOLS_DIR} ] && [ -z ${TOOLS_DIR_IN_PATH} ]; then
if [ -e "${TOOLS_DIR}" ] && [ -z "${TOOLS_DIR_IN_PATH}" ]; then
echo "Extending PATH by ${TOOLS_DIR}/bin"
export PATH=${TOOLS_DIR}/bin:${PATH}
export PATH="${TOOLS_DIR}/bin:${PATH}"
fi

unset TOOLS_DIR
}

export_gdb()
{
case $1 in
case "$1" in
xtensa)
GDB_ARCH="xtensa-esp-elf-gdb"
;;
Expand All @@ -110,40 +110,42 @@ export_gdb()
echo "error: Unknown platform $1, use xtensa or riscv"
return
esac

GDB_VERSION="12.1_20221002"

TOOLS_DIR=${TOOLS_PATH}/${GDB_ARCH}/${GDB_VERSION}/${GDB_ARCH}
TOOLS_DIR_IN_PATH=`echo $PATH | grep ${TOOLS_DIR}`

if [ -e ${TOOLS_DIR} ] && [ -z ${TOOLS_DIR_IN_PATH} ]; then
TOOLS_DIR="${TOOLS_PATH}/${GDB_ARCH}/${GDB_VERSION}/${GDB_ARCH}"
TOOLS_DIR_IN_PATH="$(echo $PATH | grep "${TOOLS_DIR}")"

if [ -e "${TOOLS_DIR}" ] && [ -z "${TOOLS_DIR_IN_PATH}" ]; then
echo "Extending PATH by ${TOOLS_DIR}/bin"
export PATH=${TOOLS_DIR}/bin:${PATH}
export PATH="${TOOLS_DIR}/bin:${PATH}"
fi

unset TOOLS_DIR
}

if [ -z $1 ]; then
if [ -z "$1" ]; then
echo "Usage: export.sh <tool>"
echo " export.sh gdb <platform>"
echo "<tool> = all | esp32 | esp32c3 | esp32s2 | esp32s3 | gdb | openocd | qemu"
echo "<platform> = xtensa | riscv"
elif [ "$1" = "all" ]; then
ARCH_ALL="esp32 esp32c3 esp32s2 esp32s3"
for arch in ${ARCH_ALL}; do
export_arch $arch
export_arch "$arch"
done
export_gdb xtensa
export_gdb riscv
export_openocd
export_qemu
export_gdb xtensa
export_gdb riscv
elif [ "$1" = "gdb" ]; then
if [ -z "$2" ]; then
echo "platform required: xtensa | riscv"
exit 1
else
export_gdb "$2"
fi
export_gdb $2
elif [ "$1" = "openocd" ]; then
export_openocd
elif [ "$1" = "qemu" ]; then
Expand Down

0 comments on commit 25d6eb3

Please sign in to comment.