From b148de8f1aa08db095d4334a8f010106a4c0ffee Mon Sep 17 00:00:00 2001 From: Gunar Schorcht Date: Fri, 29 Jul 2022 17:20:41 +0200 Subject: [PATCH 1/3] dist/tools/esptools: move test for libncurses version to qemu handling Since macOS doesn't have `ldconfig` command, it must not be used outside the `install_qemu` and `export_qemu` function. --- dist/tools/esptools/export.sh | 22 +++++++++++----------- dist/tools/esptools/install.sh | 14 +++++++------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/dist/tools/esptools/export.sh b/dist/tools/esptools/export.sh index d25716683d..34d0c14250 100755 --- a/dist/tools/esptools/export.sh +++ b/dist/tools/esptools/export.sh @@ -5,17 +5,6 @@ ESP32_GCC_VERSION_DIR="8.4.0" ESP32_OPENOCD_VERSION="v0.11.0-esp32-20211220" -# qemu version depends on the version of ncurses lib -if [ "$(ldconfig -p | grep libncursesw.so.6)" != "" ]; then - ESP32_QEMU_VERSION="esp-develop-20220203" -else - ESP32_QEMU_VERSION="esp-develop-20210220" -fi - -if [ -z ${IDF_TOOLS_PATH} ]; then - IDF_TOOLS_PATH=${HOME}/.espressif -fi - TOOLS_PATH=${IDF_TOOLS_PATH}/tools export_arch() @@ -61,6 +50,17 @@ export_openocd() export_qemu() { + # qemu version depends on the version of ncurses lib + if [ "$(ldconfig -p | grep libncursesw.so.6)" != "" ]; then + ESP32_QEMU_VERSION="esp-develop-20220203" + else + ESP32_QEMU_VERSION="esp-develop-20210220" + fi + + 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}` diff --git a/dist/tools/esptools/install.sh b/dist/tools/esptools/install.sh index 3eb3a4014d..4618db5851 100755 --- a/dist/tools/esptools/install.sh +++ b/dist/tools/esptools/install.sh @@ -7,13 +7,6 @@ ESP32_GCC_VERSION_DOWNLOAD="gcc8_4_0" ESP32_OPENOCD_VERSION="v0.11.0-esp32-20211220" ESP32_OPENOCD_VERSION_TGZ="0.11.0-esp32-20211220" -# qemu version depends on the version of ncurses lib -if [ "$(ldconfig -p | grep libncursesw.so.6)" != "" ]; then - ESP32_QEMU_VERSION="esp-develop-20220203" -else - ESP32_QEMU_VERSION="esp-develop-20210220" -fi - # set the tool path to the default if not already set if [ -z ${IDF_TOOLS_PATH} ]; then IDF_TOOLS_PATH=${HOME}/.espressif @@ -135,6 +128,13 @@ install_qemu() 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-20220203" + else + ESP32_QEMU_VERSION="esp-develop-20210220" + fi + TOOLS_DIR=${TOOLS_PATH}/qemu-esp32/${ESP32_QEMU_VERSION} URL_PATH=https://github.com/espressif/qemu/releases/download From 1016eaff4ade0b37d9a713c05b9457b79c8861e2 Mon Sep 17 00:00:00 2001 From: Gunar Schorcht Date: Fri, 29 Jul 2022 17:21:49 +0200 Subject: [PATCH 2/3] dist/tools/esptools: qemu-esp32 is only supported on linux-amd64 Since the only platform support by `qemu-esp32` is `linux-amd64`, a platform test is added to the `export_qemu` function. --- dist/tools/esptools/export.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/dist/tools/esptools/export.sh b/dist/tools/esptools/export.sh index 34d0c14250..f919e02ef9 100755 --- a/dist/tools/esptools/export.sh +++ b/dist/tools/esptools/export.sh @@ -50,6 +50,22 @@ 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} + + # map different platform names to a unique OS name + case ${PLATFORM} in + linux-amd64|linux64|Linux-x86_64|FreeBSD-amd64) + OS=linux-amd64 + ;; + *) + echo "error: OS architecture ${PLATFORM} not supported" + exit 1 + ;; + esac + # qemu version depends on the version of ncurses lib if [ "$(ldconfig -p | grep libncursesw.so.6)" != "" ]; then ESP32_QEMU_VERSION="esp-develop-20220203" From f6f52749c6064e9764954eb32019d2debba1714b Mon Sep 17 00:00:00 2001 From: Gunar Schorcht Date: Fri, 29 Jul 2022 17:22:14 +0200 Subject: [PATCH 3/3] dist/tools/esptools: add macOS support --- dist/tools/esptools/install.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dist/tools/esptools/install.sh b/dist/tools/esptools/install.sh index 4618db5851..218bb920d6 100755 --- a/dist/tools/esptools/install.sh +++ b/dist/tools/esptools/install.sh @@ -52,6 +52,9 @@ case ${PLATFORM} in linux-i686|linux32|Linux-i686|FreeBSD-i386) OS=linux-i686 ;; + Darwin-x86_64) + OS=macos + ;; *) echo "error: OS architecture ${PLATFORM} not supported" exit 1