From 6b0c756ebfd6e44acc7d370b6bc20ef4afd8beea Mon Sep 17 00:00:00 2001 From: Anton Maklakov Date: Thu, 3 Mar 2022 10:56:35 +0700 Subject: [PATCH 1/3] tools: update tools.json for Clang 14 Closes https://github.com/espressif/clang-tidy-runner/issues/15 --- tools/tools.json | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/tools/tools.json b/tools/tools.json index ebb4c2c172..447867f8c3 100644 --- a/tools/tools.json +++ b/tools/tools.json @@ -396,26 +396,26 @@ "versions": [ { "linux-amd64": { - "sha256": "d62d9234c702a86ed510777125ee97458204e28877806a73f9de5e41d7b65716", - "size": 102954848, - "url": "https://github.com/espressif/llvm-project/releases/download/esp-12.0.1-20210914/xtensa-esp32-elf-llvm12_0_1-esp-12.0.1-20210914-linux-amd64.tar.xz" + "sha256": "b0148627912dacf4a4cab4596ba9467cb8dd771522ca27b9526bc57b88ff366f", + "size": 125101504, + "url": "https://github.com/espressif/llvm-project/releases/download/esp-14.0.0-20220415/xtensa-esp32-elf-llvm14_0_0-esp-14.0.0-20220415-linux-amd64.tar.xz" }, "macos": { - "sha256": "6e7413e5fa515e403859ecf5301bdcdc3f8bf12c5de9aecaa11e9f17f32b05db", - "size": 89888488, - "url": "https://github.com/espressif/llvm-project/releases/download/esp-12.0.1-20210914/xtensa-esp32-elf-llvm12_0_1-esp-12.0.1-20210914-macos.tar.xz" + "sha256": "1a78c598825ef168c0c5668aff7848825a7b9d014bffd1f2f2484ceea9df3841", + "size": 107100188, + "url": "https://github.com/espressif/llvm-project/releases/download/esp-14.0.0-20220415/xtensa-esp32-elf-llvm14_0_0-esp-14.0.0-20220415-macos.tar.xz" }, "macos-arm64": { - "sha256": "6e7413e5fa515e403859ecf5301bdcdc3f8bf12c5de9aecaa11e9f17f32b05db", - "size": 89888488, - "url": "https://github.com/espressif/llvm-project/releases/download/esp-12.0.1-20210914/xtensa-esp32-elf-llvm12_0_1-esp-12.0.1-20210914-macos.tar.xz" + "sha256": "1a78c598825ef168c0c5668aff7848825a7b9d014bffd1f2f2484ceea9df3841", + "size": 107100188, + "url": "https://github.com/espressif/llvm-project/releases/download/esp-14.0.0-20220415/xtensa-esp32-elf-llvm14_0_0-esp-14.0.0-20220415-macos.tar.xz" }, - "name": "12.0.1-d9341b81fc", + "name": "14.0.0-38679f0333", "status": "recommended", "win64": { - "sha256": "e056366959c722367e4144076c5383bd417ea199db5658bb7bb6c95b9aca014b", - "size": 177903504, - "url": "https://github.com/espressif/llvm-project/releases/download/esp-12.0.1-20210914/xtensa-esp32-elf-llvm12_0_1-esp-12.0.1-20210914-win64.zip" + "sha256": "793e7bd9c40fcb9a4fababaaccf3e4c5b8d9554d406af1b1fbee51806bf8c5dd", + "size": 174294128, + "url": "https://github.com/espressif/llvm-project/releases/download/esp-14.0.0-20220415/xtensa-esp32-elf-llvm14_0_0-esp-14.0.0-20220415-win64.zip" } } ] From 55dda77b9881260532f2d47020286356ff0a7cf3 Mon Sep 17 00:00:00 2001 From: Anton Maklakov Date: Wed, 29 Jun 2022 15:13:07 +0700 Subject: [PATCH 2/3] build: add support ESP32-S3 in Clang build configuration --- tools/cmake/toolchain-clang-esp32s3.cmake | 32 +++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 tools/cmake/toolchain-clang-esp32s3.cmake diff --git a/tools/cmake/toolchain-clang-esp32s3.cmake b/tools/cmake/toolchain-clang-esp32s3.cmake new file mode 100644 index 0000000000..bb9da7c157 --- /dev/null +++ b/tools/cmake/toolchain-clang-esp32s3.cmake @@ -0,0 +1,32 @@ +include($ENV{IDF_PATH}/tools/cmake/utilities.cmake) + +set(CMAKE_SYSTEM_NAME Generic) + +set(CMAKE_C_COMPILER clang) +set(CMAKE_CXX_COMPILER clang++) +set(CMAKE_ASM_COMPILER clang) + +set(CMAKE_AR xtensa-esp32-elf-ar) +set(CMAKE_RANLIB xtensa-esp32-elf-gcc-ranlib) +set(CMAKE_OBJDUMP xtensa-esp32-elf-objdump) + +# -freestanding is a hack to force Clang to use its own stdatomic.h, +# without falling back to the (incompatible) GCC stdatomic.h +# https://github.com/espressif/llvm-project/blob/d9341b81/clang/lib/Headers/stdatomic.h#L13-L18 +remove_duplicated_flags("--target=xtensa -mcpu=esp32s3 -ffreestanding ${CMAKE_C_FLAGS}" + UNIQ_CMAKE_C_FLAGS) +set(CMAKE_C_FLAGS "${UNIQ_CMAKE_C_FLAGS}" + CACHE STRING "C Compiler Base Flags" + FORCE) + +remove_duplicated_flags("--target=xtensa -mcpu=esp32s3 -ffreestanding ${CMAKE_CXX_FLAGS}" + UNIQ_CMAKE_CXX_FLAGS) +set(CMAKE_CXX_FLAGS "${UNIQ_CMAKE_CXX_FLAGS}" + CACHE STRING "C++ Compiler Base Flags" + FORCE) + +remove_duplicated_flags("--target=xtensa -mcpu=esp32s3 ${CMAKE_ASM_FLAGS}" + UNIQ_CMAKE_ASM_FLAGS) +set(CMAKE_ASM_FLAGS "${UNIQ_CMAKE_ASM_FLAGS}" + CACHE STRING "Assembler Base Flags" + FORCE) From 0bbfff4382092c0619d8340b36c9383643a3ae27 Mon Sep 17 00:00:00 2001 From: Anton Maklakov Date: Thu, 30 Jun 2022 13:37:26 +0700 Subject: [PATCH 3/3] docs(idf.py): clarify clang-tidy setup --- docs/en/api-guides/tools/idf-clang-tidy.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/api-guides/tools/idf-clang-tidy.rst b/docs/en/api-guides/tools/idf-clang-tidy.rst index 254a8c1d10..009e4769e1 100644 --- a/docs/en/api-guides/tools/idf-clang-tidy.rst +++ b/docs/en/api-guides/tools/idf-clang-tidy.rst @@ -27,7 +27,7 @@ If you have never run this tool before, take the following steps to get this too This toolchain is still under development. After the final release, you don't have to install them manually. -#. Get file from the `llvm repository `_ and add the folder of this script to the ``$PATH``. Or you could pass an optional argument ``--run-clang-tidy-py`` later when you call ``idf.py clang-check``. +#. Get file from the `llvm repository `_ and add the folder of this script to the ``$PATH``. Or you could pass an optional argument ``--run-clang-tidy-py`` later when you call ``idf.py clang-check``. Please don't forget to make the script executable. .. note::