From 98199d50d633f34c7bef97052e0a6d855ad139c4 Mon Sep 17 00:00:00 2001 From: Alexey Lapshin Date: Wed, 12 Jul 2023 12:28:58 +0400 Subject: [PATCH 01/20] change(tools): update gcc toolchain version to 13.2.0 Add Kconfig option to supress new gcc warnings Update docs with migration guide --- CMakeLists.txt | 7 + Kconfig | 7 + docs/en/api-guides/tools/idf-tools-notes.inc | 12 +- .../migration-guides/release-5.x/5.2/gcc.rst | 39 +++ .../release-5.x/5.2/index.rst | 1 + .../api-guides/tools/idf-tools-notes.inc | 12 +- .../migration-guides/release-5.x/5.2/gcc.rst | 12 + .../release-5.x/5.2/index.rst | 1 + tools/idf_py_actions/hints.yml | 5 + .../artifact_expected_addition.json | 4 +- .../add_version/artifact_input.json | 4 +- .../add_version/checksum.sha256 | 144 ++++------ .../checksum_expected_addition.json | 16 +- .../checksum_expected_override.json | 16 +- tools/test_idf_tools/test_idf_tools.py | 100 ++----- tools/tools.json | 268 ++++-------------- 16 files changed, 234 insertions(+), 414 deletions(-) create mode 100644 docs/en/migration-guides/release-5.x/5.2/gcc.rst create mode 100644 docs/zh_CN/migration-guides/release-5.x/5.2/gcc.rst diff --git a/CMakeLists.txt b/CMakeLists.txt index 6de3173992..9535eecfa9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -186,6 +186,13 @@ if(CONFIG_COMPILER_DISABLE_GCC12_WARNINGS) "-Wno-use-after-free") endif() +if(CONFIG_COMPILER_DISABLE_GCC13_WARNINGS) + list(APPEND compile_options "-Wno-xor-used-as-pow") + list(APPEND c_compile_options "-Wno-enum-int-mismatch") + list(APPEND cxx_compile_options "-Wno-self-move" + "-Wno-dangling-reference") +endif() + # GCC-specific options if(CMAKE_C_COMPILER_ID STREQUAL "GNU") list(APPEND compile_options "-fstrict-volatile-bitfields" diff --git a/Kconfig b/Kconfig index 1f36751668..802aa3165d 100644 --- a/Kconfig +++ b/Kconfig @@ -525,6 +525,13 @@ mainmenu "Espressif IoT Development Framework Configuration" Enable this option if use GCC 12 or newer, and want to disable warnings which don't appear with GCC 11. + config COMPILER_DISABLE_GCC13_WARNINGS + bool "Disable new warnings introduced in GCC 13" + default "n" + help + Enable this option if use GCC 13 or newer, and want to disable warnings which don't appear with + GCC 12. + config COMPILER_DUMP_RTL_FILES bool "Dump RTL files during compilation" help diff --git a/docs/en/api-guides/tools/idf-tools-notes.inc b/docs/en/api-guides/tools/idf-tools-notes.inc index d0850c2606..5be741b5bb 100644 --- a/docs/en/api-guides/tools/idf-tools-notes.inc +++ b/docs/en/api-guides/tools/idf-tools-notes.inc @@ -12,17 +12,7 @@ --- -.. tool-xtensa-esp32-elf-notes - - ---- - -.. tool-xtensa-esp32s2-elf-notes - - ---- - -.. tool-xtensa-esp32s3-elf-notes +.. tool-xtensa-esp-elf-notes --- diff --git a/docs/en/migration-guides/release-5.x/5.2/gcc.rst b/docs/en/migration-guides/release-5.x/5.2/gcc.rst new file mode 100644 index 0000000000..c608e2ff31 --- /dev/null +++ b/docs/en/migration-guides/release-5.x/5.2/gcc.rst @@ -0,0 +1,39 @@ +GCC +*** + +:link_to_translation:`zh_CN:[中文]` + + +GCC Version +=========== + +The previous GCC version was GCC 12.2.0. This has now been upgraded to GCC 13.2.0 on all targets. Users that need to port their code from GCC 12.2.0 to 13.2.0 should refer to the series of official GCC porting guides listed below: + +* `Porting to GCC 13 `_ + + +Common Porting Problems and Fixes +================================= + +stdio.h No Longer Includes sys/types.h +-------------------------------------- + +Issue: +^^^^^^ + +Compile errors may occur in code that previously worked with the old toolchain. For example: + +.. code-block:: c + + #include + clock_t var; // error: expected specifier-qualifier-list before 'clock_t' + +Solution: +^^^^^^^^^ + +To resolve this issue, the correct header must be included. Refactor the code like this: + +.. code-block:: c + + #include + clock_t var; diff --git a/docs/en/migration-guides/release-5.x/5.2/index.rst b/docs/en/migration-guides/release-5.x/5.2/index.rst index 751799e2c4..e9e964652e 100644 --- a/docs/en/migration-guides/release-5.x/5.2/index.rst +++ b/docs/en/migration-guides/release-5.x/5.2/index.rst @@ -6,6 +6,7 @@ Migration from 5.1 to 5.2 .. toctree:: :maxdepth: 1 + gcc peripherals protocols wifi diff --git a/docs/zh_CN/api-guides/tools/idf-tools-notes.inc b/docs/zh_CN/api-guides/tools/idf-tools-notes.inc index b09c07fedb..da7bd3550a 100644 --- a/docs/zh_CN/api-guides/tools/idf-tools-notes.inc +++ b/docs/zh_CN/api-guides/tools/idf-tools-notes.inc @@ -14,17 +14,7 @@ --- -.. tool-xtensa-esp32-elf-notes - - ---- - -.. tool-xtensa-esp32s2-elf-notes - - ---- - -.. tool-xtensa-esp32s3-elf-notes +.. tool-xtensa-esp-elf-notes --- diff --git a/docs/zh_CN/migration-guides/release-5.x/5.2/gcc.rst b/docs/zh_CN/migration-guides/release-5.x/5.2/gcc.rst new file mode 100644 index 0000000000..5535b9fd91 --- /dev/null +++ b/docs/zh_CN/migration-guides/release-5.x/5.2/gcc.rst @@ -0,0 +1,12 @@ +GCC +*** + +:link_to_translation:`en:[English]` + + +GCC 版本 +======== + +ESP-IDF 之前使用的 GCC 版本为 12.2.0,现已针对所有芯片目标升级至 GCC 13.2.0。若需要将代码从 GCC 12.2.0 迁移到 GCC 13.2.0,请参考以下 GCC 官方迁移指南。 + +* `迁移至 GCC 13 `_ diff --git a/docs/zh_CN/migration-guides/release-5.x/5.2/index.rst b/docs/zh_CN/migration-guides/release-5.x/5.2/index.rst index 795b89483a..e3c8ef97eb 100644 --- a/docs/zh_CN/migration-guides/release-5.x/5.2/index.rst +++ b/docs/zh_CN/migration-guides/release-5.x/5.2/index.rst @@ -6,6 +6,7 @@ .. toctree:: :maxdepth: 1 + gcc peripherals protocols wifi diff --git a/tools/idf_py_actions/hints.yml b/tools/idf_py_actions/hints.yml index cf24e8ff9b..b4d347cfa6 100644 --- a/tools/idf_py_actions/hints.yml +++ b/tools/idf_py_actions/hints.yml @@ -392,3 +392,8 @@ - re: "assert failed: [\\w]+ tlsf.c:[\\d]+" hint: "CORRUPT HEAP: heap metadata corrupted resulting in TLSF malfunction.\nMake sure you are not making out of bound writing on the memory you allocate in your application.\nMake sure you are not writing on freed memory.\nFor more information run 'idf.py docs -sp api-reference/system/heap_debug.html'." + +- + re: "-Werror=(xor-used-as-pow|enum-int-mismatch|self-move|dangling-reference)" + hint: "The warning(s) '{}' may appear after compiler update above GCC-13\nTo suppress these warnings use 'idf.py menuconfig' to enable configure option 'Compiler options' -> 'Disable new warnings introduced in GCC 13'\nPlease note that this is not a permanent solution, and this option will be removed in a future update of the ESP-IDF.\nIt is strongly recommended to fix all warnings, as they may indicate potential issues!" + match_to_output: True diff --git a/tools/test_idf_tools/add_version/artifact_expected_addition.json b/tools/test_idf_tools/add_version/artifact_expected_addition.json index 76628bac07..cc898e7299 100644 --- a/tools/test_idf_tools/add_version/artifact_expected_addition.json +++ b/tools/test_idf_tools/add_version/artifact_expected_addition.json @@ -2,12 +2,12 @@ "linux-amd64": { "sha256": "d2d02ea74de2c9fab1d802db969c18d409a8663a9697977bb1c98ccdd9de4372", "size": 10, - "url": "http://test.com/xtensa-esp32-elf-test-linux-amd64.tar.gz" + "url": "http://test.com/xtensa-esp-elf-test-linux-amd64.tar.gz" }, "linux-armhf": { "sha256": "d1b3707fbdc6a22d16e95bf6b910646f5d9c2b3ed81bd637d454ffb9bb0948e4", "size": 20, - "url": "http://test.com/xtensa-esp32-elf-test-linux-armhf.tar.gz" + "url": "http://test.com/xtensa-esp-elf-test-linux-armhf.tar.gz" }, "name": "test", "status": "supported" diff --git a/tools/test_idf_tools/add_version/artifact_input.json b/tools/test_idf_tools/add_version/artifact_input.json index eef2d0b285..c56442d6f0 100644 --- a/tools/test_idf_tools/add_version/artifact_input.json +++ b/tools/test_idf_tools/add_version/artifact_input.json @@ -1,11 +1,11 @@ [ { - "filename": "xtensa-esp32-elf-test-linux-amd64.tar.gz", + "filename": "xtensa-esp-elf-test-linux-amd64.tar.gz", "size": 10, "sha256": "d2d02ea74de2c9fab1d802db969c18d409a8663a9697977bb1c98ccdd9de4372" }, { - "filename": "xtensa-esp32-elf-test-linux-armhf.tar.gz", + "filename": "xtensa-esp-elf-test-linux-armhf.tar.gz", "size": 20, "sha256": "d1b3707fbdc6a22d16e95bf6b910646f5d9c2b3ed81bd637d454ffb9bb0948e4" } diff --git a/tools/test_idf_tools/add_version/checksum.sha256 b/tools/test_idf_tools/add_version/checksum.sha256 index 79378cf1b4..285a3363ba 100644 --- a/tools/test_idf_tools/add_version/checksum.sha256 +++ b/tools/test_idf_tools/add_version/checksum.sha256 @@ -1,98 +1,50 @@ # crosstool-NG-esp-2021r2.tar.gz: 3179127 bytes 6b2a40d84bf1d3a0ab71b7df8a265d323c43b4b48de017e30e6262642cb04fb1 *crosstool-NG-esp-2021r2.tar.gz -# riscv32-esp-elf-gcc8_4_0-esp-2021r2-linux-amd64.tar.gz: 106837189 bytes -812d735063da9d063b374b59f55832a96c41fbd27ddaef19000a75de8607ba21 *riscv32-esp-elf-gcc8_4_0-esp-2021r2-linux-amd64.tar.gz -# riscv32-esp-elf-gcc8_4_0-esp-2021r2-linux-arm64.tar.gz: 103273444 bytes -712f1fbc3e08304a6f32aa18b346b16bbcb413b507b3d4c7c3211bf0d7dc4813 *riscv32-esp-elf-gcc8_4_0-esp-2021r2-linux-arm64.tar.gz -# riscv32-esp-elf-gcc8_4_0-esp-2021r2-linux-armel.tar.gz: 103058744 bytes -80a3342cda2cd4b6b75ebb2b36d5d12fce7d375cfadadcff01ec3a907f0a16a2 *riscv32-esp-elf-gcc8_4_0-esp-2021r2-linux-armel.tar.gz -# riscv32-esp-elf-gcc8_4_0-esp-2021r2-linux-armhf.tar.gz: 100134410 bytes -ed4e6bebd34aed77048bd33ae13c0e5ff404b8748f99e4004983ce365309b039 *riscv32-esp-elf-gcc8_4_0-esp-2021r2-linux-armhf.tar.gz -# riscv32-esp-elf-gcc8_4_0-esp-2021r2-linux-i686.tar.gz: 109447789 bytes -7f0162a81558ab0ed09d6c5d356def25b5cb3d5c2d61358f20152fa260ccc8ae *riscv32-esp-elf-gcc8_4_0-esp-2021r2-linux-i686.tar.gz -# riscv32-esp-elf-gcc8_4_0-esp-2021r2-macos.tar.gz: 113672945 bytes -3ff7e5427907cf8e271c1f959b70fb01e39625c3caf61a6567e7b38aa0c11578 *riscv32-esp-elf-gcc8_4_0-esp-2021r2-macos.tar.gz -# riscv32-esp-elf-gcc8_4_0-esp-2021r2-win32.zip: 140809778 bytes -c8ff08883c1456c278fad85e1c43b7c6e251d525683214168655550e85c5b82e *riscv32-esp-elf-gcc8_4_0-esp-2021r2-win32.zip -# riscv32-esp-elf-gcc8_4_0-esp-2021r2-win64.zip: 142365782 bytes -6c04cb4728db928ec6473e63146b695b6dec686a0d40dd73dd3353f05247b19e *riscv32-esp-elf-gcc8_4_0-esp-2021r2-win64.zip -# xtensa-esp32-elf-gcc8_4_0-esp-2021r2-linux-amd64.tar.gz: 90565318 bytes -3eb3d68b27fa6ba5af6f88da21cb8face9be0094daaa8960793cfe570ab785ff *xtensa-esp32-elf-gcc8_4_0-esp-2021r2-linux-amd64.tar.gz -# xtensa-esp32-elf-gcc8_4_0-esp-2021r2-linux-arm64.tar.gz: 86860292 bytes -aa534be24e45e06b7080a6a3bb8cd9e3cfb818f5f8bce2244d7cfb5e91336541 *xtensa-esp32-elf-gcc8_4_0-esp-2021r2-linux-arm64.tar.gz -# xtensa-esp32-elf-gcc8_4_0-esp-2021r2-linux-armel.tar.gz: 86183421 bytes -f0e49ce06fe7833ff5d76961dc2dac5449d320f823bb8c05a302cf85a3a6eb04 *xtensa-esp32-elf-gcc8_4_0-esp-2021r2-linux-armel.tar.gz -# xtensa-esp32-elf-gcc8_4_0-esp-2021r2-linux-armhf.tar.gz: 83295350 bytes -b9de7b995630ea000318ee734c33dc1b9c3a9d24b42403e98045a62ccdef1ecf *xtensa-esp32-elf-gcc8_4_0-esp-2021r2-linux-armhf.tar.gz -# xtensa-esp32-elf-gcc8_4_0-esp-2021r2-linux-i686.tar.gz: 92582250 bytes -06de09b74652de43e5b22db3b7fc992623044baa75e9faaab68317a986715ba3 *xtensa-esp32-elf-gcc8_4_0-esp-2021r2-linux-i686.tar.gz -# xtensa-esp32-elf-gcc8_4_0-esp-2021r2-macos.tar.gz: 97808961 bytes -96443f69c8569417c780ee749d91ef33cffe22153fffa30a0fbf12107d87381b *xtensa-esp32-elf-gcc8_4_0-esp-2021r2-macos.tar.gz -# xtensa-esp32-elf-gcc8_4_0-esp-2021r2-win32.zip: 112578260 bytes -076a4171bdc33e5ced3952efffb233d70263dfa760e636704050597a9edf61db *xtensa-esp32-elf-gcc8_4_0-esp-2021r2-win32.zip -# xtensa-esp32-elf-gcc8_4_0-esp-2021r2-win64.zip: 115278695 bytes -c35b7998f7f503e0cb22055d1e279ae14b6b0e09bb3ff3846b17d552ece9c247 *xtensa-esp32-elf-gcc8_4_0-esp-2021r2-win64.zip -# xtensa-esp32s2-elf-gcc8_4_0-esp-2021r2-linux-amd64.tar.gz: 90901736 bytes -a6e0947c92b823ca04f062522249f0a428357e0b056f1ff4c6bcabef83cf63a7 *xtensa-esp32s2-elf-gcc8_4_0-esp-2021r2-linux-amd64.tar.gz -# xtensa-esp32s2-elf-gcc8_4_0-esp-2021r2-linux-arm64.tar.gz: 87176557 bytes -d2e5600fc194b508bd393b236a09fd62ed70afb6c36619d4b106b696a56ca66d *xtensa-esp32s2-elf-gcc8_4_0-esp-2021r2-linux-arm64.tar.gz -# xtensa-esp32s2-elf-gcc8_4_0-esp-2021r2-linux-armel.tar.gz: 86581102 bytes -3fff4199e986dd74660f17ca27d9414cb98f1b911a7f13bb3b22e784cb1156cf *xtensa-esp32s2-elf-gcc8_4_0-esp-2021r2-linux-armel.tar.gz -# xtensa-esp32s2-elf-gcc8_4_0-esp-2021r2-linux-armhf.tar.gz: 83722420 bytes -57c37c08e2cb93b300a1b1aeb9ee93350a642832e13e77b6ed4bfa2caddf1e45 *xtensa-esp32s2-elf-gcc8_4_0-esp-2021r2-linux-armhf.tar.gz -# xtensa-esp32s2-elf-gcc8_4_0-esp-2021r2-linux-i686.tar.gz: 92875986 bytes -7732f9fb371d36b6b324820e300beecc33c2719921a61cf1cdb5bc625016b346 *xtensa-esp32s2-elf-gcc8_4_0-esp-2021r2-linux-i686.tar.gz -# xtensa-esp32s2-elf-gcc8_4_0-esp-2021r2-macos.tar.gz: 98212907 bytes -e6dd32782fcff8f633299b97d1c671d6b6513390aca2ddbd7543c2cc62e72d7e *xtensa-esp32s2-elf-gcc8_4_0-esp-2021r2-macos.tar.gz -# xtensa-esp32s2-elf-gcc8_4_0-esp-2021r2-win32.zip: 113022469 bytes -41b917b35f6fbe7d30b7de91c32cf348c406acfa729a1eabc450d040dc46fbe2 *xtensa-esp32s2-elf-gcc8_4_0-esp-2021r2-win32.zip -# xtensa-esp32s2-elf-gcc8_4_0-esp-2021r2-win64.zip: 115696999 bytes -a764c1a0ee743d69f8cbfadbe4426a2c15c0e233b0894244c7cadf3b4d7dd32a *xtensa-esp32s2-elf-gcc8_4_0-esp-2021r2-win64.zip -# xtensa-esp32s3-elf-gcc8_4_0-esp-2021r2-linux-amd64.tar.gz: 90887465 bytes -b958eb47f51fc2a91e3beda78a331a380eb8c96d5452f7795adf3f565d7fca2f *xtensa-esp32s3-elf-gcc8_4_0-esp-2021r2-linux-amd64.tar.gz -# xtensa-esp32s3-elf-gcc8_4_0-esp-2021r2-linux-arm64.tar.gz: 87047917 bytes -5fb122f1109a0b1aa7a42b6b48f56c854c0a84d13047a3bb0a78bdc737bf70e2 *xtensa-esp32s3-elf-gcc8_4_0-esp-2021r2-linux-arm64.tar.gz -# xtensa-esp32s3-elf-gcc8_4_0-esp-2021r2-linux-armel.tar.gz: 86448074 bytes -d618be508629749110785ce0038b35959cc4e6953629e2dc6d65697425b905e1 *xtensa-esp32s3-elf-gcc8_4_0-esp-2021r2-linux-armel.tar.gz -# xtensa-esp32s3-elf-gcc8_4_0-esp-2021r2-linux-armhf.tar.gz: 83545136 bytes -c2b129c1979b79cbe5bab78178ac9abe8be66db6dd5ed432a779229d7e87195b *xtensa-esp32s3-elf-gcc8_4_0-esp-2021r2-linux-armhf.tar.gz -# xtensa-esp32s3-elf-gcc8_4_0-esp-2021r2-linux-i686.tar.gz: 92888291 bytes -9701907da616992079d302acf5a04f97361b39ca3e74112690b2c896875f3a62 *xtensa-esp32s3-elf-gcc8_4_0-esp-2021r2-linux-i686.tar.gz -# xtensa-esp32s3-elf-gcc8_4_0-esp-2021r2-macos.tar.gz: 98564027 bytes -d417885a5d150d94b3b84f68460b7af399a789cb0c7c632e222feed666c8aaea *xtensa-esp32s3-elf-gcc8_4_0-esp-2021r2-macos.tar.gz -# xtensa-esp32s3-elf-gcc8_4_0-esp-2021r2-win32.zip: 112979829 bytes -d2d76c69b267767d7caf01f152cf0d1dbb9facba0e9bd2cbcad5130253a14e5f *xtensa-esp32s3-elf-gcc8_4_0-esp-2021r2-win32.zip -# xtensa-esp32s3-elf-gcc8_4_0-esp-2021r2-win64.zip: 115825020 bytes -9c04d1da09c600b380f323b01c15e3ec511053db7d0c161085081a3fa812dc1e *xtensa-esp32s3-elf-gcc8_4_0-esp-2021r2-win64.zip -# riscv32-esp-elf-gcc8_4_0-esp-2021r2-patch1-win32.zip: 144692343 bytes -f1ff7d2a87e1f1515371c1e4868b982e6a0958df144e2f1b2bd7e684ec1f9c93 *riscv32-esp-elf-gcc8_4_0-esp-2021r2-patch1-win32.zip -# xtensa-esp32-elf-gcc8_4_0-esp-2021r2-patch1-win32.zip: 116460829 bytes -eba06307022cc659e3c5345ecb3c620c99ec5d0d2a5cb59ac21c831edcbafc45 *xtensa-esp32-elf-gcc8_4_0-esp-2021r2-patch1-win32.zip -# xtensa-esp32s2-elf-gcc8_4_0-esp-2021r2-patch1-win32.zip: 116905046 bytes -083458aed4e0e1efad3779098b5626dbb41cfe00892daf1ae1fde07f59ac40b9 *xtensa-esp32s2-elf-gcc8_4_0-esp-2021r2-patch1-win32.zip -# xtensa-esp32s3-elf-gcc8_4_0-esp-2021r2-patch1-win32.zip: 116862406 bytes -0985f5292370daad2bf228d80bcd51aacb060288a24c7d1965fddfb16e4e2613 *xtensa-esp32s3-elf-gcc8_4_0-esp-2021r2-patch1-win32.zip -# riscv32-esp-elf-gcc8_4_0-esp-2021r2-patch1-win64.zip: 146593717 bytes -791b8c8ed99934a2ec7f42100f2c71fb1ef7042efa7c6267c0d59394175c827a *riscv32-esp-elf-gcc8_4_0-esp-2021r2-patch1-win64.zip -# xtensa-esp32-elf-gcc8_4_0-esp-2021r2-patch1-win64.zip: 119506634 bytes -36a47c80fa79a867244f39794565c391cf4646d221c8f3e228bef45a5de1d32a *xtensa-esp32-elf-gcc8_4_0-esp-2021r2-patch1-win64.zip -# xtensa-esp32s2-elf-gcc8_4_0-esp-2021r2-patch1-win64.zip: 119924946 bytes -e535084882355d5f7587d79d4c0b6d135a318288acf50a5a2fe1b90dbc934b61 *xtensa-esp32s2-elf-gcc8_4_0-esp-2021r2-patch1-win64.zip -# xtensa-esp32s3-elf-gcc8_4_0-esp-2021r2-patch1-win64.zip: 120052967 bytes -cb98c854017ffa3222ef1db9e76151364d6f22841b11b07e857363065be91d1f *xtensa-esp32s3-elf-gcc8_4_0-esp-2021r2-patch1-win64.zip -# riscv32-esp-elf-gcc8_4_0-esp-2021r2-patch2-win32.zip: 144701997 bytes -937566910600d3d5b4ef6f272084fe59ea82dc3711b260a601be7487ef7a4626 *riscv32-esp-elf-gcc8_4_0-esp-2021r2-patch2-win32.zip -# riscv32-esp-elf-gcc8_4_0-esp-2021r2-patch2-win64.zip: 146606360 bytes -40570481ba0d78f7a51e523ce2e7d144b55352071adeeda0d7e81161c6c73245 *riscv32-esp-elf-gcc8_4_0-esp-2021r2-patch2-win64.zip -# xtensa-esp32-elf-gcc8_4_0-esp-2021r2-patch2-win32.zip: 116446514 bytes -c14cc88ddeff6d5494497de33fb5783268c6a171b3bb8c745aafae58507e2356 *xtensa-esp32-elf-gcc8_4_0-esp-2021r2-patch2-win32.zip -# xtensa-esp32-elf-gcc8_4_0-esp-2021r2-patch2-win64.zip: 119516221 bytes -68db46ed4f188e169b922d43215eea781de28f847e7caed3acd5991d0bfb67bd *xtensa-esp32-elf-gcc8_4_0-esp-2021r2-patch2-win64.zip -# xtensa-esp32s2-elf-gcc8_4_0-esp-2021r2-patch2-win32.zip: 116913005 bytes -2c6aea1a132c6caa5a71cb5389b43454276bf097c98bb25d5bb778ed65036aef *xtensa-esp32s2-elf-gcc8_4_0-esp-2021r2-patch2-win32.zip -# xtensa-esp32s2-elf-gcc8_4_0-esp-2021r2-patch2-win64.zip: 119924927 bytes -2d57cb5d897592cf0abdae94d1d673cdad294007f6210a96f34e7cd9f26c48a1 *xtensa-esp32s2-elf-gcc8_4_0-esp-2021r2-patch2-win64.zip -# xtensa-esp32s3-elf-gcc8_4_0-esp-2021r2-patch2-win32.zip: 116846719 bytes -cfac4ec95f7cf64b7d81a66799e388062469d53ffb19698c2b30ccf78076e92f *xtensa-esp32s3-elf-gcc8_4_0-esp-2021r2-patch2-win32.zip -# xtensa-esp32s3-elf-gcc8_4_0-esp-2021r2-patch2-win64.zip: 120066549 bytes -31c79edf0df6592da61869d5d85d8e8fd064f0a247f2a3849996facc17a9e972 *xtensa-esp32s3-elf-gcc8_4_0-esp-2021r2-patch2-win64.zip +# riscv32-esp-elf-esp-0.0.0-19700101-linux-amd64.tar.gz: 106837189 bytes +812d735063da9d063b374b59f55832a96c41fbd27ddaef19000a75de8607ba21 *riscv32-esp-elf-esp-0.0.0-19700101-linux-amd64.tar.gz +# riscv32-esp-elf-esp-0.0.0-19700101-linux-arm64.tar.gz: 103273444 bytes +712f1fbc3e08304a6f32aa18b346b16bbcb413b507b3d4c7c3211bf0d7dc4813 *riscv32-esp-elf-esp-0.0.0-19700101-linux-arm64.tar.gz +# riscv32-esp-elf-esp-0.0.0-19700101-linux-armel.tar.gz: 103058744 bytes +80a3342cda2cd4b6b75ebb2b36d5d12fce7d375cfadadcff01ec3a907f0a16a2 *riscv32-esp-elf-esp-0.0.0-19700101-linux-armel.tar.gz +# riscv32-esp-elf-esp-0.0.0-19700101-linux-armhf.tar.gz: 100134410 bytes +ed4e6bebd34aed77048bd33ae13c0e5ff404b8748f99e4004983ce365309b039 *riscv32-esp-elf-esp-0.0.0-19700101-linux-armhf.tar.gz +# riscv32-esp-elf-esp-0.0.0-19700101-linux-i686.tar.gz: 109447789 bytes +7f0162a81558ab0ed09d6c5d356def25b5cb3d5c2d61358f20152fa260ccc8ae *riscv32-esp-elf-esp-0.0.0-19700101-linux-i686.tar.gz +# riscv32-esp-elf-esp-0.0.0-19700101-macos.tar.gz: 113672945 bytes +3ff7e5427907cf8e271c1f959b70fb01e39625c3caf61a6567e7b38aa0c11578 *riscv32-esp-elf-esp-0.0.0-19700101-macos.tar.gz +# riscv32-esp-elf-esp-0.0.0-19700101-win32.zip: 140809778 bytes +c8ff08883c1456c278fad85e1c43b7c6e251d525683214168655550e85c5b82e *riscv32-esp-elf-esp-0.0.0-19700101-win32.zip +# riscv32-esp-elf-esp-0.0.0-19700101-win64.zip: 142365782 bytes +6c04cb4728db928ec6473e63146b695b6dec686a0d40dd73dd3353f05247b19e *riscv32-esp-elf-esp-0.0.0-19700101-win64.zip +# xtensa-esp-elf-esp-0.0.0-19700101-linux-amd64.tar.gz: 90565318 bytes +3eb3d68b27fa6ba5af6f88da21cb8face9be0094daaa8960793cfe570ab785ff *xtensa-esp-elf-esp-0.0.0-19700101-linux-amd64.tar.gz +# xtensa-esp-elf-esp-0.0.0-19700101-linux-arm64.tar.gz: 86860292 bytes +aa534be24e45e06b7080a6a3bb8cd9e3cfb818f5f8bce2244d7cfb5e91336541 *xtensa-esp-elf-esp-0.0.0-19700101-linux-arm64.tar.gz +# xtensa-esp-elf-esp-0.0.0-19700101-linux-armel.tar.gz: 86183421 bytes +f0e49ce06fe7833ff5d76961dc2dac5449d320f823bb8c05a302cf85a3a6eb04 *xtensa-esp-elf-esp-0.0.0-19700101-linux-armel.tar.gz +# xtensa-esp-elf-esp-0.0.0-19700101-linux-armhf.tar.gz: 83295350 bytes +b9de7b995630ea000318ee734c33dc1b9c3a9d24b42403e98045a62ccdef1ecf *xtensa-esp-elf-esp-0.0.0-19700101-linux-armhf.tar.gz +# xtensa-esp-elf-esp-0.0.0-19700101-linux-i686.tar.gz: 92582250 bytes +06de09b74652de43e5b22db3b7fc992623044baa75e9faaab68317a986715ba3 *xtensa-esp-elf-esp-0.0.0-19700101-linux-i686.tar.gz +# xtensa-esp-elf-esp-0.0.0-19700101-macos.tar.gz: 97808961 bytes +96443f69c8569417c780ee749d91ef33cffe22153fffa30a0fbf12107d87381b *xtensa-esp-elf-esp-0.0.0-19700101-macos.tar.gz +# xtensa-esp-elf-esp-0.0.0-19700101-win32.zip: 112578260 bytes +076a4171bdc33e5ced3952efffb233d70263dfa760e636704050597a9edf61db *xtensa-esp-elf-esp-0.0.0-19700101-win32.zip +# xtensa-esp-elf-esp-0.0.0-19700101-win64.zip: 115278695 bytes +c35b7998f7f503e0cb22055d1e279ae14b6b0e09bb3ff3846b17d552ece9c247 *xtensa-esp-elf-esp-0.0.0-19700101-win64.zip +# riscv32-esp-elf-esp-0.0.0-19700101-patch1-win32.zip: 144692343 bytes +f1ff7d2a87e1f1515371c1e4868b982e6a0958df144e2f1b2bd7e684ec1f9c93 *riscv32-esp-elf-esp-0.0.0-19700101-patch1-win32.zip +# xtensa-esp-elf-esp-0.0.0-19700101-patch1-win32.zip: 116460829 bytes +eba06307022cc659e3c5345ecb3c620c99ec5d0d2a5cb59ac21c831edcbafc45 *xtensa-esp-elf-esp-0.0.0-19700101-patch1-win32.zip +# riscv32-esp-elf-esp-0.0.0-19700101-patch1-win64.zip: 146593717 bytes +791b8c8ed99934a2ec7f42100f2c71fb1ef7042efa7c6267c0d59394175c827a *riscv32-esp-elf-esp-0.0.0-19700101-patch1-win64.zip +# xtensa-esp-elf-esp-0.0.0-19700101-patch1-win64.zip: 119506634 bytes +36a47c80fa79a867244f39794565c391cf4646d221c8f3e228bef45a5de1d32a *xtensa-esp-elf-esp-0.0.0-19700101-patch1-win64.zip +# riscv32-esp-elf-esp-0.0.0-19700101-patch2-win32.zip: 144701997 bytes +937566910600d3d5b4ef6f272084fe59ea82dc3711b260a601be7487ef7a4626 *riscv32-esp-elf-esp-0.0.0-19700101-patch2-win32.zip +# riscv32-esp-elf-esp-0.0.0-19700101-patch2-win64.zip: 146606360 bytes +40570481ba0d78f7a51e523ce2e7d144b55352071adeeda0d7e81161c6c73245 *riscv32-esp-elf-esp-0.0.0-19700101-patch2-win64.zip +# xtensa-esp-elf-esp-0.0.0-19700101-patch2-win32.zip: 116446514 bytes +c14cc88ddeff6d5494497de33fb5783268c6a171b3bb8c745aafae58507e2356 *xtensa-esp-elf-esp-0.0.0-19700101-patch2-win32.zip +# xtensa-esp-elf-esp-0.0.0-19700101-patch2-win64.zip: 119516221 bytes +68db46ed4f188e169b922d43215eea781de28f847e7caed3acd5991d0bfb67bd *xtensa-esp-elf-esp-0.0.0-19700101-patch2-win64.zip diff --git a/tools/test_idf_tools/add_version/checksum_expected_addition.json b/tools/test_idf_tools/add_version/checksum_expected_addition.json index ba82700374..cb36584357 100644 --- a/tools/test_idf_tools/add_version/checksum_expected_addition.json +++ b/tools/test_idf_tools/add_version/checksum_expected_addition.json @@ -2,43 +2,43 @@ "linux-amd64":{ "sha256":"3eb3d68b27fa6ba5af6f88da21cb8face9be0094daaa8960793cfe570ab785ff", "size":90565318, - "url":"http://test.com/xtensa-esp32-elf-gcc8_4_0-esp-2021r2-linux-amd64.tar.gz" + "url":"http://test.com/xtensa-esp-elf-esp-0.0.0-19700101-linux-amd64.tar.gz" }, "linux-arm64":{ "sha256":"aa534be24e45e06b7080a6a3bb8cd9e3cfb818f5f8bce2244d7cfb5e91336541", "size":86860292, - "url":"http://test.com/xtensa-esp32-elf-gcc8_4_0-esp-2021r2-linux-arm64.tar.gz" + "url":"http://test.com/xtensa-esp-elf-esp-0.0.0-19700101-linux-arm64.tar.gz" }, "linux-armel":{ "sha256":"f0e49ce06fe7833ff5d76961dc2dac5449d320f823bb8c05a302cf85a3a6eb04", "size":86183421, - "url":"http://test.com/xtensa-esp32-elf-gcc8_4_0-esp-2021r2-linux-armel.tar.gz" + "url":"http://test.com/xtensa-esp-elf-esp-0.0.0-19700101-linux-armel.tar.gz" }, "linux-armhf":{ "sha256":"b9de7b995630ea000318ee734c33dc1b9c3a9d24b42403e98045a62ccdef1ecf", "size":83295350, - "url":"http://test.com/xtensa-esp32-elf-gcc8_4_0-esp-2021r2-linux-armhf.tar.gz" + "url":"http://test.com/xtensa-esp-elf-esp-0.0.0-19700101-linux-armhf.tar.gz" }, "linux-i686":{ "sha256":"06de09b74652de43e5b22db3b7fc992623044baa75e9faaab68317a986715ba3", "size":92582250, - "url":"http://test.com/xtensa-esp32-elf-gcc8_4_0-esp-2021r2-linux-i686.tar.gz" + "url":"http://test.com/xtensa-esp-elf-esp-0.0.0-19700101-linux-i686.tar.gz" }, "macos":{ "sha256":"96443f69c8569417c780ee749d91ef33cffe22153fffa30a0fbf12107d87381b", "size":97808961, - "url":"http://test.com/xtensa-esp32-elf-gcc8_4_0-esp-2021r2-macos.tar.gz" + "url":"http://test.com/xtensa-esp-elf-esp-0.0.0-19700101-macos.tar.gz" }, "name":"test", "status":"supported", "win32":{ "sha256":"c14cc88ddeff6d5494497de33fb5783268c6a171b3bb8c745aafae58507e2356", "size":116446514, - "url":"http://test.com/xtensa-esp32-elf-gcc8_4_0-esp-2021r2-patch2-win32.zip" + "url":"http://test.com/xtensa-esp-elf-esp-0.0.0-19700101-patch2-win32.zip" }, "win64":{ "sha256":"68db46ed4f188e169b922d43215eea781de28f847e7caed3acd5991d0bfb67bd", "size":119516221, - "url":"http://test.com/xtensa-esp32-elf-gcc8_4_0-esp-2021r2-patch2-win64.zip" + "url":"http://test.com/xtensa-esp-elf-esp-0.0.0-19700101-patch2-win64.zip" } } diff --git a/tools/test_idf_tools/add_version/checksum_expected_override.json b/tools/test_idf_tools/add_version/checksum_expected_override.json index 6dce72830f..914e918955 100644 --- a/tools/test_idf_tools/add_version/checksum_expected_override.json +++ b/tools/test_idf_tools/add_version/checksum_expected_override.json @@ -2,43 +2,43 @@ "linux-amd64":{ "sha256":"3eb3d68b27fa6ba5af6f88da21cb8face9be0094daaa8960793cfe570ab785ff", "size":90565318, - "url":"http://test.com/xtensa-esp32-elf-gcc8_4_0-esp-2021r2-linux-amd64.tar.gz" + "url":"http://test.com/xtensa-esp-elf-esp-0.0.0-19700101-linux-amd64.tar.gz" }, "linux-arm64":{ "sha256":"aa534be24e45e06b7080a6a3bb8cd9e3cfb818f5f8bce2244d7cfb5e91336541", "size":86860292, - "url":"http://test.com/xtensa-esp32-elf-gcc8_4_0-esp-2021r2-linux-arm64.tar.gz" + "url":"http://test.com/xtensa-esp-elf-esp-0.0.0-19700101-linux-arm64.tar.gz" }, "linux-armel":{ "sha256":"f0e49ce06fe7833ff5d76961dc2dac5449d320f823bb8c05a302cf85a3a6eb04", "size":86183421, - "url":"http://test.com/xtensa-esp32-elf-gcc8_4_0-esp-2021r2-linux-armel.tar.gz" + "url":"http://test.com/xtensa-esp-elf-esp-0.0.0-19700101-linux-armel.tar.gz" }, "linux-armhf":{ "sha256":"b9de7b995630ea000318ee734c33dc1b9c3a9d24b42403e98045a62ccdef1ecf", "size":83295350, - "url":"http://test.com/xtensa-esp32-elf-gcc8_4_0-esp-2021r2-linux-armhf.tar.gz" + "url":"http://test.com/xtensa-esp-elf-esp-0.0.0-19700101-linux-armhf.tar.gz" }, "linux-i686":{ "sha256":"06de09b74652de43e5b22db3b7fc992623044baa75e9faaab68317a986715ba3", "size":92582250, - "url":"http://test.com/xtensa-esp32-elf-gcc8_4_0-esp-2021r2-linux-i686.tar.gz" + "url":"http://test.com/xtensa-esp-elf-esp-0.0.0-19700101-linux-i686.tar.gz" }, "macos":{ "sha256":"96443f69c8569417c780ee749d91ef33cffe22153fffa30a0fbf12107d87381b", "size":97808961, - "url":"http://test.com/xtensa-esp32-elf-gcc8_4_0-esp-2021r2-macos.tar.gz" + "url":"http://test.com/xtensa-esp-elf-esp-0.0.0-19700101-macos.tar.gz" }, "name":"test", "status":"recommended", "win32":{ "sha256":"c14cc88ddeff6d5494497de33fb5783268c6a171b3bb8c745aafae58507e2356", "size":116446514, - "url":"http://test.com/xtensa-esp32-elf-gcc8_4_0-esp-2021r2-patch2-win32.zip" + "url":"http://test.com/xtensa-esp-elf-esp-0.0.0-19700101-patch2-win32.zip" }, "win64":{ "sha256":"68db46ed4f188e169b922d43215eea781de28f847e7caed3acd5991d0bfb67bd", "size":119516221, - "url":"http://test.com/xtensa-esp32-elf-gcc8_4_0-esp-2021r2-patch2-win64.zip" + "url":"http://test.com/xtensa-esp-elf-esp-0.0.0-19700101-patch2-win64.zip" } } diff --git a/tools/test_idf_tools/test_idf_tools.py b/tools/test_idf_tools/test_idf_tools.py index 24219f4a10..d68f39ae78 100755 --- a/tools/test_idf_tools/test_idf_tools.py +++ b/tools/test_idf_tools/test_idf_tools.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# SPDX-FileCopyrightText: 2019-2021 Espressif Systems (Shanghai) CO LTD +# SPDX-FileCopyrightText: 2019-2023 Espressif Systems (Shanghai) CO LTD # SPDX-License-Identifier: Apache-2.0 import json @@ -40,9 +40,7 @@ except ImportError: ESP32ULP = 'esp32ulp-elf' OPENOCD = 'openocd-esp32' RISCV_ELF = 'riscv32-esp-elf' -XTENSA_ESP32_ELF = 'xtensa-esp32-elf' -XTENSA_ESP32S2_ELF = 'xtensa-esp32s2-elf' -XTENSA_ESP32S3_ELF = 'xtensa-esp32s3-elf' +XTENSA_ELF = 'xtensa-esp-elf' XTENSA_ESP_GDB = 'xtensa-esp-elf-gdb' RISCV_ESP_GDB = 'riscv32-esp-elf-gdb' ESP_ROM_ELFS = 'esp-rom-elfs' @@ -66,9 +64,7 @@ version_dict = get_version_dict() ESP32ULP_VERSION = version_dict[ESP32ULP] OPENOCD_VERSION = version_dict[OPENOCD] RISCV_ELF_VERSION = version_dict[RISCV_ELF] -XTENSA_ESP32_ELF_VERSION = version_dict[XTENSA_ESP32_ELF] -XTENSA_ESP32S2_ELF_VERSION = version_dict[XTENSA_ESP32S2_ELF] -XTENSA_ESP32S3_ELF_VERSION = version_dict[XTENSA_ESP32S3_ELF] +XTENSA_ELF_VERSION = version_dict[XTENSA_ELF] XTENSA_ESP_GDB_VERSION = version_dict[XTENSA_ESP_GDB] RISCV_ESP_GDB_VERSION = version_dict[RISCV_ESP_GDB] ESP_ROM_ELFS_VERSION = version_dict[ESP_ROM_ELFS] @@ -138,20 +134,14 @@ class TestUsage(unittest.TestCase): self.assertIn('- %s (recommended)' % OPENOCD_VERSION, output) self.assertIn('* %s:' % RISCV_ELF, output) self.assertIn('- %s (recommended)' % RISCV_ELF_VERSION, output) - self.assertIn('* %s:' % XTENSA_ESP32_ELF, output) - self.assertIn('- %s (recommended)' % XTENSA_ESP32_ELF_VERSION, output) - self.assertIn('* %s:' % XTENSA_ESP32S2_ELF, output) - self.assertIn('- %s (recommended)' % XTENSA_ESP32S2_ELF_VERSION, output) - self.assertIn('* %s:' % XTENSA_ESP32S3_ELF, output) - self.assertIn('- %s (recommended)' % XTENSA_ESP32S3_ELF_VERSION, output) + self.assertIn('* %s:' % XTENSA_ELF, output) + self.assertIn('- %s (recommended)' % XTENSA_ELF_VERSION, output) - required_tools_installed = 9 + required_tools_installed = 7 output = self.run_idf_tools_with_action(['install']) self.assert_tool_installed(output, OPENOCD, OPENOCD_VERSION) self.assert_tool_installed(output, RISCV_ELF, RISCV_ELF_VERSION) - self.assert_tool_installed(output, XTENSA_ESP32_ELF, XTENSA_ESP32_ELF_VERSION) - self.assert_tool_installed(output, XTENSA_ESP32S2_ELF, XTENSA_ESP32S2_ELF_VERSION) - self.assert_tool_installed(output, XTENSA_ESP32S3_ELF, XTENSA_ESP32S3_ELF_VERSION) + self.assert_tool_installed(output, XTENSA_ELF, XTENSA_ELF_VERSION) self.assert_tool_installed(output, ESP32ULP, ESP32ULP_VERSION) self.assert_tool_installed(output, XTENSA_ESP_GDB, XTENSA_ESP_GDB_VERSION) self.assert_tool_installed(output, RISCV_ESP_GDB, RISCV_ESP_GDB_VERSION) @@ -163,9 +153,7 @@ class TestUsage(unittest.TestCase): self.assertIn('version installed in tools directory: ' + ESP32ULP_VERSION, output) self.assertIn('version installed in tools directory: ' + OPENOCD_VERSION, output) self.assertIn('version installed in tools directory: ' + RISCV_ELF_VERSION, output) - self.assertIn('version installed in tools directory: ' + XTENSA_ESP32_ELF_VERSION, output) - self.assertIn('version installed in tools directory: ' + XTENSA_ESP32S2_ELF_VERSION, output) - self.assertIn('version installed in tools directory: ' + XTENSA_ESP32S3_ELF_VERSION, output) + self.assertIn('version installed in tools directory: ' + XTENSA_ELF_VERSION, output) self.assertIn('version installed in tools directory: ' + XTENSA_ESP_GDB_VERSION, output) self.assertIn('version installed in tools directory: ' + RISCV_ESP_GDB_VERSION, output) self.assertIn('version installed in tools directory: ' + ESP_ROM_ELFS_VERSION, output) @@ -173,16 +161,12 @@ class TestUsage(unittest.TestCase): output = self.run_idf_tools_with_action(['export']) self.assertIn('%s/tools/esp32ulp-elf/%s/esp32ulp-elf/bin' % (self.temp_tools_dir, ESP32ULP_VERSION), output) - self.assertIn('%s/tools/xtensa-esp32-elf/%s/xtensa-esp32-elf/bin' % - (self.temp_tools_dir, XTENSA_ESP32_ELF_VERSION), output) + self.assertIn('%s/tools/xtensa-esp-elf/%s/xtensa-esp-elf/bin' % + (self.temp_tools_dir, XTENSA_ELF_VERSION), output) self.assertIn('%s/tools/openocd-esp32/%s/openocd-esp32/bin' % (self.temp_tools_dir, OPENOCD_VERSION), output) self.assertIn('%s/tools/riscv32-esp-elf/%s/riscv32-esp-elf/bin' % (self.temp_tools_dir, RISCV_ELF_VERSION), output) - self.assertIn('%s/tools/xtensa-esp32s2-elf/%s/xtensa-esp32s2-elf/bin' % - (self.temp_tools_dir, XTENSA_ESP32S2_ELF_VERSION), output) - self.assertIn('%s/tools/xtensa-esp32s3-elf/%s/xtensa-esp32s3-elf/bin' % - (self.temp_tools_dir, XTENSA_ESP32S3_ELF_VERSION), output) self.assertIn('%s/tools/xtensa-esp-elf-gdb/%s/xtensa-esp-elf-gdb/bin' % (self.temp_tools_dir, XTENSA_ESP_GDB_VERSION), output) self.assertIn('%s/tools/riscv32-esp-elf-gdb/%s/riscv32-esp-elf-gdb/bin' % @@ -199,7 +183,7 @@ class TestUsage(unittest.TestCase): [ 'add-version', '--tool', - XTENSA_ESP32_ELF, + XTENSA_ELF, '--url-prefix', 'http://test.com', '--version', @@ -218,19 +202,17 @@ class TestUsage(unittest.TestCase): 'list', '--outdated' ]) - self.assertIn((f'{XTENSA_ESP32_ELF}: version {XTENSA_ESP32_ELF_VERSION} ' + self.assertIn((f'{XTENSA_ELF}: version {XTENSA_ELF_VERSION} ' f'is outdated by {new_version}'), output) def test_tools_for_esp32(self): required_tools_installed = 5 output = self.run_idf_tools_with_action(['install', '--targets=esp32']) - self.assert_tool_installed(output, XTENSA_ESP32_ELF, XTENSA_ESP32_ELF_VERSION) + self.assert_tool_installed(output, XTENSA_ELF, XTENSA_ELF_VERSION) self.assert_tool_installed(output, OPENOCD, OPENOCD_VERSION) self.assert_tool_installed(output, ESP32ULP, ESP32ULP_VERSION) self.assert_tool_installed(output, XTENSA_ESP_GDB, XTENSA_ESP_GDB_VERSION) self.assert_tool_not_installed(output, RISCV_ELF, RISCV_ELF_VERSION) - self.assert_tool_not_installed(output, XTENSA_ESP32S2_ELF, XTENSA_ESP32S2_ELF_VERSION) - self.assert_tool_not_installed(output, XTENSA_ESP32S3_ELF, XTENSA_ESP32S3_ELF_VERSION) self.assert_tool_not_installed(output, RISCV_ESP_GDB, RISCV_ESP_GDB_VERSION) self.assert_tool_installed(output, ESP_ROM_ELFS, ESP_ROM_ELFS_VERSION) self.assertIn('Destination: {}'.format(os.path.join(self.temp_tools_dir, 'dist')), output) @@ -238,7 +220,7 @@ class TestUsage(unittest.TestCase): output = self.run_idf_tools_with_action(['check']) self.assertIn('version installed in tools directory: ' + ESP32ULP_VERSION, output) - self.assertIn('version installed in tools directory: ' + XTENSA_ESP32_ELF_VERSION, output) + self.assertIn('version installed in tools directory: ' + XTENSA_ELF_VERSION, output) self.assertIn('version installed in tools directory: ' + OPENOCD_VERSION, output) self.assertIn('version installed in tools directory: ' + XTENSA_ESP_GDB_VERSION, output) self.assertIn('version installed in tools directory: ' + ESP_ROM_ELFS_VERSION, output) @@ -246,18 +228,14 @@ class TestUsage(unittest.TestCase): output = self.run_idf_tools_with_action(['export']) self.assertIn('%s/tools/esp32ulp-elf/%s/esp32ulp-elf/bin' % (self.temp_tools_dir, ESP32ULP_VERSION), output) - self.assertIn('%s/tools/xtensa-esp32-elf/%s/xtensa-esp32-elf/bin' % - (self.temp_tools_dir, XTENSA_ESP32_ELF_VERSION), output) + self.assertIn('%s/tools/xtensa-esp-elf/%s/xtensa-esp-elf/bin' % + (self.temp_tools_dir, XTENSA_ELF_VERSION), output) self.assertIn('%s/tools/openocd-esp32/%s/openocd-esp32/bin' % (self.temp_tools_dir, OPENOCD_VERSION), output) self.assertIn('%s/tools/xtensa-esp-elf-gdb/%s/xtensa-esp-elf-gdb/bin' % (self.temp_tools_dir, XTENSA_ESP_GDB_VERSION), output) self.assertNotIn('%s/tools/riscv32-esp-elf/%s/riscv32-esp-elf/bin' % (self.temp_tools_dir, RISCV_ELF_VERSION), output) - self.assertNotIn('%s/tools/xtensa-esp32s2-elf/%s/xtensa-esp32s2-elf/bin' % - (self.temp_tools_dir, XTENSA_ESP32S2_ELF_VERSION), output) - self.assertNotIn('%s/tools/xtensa-esp32s3-elf/%s/xtensa-esp32s3-elf/bin' % - (self.temp_tools_dir, XTENSA_ESP32S3_ELF_VERSION), output) self.assertNotIn('%s/tools/riscv32-esp-elf-gdb/%s/riscv32-esp-elf-gdb/bin' % (self.temp_tools_dir, RISCV_ESP_GDB_VERSION), output) self.assertIn('%s/tools/esp-rom-elfs/%s/' % @@ -269,9 +247,7 @@ class TestUsage(unittest.TestCase): self.assert_tool_installed(output, OPENOCD, OPENOCD_VERSION) self.assert_tool_installed(output, RISCV_ELF, RISCV_ELF_VERSION) self.assert_tool_installed(output, RISCV_ESP_GDB, RISCV_ESP_GDB_VERSION) - self.assert_tool_not_installed(output, XTENSA_ESP32_ELF, XTENSA_ESP32_ELF_VERSION) - self.assert_tool_not_installed(output, XTENSA_ESP32S2_ELF, XTENSA_ESP32S2_ELF_VERSION) - self.assert_tool_not_installed(output, XTENSA_ESP32S3_ELF, XTENSA_ESP32S3_ELF_VERSION) + self.assert_tool_not_installed(output, XTENSA_ELF, XTENSA_ELF_VERSION) self.assert_tool_not_installed(output, ESP32ULP, ESP32ULP_VERSION) self.assert_tool_not_installed(output, XTENSA_ESP_GDB_VERSION, XTENSA_ESP_GDB_VERSION) self.assert_tool_installed(output, ESP_ROM_ELFS, ESP_ROM_ELFS_VERSION) @@ -291,12 +267,8 @@ class TestUsage(unittest.TestCase): (self.temp_tools_dir, RISCV_ELF_VERSION), output) self.assertNotIn('%s/tools/esp32ulp-elf/%s/esp32ulp-elf/bin' % (self.temp_tools_dir, ESP32ULP_VERSION), output) - self.assertNotIn('%s/tools/xtensa-esp32-elf/%s/xtensa-esp32-elf/bin' % - (self.temp_tools_dir, XTENSA_ESP32_ELF_VERSION), output) - self.assertNotIn('%s/tools/xtensa-esp32s2-elf/%s/xtensa-esp32s2-elf/bin' % - (self.temp_tools_dir, XTENSA_ESP32S2_ELF_VERSION), output) - self.assertNotIn('%s/tools/xtensa-esp32s3-elf/%s/xtensa-esp32s3-elf/bin' % - (self.temp_tools_dir, XTENSA_ESP32S3_ELF_VERSION), output) + self.assertNotIn('%s/tools/xtensa-esp-elf/%s/xtensa-esp-elf/bin' % + (self.temp_tools_dir, XTENSA_ELF_VERSION), output) self.assertNotIn('%s/tools/xtensa-esp-elf-gdb/%s/xtensa-esp-elf-gdb/bin' % (self.temp_tools_dir, XTENSA_ESP_GDB_VERSION), output) self.assertIn('%s/tools/esp-rom-elfs/%s/' % @@ -305,37 +277,31 @@ class TestUsage(unittest.TestCase): def test_tools_for_esp32s2(self): required_tools_installed = 6 output = self.run_idf_tools_with_action(['install', '--targets=esp32s2']) - self.assert_tool_installed(output, XTENSA_ESP32S2_ELF, XTENSA_ESP32S2_ELF_VERSION) + self.assert_tool_installed(output, XTENSA_ELF, XTENSA_ELF_VERSION) self.assert_tool_installed(output, OPENOCD, OPENOCD_VERSION) self.assert_tool_installed(output, RISCV_ELF, RISCV_ELF_VERSION) self.assert_tool_installed(output, ESP32ULP, ESP32ULP_VERSION) self.assert_tool_installed(output, XTENSA_ESP_GDB, XTENSA_ESP_GDB_VERSION) self.assert_tool_installed(output, ESP_ROM_ELFS, ESP_ROM_ELFS_VERSION) self.assert_tool_not_installed(output, RISCV_ESP_GDB, RISCV_ESP_GDB_VERSION) - self.assert_tool_not_installed(output, XTENSA_ESP32_ELF, XTENSA_ESP32_ELF_VERSION) - self.assert_tool_not_installed(output, XTENSA_ESP32S3_ELF, XTENSA_ESP32S3_ELF_VERSION) self.assertIn('Destination: {}'.format(os.path.join(self.temp_tools_dir, 'dist')), output) self.assertEqual(required_tools_installed, output.count('Done')) output = self.run_idf_tools_with_action(['check']) self.assertIn('version installed in tools directory: ' + OPENOCD_VERSION, output) - self.assertIn('version installed in tools directory: ' + XTENSA_ESP32S2_ELF_VERSION, output) + self.assertIn('version installed in tools directory: ' + XTENSA_ELF_VERSION, output) self.assertIn('version installed in tools directory: ' + XTENSA_ESP_GDB_VERSION, output) self.assertIn('version installed in tools directory: ' + ESP_ROM_ELFS_VERSION, output) output = self.run_idf_tools_with_action(['export']) - self.assertIn('%s/tools/xtensa-esp32s2-elf/%s/xtensa-esp32s2-elf/bin' % - (self.temp_tools_dir, XTENSA_ESP32S2_ELF_VERSION), output) + self.assertIn('%s/tools/xtensa-esp-elf/%s/xtensa-esp-elf/bin' % + (self.temp_tools_dir, XTENSA_ELF_VERSION), output) self.assertIn('%s/tools/openocd-esp32/%s/openocd-esp32/bin' % (self.temp_tools_dir, OPENOCD_VERSION), output) self.assertIn('%s/tools/esp32ulp-elf/%s/esp32ulp-elf/bin' % (self.temp_tools_dir, ESP32ULP_VERSION), output) - self.assertNotIn('%s/tools/xtensa-esp32-elf/%s/xtensa-esp32-elf/bin' % - (self.temp_tools_dir, XTENSA_ESP32_ELF_VERSION), output) self.assertIn('%s/tools/riscv32-esp-elf/%s/riscv32-esp-elf/bin' % (self.temp_tools_dir, RISCV_ELF_VERSION), output) - self.assertNotIn('%s/tools/xtensa-esp32s3-elf/%s/xtensa-esp32s3-elf/bin' % - (self.temp_tools_dir, XTENSA_ESP32S3_ELF_VERSION), output) self.assertIn('%s/tools/xtensa-esp-elf-gdb/%s/xtensa-esp-elf-gdb/bin' % (self.temp_tools_dir, XTENSA_ESP_GDB_VERSION), output) self.assertNotIn('%s/tools/riscv32-esp-elf-gdb/%s/riscv32-esp-elf-gdb/bin' % @@ -346,21 +312,19 @@ class TestUsage(unittest.TestCase): def test_tools_for_esp32s3(self): required_tools_installed = 6 output = self.run_idf_tools_with_action(['install', '--targets=esp32s3']) - self.assert_tool_installed(output, XTENSA_ESP32S3_ELF, XTENSA_ESP32S3_ELF_VERSION) + self.assert_tool_installed(output, XTENSA_ELF, XTENSA_ELF_VERSION) self.assert_tool_installed(output, OPENOCD, OPENOCD_VERSION) self.assert_tool_installed(output, RISCV_ELF, RISCV_ELF_VERSION) self.assert_tool_installed(output, ESP32ULP, ESP32ULP_VERSION) self.assert_tool_installed(output, XTENSA_ESP_GDB, XTENSA_ESP_GDB_VERSION) self.assert_tool_installed(output, ESP_ROM_ELFS, ESP_ROM_ELFS_VERSION) self.assert_tool_not_installed(output, RISCV_ESP_GDB, RISCV_ESP_GDB_VERSION) - self.assert_tool_not_installed(output, XTENSA_ESP32_ELF, XTENSA_ESP32_ELF_VERSION) - self.assert_tool_not_installed(output, XTENSA_ESP32S2_ELF, XTENSA_ESP32S2_ELF_VERSION) self.assertIn('Destination: {}'.format(os.path.join(self.temp_tools_dir, 'dist')), output) self.assertEqual(required_tools_installed, output.count('Done')) output = self.run_idf_tools_with_action(['check']) self.assertIn('version installed in tools directory: ' + OPENOCD_VERSION, output) - self.assertIn('version installed in tools directory: ' + XTENSA_ESP32S3_ELF_VERSION, output) + self.assertIn('version installed in tools directory: ' + XTENSA_ELF_VERSION, output) self.assertIn('version installed in tools directory: ' + XTENSA_ESP_GDB_VERSION, output) self.assertIn('version installed in tools directory: ' + RISCV_ESP_GDB_VERSION, output) self.assertIn('version installed in tools directory: ' + ESP_ROM_ELFS_VERSION, output) @@ -368,16 +332,12 @@ class TestUsage(unittest.TestCase): output = self.run_idf_tools_with_action(['export']) self.assertIn('%s/tools/openocd-esp32/%s/openocd-esp32/bin' % (self.temp_tools_dir, OPENOCD_VERSION), output) - self.assertIn('%s/tools/xtensa-esp32s3-elf/%s/xtensa-esp32s3-elf/bin' % - (self.temp_tools_dir, XTENSA_ESP32S3_ELF_VERSION), output) + self.assertIn('%s/tools/xtensa-esp-elf/%s/xtensa-esp-elf/bin' % + (self.temp_tools_dir, XTENSA_ELF_VERSION), output) self.assertIn('%s/tools/esp32ulp-elf/%s/esp32ulp-elf/bin' % (self.temp_tools_dir, ESP32ULP_VERSION), output) - self.assertNotIn('%s/tools/xtensa-esp32-elf/%s/xtensa-esp32-elf/bin' % - (self.temp_tools_dir, XTENSA_ESP32_ELF_VERSION), output) self.assertIn('%s/tools/riscv32-esp-elf/%s/riscv32-esp-elf/bin' % (self.temp_tools_dir, RISCV_ELF_VERSION), output) - self.assertNotIn('%s/tools/xtensa-esp32s2-elf/%s/xtensa-esp32s2-elf/bin' % - (self.temp_tools_dir, XTENSA_ESP32S2_ELF_VERSION), output) self.assertIn('%s/tools/xtensa-esp-elf-gdb/%s/xtensa-esp-elf-gdb/bin' % (self.temp_tools_dir, XTENSA_ESP_GDB_VERSION), output) self.assertNotIn('%s/tools/riscv32-esp-elf-gdb/%s/riscv32-esp-elf-gdb/bin' % @@ -388,7 +348,7 @@ class TestUsage(unittest.TestCase): def test_uninstall_option(self): self.run_idf_tools_with_action(['install', '--targets=esp32']) - test_tool_name = XTENSA_ESP32_ELF + test_tool_name = XTENSA_ELF test_tool_version = 'test_version' tools_json_new = os.path.join(self.temp_tools_dir, 'tools', 'tools.new.json') self.run_idf_tools_with_action( @@ -409,7 +369,7 @@ class TestUsage(unittest.TestCase): output = self.run_idf_tools_with_action(['--tools-json', tools_json_new, 'uninstall', '--dry-run']) self.assertIn('For removing old versions of ' + test_tool_name, output) output = self.run_idf_tools_with_action(['--tools-json', tools_json_new, 'uninstall']) - self.assertIn(os.path.join(self.temp_tools_dir, 'tools', test_tool_name, XTENSA_ESP32_ELF_VERSION) + ' was removed.', output) + self.assertIn(os.path.join(self.temp_tools_dir, 'tools', test_tool_name, XTENSA_ELF_VERSION) + ' was removed.', output) output = self.run_idf_tools_with_action(['uninstall']) self.assertEqual('', output) @@ -429,7 +389,7 @@ class TestMaintainer(unittest.TestCase): idf_path = os.getenv('IDF_PATH') cls.tools_old = os.path.join(idf_path, 'tools/tools.json') cls.tools_new = os.path.join(idf_path, 'tools/tools.new.json') - cls.test_tool_name = 'xtensa-esp32-elf' + cls.test_tool_name = 'xtensa-esp-elf' def test_validation(self): idf_tools.main(['validate']) diff --git a/tools/tools.json b/tools/tools.json index 261ada385d..5f4202e66b 100644 --- a/tools/tools.json +++ b/tools/tools.json @@ -153,10 +153,10 @@ ] }, { - "description": "Toolchain for Xtensa (ESP32) based on GCC", + "description": "Toolchain for 32-bit Xtensa based on GCC", "export_paths": [ [ - "xtensa-esp32-elf", + "xtensa-esp-elf", "bin" ] ], @@ -164,209 +164,65 @@ "info_url": "https://github.com/espressif/crosstool-NG", "install": "always", "license": "GPL-3.0-with-GCC-exception", - "name": "xtensa-esp32-elf", - "supported_targets": [ - "esp32" - ], - "version_cmd": [ - "xtensa-esp32-elf-gcc", - "--version" - ], - "version_regex": "\\(crosstool-NG\\s+(?:crosstool-ng-)?([0-9a-zA-Z\\.\\-_]+)\\)", - "versions": [ - { - "linux-amd64": { - "sha256": "4d2e02ef47f1a93a4dcfdbaecd486adfaab4c0e26deea2c18d6385527f39f864", - "size": 67006496, - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-12.2.0_20230208/xtensa-esp32-elf-12.2.0_20230208-x86_64-linux-gnu.tar.xz" - }, - "linux-arm64": { - "sha256": "9e211a182b6ea0396a41c78f52f51d964e7875fe274ea9c81111bf0dbc90c516", - "size": 60751692, - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-12.2.0_20230208/xtensa-esp32-elf-12.2.0_20230208-aarch64-linux-gnu.tar.xz" - }, - "linux-armel": { - "sha256": "2ddd91fb98b79b30042b7918eef60cf10c7bd5b1da853e83b65f293b96dec800", - "size": 56720952, - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-12.2.0_20230208/xtensa-esp32-elf-12.2.0_20230208-arm-linux-gnueabi.tar.xz" - }, - "linux-armhf": { - "sha256": "a683a468555dcbcb6ce32a190842110d6f853d4d6104d61cf0bc9dd50c6be1e6", - "size": 60612092, - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-12.2.0_20230208/xtensa-esp32-elf-12.2.0_20230208-arm-linux-gnueabihf.tar.xz" - }, - "linux-i686": { - "sha256": "292b19ea6186508a923fb6fd0103977e001d4eb8e77836c7e3d6ce6e5fa7d305", - "size": 69446616, - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-12.2.0_20230208/xtensa-esp32-elf-12.2.0_20230208-i686-linux-gnu.tar.xz" - }, - "macos": { - "sha256": "b09d87fdb1dc32cd1d718935065ef931b101a14df6b17be56748e52640955bff", - "size": 65895468, - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-12.2.0_20230208/xtensa-esp32-elf-12.2.0_20230208-x86_64-apple-darwin.tar.xz" - }, - "macos-arm64": { - "sha256": "f50acab2b216e9475dc5313b3e4b424cbc70d0abd23ba1818aff4a019165da8e", - "size": 57168044, - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-12.2.0_20230208/xtensa-esp32-elf-12.2.0_20230208-aarch64-apple-darwin.tar.xz" - }, - "name": "esp-12.2.0_20230208", - "status": "recommended", - "win32": { - "sha256": "62bb6428d107ed3f44c212c77ecf24804b74c97327b0f0ad2029c656c6dbd6ee", - "size": 130847086, - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-12.2.0_20230208/xtensa-esp32-elf-12.2.0_20230208-i686-w64-mingw32.zip" - }, - "win64": { - "sha256": "8febfe4a6476efc69012390106c8c660a14418f025137b0513670c72124339cf", - "size": 134985117, - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-12.2.0_20230208/xtensa-esp32-elf-12.2.0_20230208-x86_64-w64-mingw32.zip" - } - } - ] - }, - { - "description": "Toolchain for Xtensa (ESP32-S2) based on GCC", - "export_paths": [ - [ - "xtensa-esp32s2-elf", - "bin" - ] - ], - "export_vars": {}, - "info_url": "https://github.com/espressif/crosstool-NG", - "install": "always", - "license": "GPL-3.0-with-GCC-exception", - "name": "xtensa-esp32s2-elf", - "supported_targets": [ - "esp32s2" - ], - "version_cmd": [ - "xtensa-esp32s2-elf-gcc", - "--version" - ], - "version_regex": "\\(crosstool-NG\\s+(?:crosstool-ng-)?([0-9a-zA-Z\\.\\-_]+)\\)", - "versions": [ - { - "linux-amd64": { - "sha256": "a1bd8f0252aae02cff2c289f742fbdbaa2c24644cc30e883d118253ea4df1799", - "size": 64374532, - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-12.2.0_20230208/xtensa-esp32s2-elf-12.2.0_20230208-x86_64-linux-gnu.tar.xz" - }, - "linux-arm64": { - "sha256": "48e88053e92bab1bf8d6dbad7ddb4d140c537159d607a36e73e74e1f5f23c892", - "size": 58021880, - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-12.2.0_20230208/xtensa-esp32s2-elf-12.2.0_20230208-aarch64-linux-gnu.tar.xz" - }, - "linux-armel": { - "sha256": "37cdd619fa56ce884570cedd00dd2f4a5eb9a1fce3755a2f4b9279d1136e47c1", - "size": 59627080, - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-12.2.0_20230208/xtensa-esp32s2-elf-12.2.0_20230208-arm-linux-gnueabi.tar.xz" - }, - "linux-armhf": { - "sha256": "99a7b34e8826d0c0b5703e5a4e7db8716b9738fa4f03eed759f383a10617e788", - "size": 59762112, - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-12.2.0_20230208/xtensa-esp32s2-elf-12.2.0_20230208-arm-linux-gnueabihf.tar.xz" - }, - "linux-i686": { - "sha256": "d9b79e9e3204fa8e40f9942ea1197a83ae1527e3711a45bc17171ff5fec43e54", - "size": 69013172, - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-12.2.0_20230208/xtensa-esp32s2-elf-12.2.0_20230208-i686-linux-gnu.tar.xz" - }, - "macos": { - "sha256": "e7b2fbacd8186b24d1b1264ad6cf639f476d51f5d908fb79504abfe6281d3c8c", - "size": 65634524, - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-12.2.0_20230208/xtensa-esp32s2-elf-12.2.0_20230208-x86_64-apple-darwin.tar.xz" - }, - "macos-arm64": { - "sha256": "d2c997ce5f43a93c3787c224aa8742b0cd87443794514ab2153cd629665506f0", - "size": 57290936, - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-12.2.0_20230208/xtensa-esp32s2-elf-12.2.0_20230208-aarch64-apple-darwin.tar.xz" - }, - "name": "esp-12.2.0_20230208", - "status": "recommended", - "win32": { - "sha256": "1e6dac5162ab75f94b88c47ebeabb6600c652fb4f615ed07c1724d037c02fd19", - "size": 131273859, - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-12.2.0_20230208/xtensa-esp32s2-elf-12.2.0_20230208-i686-w64-mingw32.zip" - }, - "win64": { - "sha256": "8a785cc4e0838cebe404f82c0ead7a0f9ac5fabc660a742e33a41ddac6326cc1", - "size": 135373049, - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-12.2.0_20230208/xtensa-esp32s2-elf-12.2.0_20230208-x86_64-w64-mingw32.zip" - } - } - ] - }, - { - "description": "Toolchain for Xtensa (ESP32-S3) based on GCC", - "export_paths": [ - [ - "xtensa-esp32s3-elf", - "bin" - ] - ], - "export_vars": {}, - "info_url": "https://github.com/espressif/crosstool-NG", - "install": "always", - "license": "GPL-3.0-with-GCC-exception", - "name": "xtensa-esp32s3-elf", + "name": "xtensa-esp-elf", "supported_targets": [ + "esp32", + "esp32s2", "esp32s3" ], "version_cmd": [ - "xtensa-esp32s3-elf-gcc", + "xtensa-esp-elf-gcc", "--version" ], "version_regex": "\\(crosstool-NG\\s+(?:crosstool-ng-)?([0-9a-zA-Z\\.\\-_]+)\\)", "versions": [ { "linux-amd64": { - "sha256": "29b5ea6b30d98231f0c17f2327404109e0abf59b48d0f2890d9d9899678a89a3", - "size": 67512340, - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-12.2.0_20230208/xtensa-esp32s3-elf-12.2.0_20230208-x86_64-linux-gnu.tar.xz" + "sha256": "bae7da23ea8516fb7e42640f4420c4dd1ebfd64189a14fc330d73e173b3a038b", + "size": 112588084, + "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-13.2.0_20230928/xtensa-esp-elf-13.2.0_20230928-x86_64-linux-gnu.tar.xz" }, "linux-arm64": { - "sha256": "30a1fed3ab6341feb1ae986ee55f227df6a594293ced13c65a0136eb4681087d", - "size": 60207516, - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-12.2.0_20230208/xtensa-esp32s3-elf-12.2.0_20230208-aarch64-linux-gnu.tar.xz" + "sha256": "faa4755bedafb1c10feaeef01c610803ee9ace088b26d7db90a5ee0816c20f9e", + "size": 104257688, + "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-13.2.0_20230928/xtensa-esp-elf-13.2.0_20230928-aarch64-linux-gnu.tar.xz" }, "linux-armel": { - "sha256": "c180836bf43b90b4b7c24166a3bd4156c74c8e58bb85761aa58da98d076e6f48", - "size": 57151040, - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-12.2.0_20230208/xtensa-esp32s3-elf-12.2.0_20230208-arm-linux-gnueabi.tar.xz" + "sha256": "38702870453b8d226fbc348ae2288f02cbc6317a3afa89982da6a6ef6866e05a", + "size": 99702488, + "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-13.2.0_20230928/xtensa-esp-elf-13.2.0_20230928-arm-linux-gnueabi.tar.xz" }, "linux-armhf": { - "sha256": "4cc1adee141de67ffb7e94e53d30bf4e120ef07d4063fecc2153c69ad4b54f7f", - "size": 60955732, - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-12.2.0_20230208/xtensa-esp32s3-elf-12.2.0_20230208-arm-linux-gnueabihf.tar.xz" + "sha256": "aeb872fe0f7f342ed1a42e02dad15e1fa255aec852e88bb8ff2725380ddde501", + "size": 104316996, + "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-13.2.0_20230928/xtensa-esp-elf-13.2.0_20230928-arm-linux-gnueabihf.tar.xz" }, "linux-i686": { - "sha256": "9a968f58085c66b41ca13af8d652e5250df0f8d8e17988e34846be9c76672cab", - "size": 68403124, - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-12.2.0_20230208/xtensa-esp32s3-elf-12.2.0_20230208-i686-linux-gnu.tar.xz" + "sha256": "fc25701749f365af5f270221e0e8439ce7fcc26eeac145a91cfe02f3100de2d6", + "size": 113231244, + "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-13.2.0_20230928/xtensa-esp-elf-13.2.0_20230928-i586-linux-gnu.tar.xz" }, "macos": { - "sha256": "30375231847a9070e4e0acb3102b7d35a60448a55536bfa113c677c449da3eef", - "size": 68227240, - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-12.2.0_20230208/xtensa-esp32s3-elf-12.2.0_20230208-x86_64-apple-darwin.tar.xz" + "sha256": "b9b7a6d1dc4ea065bf6763fa904729e1c808d6dfbf1dfabf12852e2929251ee9", + "size": 115211408, + "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-13.2.0_20230928/xtensa-esp-elf-13.2.0_20230928-x86_64-apple-darwin.tar.xz" }, "macos-arm64": { - "sha256": "ae9a1a3e12c0b6f6f28a3878f5964e91a410350248586c90db94f8bdaeef7695", - "size": 57080804, - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-12.2.0_20230208/xtensa-esp32s3-elf-12.2.0_20230208-aarch64-apple-darwin.tar.xz" + "sha256": "687243e5cbefb7cf05603effbdd6fde5769f94daff7e519f5bbe61f43c4c0ef6", + "size": 100098880, + "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-13.2.0_20230928/xtensa-esp-elf-13.2.0_20230928-aarch64-apple-darwin.tar.xz" }, - "name": "esp-12.2.0_20230208", + "name": "esp-13.2.0_20230928", "status": "recommended", "win32": { - "sha256": "3ddf51774817e815e5d41c312a90c1159226978fb45fd0d4f7085c567f8b73ab", - "size": 131134034, - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-12.2.0_20230208/xtensa-esp32s3-elf-12.2.0_20230208-i686-w64-mingw32.zip" + "sha256": "7a2822ef554be175bbe5c67c2010a6dd29aec6221bdb5ed8970f164e2744714a", + "size": 266511200, + "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-13.2.0_20230928/xtensa-esp-elf-13.2.0_20230928-i686-w64-mingw32.zip" }, "win64": { - "sha256": "1d15ca65e3508388a86d8bed3048c46d07538f5bc88d3e4296f9c03152087cd1", - "size": 135381926, - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-12.2.0_20230208/xtensa-esp32s3-elf-12.2.0_20230208-x86_64-w64-mingw32.zip" + "sha256": "80e3271b7c9b64694ba8494b90054da2efce328f7d4e5f5f625d08808372fa64", + "size": 270164567, + "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-13.2.0_20230928/xtensa-esp-elf-13.2.0_20230928-x86_64-w64-mingw32.zip" } } ] @@ -465,51 +321,51 @@ "versions": [ { "linux-amd64": { - "sha256": "21694e5ee506f5e52908b12c6b5be7044d87cf34bb4dfcd151d0a10ea09dedc1", - "size": 131410024, - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-12.2.0_20230208/riscv32-esp-elf-12.2.0_20230208-x86_64-linux-gnu.tar.xz" + "sha256": "782feefe354500c5f968e8c91959651be3bdbbd7ae8a17affcee2b1bffcaad89", + "size": 143575940, + "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-13.2.0_20230928/riscv32-esp-elf-13.2.0_20230928-x86_64-linux-gnu.tar.xz" }, "linux-arm64": { - "sha256": "aefbf1e6f2c91a10e8995399d2003502e167e8c95e77f40957309e843700906a", - "size": 125863404, - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-12.2.0_20230208/riscv32-esp-elf-12.2.0_20230208-aarch64-linux-gnu.tar.xz" + "sha256": "6ee4b30dff18bdea9ada79399c0c81ba82b6ed99a565746a7d5040c7e62566b3", + "size": 142577236, + "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-13.2.0_20230928/riscv32-esp-elf-13.2.0_20230928-aarch64-linux-gnu.tar.xz" }, "linux-armel": { - "sha256": "9740cbddb4cb5e05382991c83d8c96a5fb7d87046449e77791b3b0de29a3ddd8", - "size": 121040676, - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-12.2.0_20230208/riscv32-esp-elf-12.2.0_20230208-arm-linux-gnueabi.tar.xz" + "sha256": "3231ca04ea4f53dc602ae1cc728151a16c5d424063ac69542b8bf6cde10e7755", + "size": 135201840, + "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-13.2.0_20230928/riscv32-esp-elf-13.2.0_20230928-arm-linux-gnueabi.tar.xz" }, "linux-armhf": { - "sha256": "ee6210b1068802ed8486543c1f313cb8ac64571c20d51bf50fdb34ad4c457018", - "size": 123564880, - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-12.2.0_20230208/riscv32-esp-elf-12.2.0_20230208-arm-linux-gnueabihf.tar.xz" + "sha256": "eb43ac9dcad8fe79bdf4b8d29cf4751d41cbcb1fadd831f2779a84f4fb1c5ca0", + "size": 143656008, + "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-13.2.0_20230928/riscv32-esp-elf-13.2.0_20230928-arm-linux-gnueabihf.tar.xz" }, "linux-i686": { - "sha256": "9207fe3d1413cf29fad6dc4bdc9a35f538b0b2c48a70e9a89d2f0e930c346aed", - "size": 133871120, - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-12.2.0_20230208/riscv32-esp-elf-12.2.0_20230208-i686-linux-gnu.tar.xz" + "sha256": "51421bd181392472fee8242d53dfa6305a67b21e1073f0f9f69d215987da9684", + "size": 151339344, + "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-13.2.0_20230928/riscv32-esp-elf-13.2.0_20230928-i586-linux-gnu.tar.xz" }, "macos": { - "sha256": "78cd1afe458fceb7c2657fe346edb0ecfde3b8743ccf7a7a7509c456cad9de9a", - "size": 135635672, - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-12.2.0_20230208/riscv32-esp-elf-12.2.0_20230208-x86_64-apple-darwin.tar.xz" + "sha256": "ce40c75a1ae0e4b986daeeff321aaa7b57f74eb4bcfd011f1252fd6932bbb90f", + "size": 153157496, + "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-13.2.0_20230928/riscv32-esp-elf-13.2.0_20230928-x86_64-apple-darwin.tar.xz" }, "macos-arm64": { - "sha256": "6c0a4151afb258766911fc7bcfe5f4fee6ee2cd9a5ff25542bc1228c1203a3f9", - "size": 119346172, - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-12.2.0_20230208/riscv32-esp-elf-12.2.0_20230208-aarch64-apple-darwin.tar.xz" + "sha256": "c2f989370c101ae3f890aa71e6f57064f068f7c4a1d9f26445894c83f919624f", + "size": 135811812, + "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-13.2.0_20230928/riscv32-esp-elf-13.2.0_20230928-aarch64-apple-darwin.tar.xz" }, - "name": "esp-12.2.0_20230208", + "name": "esp-13.2.0_20230928", "status": "recommended", "win32": { - "sha256": "a5dfbb6dbf6fc6c6ea9beb2723af059ba3c5b2c86c2f0dc3b21afdc7bb229bf5", - "size": 324863847, - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-12.2.0_20230208/riscv32-esp-elf-12.2.0_20230208-i686-w64-mingw32.zip" + "sha256": "37737463826486c9c11e74a140b1b50195dc868e547c8ee557950c811741197c", + "size": 362812332, + "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-13.2.0_20230928/riscv32-esp-elf-13.2.0_20230928-i686-w64-mingw32.zip" }, "win64": { - "sha256": "9deae9e0013b2f7bbf017f9c8135755bfa89522f337c7dca35872bf12ec08176", - "size": 328092732, - "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-12.2.0_20230208/riscv32-esp-elf-12.2.0_20230208-x86_64-w64-mingw32.zip" + "sha256": "1300a54505dc964fa9104482737152e669f4d880efc1d54057378d9e6910ae1e", + "size": 366053112, + "url": "https://github.com/espressif/crosstool-NG/releases/download/esp-13.2.0_20230928/riscv32-esp-elf-13.2.0_20230928-x86_64-w64-mingw32.zip" } } ] From 71713bcdb52defa6542dcabedaf3ae34383fdec4 Mon Sep 17 00:00:00 2001 From: Alexey Lapshin Date: Wed, 12 Jul 2023 14:07:25 +0400 Subject: [PATCH 02/20] fix(mbedtls): fix gcc 13.1.0 warnings --- components/mbedtls/port/aes/dma/esp_aes.c | 2 +- components/mbedtls/port/sha/dma/sha.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/components/mbedtls/port/aes/dma/esp_aes.c b/components/mbedtls/port/aes/dma/esp_aes.c index 8969805698..c24fcbc510 100644 --- a/components/mbedtls/port/aes/dma/esp_aes.c +++ b/components/mbedtls/port/aes/dma/esp_aes.c @@ -333,7 +333,7 @@ static int esp_aes_process_dma(esp_aes_context *ctx, const unsigned char *input, lldesc_t *in_desc_head = NULL, *out_desc_head = NULL; lldesc_t *out_desc_tail = NULL; /* pointer to the final output descriptor */ lldesc_t *block_desc = NULL, *block_in_desc = NULL, *block_out_desc = NULL; - size_t lldesc_num; + size_t lldesc_num = 0; unsigned stream_bytes = len % AES_BLOCK_BYTES; // bytes which aren't in a full block unsigned block_bytes = len - stream_bytes; // bytes which are in a full block unsigned blocks = (block_bytes / AES_BLOCK_BYTES) + ((stream_bytes > 0) ? 1 : 0); diff --git a/components/mbedtls/port/sha/dma/sha.c b/components/mbedtls/port/sha/dma/sha.c index f0638ed3cf..26d0612589 100644 --- a/components/mbedtls/port/sha/dma/sha.c +++ b/components/mbedtls/port/sha/dma/sha.c @@ -251,7 +251,7 @@ static esp_err_t esp_sha_dma_process(esp_sha_type sha_type, const void *input, u const void *buf, uint32_t buf_len, bool is_first_block) { int ret = 0; - lldesc_t *dma_descr_head; + lldesc_t *dma_descr_head = NULL; size_t num_blks = (ilen + buf_len) / block_length(sha_type); memset(&s_dma_descr_input, 0, sizeof(lldesc_t)); From a41e3d408f30a5452072ad01dda05dd57364e557 Mon Sep 17 00:00:00 2001 From: Alexey Lapshin Date: Mon, 17 Jul 2023 12:31:56 +0400 Subject: [PATCH 03/20] fix(wpa_supplicant): fix sys/types include --- components/wpa_supplicant/port/include/os.h | 1 + 1 file changed, 1 insertion(+) diff --git a/components/wpa_supplicant/port/include/os.h b/components/wpa_supplicant/port/include/os.h index 51334ad340..a3442fade9 100644 --- a/components/wpa_supplicant/port/include/os.h +++ b/components/wpa_supplicant/port/include/os.h @@ -14,6 +14,7 @@ #ifndef OS_H #define OS_H +#include #include "esp_types.h" #include #include From 5c41edb863f2a8d43f6af84c4758ab738e468121 Mon Sep 17 00:00:00 2001 From: Alexey Lapshin Date: Tue, 18 Jul 2023 13:40:20 +0400 Subject: [PATCH 04/20] fix(tools): fix panic test gcc 13.1.0 warnings --- tools/test_apps/system/panic/main/CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/test_apps/system/panic/main/CMakeLists.txt b/tools/test_apps/system/panic/main/CMakeLists.txt index dea3633295..cdbffba4a4 100644 --- a/tools/test_apps/system/panic/main/CMakeLists.txt +++ b/tools/test_apps/system/panic/main/CMakeLists.txt @@ -17,4 +17,5 @@ idf_component_register(SRCS "${srcs}" PRIV_REQUIRES esp_gdbstub) target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-unused-variable" - "-Wno-infinite-recursion") + "-Wno-infinite-recursion" + "-Wno-array-bounds") From 295f9cdd56382fdf1409158bbeaafa590c26061a Mon Sep 17 00:00:00 2001 From: Alexey Lapshin Date: Tue, 18 Jul 2023 14:02:59 +0400 Subject: [PATCH 05/20] fix(esp_system): add no_sanitize_undefined for init functions Something wrong with -Og optimization. It started to fail without reason. --- components/esp_system/startup.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/components/esp_system/startup.c b/components/esp_system/startup.c index 3d98a6e2fd..240e2f20e2 100644 --- a/components/esp_system/startup.c +++ b/components/esp_system/startup.c @@ -167,6 +167,7 @@ size_t __cxx_eh_arena_size_get(void) * over in ascending direction instead of descending direction. * The RISC-V-specific behavior is dependent on the linker script ld/esp32c3/sections.ld.in. */ +__attribute__((no_sanitize_undefined)) /* TODO: IDF-8133 */ static void do_global_ctors(void) { #if __riscv @@ -209,6 +210,7 @@ static void do_global_ctors(void) * The sequence of the init function calls (sorted by priority) is documented in * system_init_fn.txt file. */ +__attribute__((no_sanitize_undefined)) /* TODO: IDF-8133 */ static void do_system_init_fn(void) { extern esp_system_init_fn_t _esp_system_init_fn_array_start; From 76dfcac597c83f8851a90bd97801609d454bff83 Mon Sep 17 00:00:00 2001 From: Alexey Lapshin Date: Wed, 19 Jul 2023 11:20:33 +0400 Subject: [PATCH 06/20] fix(esp_system): fix gcc 13.1.0 warnings --- components/esp_system/eh_frame_parser.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/esp_system/eh_frame_parser.c b/components/esp_system/eh_frame_parser.c index 363c9f1142..24aa5ec50f 100644 --- a/components/esp_system/eh_frame_parser.c +++ b/components/esp_system/eh_frame_parser.c @@ -255,8 +255,8 @@ typedef struct { * @brief Symbols defined by the linker. * Retrieve the addresses of both .eh_frame_hdr and .eh_frame sections. */ -extern char __eh_frame_hdr; -extern char __eh_frame; +extern void *__eh_frame_hdr; +extern void *__eh_frame; /** * @brief Decode multiple bytes encoded in LEB128. From 6a94453a18de50cb8c6cd3a773a3ce748a43ddde Mon Sep 17 00:00:00 2001 From: Alexey Lapshin Date: Wed, 19 Jul 2023 16:57:15 +0400 Subject: [PATCH 07/20] fix(bt): fix gcc 13.1.0 warnings --- .../bt/common/btc/profile/esp/blufi/blufi_prf.c | 4 ++-- .../api/core/esp_ble_mesh_provisioning_api.c | 17 ++++++++--------- .../bt/host/bluedroid/stack/btm/btm_ble_5_gap.c | 2 ++ .../bt/host/bluedroid/stack/btu/btu_hcif.c | 8 +------- 4 files changed, 13 insertions(+), 18 deletions(-) diff --git a/components/bt/common/btc/profile/esp/blufi/blufi_prf.c b/components/bt/common/btc/profile/esp/blufi/blufi_prf.c index 7a73ac4976..2c7be2127f 100644 --- a/components/bt/common/btc/profile/esp/blufi/blufi_prf.c +++ b/components/bt/common/btc/profile/esp/blufi/blufi_prf.c @@ -367,7 +367,7 @@ void btc_blufi_send_wifi_list(uint16_t apCount, esp_blufi_ap_record_t *list) int data_len; uint8_t *p; // malloc size: (len + RSSI + ssid buffer) * apCount; - uint malloc_size = (1 + 1 + sizeof(list->ssid)) * apCount; + uint32_t malloc_size = (1 + 1 + sizeof(list->ssid)) * apCount; p = data = osi_malloc(malloc_size); if (data == NULL) { BTC_TRACE_ERROR("malloc error\n"); @@ -376,7 +376,7 @@ void btc_blufi_send_wifi_list(uint16_t apCount, esp_blufi_ap_record_t *list) type = BLUFI_BUILD_TYPE(BLUFI_TYPE_DATA, BLUFI_TYPE_DATA_SUBTYPE_WIFI_LIST); for (int i = 0; i < apCount; ++i) { - uint len = strlen((const char *)list[i].ssid); + uint32_t len = strlen((const char *)list[i].ssid); data_len = (p - data); //current_len + ssid + rssi + total_len_value if((data_len + len + 1 + 1) > malloc_size) { diff --git a/components/bt/esp_ble_mesh/api/core/esp_ble_mesh_provisioning_api.c b/components/bt/esp_ble_mesh/api/core/esp_ble_mesh_provisioning_api.c index 3f407b3a4f..c89903a1d8 100644 --- a/components/bt/esp_ble_mesh/api/core/esp_ble_mesh_provisioning_api.c +++ b/components/bt/esp_ble_mesh/api/core/esp_ble_mesh_provisioning_api.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2017-2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2017-2023 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -140,9 +140,9 @@ esp_err_t esp_ble_mesh_node_input_string(const char *string) msg.sig = BTC_SIG_API_CALL; msg.pid = BTC_PID_PROV; msg.act = BTC_BLE_MESH_ACT_INPUT_STRING; - memset(arg.input_string.string, 0, sizeof(arg.input_string.string)); - strncpy(arg.input_string.string, string, - MIN(strlen(string), sizeof(arg.input_string.string))); + + arg.input_string.string[sizeof(arg.input_string.string) - 1] = 0; + strncpy(arg.input_string.string, string, sizeof(arg.input_string.string) - 1); return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); @@ -163,8 +163,8 @@ esp_err_t esp_ble_mesh_set_unprovisioned_device_name(const char *name) msg.pid = BTC_PID_PROV; msg.act = BTC_BLE_MESH_ACT_SET_DEVICE_NAME; - memset(arg.set_device_name.name, 0, sizeof(arg.set_device_name.name)); - strncpy(arg.set_device_name.name, name, ESP_BLE_MESH_DEVICE_NAME_MAX_LEN); + arg.set_device_name.name[sizeof(arg.set_device_name.name) - 1] = 0; + strncpy(arg.set_device_name.name, name, sizeof(arg.set_device_name.name) - 1); return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); @@ -211,9 +211,8 @@ esp_err_t esp_ble_mesh_provisioner_input_string(const char *string, uint8_t link msg.pid = BTC_PID_PROV; msg.act = BTC_BLE_MESH_ACT_PROVISIONER_INPUT_STR; - memset(arg.provisioner_input_str.string, 0, sizeof(arg.provisioner_input_str.string)); - strncpy(arg.provisioner_input_str.string, string, - MIN(strlen(string), sizeof(arg.provisioner_input_str.string))); + arg.provisioner_input_str.string[sizeof(arg.provisioner_input_str.string) - 1] = 0; + strncpy(arg.provisioner_input_str.string, string, sizeof(arg.provisioner_input_str.string) - 1); arg.provisioner_input_str.link_idx = link_idx; return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_prov_args_t), NULL, NULL) diff --git a/components/bt/host/bluedroid/stack/btm/btm_ble_5_gap.c b/components/bt/host/bluedroid/stack/btm/btm_ble_5_gap.c index 585a5eb944..2a4c9ce85e 100644 --- a/components/bt/host/bluedroid/stack/btm/btm_ble_5_gap.c +++ b/components/bt/host/bluedroid/stack/btm/btm_ble_5_gap.c @@ -35,6 +35,7 @@ typedef struct { tBTM_EXT_ADV_RECORD adv_record[MAX_BLE_ADV_INSTANCE] = {0}; extern void btm_ble_inter_set(bool extble_inter); +#if !UC_BT_STACK_NO_LOG static const char *btm_ble_hci_status_to_str(tHCI_STATUS status) { switch(status) { @@ -184,6 +185,7 @@ static const char *btm_ble_hci_status_to_str(tHCI_STATUS status) return NULL; } +#endif /* !UC_BT_STACK_NO_LOG */ void btm_ble_extendadvcb_init(void) { diff --git a/components/bt/host/bluedroid/stack/btu/btu_hcif.c b/components/bt/host/bluedroid/stack/btu/btu_hcif.c index d5749500dc..52daeafc06 100644 --- a/components/bt/host/bluedroid/stack/btu/btu_hcif.c +++ b/components/bt/host/bluedroid/stack/btu/btu_hcif.c @@ -947,6 +947,7 @@ static void btu_hcif_esco_connection_chg_evt (UINT8 *p) static void btu_hcif_hdl_command_complete (UINT16 opcode, UINT8 *p, UINT16 evt_len, void *p_cplt_cback) { + uint8_t status; switch (opcode) { case HCI_INQUIRY_CANCEL: /* Tell inquiry processing that we are done */ @@ -1012,7 +1013,6 @@ static void btu_hcif_hdl_command_complete (UINT16 opcode, UINT8 *p, UINT16 evt_l btm_ble_clear_white_list_complete(p, evt_len); break; case HCI_BLE_WRITE_ADV_PARAMS: { - uint8_t status; STREAM_TO_UINT8 (status, p); if(status != HCI_SUCCESS) { HCI_TRACE_ERROR("hci write adv params error 0x%x", status); @@ -1020,7 +1020,6 @@ static void btu_hcif_hdl_command_complete (UINT16 opcode, UINT8 *p, UINT16 evt_l break; } case HCI_BLE_RC_PARAM_REQ_REPLY: { - uint8_t status; STREAM_TO_UINT8 (status, p); if(status != HCI_SUCCESS) { HCI_TRACE_ERROR("hci connection params reply command error 0x%x", status); @@ -1028,7 +1027,6 @@ static void btu_hcif_hdl_command_complete (UINT16 opcode, UINT8 *p, UINT16 evt_l break; } case HCI_BLE_RC_PARAM_REQ_NEG_REPLY: { - uint8_t status; STREAM_TO_UINT8 (status, p); if(status != HCI_SUCCESS) { HCI_TRACE_ERROR("hci connection params neg reply command error %x", status); @@ -1096,13 +1094,11 @@ static void btu_hcif_hdl_command_complete (UINT16 opcode, UINT8 *p, UINT16 evt_l case HCI_BLE_SET_EXT_ADV_DATA: case HCI_BLE_SET_EXT_SCAN_RSP_DATA: case HCI_BLE_SET_EXT_ADV_ENABLE: { - uint8_t status; STREAM_TO_UINT8 (status, p); HCI_TRACE_EVENT("%s opcode 0x%x status 0x%x", __func__, opcode, status); break; } case HCI_BLE_READ_PHY: { - uint8_t status; uint16_t conn_handle; uint8_t tx_phy; uint8_t rx_phy; @@ -1125,7 +1121,6 @@ static void btu_hcif_hdl_command_complete (UINT16 opcode, UINT8 *p, UINT16 evt_l case HCI_BLE_PERIOD_ADV_SYNC_TRANS: case HCI_BLE_PERIOD_ADV_SET_INFO_TRANS: case HCI_BLE_SET_PAST_PARAMS: { - UINT8 status; UINT16 conn_handle; STREAM_TO_UINT8(status, p); STREAM_TO_UINT16(conn_handle, p); @@ -1140,7 +1135,6 @@ static void btu_hcif_hdl_command_complete (UINT16 opcode, UINT8 *p, UINT16 evt_l if ((opcode & HCI_GRP_VENDOR_SPECIFIC) == HCI_GRP_VENDOR_SPECIFIC) { btm_vsc_complete (p, opcode, evt_len, (tBTM_CMPL_CB *)p_cplt_cback); } - uint8_t status; STREAM_TO_UINT8 (status, p); if(status != HCI_SUCCESS) { HCI_TRACE_ERROR("CC evt: op=0x%x, status=0x%x", opcode, status); From 8bbcc224dd865fcbc0a789bb1fce9f9c01394ca8 Mon Sep 17 00:00:00 2001 From: Alexey Lapshin Date: Wed, 19 Jul 2023 23:06:33 +0400 Subject: [PATCH 08/20] fix(espcoredump): fix gcc 13.1.0 warnings --- .../espcoredump/src/port/xtensa/core_dump_port.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/components/espcoredump/src/port/xtensa/core_dump_port.c b/components/espcoredump/src/port/xtensa/core_dump_port.c index f89a0e0f19..fd17ac2584 100644 --- a/components/espcoredump/src/port/xtensa/core_dump_port.c +++ b/components/espcoredump/src/port/xtensa/core_dump_port.c @@ -290,16 +290,17 @@ void esp_core_dump_reset_fake_stacks(void) /* Get the top of the ISR stack. * Check core dump port interface for more information about this function. */ -uint8_t* esp_core_dump_get_isr_stack_top(void) { - extern uint8_t port_IntStack; - return &port_IntStack; +uint8_t* esp_core_dump_get_isr_stack_top(void) +{ + extern uint8_t port_IntStack[]; + return port_IntStack; } - uint32_t esp_core_dump_get_isr_stack_end(void) - { +uint32_t esp_core_dump_get_isr_stack_end(void) +{ uint8_t* isr_top_stack = esp_core_dump_get_isr_stack_top(); return (uint32_t)(isr_top_stack + (xPortGetCoreID()+1)*configISR_STACK_SIZE); - } +} static inline bool esp_core_dump_task_stack_end_is_sane(uint32_t sp) From 0172df94acf4ea13626808a2f3da7be0d254f4db Mon Sep 17 00:00:00 2001 From: Alexey Lapshin Date: Wed, 26 Jul 2023 14:31:43 +0400 Subject: [PATCH 09/20] fix(app_trace): fix gcov for gcc 13.1.0 --- components/app_trace/gcov/gcov_rtio.c | 8 +++- components/app_trace/gcov/io_sym.map | 1 + components/app_trace/host_file_io.c | 49 ++++++++++++++++++-- components/app_trace/include/esp_app_trace.h | 13 +++++- 4 files changed, 66 insertions(+), 5 deletions(-) diff --git a/components/app_trace/gcov/gcov_rtio.c b/components/app_trace/gcov/gcov_rtio.c index 8dd9e0d0cb..f61c45bd16 100644 --- a/components/app_trace/gcov/gcov_rtio.c +++ b/components/app_trace/gcov/gcov_rtio.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2017-2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2017-2023 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -173,6 +173,12 @@ long gcov_rtio_ftell(void *stream) return ret; } +int gcov_rtio_feof(void *stream) +{ + ESP_EARLY_LOGV(TAG, "%s", __FUNCTION__); + return 0; // esp_apptrace_feof(ESP_APPTRACE_DEST_TRAX, stream); // TODO IDF-7920 +} + void gcov_rtio_setbuf(void *arg1 __attribute__ ((unused)), void *arg2 __attribute__ ((unused))) { return; diff --git a/components/app_trace/gcov/io_sym.map b/components/app_trace/gcov/io_sym.map index 727766648b..7dd3aa0ac3 100644 --- a/components/app_trace/gcov/io_sym.map +++ b/components/app_trace/gcov/io_sym.map @@ -5,3 +5,4 @@ fread gcov_rtio_fread fseek gcov_rtio_fseek ftell gcov_rtio_ftell setbuf gcov_rtio_setbuf +feof gcov_rtio_feof diff --git a/components/app_trace/host_file_io.c b/components/app_trace/host_file_io.c index a36ed8969f..5ccc062edd 100644 --- a/components/app_trace/host_file_io.c +++ b/components/app_trace/host_file_io.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2017-2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2017-2023 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -29,6 +29,7 @@ const static char *TAG = "esp_host_file_io"; #define ESP_APPTRACE_FILE_CMD_FSEEK 0x4 #define ESP_APPTRACE_FILE_CMD_FTELL 0x5 #define ESP_APPTRACE_FILE_CMD_STOP 0x6 // indicates that there is no files to transfer +#define ESP_APPTRACE_FILE_CMD_FEOF 0x7 /** File operation header */ typedef struct { @@ -68,6 +69,11 @@ typedef struct { void * file; } esp_apptrace_fseek_args_t; +/** Helper structure for feof */ +typedef struct { + void *file; +} esp_apptrace_feof_args_t; + /** Helper structure for ftell */ typedef struct { void *file; @@ -228,8 +234,11 @@ size_t esp_apptrace_fwrite(esp_apptrace_dest_t dest, const void *ptr, size_t siz ESP_EARLY_LOGE(TAG, "Failed to read response (%d)!", ret); return 0; } - - return resp/size; // return the number of items written + /* OpenOCD writes it like that: + * fwrite(buf, size, 1, file); + * So, if 1 was returned that means fwrite succeed + */ + return resp == 1 ? nmemb : 0; } static void esp_apptrace_fread_args_prepare(uint8_t *buf, void *priv) @@ -275,6 +284,10 @@ size_t esp_apptrace_fread(esp_apptrace_dest_t dest, void *ptr, size_t size, size ESP_EARLY_LOGE(TAG, "Failed to read file data (%d)!", ret); return 0; } + /* OpenOCD reads it like that: + * fread(buf, 1 ,size, file); + * So, total read bytes count returns + */ return resp/size; // return the number of items read } @@ -354,4 +367,34 @@ int esp_apptrace_fstop(esp_apptrace_dest_t dest) return ret; } +static void esp_apptrace_feof_args_prepare(uint8_t *buf, void *priv) +{ + esp_apptrace_feof_args_t *args = priv; + + memcpy(buf, &args->file, sizeof(args->file)); +} + +int esp_apptrace_feof(esp_apptrace_dest_t dest, void *stream) +{ + esp_apptrace_feof_args_t cmd_args; + + cmd_args.file = stream; + esp_err_t ret = esp_apptrace_file_cmd_send(dest, ESP_APPTRACE_FILE_CMD_FEOF, esp_apptrace_feof_args_prepare, + &cmd_args, sizeof(cmd_args)); + if (ret != ESP_OK) { + ESP_EARLY_LOGE(TAG, "Failed to send file cmd (%d)!", ret); + return EOF; + } + + // now read the answer + int resp; + ret = esp_apptrace_file_rsp_recv(dest, (uint8_t *)&resp, sizeof(resp)); + if (ret != ESP_OK) { + ESP_EARLY_LOGE(TAG, "Failed to read response (%d)!", ret); + return EOF; + } + + return resp; +} + #endif diff --git a/components/app_trace/include/esp_app_trace.h b/components/app_trace/include/esp_app_trace.h index 18a533f937..d581b0eb89 100644 --- a/components/app_trace/include/esp_app_trace.h +++ b/components/app_trace/include/esp_app_trace.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2017-2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2017-2023 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -255,6 +255,17 @@ int esp_apptrace_ftell(esp_apptrace_dest_t dest, void *stream); */ int esp_apptrace_fstop(esp_apptrace_dest_t dest); +/** + * @brief Test end-of-file indicator on a stream. + * This function has the same semantic as 'feof' except for the first argument. + * + * @param dest Indicates HW interface to use. + * @param stream File handle returned by esp_apptrace_fopen. + * + * @return Non-Zero if end-of-file indicator is set for stream. See feof for details. + */ +int esp_apptrace_feof(esp_apptrace_dest_t dest, void *stream); + /** * @brief Triggers gcov info dump. * This function waits for the host to connect to target before dumping data. From 6f9901817fc90fa0a8bab3b308cfce58692bf865 Mon Sep 17 00:00:00 2001 From: Alexey Lapshin Date: Thu, 27 Jul 2023 14:26:16 +0400 Subject: [PATCH 10/20] fix(app_trace): fix sysview_tracing_heap_log test --- .../sysview_tracing_heap_log/pytest_sysview_tracing_heap_log.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/system/sysview_tracing_heap_log/pytest_sysview_tracing_heap_log.py b/examples/system/sysview_tracing_heap_log/pytest_sysview_tracing_heap_log.py index 1681c5a18c..1df1c4a320 100644 --- a/examples/system/sysview_tracing_heap_log/pytest_sysview_tracing_heap_log.py +++ b/examples/system/sysview_tracing_heap_log/pytest_sysview_tracing_heap_log.py @@ -42,5 +42,5 @@ def test_examples_sysview_tracing_heap_log(idf_path: str, dut: IdfDut) -> None: with open(dut.gdb._logfile) as fr: # pylint: disable=protected-access gdb_pexpect_proc = pexpect.fdpexpect.fdspawn(fr.fileno()) gdb_pexpect_proc.expect_exact( - 'Thread 2 "main" hit Temporary breakpoint 1, heap_trace_start (mode_param=HEAP_TRACE_ALL)', timeout=10) + 'Thread 2 "main" hit Temporary breakpoint 1, heap_trace_start (mode_param', timeout=10) # should be (mode_param=HEAP_TRACE_ALL) # TODO GCC-329 gdb_pexpect_proc.expect_exact('Thread 2 "main" hit Temporary breakpoint 2, heap_trace_stop ()', timeout=10) From c94d443a1bfbc1c412c8b77c8e3a767b839b603c Mon Sep 17 00:00:00 2001 From: Alexey Lapshin Date: Tue, 25 Jul 2023 17:57:12 +0400 Subject: [PATCH 11/20] feat(newlib): add iterator into test output --- components/newlib/test_apps/newlib/main/test_time.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/newlib/test_apps/newlib/main/test_time.c b/components/newlib/test_apps/newlib/main/test_time.c index d10f92faf0..0ce0f18286 100644 --- a/components/newlib/test_apps/newlib/main/test_time.c +++ b/components/newlib/test_apps/newlib/main/test_time.c @@ -79,7 +79,7 @@ TEST_CASE("Reading RTC registers on APP CPU doesn't affect clock", "[newlib]") struct timeval tv_stop; gettimeofday(&tv_stop, NULL); float time_sec = tv_stop.tv_sec - tv_start.tv_sec + 1e-6f * (tv_stop.tv_usec - tv_start.tv_usec); - printf("(0) time taken: %f sec\n", time_sec); + printf("(%d) time taken: %f sec\n", i, time_sec); TEST_ASSERT_TRUE(fabs(time_sec - 1.0f) < 0.1); } TEST_ASSERT_TRUE(xSemaphoreTake(done, 5000 / portTICK_PERIOD_MS)); From a43c509d4ba769ffc4d9c679c7cd32c9ec50eb4a Mon Sep 17 00:00:00 2001 From: Alexey Lapshin Date: Wed, 9 Aug 2023 12:11:54 +0400 Subject: [PATCH 12/20] change(newlib): update newlib according to new internal structures --- components/esp_system/startup.c | 26 ++----- components/newlib/newlib_init.c | 67 +++++++++++++++++-- .../newlib/platform_include/esp_newlib.h | 13 +++- .../newlib/platform_include/sys/reent.h | 29 +++++++- components/newlib/reent_init.c | 55 +++++---------- components/vfs/include/esp_vfs_console.h | 2 + components/vfs/vfs_console.c | 2 +- 7 files changed, 124 insertions(+), 70 deletions(-) diff --git a/components/esp_system/startup.c b/components/esp_system/startup.c index 240e2f20e2..6db1f77d02 100644 --- a/components/esp_system/startup.c +++ b/components/esp_system/startup.c @@ -305,28 +305,10 @@ static void do_core_init(void) #endif #if defined(CONFIG_VFS_SUPPORT_IO) && !defined(CONFIG_ESP_CONSOLE_NONE) - const static char *default_stdio_dev = "/dev/console/"; - esp_reent_init(_GLOBAL_REENT); - _GLOBAL_REENT->_stdin = fopen(default_stdio_dev, "r"); - _GLOBAL_REENT->_stdout = fopen(default_stdio_dev, "w"); - _GLOBAL_REENT->_stderr = fopen(default_stdio_dev, "w"); -#if ESP_ROM_NEEDS_SWSETUP_WORKAROUND - /* - - This workaround for printf functions using 32-bit time_t after the 64-bit time_t upgrade - - The 32-bit time_t usage is triggered through ROM Newlib functions printf related functions calling __swsetup_r() on - the first call to a particular file pointer (i.e., stdin, stdout, stderr) - - Thus, we call the toolchain version of __swsetup_r() now (before any printf calls are made) to setup all of the - file pointers. Thus, the ROM newlib code will never call the ROM version of __swsetup_r(). - - See IDFGH-7728 for more details - */ - extern int __swsetup_r(struct _reent *, FILE *); - __swsetup_r(_GLOBAL_REENT, _GLOBAL_REENT->_stdout); - __swsetup_r(_GLOBAL_REENT, _GLOBAL_REENT->_stderr); - __swsetup_r(_GLOBAL_REENT, _GLOBAL_REENT->_stdin); -#endif // ESP_ROM_NEEDS_SWSETUP_WORKAROUND -#else // defined(CONFIG_VFS_SUPPORT_IO) && !defined(CONFIG_ESP_CONSOLE_NONE) - _REENT_SMALL_CHECK_INIT(_GLOBAL_REENT); -#endif // defined(CONFIG_VFS_SUPPORT_IO) && !defined(CONFIG_ESP_CONSOLE_NONE) + esp_newlib_init_global_stdio(ESP_VFS_DEV_CONSOLE); +#else + esp_newlib_init_global_stdio(NULL); +#endif esp_err_t err __attribute__((unused)); diff --git a/components/newlib/newlib_init.c b/components/newlib/newlib_init.c index f966b790ed..2c9b798c74 100644 --- a/components/newlib/newlib_init.c +++ b/components/newlib/newlib_init.c @@ -39,8 +39,6 @@ #include "esp32p4/rom/libc_stubs.h" #endif -static struct _reent s_reent; - extern int _printf_float(struct _reent *rptr, void *pdata, FILE * fp, @@ -58,6 +56,21 @@ static void raise_r_stub(struct _reent *rptr) _raise_r(rptr, 0); } +static void esp_cleanup_r (struct _reent *rptr) +{ + if (_REENT_STDIN(rptr) != _REENT_STDIN(_GLOBAL_REENT)) { + _fclose_r(rptr, _REENT_STDIN(rptr)); + } + + if (_REENT_STDOUT(rptr) != _REENT_STDOUT(_GLOBAL_REENT)) { + _fclose_r(rptr, _REENT_STDOUT(rptr)); + } + + if (_REENT_STDERR(rptr) !=_REENT_STDERR(_GLOBAL_REENT)) { + _fclose_r(rptr, _REENT_STDERR(rptr)); + } +} + static struct syscall_stub_table s_stub_table = { .__getreent = &__getreent, ._malloc_r = &_malloc_r, @@ -120,14 +133,14 @@ static struct syscall_stub_table s_stub_table = { */ .__assert_func = __assert_func, - /* We don't expect either ROM code or IDF to ever call __sinit, so it's implemented as abort() for now. + /* We don't expect either ROM code to ever call __sinit, so it's implemented as abort() for now. - esp_reent_init() does this job inside IDF. - - Kept in the syscall table in case we find a need for it later. + __sinit may be called in IDF side only if /dev/console used as input/output. It called only + once for _GLOBAL_REENT. Then reuse std file pointers from _GLOBAL_REENT in another reents. + See esp_newlib_init() and esp_reent_init() for details. */ .__sinit = (void *)abort, - ._cleanup_r = &_cleanup_r, + ._cleanup_r = &esp_cleanup_r, #endif }; @@ -141,7 +154,17 @@ void esp_newlib_init(void) syscall_table_ptr = &s_stub_table; #endif +#if __NEWLIB__ > 4 || ( __NEWLIB__ == 4 && __NEWLIB_MINOR__ > 1 ) /* TODO: IDF-8134 */ + memset(&__sglue, 0, sizeof(__sglue)); + _global_impure_ptr = _GLOBAL_REENT; +#else + static struct _reent s_reent; _GLOBAL_REENT = &s_reent; +#endif + + /* Ensure that the initialization of sfp is prevented until esp_newlib_init_global_stdio() is explicitly invoked. */ + _GLOBAL_REENT->__cleanup = esp_cleanup_r; + _REENT_SDIDINIT(_GLOBAL_REENT) = 1; environ = malloc(sizeof(char*)); if (environ == 0) { @@ -154,3 +177,33 @@ void esp_newlib_init(void) } void esp_setup_newlib_syscalls(void) __attribute__((alias("esp_newlib_init"))); + +void esp_newlib_init_global_stdio(const char *stdio_dev) +{ + if (stdio_dev == NULL) + { + _GLOBAL_REENT->__cleanup = NULL; + _REENT_SDIDINIT(_GLOBAL_REENT) = 0; + __sinit(_GLOBAL_REENT); + _GLOBAL_REENT->__cleanup = esp_cleanup_r; + _REENT_SDIDINIT(_GLOBAL_REENT) = 1; + } else { + _REENT_STDIN(_GLOBAL_REENT) = fopen(stdio_dev, "r"); + _REENT_STDOUT(_GLOBAL_REENT) = fopen(stdio_dev, "w"); + _REENT_STDERR(_GLOBAL_REENT) = fopen(stdio_dev, "w"); +#if ESP_ROM_NEEDS_SWSETUP_WORKAROUND + /* + - This workaround for printf functions using 32-bit time_t after the 64-bit time_t upgrade + - The 32-bit time_t usage is triggered through ROM Newlib functions printf related functions calling __swsetup_r() on + the first call to a particular file pointer (i.e., stdin, stdout, stderr) + - Thus, we call the toolchain version of __swsetup_r() now (before any printf calls are made) to setup all of the + file pointers. Thus, the ROM newlib code will never call the ROM version of __swsetup_r(). + - See IDFGH-7728 for more details + */ + extern int __swsetup_r (struct _reent *, FILE *); + __swsetup_r(_GLOBAL_REENT, _REENT_STDIN(_GLOBAL_REENT)); + __swsetup_r(_GLOBAL_REENT, _REENT_STDOUT(_GLOBAL_REENT)); + __swsetup_r(_GLOBAL_REENT, _REENT_STDERR(_GLOBAL_REENT)); +#endif /* ESP_ROM_NEEDS_SWSETUP_WORKAROUND */ + } +} diff --git a/components/newlib/platform_include/esp_newlib.h b/components/newlib/platform_include/esp_newlib.h index 7912100b51..fe5e4cf343 100644 --- a/components/newlib/platform_include/esp_newlib.h +++ b/components/newlib/platform_include/esp_newlib.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -25,6 +25,17 @@ void esp_newlib_time_init(void); */ void esp_reent_init(struct _reent* r); +/** + * Postponed _GLOBAL_REENT stdio FPs initialization. + * + * Can not be a part of esp_reent_init() because stdio device may not initialized yet. + * + * Called from startup code and FreeRTOS, not intended to be called from + * application code. + * + */ +void esp_newlib_init_global_stdio(const char* stdio_dev); + /** * Clean up some of lazily allocated buffers in REENT structures. */ diff --git a/components/newlib/platform_include/sys/reent.h b/components/newlib/platform_include/sys/reent.h index 845f66161e..0be3983d27 100644 --- a/components/newlib/platform_include/sys/reent.h +++ b/components/newlib/platform_include/sys/reent.h @@ -1,22 +1,47 @@ /* - * SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2020-2023 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ #pragma once +#if __NEWLIB__ > 4 || ( __NEWLIB__ == 4 && __NEWLIB_MINOR__ > 1 ) /* TODO: IDF-8134 */ +#define _REENT_BACKWARD_BINARY_COMPAT +#define _REENT_SDIDINIT(_ptr) ((_ptr)->_reserved_0) +#define _REENT_SGLUE(_ptr) (__sglue) +#else +#define _REENT_CLEANUP(_ptr) ((_ptr)->__cleanup) +#define _REENT_STDIN(_ptr) ((_ptr)->_stdin) +#define _REENT_STDOUT(_ptr) ((_ptr)->_stdout) +#define _REENT_STDERR(_ptr) ((_ptr)->_stderr) +#define _REENT_SDIDINIT(_ptr) ((_ptr)->__sdidinit) +#define _REENT_SGLUE(_ptr) ((_ptr)->__sglue) +#endif + #include_next + #ifdef __cplusplus extern "C" { #endif +#if __NEWLIB__ > 4 || ( __NEWLIB__ == 4 && __NEWLIB_MINOR__ > 1 ) /* TODO: IDF-8134 */ + +extern void __sinit (struct _reent *); + +extern struct _glue __sglue; +extern struct _reent * _global_impure_ptr; + +#else /* __NEWLIB__ > 4 || ( __NEWLIB__ == 4 && __NEWLIB_MINOR__ > 1 ) */ + /* This function is not part of the newlib API, it is defined in libc/stdio/local.h * There is no nice way to get __cleanup member populated while avoiding __sinit, * so extern declaration is used here. */ -extern void _cleanup_r(struct _reent* r); +extern void _cleanup_r(struct _reent *); + +#endif /* __NEWLIB__ > 4 || ( __NEWLIB__ == 4 && __NEWLIB_MINOR__ > 1 ) */ #ifdef __cplusplus } diff --git a/components/newlib/reent_init.c b/components/newlib/reent_init.c index 9f6ee0d546..7d8ade98f8 100644 --- a/components/newlib/reent_init.c +++ b/components/newlib/reent_init.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -22,14 +22,11 @@ void IRAM_ATTR esp_reent_init(struct _reent* r) { memset(r, 0, sizeof(*r)); - r->_stdout = _GLOBAL_REENT->_stdout; - r->_stderr = _GLOBAL_REENT->_stderr; - r->_stdin = _GLOBAL_REENT->_stdin; - r->__cleanup = &_cleanup_r; - r->__sdidinit = 1; - r->__sglue._next = NULL; - r->__sglue._niobs = 0; - r->__sglue._iobs = NULL; + _REENT_STDIN(r) = _REENT_STDIN(_GLOBAL_REENT); + _REENT_STDOUT(r) = _REENT_STDOUT(_GLOBAL_REENT); + _REENT_STDERR(r) = _REENT_STDERR(_GLOBAL_REENT); + _REENT_CLEANUP(r) = _REENT_CLEANUP(_GLOBAL_REENT); + _REENT_SDIDINIT(r) = _REENT_SDIDINIT(_GLOBAL_REENT); } /* only declared in private stdio header file, local.h */ @@ -39,26 +36,20 @@ extern void __sfp_lock_release(void); void esp_reent_cleanup(void) { struct _reent* r = __getreent(); - /* Clean up storage used by mprec functions */ - if (r->_mp) { - if (_REENT_MP_FREELIST(r)) { - for (unsigned int i = 0; i < _Kmax; ++i) { - struct _Bigint *cur, *next; - next = _REENT_MP_FREELIST(r)[i]; - while (next) { - cur = next; - next = next->_next; - free(cur); - } - } - } - free(_REENT_MP_FREELIST(r)); - free(_REENT_MP_RESULT(r)); - } + _reclaim_reent(r); + + r->_emergency = NULL; + r->_mp = NULL; + r->_r48 = NULL; + r->_localtime_buf = NULL; + r->_asctime_buf = NULL; + r->_signal_buf = NULL; + r->_misc = NULL; + r->_cvtbuf = NULL; /* Clean up "glue" (lazily-allocated FILE objects) */ - struct _glue* prev = &_GLOBAL_REENT->__sglue; - for (struct _glue* cur = _GLOBAL_REENT->__sglue._next; cur != NULL;) { + struct _glue* prev = &_REENT_SGLUE(_GLOBAL_REENT); + for (struct _glue* cur = _REENT_SGLUE(_GLOBAL_REENT)._next; cur != NULL;) { if (cur->_niobs == 0) { cur = cur->_next; continue; @@ -81,14 +72,4 @@ void esp_reent_cleanup(void) free(cur); cur = next; } - - /* Clean up various other buffers */ - free(r->_mp); - r->_mp = NULL; - free(r->_r48); - r->_r48 = NULL; - free(r->_localtime_buf); - r->_localtime_buf = NULL; - free(r->_asctime_buf); - r->_asctime_buf = NULL; } diff --git a/components/vfs/include/esp_vfs_console.h b/components/vfs/include/esp_vfs_console.h index bc5ce6733d..3ac6e31add 100644 --- a/components/vfs/include/esp_vfs_console.h +++ b/components/vfs/include/esp_vfs_console.h @@ -8,6 +8,8 @@ #include "esp_err.h" +#define ESP_VFS_DEV_CONSOLE "/dev/console" + #ifdef __cplusplus extern "C" { #endif diff --git a/components/vfs/vfs_console.c b/components/vfs/vfs_console.c index caf2ec1aaf..1360be33cc 100644 --- a/components/vfs/vfs_console.c +++ b/components/vfs/vfs_console.c @@ -188,7 +188,7 @@ static const esp_vfs_t vfs = { esp_err_t esp_vfs_dev_console_register(void) { - return esp_vfs_register("/dev/console", &vfs, NULL); + return esp_vfs_register(ESP_VFS_DEV_CONSOLE, &vfs, NULL); } esp_err_t esp_vfs_console_register(void) From fdc6d0d8137b9664b639996ef34b454ac400bfa2 Mon Sep 17 00:00:00 2001 From: Alexey Lapshin Date: Thu, 17 Aug 2023 09:57:18 +0400 Subject: [PATCH 13/20] change(newlib): use GCC builtin subword atomics --- components/newlib/newlib.lf | 2 - components/newlib/port/CMakeLists.txt | 4 - components/newlib/port/riscv/port_stdatomic.S | 659 ------------------ 3 files changed, 665 deletions(-) delete mode 100644 components/newlib/port/riscv/port_stdatomic.S diff --git a/components/newlib/newlib.lf b/components/newlib/newlib.lf index 6485fc161c..d92c04fb0f 100644 --- a/components/newlib/newlib.lf +++ b/components/newlib/newlib.lf @@ -5,5 +5,3 @@ entries: abort (noflash) assert (noflash) stdatomic (noflash) - if IDF_TARGET_ARCH_RISCV: - port_stdatomic (noflash) diff --git a/components/newlib/port/CMakeLists.txt b/components/newlib/port/CMakeLists.txt index c4c37abfd0..a9187d56a4 100644 --- a/components/newlib/port/CMakeLists.txt +++ b/components/newlib/port/CMakeLists.txt @@ -1,5 +1 @@ target_sources(${COMPONENT_LIB} PRIVATE "${CMAKE_CURRENT_LIST_DIR}/esp_time_impl.c") - -if(CONFIG_IDF_TARGET_ARCH_RISCV) - target_sources(${COMPONENT_LIB} PRIVATE "${CMAKE_CURRENT_LIST_DIR}/riscv/port_stdatomic.S") -endif() diff --git a/components/newlib/port/riscv/port_stdatomic.S b/components/newlib/port/riscv/port_stdatomic.S deleted file mode 100644 index b43fb03db9..0000000000 --- a/components/newlib/port/riscv/port_stdatomic.S +++ /dev/null @@ -1,659 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ -#if __riscv_atomic == 1 - -.macro ALIGNED_PTR_2 ptr, offset - andi \ptr, a0, -4 // aligned ptr - sub \offset, a0, \ptr - slli \offset, \offset, 3 // offset (in bits) between ptr and aligned ptr - li t6, 24 - bne \offset, t6, 1f // do atomic operation in case var is not splited between 2 words - lr.w t2, (a0) // invokes 'Load access fault!' -1: -.endm - - .global __atomic_load_2 - .type __atomic_load_2, @function -__atomic_load_2: - ALIGNED_PTR_2 t0, t1 - lr.w t2, (t0) // t2 - load atomic - srl t4, t2, t1 - slli a0, t4, 0x10 - srli a0, a0, 0x10 - ret - .size __atomic_load_2, . - __atomic_load_2 - - - .global __atomic_store_2 - .type __atomic_store_2, @function -__atomic_store_2: - ALIGNED_PTR_2 t0, t1 - li t6, 0xffff - sll t6, t6, t1 - not t6, t6 // t6 - bitwise mask - sll t5, a1, t1 // t5 - shifted new value to easy place into aligned memory -1: // do not change registers (t0, t1, t5, t6) after this label - lr.w t2, (t0) // t2 - load atomic - and t3, t2, t6 // t3 - masked aliged memory. Atomic variable part is zeroed here - or t4, t5, t3 // t4 - combine desire half-word with half-word from origin aligned memory - sc.w t3, t4, (t0) // t3 - atomic write result (0 - success) - bnez t3, 1b - ret - .size __atomic_store_2, . - __atomic_store_2 - - - .global __atomic_exchange_2 - .type __atomic_exchange_2, @function -__atomic_exchange_2: - ALIGNED_PTR_2 t0, t1 - li t6, 0xffff - sll t6, t6, t1 - not t6, t6 // t6 - bitwise mask - sll t5, a1, t1 // t5 - shifted new value to easy place into aligned memory -1: // do not change registers (t0, t1, t5, t6) after this label - lr.w t2, (t0) // t2 - load atomic - and t3, t2, t6 // t3 - masked aliged memory. Atomic variable part is zeroed here - or t4, t5, t3 // t4 - combine desire half-word with half-word from origin aligned memory - sc.w t3, t4, (t0) // t3 - atomic write result (0 - success) - bnez t3, 1b - srl t4, t2, t1 - slli a0, t4, 0x10 - srli a0, a0, 0x10 - ret - .size __atomic_exchange_2, . - __atomic_exchange_2 - - - .global __atomic_compare_exchange_2 - .type __atomic_compare_exchange_2, @function -__atomic_compare_exchange_2: - ALIGNED_PTR_2 t0, t1 - li t6, 0xffff0000 - srl t6, t6, t1 // t6 - bitwise mask (0xffff0000/0x0000ffff) - lhu t5, (a1) - sll t5, t5, t1 // t5 - shifted expect value to easy compare with aligned memory - sll t4, a2, t1 // t4 - shifted desired value to easy place into aligned memory -1: // do not change registers (t0, t1, t4, t5) after this label - not t6, t6 - lr.w t2, (t0) // t2 - load atomic - and t3, t2, t6 // t3 - prepare half-word from aligned memory to compare with expected (t5) - bne t3, t5, 2f - not t6, t6 - and t2, t2, t6 - or t3, t4, t2 // t3 - combine desire half-word with half-word from origin aligned memory - sc.w t2, t3, (t0) // t2 - atomic write result (0 - success) - bnez t2, 1b - li a0, 1 - ret -2: - srl t3, t3, t1 - sh t3, (a1) // store atomic value into expect variable - li a0, 0 - ret - .size __atomic_compare_exchange_2, . - __atomic_compare_exchange_2 - - - .global __atomic_fetch_or_2 - .type __atomic_fetch_or_2, @function -__atomic_fetch_or_2: - ALIGNED_PTR_2 t0, t1 - sll t2, a1, t1 // t2 - shifted value half-word. - amoor.w t0, t2, (t0) // t0 - shifted value before atomic operation performed - srl t0, t0, t1 - slli a0, t0, 0x10 - srli a0, a0, 0x10 - ret - .size __atomic_fetch_or_2, . - __atomic_fetch_or_2 - - - .global __atomic_or_fetch_2 - .type __atomic_or_fetch_2, @function -__atomic_or_fetch_2: - ALIGNED_PTR_2 t0, t1 - sll t2, a1, t1 // t2 - shifted value half-word. - amoor.w t0, t2, (t0) // t0 - shifted value before atomic operation performed - srl t2, t2, t1 - slli a0, t2, 0x10 - srli a0, a0, 0x10 - ret - .size __atomic_or_fetch_2, . - __atomic_or_fetch_2 - - - .global __atomic_fetch_xor_2 - .type __atomic_fetch_xor_2, @function -__atomic_fetch_xor_2: - ALIGNED_PTR_2 t0, t1 - sll t2, a1, t1 // t2 - shifted value half-word. - amoxor.w t0, t2, (t0) // t0 - shifted value before atomic operation performed - srl t0, t0, t1 - slli a0, t0, 0x10 - srli a0, a0, 0x10 - ret - .size __atomic_fetch_xor_2, . - __atomic_fetch_xor_2 - - - .global __atomic_xor_fetch_2 - .type __atomic_xor_fetch_2, @function -__atomic_xor_fetch_2: - ALIGNED_PTR_2 t0, t1 - sll t2, a1, t1 // t2 - shifted value half-word. - amoxor.w t0, t2, (t0) // t0 - shifted value before atomic operation performed - srl t2, t2, t1 - slli a0, t2, 0x10 - srli a0, a0, 0x10 - ret - .size __atomic_xor_fetch_2, . - __atomic_xor_fetch_2 - - - .global __atomic_fetch_and_2 - .type __atomic_fetch_and_2, @function -__atomic_fetch_and_2: - ALIGNED_PTR_2 t0, t1 - li t6, 0xffff0000 // t6 - bitwise mask - srl t6, t6, t1 // t6 - using to fill non-atomic bytes with 0xff in aligned memory - sll t2, a1, t1 // t2 - shifted value half-word. - or t2, t2, t6 // t2 - 0xXXXXffff or 0xffffXXXX where is value halfword - amoand.w t0, t2, (t0) // t0 - shifted value before atomic operation performed - srl t0, t0, t1 - slli a0, t0, 0x10 - srli a0, a0, 0x10 - ret - .size __atomic_fetch_and_2, . - __atomic_fetch_and_2 - - - .global __atomic_and_fetch_2 - .type __atomic_and_fetch_2, @function -__atomic_and_fetch_2: - ALIGNED_PTR_2 t0, t1 - li t6, 0xffff0000 // t6 - bitwise mask - srl t6, t6, t1 // t6 - using to fill non-atomic bytes with 0xff in aligned memory - sll t2, a1, t1 // t2 - shifted value half-word. - or t2, t2, t6 // t2 - 0xXXXXffff or 0xffffXXXX where XXXX is value halfword - amoand.w t0, t2, (t0) // t0 - shifted value before atomic operation performed - srl t2, t2, t1 - slli a0, t2, 0x10 - srli a0, a0, 0x10 - ret - .size __atomic_and_fetch_2, . - __atomic_and_fetch_2 - - - .global __atomic_fetch_nand_2 - .type __atomic_fetch_nand_2, @function -__atomic_fetch_nand_2: - ALIGNED_PTR_2 t0, t1 - li t5, 0xffff - sll t5, t5, t1 // t5 - bitwise mask - not t6, t5 // t6 - bitwise mask -1: // do not change registers (t0, t1, t5, t6) after this label - lr.w t2, (t0) // t2 - load atomic - srl t3, t2, t1 - and t3, t3, a1 - not t3, t3 // t3 - atomic value to write - sll t3, t3, t1 - and t4, t2, t6 // t4 - masked aliged memory. Atomic variable part is zeroed here - or t4, t4, t3 // t4 - combine desire byte-word with origin aligned memory - sc.w t4, t4, (t0) // t3 - atomic write result (0 - success) - bnez t4, 1b - srl t4, t2, t1 - slli a0, t4, 0x10 - srli a0, a0, 0x10 - ret - .size __atomic_fetch_nand_2, . - __atomic_fetch_nand_2 - - - .global __atomic_nand_fetch_2 - .type __atomic_nand_fetch_2, @function -__atomic_nand_fetch_2: - ALIGNED_PTR_2 t0, t1 - li t5, 0xffff - sll t5, t5, t1 // t5 - bitwise mask - not t6, t5 // t6 - bitwise mask -1: // do not change registers (t0, t1, t5, t6) after this label - lr.w t2, (t0) // t2 - load atomic - srl t3, t2, t1 - and t3, t3, a1 - not t3, t3 // t3 - atomic value to write - sll t3, t3, t1 - and t4, t2, t6 // t4 - masked aliged memory. Atomic variable part is zeroed here - or t4, t4, t3 // t4 - combine desire byte-word with origin aligned memory - sc.w t4, t4, (t0) // t3 - atomic write result (0 - success) - bnez t4, 1b - srl t4, t2, t1 - slli a0, t3, 0x10 - srli a0, a0, 0x10 - ret - .size __atomic_nand_fetch_2, . - __atomic_nand_fetch_2 - - - .global __atomic_fetch_sub_2 - .type __atomic_fetch_sub_2, @function -__atomic_fetch_sub_2: - ALIGNED_PTR_2 t0, t1 - li t5, 0xffff // t5 - bitwise mask - not t6, t5 - srl t6, t6, t1 // t6 - bitwise mask -1: // do not change registers (t0, t1, t5, t6) after this label - lr.w t2, (t0) // t2 - load atomic - srl a0, t2, t1 - and a0, a0, t5 // a0 - value in atomic before performing operation - sub t3, a0, a1 - and t3, t3, t5 // t3 - value to be written to atomic - sll t3, t3, t1 - and t2, t2, t6 - or t3, t3, t2 // t3 - value to be written into aligned memory - sc.w t2, t3, (t0) // t2 - atomic write result (0 - success) - bnez t2, 1b - ret - .size __atomic_fetch_sub_2, . - __atomic_fetch_sub_2 - - - .global __atomic_sub_fetch_2 - .type __atomic_sub_fetch_2, @function -__atomic_sub_fetch_2: - ALIGNED_PTR_2 t0, t1 - li t5, 0xffff // t5 - bitwise mask - not t6, t5 - srl t6, t6, t1 // t6 - bitwise mask -1: // do not change registers (t0, t1, t5, t6) after this label - lr.w t2, (t0) // t2 - load atomic - srl t4, t2, t1 - and t4, t4, t5 - sub t4, t4, a1 - and t4, t4, t5 // t4 - value to be written to atomic - sll t4, t4, t1 - and t2, t2, t6 - or t4, t4, t2 // t4 - value to be written into aligned memory - sc.w t2, t4, (t0) // t2 - atomic write result (0 - success) - bnez t2, 1b - srl t4, t4, t1 - slli a0, t4, 0x10 - srli a0, a0, 0x10 - ret - .size __atomic_sub_fetch_2, . - __atomic_sub_fetch_2 - - - .global __atomic_fetch_add_2 - .type __atomic_fetch_add_2, @function -__atomic_fetch_add_2: - ALIGNED_PTR_2 t0, t1 - li t5, 0xffff // t5 - bitwise mask - not t6, t5 - srl t6, t6, t1 // t6 - bitwise mask -1: // do not change registers (t0, t1, t5, t6) after this label - lr.w t2, (t0) // t2 - load atomic - srl t4, t2, t1 - and t4, t4, t5 // t4 - half-word value in atomic before performing operation - add t3, t4, a1 - and t4, t4, t5 // t3 - half-word value to be written to atomic - sll t3, t3, t1 - and t2, t2, t6 - or t3, t3, t2 // t3 - value to be written into aligned memory - sc.w t2, t3, (t0) // t2 - atomic write result (0 - success) - bnez t2, 1b - slli a0, t4, 0x10 - srli a0, a0, 0x10 - ret - .size __atomic_fetch_add_2, . - __atomic_fetch_add_2 - - - .global __atomic_add_fetch_2 - .type __atomic_add_fetch_2, @function -__atomic_add_fetch_2: - ALIGNED_PTR_2 t0, t1 - li t5, 0xffff // t5 - bitwise mask - not t6, t5 - srl t6, t6, t1 // t6 - bitwise mask -1: // do not change registers (t0, t1, t5, t6) after this label - lr.w t2, (t0) // t2 - load atomic - srl t4, t2, t1 - and t4, t4, t5 - add t4, t4, a1 - and t4, t4, t5 // t4 - value to be written to atomic - sll t4, t4, t1 - and t2, t2, t6 - or t4, t4, t2 // t4 - value to be written into aligned memory - sc.w t2, t4, (t0) // t2 - atomic write result (0 - success) - bnez t2, 1b - srl t4, t4, t1 - slli a0, t4, 0x10 - srli a0, a0, 0x10 - ret - .size __atomic_add_fetch_2, . - __atomic_add_fetch_2 - - - .global __atomic_load_1 - .type __atomic_load_1, @function -__atomic_load_1: - andi t0, a0, -4 // t0 - aligned ptr - sub t1, a0, t0 - slli t1, t1, 3 // t1 - offset (in bits) between ptr and aligned ptr - li t6, 0xff - sll t6, t6, t1 - not t6, t6 // t6 - bitwise mask - lr.w t2, (t0) // t2 - load atomic - srl t4, t2, t1 - andi a0, t4, 0xff - ret - .size __atomic_load_1, . - __atomic_load_1 - - - .global __atomic_store_1 - .type __atomic_store_1, @function -__atomic_store_1: - andi t0, a0, -4 // t0 - aligned ptr - sub t1, a0, t0 - slli t1, t1, 3 // t1 - offset (in bits) between ptr and aligned ptr - li t6, 0xff - sll t6, t6, t1 - not t6, t6 // t6 - bitwise mask - sll t5, a1, t1 // t5 - shifted new value to easy place into aligned memory -1: // do not change registers (t0, t1, t5, t6) after this label - lr.w t2, (t0) // t2 - load atomic - and t3, t2, t6 // t3 - masked aliged memory. Atomic variable part is zeroed here - or t4, t5, t3 // t4 - combine desire byte-word with origin aligned memory - sc.w t3, t4, (t0) // t3 - atomic write result (0 - success) - bnez t3, 1b - ret - .size __atomic_store_1, . - __atomic_store_1 - - - .global __atomic_exchange_1 - .type __atomic_exchange_1, @function -__atomic_exchange_1: - andi t0, a0, -4 // t0 - aligned ptr - sub t1, a0, t0 - slli t1, t1, 3 // t1 - offset (in bits) between ptr and aligned ptr - li t6, 0xff - sll t6, t6, t1 - not t6, t6 // t6 - bitwise mask - sll t5, a1, t1 // t5 - shifted new value to easy place into aligned memory -1: // do not change registers (t0, t1, t5, t6) after this label - lr.w t2, (t0) // t2 - load atomic - and t3, t2, t6 // t3 - masked aliged memory. Atomic variable part is zeroed here - or t4, t5, t3 // t4 - combine desire byte-word with origin aligned memory - sc.w t3, t4, (t0) // t3 - atomic write result (0 - success) - bnez t3, 1b - srl t4, t2, t1 - andi a0, t4, 0xff - ret - .size __atomic_exchange_1, . - __atomic_exchange_1 - - - .global __atomic_compare_exchange_1 - .type __atomic_compare_exchange_1, @function -__atomic_compare_exchange_1: - andi t0, a0, -4 // t0 - aligned ptr - sub t1, a0, t0 - slli t1, t1, 3 // t1 - offset (in bits) between ptr and aligned ptr - li t6, 0xff - sll t6, t6, t1 - not t6, t6 // t6 - bitwise mask - lbu t5, (a1) - sll t5, t5, t1 // t5 - shifted expect value to easy compare with aligned memory - sll t4, a2, t1 // t4 - shifted desired value to easy place into aligned memory -1: // do not change registers (t0, t1, t4, t5) after this label - not t6, t6 - lr.w t2, (t0) // t2 - load atomic - and t3, t2, t6 // t3 - prepare half-word from aligned memory to compare with expected (t5) - bne t3, t5, 2f // goto fail - not t6, t6 - and t2, t2, t6 - or t3, t4, t2 // t3 - combine desire half-word with half-word from origin aligned memory - sc.w t2, t3, (t0) // t2 - atomic write result (0 - success) - bnez t2, 1b // retry - li a0, 1 - ret -2: - srl t3, t3, t1 - sb t3, (a1) // store atomic value into expect variable - li a0, 0 - ret - .size __atomic_compare_exchange_1, . - __atomic_compare_exchange_1 - - - .global __atomic_fetch_or_1 - .type __atomic_fetch_or_1, @function -__atomic_fetch_or_1: - andi t0, a0, -4 // t0 - aligned ptr - sub t1, a0, t0 - slli t1, t1, 3 // t1 - offset (in bits) between ptr and aligned ptr - sll t2, a1, t1 // t2 - shifted value half-word. - amoor.w t0, t2, (t0) // t0 - shifted value before atomic operation performed - srl t0, t0, t1 - andi a0, t0, 0xff - ret - .size __atomic_fetch_or_1, . - __atomic_fetch_or_1 - - - .global __atomic_or_fetch_1 - .type __atomic_or_fetch_1, @function -__atomic_or_fetch_1: - andi t0, a0, -4 // t0 - aligned ptr - sub t1, a0, t0 - slli t1, t1, 3 // t1 - offset (in bits) between ptr and aligned ptr - sll t2, a1, t1 // t2 - shifted byte-word value. - amoor.w t0, t2, (t0) // t0 - shifted value before atomic operation performed - srl t2, t2, t1 - andi a0, t2, 0xff - ret - .size __atomic_or_fetch_1, . - __atomic_or_fetch_1 - - - .global __atomic_fetch_xor_1 - .type __atomic_fetch_xor_1, @function -__atomic_fetch_xor_1: - andi t0, a0, -4 // t0 - aligned ptr - sub t1, a0, t0 - slli t1, t1, 3 // t1 - offset (in bits) between ptr and aligned ptr - sll t2, a1, t1 // t2 - shifted value byte-word. - amoxor.w t0, t2, (t0) // t0 - shifted value before atomic operation performed - srl t0, t0, t1 - andi a0, t0, 0xff - ret - .size __atomic_fetch_xor_1, . - __atomic_fetch_xor_1 - - - .global __atomic_xor_fetch_1 - .type __atomic_xor_fetch_1, @function -__atomic_xor_fetch_1: - andi t0, a0, -4 // t0 - aligned ptr - sub t1, a0, t0 - slli t1, t1, 3 // t1 - offset (in bits) between ptr and aligned ptr - sll t2, a1, t1 // t2 - shifted value byte-word. - amoxor.w t0, t2, (t0) // t0 - shifted value before atomic operation performed - srl t2, t2, t1 - andi a0, t2, 0xff - ret - .size __atomic_xor_fetch_1, . - __atomic_xor_fetch_1 - - - .global __atomic_fetch_and_1 - .type __atomic_fetch_and_1, @function -__atomic_fetch_and_1: - andi t0, a0, -4 // t0 - aligned ptr - sub t1, a0, t0 - slli t1, t1, 3 - li t6, 0xff // t6 - bitwise mask - sll t6, t6, t1 // t6 - using to fill non-atomic bytes with 0xff in aligned memory - not t6, t6 - sll t2, a1, t1 // t2 - shifted value byte-word. - or t2, t2, t6 // t2 - (0xXXffffff or 0xffXXffff ...) where XX - new value to write - amoand.w t0, t2, (t0) // t0 - shifted value before atomic operation performed - srl t0, t0, t1 - andi a0, t0, 0xff - ret - .size __atomic_fetch_and_1, . - __atomic_fetch_and_1 - - - .global __atomic_and_fetch_1 - .type __atomic_and_fetch_1, @function -__atomic_and_fetch_1: - andi t0, a0, -4 // t0 - aligned ptr - sub t1, a0, t0 - slli t1, t1, 3 - li t6, 0xff // t6 - bitwise mask - sll t6, t6, t1 // t6 - using to fill non-atomic bytes with 0xff in aligned memory - not t6, t6 - sll t2, a1, t1 // t2 - shifted value byte-word. - or t2, t2, t6 // t2 - (0xXXffffff or 0xffXXffff ...) where XX - new value to write - amoand.w t0, t2, (t0) // t0 - shifted value before atomic operation performed - srl t2, t2, t1 - andi a0, t2, 0xff - ret - .size __atomic_and_fetch_1, . - __atomic_and_fetch_1 - - - .global __atomic_nand_fetch_1 - .type __atomic_nand_fetch_1, @function -__atomic_nand_fetch_1: - andi t0, a0, -4 // t0 - aligned ptr - sub t1, a0, t0 - slli t1, t1, 3 // t1 - offset (in bits) between ptr and aligned ptr - li t6, 0xff - sll t6, t6, t1 - not t6, t6 // t6 - bitwise mask -1: // do not change registers (t0, t1, t6) after this label - lr.w t2, (t0) // t2 - load atomic - srl t3, t2, t1 - and t3, t3, a1 - not t3, t3 // t3 - atomic value to write - sll t3, t3, t1 - and t4, t2, t6 // t4 - masked aliged memory. Atomic variable part is zeroed here - or t4, t4, t3 // t4 - combine desire byte-word with origin aligned memory - sc.w t3, t4, (t0) // t3 - atomic write result (0 - success) - bnez t3, 1b - srl t4, t4, t1 - andi a0, t4, 0xff - ret - .size __atomic_nand_fetch_1, . - __atomic_nand_fetch_1 - - - .global __atomic_fetch_nand_1 - .type __atomic_fetch_nand_1, @function -__atomic_fetch_nand_1: - andi t0, a0, -4 // t0 - aligned ptr - sub t1, a0, t0 - slli t1, t1, 3 // t1 - offset (in bits) between ptr and aligned ptr - li t6, 0xff - sll t6, t6, t1 - not t6, t6 // t6 - bitwise mask -1: // do not change registers (t0, t1, t6) after this label - lr.w t2, (t0) // t2 - load atomic - srl t3, t2, t1 - and t3, t3, a1 - not t3, t3 // t3 - atomic value to write - sll t3, t3, t1 - and t4, t2, t6 // t4 - masked aliged memory. Atomic variable part is zeroed here - or t4, t4, t3 // t4 - combine desire byte-word with origin aligned memory - sc.w t3, t4, (t0) // t3 - atomic write result (0 - success) - bnez t3, 1b - srl t4, t2, t1 - andi a0, t4, 0xff - ret - .size __atomic_fetch_nand_1, . - __atomic_fetch_nand_1 - - - .global __atomic_fetch_sub_1 - .type __atomic_fetch_sub_1, @function -__atomic_fetch_sub_1: - andi t0, a0, -4 // t0 - aligned ptr - sub t1, a0, t0 - slli t1, t1, 3 // t1 - offset (in bits) between ptr and aligned ptr - li t6, 0xff - sll t6, t6, t1 - not t6, t6 // t6 - bitwise mask -1: // do not change registers (t0, t1, t6) after this label - lr.w t2, (t0) // t2 - load atomic - srl t4, t2, t1 - andi t4, t4, 0xff // t4 - value in atomic before performing operation - sub t3, t4, a1 - andi t3, t3, 0xff // t3 - value to be written to atomic - sll t3, t3, t1 - and t2, t2, t6 - or t3, t3, t2 // t3 - value to be written into aligned memory - sc.w t2, t3, (t0) // t2 - atomic write result (0 - success) - bnez t2, 1b - andi a0, t4, 0xff - ret - .size __atomic_fetch_sub_1, . - __atomic_fetch_sub_1 - - - .global __atomic_sub_fetch_1 - .type __atomic_sub_fetch_1, @function -__atomic_sub_fetch_1: - andi t0, a0, -4 // t0 - aligned ptr - sub t1, a0, t0 - slli t1, t1, 3 // t1 - offset (in bits) between ptr and aligned ptr - li t6, 0xff - sll t6, t6, t1 - not t6, t6 // t6 - bitwise mask -1: // do not change registers (t0, t1, t6) after this label - lr.w t2, (t0) // t2 - load atomic - srl t3, t2, t1 - andi t3, t3, 0xff // t3 - value in atomic before performing operation - sub t3, t3, a1 - andi t3, t3, 0xff // t3 - value to be written to atomic - sll t3, t3, t1 - and t2, t2, t6 - or t3, t3, t2 // t3 - value to be written into aligned memory - sc.w t2, t3, (t0) // t2 - atomic write result (0 - success) - bnez t2, 1b - srl t3, t3, t1 - andi a0, t3, 0xff - ret - .size __atomic_sub_fetch_1, . - __atomic_sub_fetch_1 - - - .global __atomic_fetch_add_1 - .type __atomic_fetch_add_1, @function -__atomic_fetch_add_1: - andi t0, a0, -4 // t0 - aligned ptr - sub t1, a0, t0 - slli t1, t1, 3 // t1 - offset (in bits) between ptr and aligned ptr - li t6, 0xff - sll t6, t6, t1 - not t6, t6 // t6 - bitwise mask -1: // do not change registers (t0, t1, t6) after this label - lr.w t2, (t0) // t2 - load atomic - srl t4, t2, t1 - andi t4, t4, 0xff // t4 - value in atomic before performing operation - add t3, t4, a1 - andi t3, t3, 0xff // t3 - value to be written to atomic - sll t3, t3, t1 - and t2, t2, t6 - or t3, t3, t2 // t3 - value to be written into aligned memory - sc.w t2, t3, (t0) // t2 - atomic write result (0 - success) - bnez t2, 1b - andi a0, t4, 0xff - ret - .size __atomic_fetch_add_1, . - __atomic_fetch_add_1 - - - .global __atomic_add_fetch_1 - .type __atomic_add_fetch_1, @function -__atomic_add_fetch_1: - andi t0, a0, -4 // t0 - aligned ptr - sub t1, a0, t0 - slli t1, t1, 3 // t1 - offset (in bits) between ptr and aligned ptr - li t6, 0xff - sll t6, t6, t1 - not t6, t6 // t6 - bitwise mask -1: // do not change registers (t0, t1, t6) after this label - lr.w t2, (t0) // t2 - load atomic - srl t3, t2, t1 - andi t3, t3, 0xff // t3 - value in atomic before performing operation - add t3, t3, a1 - andi t3, t3, 0xff // t3 - value to be written to atomic - sll t3, t3, t1 - and t2, t2, t6 - or t3, t3, t2 // t3 - value to be written into aligned memory - sc.w t2, t3, (t0) // t2 - atomic write result (0 - success) - bnez t2, 1b - srl t3, t3, t1 - andi a0, t3, 0xff - ret - .size __atomic_add_fetch_1, . - __atomic_add_fetch_1 - -#endif // if __riscv_atomic == 1 From 932040e08cf4328c89a36134282c318a895c173f Mon Sep 17 00:00:00 2001 From: Alexey Lapshin Date: Thu, 3 Aug 2023 13:34:18 +0400 Subject: [PATCH 14/20] fix(newlib): fix esp32-spiram-rom-functions entries name --- .../newlib/esp32-spiram-rom-functions-c.lf | 395 ++++++++++++------ 1 file changed, 272 insertions(+), 123 deletions(-) diff --git a/components/newlib/esp32-spiram-rom-functions-c.lf b/components/newlib/esp32-spiram-rom-functions-c.lf index 2275619693..7708edf477 100644 --- a/components/newlib/esp32-spiram-rom-functions-c.lf +++ b/components/newlib/esp32-spiram-rom-functions-c.lf @@ -19,153 +19,302 @@ entries: # The following libs are either used in a lot of places or in critical # code. (such as panic or abort) # Thus, they shall always be placed in IRAM. - lib_a-itoa (noflash) - lib_a-memcmp (noflash) - lib_a-memcpy (noflash) - lib_a-memset (noflash) - lib_a-strcat (noflash) - lib_a-strcmp (noflash) - lib_a-strlen (noflash) + if IDF_TOOLCHAIN = "gcc": # TODO: IDF-8134 + libc_a-itoa (noflash) + libc_a-memcmp (noflash) + libc_a-memcpy (noflash) + libc_a-memset (noflash) + libc_a-strcat (noflash) + libc_a-strcmp (noflash) + libc_a-strlen (noflash) + else: + lib_a-itoa (noflash) + lib_a-memcmp (noflash) + lib_a-memcpy (noflash) + lib_a-memset (noflash) + lib_a-strcat (noflash) + lib_a-strcmp (noflash) + lib_a-strlen (noflash) if SPIRAM_CACHE_LIBJMP_IN_IRAM = y: - lib_a-longjmp (noflash) - lib_a-setjmp (noflash) + if IDF_TOOLCHAIN = "gcc": + libc_a-longjmp (noflash) + libc_a-setjmp (noflash) + else: + lib_a-longjmp (noflash) + lib_a-setjmp (noflash) if SPIRAM_CACHE_LIBMATH_IN_IRAM = y: - lib_a-abs (noflash) - lib_a-div (noflash) - lib_a-labs (noflash) - lib_a-ldiv (noflash) - lib_a-quorem (noflash) - lib_a-s_fpclassify (noflash) - lib_a-sf_nan (noflash) + if IDF_TOOLCHAIN = "gcc": + libc_a-abs (noflash) + libc_a-div (noflash) + libc_a-labs (noflash) + libc_a-ldiv (noflash) + libc_a-quorem (noflash) + libc_a-s_fpclassify (noflash) + libc_a-sf_nan (noflash) + else: + lib_a-abs (noflash) + lib_a-div (noflash) + lib_a-labs (noflash) + lib_a-ldiv (noflash) + lib_a-quorem (noflash) + lib_a-s_fpclassify (noflash) + lib_a-sf_nan (noflash) if SPIRAM_CACHE_LIBNUMPARSER_IN_IRAM = y: - lib_a-utoa (noflash) - lib_a-atoi (noflash) - lib_a-atol (noflash) - lib_a-strtol (noflash) - lib_a-strtoul (noflash) + if IDF_TOOLCHAIN = "gcc": + libc_a-utoa (noflash) + libc_a-atoi (noflash) + libc_a-atol (noflash) + libc_a-strtol (noflash) + libc_a-strtoul (noflash) + else: + lib_a-utoa (noflash) + lib_a-atoi (noflash) + lib_a-atol (noflash) + lib_a-strtol (noflash) + lib_a-strtoul (noflash) if SPIRAM_CACHE_LIBIO_IN_IRAM = y: - lib_a-wcrtomb (noflash) - lib_a-fvwrite (noflash) - lib_a-wbuf (noflash) - lib_a-wsetup (noflash) - lib_a-fputwc (noflash) - lib_a-wctomb_r (noflash) - lib_a-ungetc (noflash) - lib_a-makebuf (noflash) - lib_a-fflush (noflash) - lib_a-refill (noflash) - lib_a-sccl (noflash) + if IDF_TOOLCHAIN = "gcc": + libc_a-wcrtomb (noflash) + libc_a-fvwrite (noflash) + libc_a-wbuf (noflash) + libc_a-wsetup (noflash) + libc_a-fputwc (noflash) + libc_a-wctomb_r (noflash) + libc_a-ungetc (noflash) + libc_a-makebuf (noflash) + libc_a-fflush (noflash) + libc_a-refill (noflash) + libc_a-sccl (noflash) + else: + lib_a-wcrtomb (noflash) + lib_a-fvwrite (noflash) + lib_a-wbuf (noflash) + lib_a-wsetup (noflash) + lib_a-fputwc (noflash) + lib_a-wctomb_r (noflash) + lib_a-ungetc (noflash) + lib_a-makebuf (noflash) + lib_a-fflush (noflash) + lib_a-refill (noflash) + lib_a-sccl (noflash) if SPIRAM_CACHE_LIBTIME_IN_IRAM = y: - lib_a-asctime (noflash) - lib_a-asctime_r (noflash) - lib_a-ctime (noflash) - lib_a-ctime_r (noflash) - lib_a-lcltime (noflash) - lib_a-lcltime_r (noflash) - lib_a-gmtime (noflash) - lib_a-gmtime_r (noflash) - lib_a-strftime (noflash) - lib_a-mktime (noflash) - lib_a-tzset_r (noflash) - lib_a-tzset (noflash) - lib_a-time (noflash) - lib_a-gettzinfo (noflash) - lib_a-systimes (noflash) - lib_a-month_lengths (noflash) - lib_a-timelocal (noflash) - lib_a-tzvars (noflash) - lib_a-tzlock (noflash) - lib_a-tzcalc_limits (noflash) - lib_a-strptime (noflash) + if IDF_TOOLCHAIN = "gcc": + libc_a-asctime (noflash) + libc_a-asctime_r (noflash) + libc_a-ctime (noflash) + libc_a-ctime_r (noflash) + libc_a-lcltime (noflash) + libc_a-lcltime_r (noflash) + libc_a-gmtime (noflash) + libc_a-gmtime_r (noflash) + libc_a-strftime (noflash) + libc_a-mktime (noflash) + libc_a-tzset_r (noflash) + libc_a-tzset (noflash) + libc_a-time (noflash) + libc_a-gettzinfo (noflash) + libc_a-systimes (noflash) + libc_a-month_lengths (noflash) + libc_a-timelocal (noflash) + libc_a-tzvars (noflash) + libc_a-tzlock (noflash) + libc_a-tzcalc_limits (noflash) + libc_a-strptime (noflash) + else: + lib_a-asctime (noflash) + lib_a-asctime_r (noflash) + lib_a-ctime (noflash) + lib_a-ctime_r (noflash) + lib_a-lcltime (noflash) + lib_a-lcltime_r (noflash) + lib_a-gmtime (noflash) + lib_a-gmtime_r (noflash) + lib_a-strftime (noflash) + lib_a-mktime (noflash) + lib_a-tzset_r (noflash) + lib_a-tzset (noflash) + lib_a-time (noflash) + lib_a-gettzinfo (noflash) + lib_a-systimes (noflash) + lib_a-month_lengths (noflash) + lib_a-timelocal (noflash) + lib_a-tzvars (noflash) + lib_a-tzlock (noflash) + lib_a-tzcalc_limits (noflash) + lib_a-strptime (noflash) if SPIRAM_CACHE_LIBCHAR_IN_IRAM = y: - lib_a-ctype_ (noflash) - lib_a-toupper (noflash) - lib_a-tolower (noflash) - lib_a-toascii (noflash) - lib_a-strupr (noflash) - lib_a-bzero (noflash) - lib_a-isalnum (noflash) - lib_a-isalpha (noflash) - lib_a-isascii (noflash) - lib_a-isblank (noflash) - lib_a-iscntrl (noflash) - lib_a-isdigit (noflash) - lib_a-isgraph (noflash) - lib_a-islower (noflash) - lib_a-isprint (noflash) - lib_a-ispunct (noflash) - lib_a-isspace (noflash) - lib_a-isupper (noflash) + if IDF_TOOLCHAIN = "gcc": + libc_a-ctype_ (noflash) + libc_a-toupper (noflash) + libc_a-tolower (noflash) + libc_a-toascii (noflash) + libc_a-strupr (noflash) + libc_a-bzero (noflash) + libc_a-isalnum (noflash) + libc_a-isalpha (noflash) + libc_a-isascii (noflash) + libc_a-isblank (noflash) + libc_a-iscntrl (noflash) + libc_a-isdigit (noflash) + libc_a-isgraph (noflash) + libc_a-islower (noflash) + libc_a-isprint (noflash) + libc_a-ispunct (noflash) + libc_a-isspace (noflash) + libc_a-isupper (noflash) + else: + lib_a-ctype_ (noflash) + lib_a-toupper (noflash) + lib_a-tolower (noflash) + lib_a-toascii (noflash) + lib_a-strupr (noflash) + lib_a-bzero (noflash) + lib_a-isalnum (noflash) + lib_a-isalpha (noflash) + lib_a-isascii (noflash) + lib_a-isblank (noflash) + lib_a-iscntrl (noflash) + lib_a-isdigit (noflash) + lib_a-isgraph (noflash) + lib_a-islower (noflash) + lib_a-isprint (noflash) + lib_a-ispunct (noflash) + lib_a-isspace (noflash) + lib_a-isupper (noflash) if SPIRAM_CACHE_LIBMEM_IN_IRAM = y: - lib_a-memccpy (noflash) - lib_a-memchr (noflash) - lib_a-memmove (noflash) - lib_a-memrchr (noflash) + if IDF_TOOLCHAIN = "gcc": + libc_a-memccpy (noflash) + libc_a-memchr (noflash) + libc_a-memmove (noflash) + libc_a-memrchr (noflash) + else: + lib_a-memccpy (noflash) + lib_a-memchr (noflash) + lib_a-memmove (noflash) + lib_a-memrchr (noflash) if SPIRAM_CACHE_LIBSTR_IN_IRAM = y: - lib_a-strcasecmp (noflash) - lib_a-strcasestr (noflash) - lib_a-strchr (noflash) - lib_a-strcoll (noflash) - lib_a-strcpy (noflash) - lib_a-strcspn (noflash) - lib_a-strdup (noflash) - lib_a-strdup_r (noflash) - lib_a-strlcat (noflash) - lib_a-strlcpy (noflash) - lib_a-strlwr (noflash) - lib_a-strncasecmp (noflash) - lib_a-strncat (noflash) - lib_a-strncmp (noflash) - lib_a-strncpy (noflash) - lib_a-strndup (noflash) - lib_a-strndup_r (noflash) - lib_a-strnlen (noflash) - lib_a-strrchr (noflash) - lib_a-strsep (noflash) - lib_a-strspn (noflash) - lib_a-strstr (noflash) - lib_a-strtok_r (noflash) - lib_a-strupr (noflash) + if IDF_TOOLCHAIN = "gcc": + libc_a-strcasecmp (noflash) + libc_a-strcasestr (noflash) + libc_a-strchr (noflash) + libc_a-strcoll (noflash) + libc_a-strcpy (noflash) + libc_a-strcspn (noflash) + libc_a-strdup (noflash) + libc_a-strdup_r (noflash) + libc_a-strlcat (noflash) + libc_a-strlcpy (noflash) + libc_a-strlwr (noflash) + libc_a-strncasecmp (noflash) + libc_a-strncat (noflash) + libc_a-strncmp (noflash) + libc_a-strncpy (noflash) + libc_a-strndup (noflash) + libc_a-strndup_r (noflash) + libc_a-strnlen (noflash) + libc_a-strrchr (noflash) + libc_a-strsep (noflash) + libc_a-strspn (noflash) + libc_a-strstr (noflash) + libc_a-strtok_r (noflash) + libc_a-strupr (noflash) + else: + lib_a-strcasecmp (noflash) + lib_a-strcasestr (noflash) + lib_a-strchr (noflash) + lib_a-strcoll (noflash) + lib_a-strcpy (noflash) + lib_a-strcspn (noflash) + lib_a-strdup (noflash) + lib_a-strdup_r (noflash) + lib_a-strlcat (noflash) + lib_a-strlcpy (noflash) + lib_a-strlwr (noflash) + lib_a-strncasecmp (noflash) + lib_a-strncat (noflash) + lib_a-strncmp (noflash) + lib_a-strncpy (noflash) + lib_a-strndup (noflash) + lib_a-strndup_r (noflash) + lib_a-strnlen (noflash) + lib_a-strrchr (noflash) + lib_a-strsep (noflash) + lib_a-strspn (noflash) + lib_a-strstr (noflash) + lib_a-strtok_r (noflash) + lib_a-strupr (noflash) if SPIRAM_CACHE_LIBRAND_IN_IRAM = y: - lib_a-srand (noflash) - lib_a-rand (noflash) - lib_a-rand_r (noflash) + if IDF_TOOLCHAIN = "gcc": + libc_a-srand (noflash) + libc_a-rand (noflash) + libc_a-rand_r (noflash) + else: + lib_a-srand (noflash) + lib_a-rand (noflash) + lib_a-rand_r (noflash) if SPIRAM_CACHE_LIBENV_IN_IRAM = y: - lib_a-environ (noflash) - lib_a-envlock (noflash) - lib_a-getenv_r (noflash) + if IDF_TOOLCHAIN = "gcc": + libc_a-environ (noflash) + libc_a-envlock (noflash) + libc_a-getenv_r (noflash) + else: + lib_a-environ (noflash) + lib_a-envlock (noflash) + lib_a-getenv_r (noflash) if SPIRAM_CACHE_LIBFILE_IN_IRAM = y: lock (noflash) isatty (noflash) - lib_a-fclose (noflash) - lib_a-open (noflash) - lib_a-close (noflash) - lib_a-creat (noflash) - lib_a-read (noflash) - lib_a-rshift (noflash) - lib_a-sbrk (noflash) - lib_a-stdio (noflash) - lib_a-syssbrk (noflash) - lib_a-sysclose (noflash) - lib_a-sysopen (noflash) creat (noflash) - lib_a-sysread (noflash) - lib_a-syswrite (noflash) - lib_a-impure (noflash) - lib_a-fwalk (noflash) - lib_a-findfp (noflash) + if IDF_TOOLCHAIN = "gcc": + libc_a-fclose (noflash) + libc_a-open (noflash) + libc_a-close (noflash) + libc_a-creat (noflash) + libc_a-read (noflash) + libc_a-rshift (noflash) + libc_a-sbrk (noflash) + libc_a-stdio (noflash) + libc_a-syssbrk (noflash) + libc_a-sysclose (noflash) + libc_a-sysopen (noflash) + libc_a-sysread (noflash) + libc_a-syswrite (noflash) + libc_a-impure (noflash) + libc_a-fwalk (noflash) + libc_a-findfp (noflash) + else: + lib_a-fclose (noflash) + lib_a-open (noflash) + lib_a-close (noflash) + lib_a-creat (noflash) + lib_a-read (noflash) + lib_a-rshift (noflash) + lib_a-sbrk (noflash) + lib_a-stdio (noflash) + lib_a-syssbrk (noflash) + lib_a-sysclose (noflash) + lib_a-sysopen (noflash) + lib_a-sysread (noflash) + lib_a-syswrite (noflash) + lib_a-impure (noflash) + lib_a-fwalk (noflash) + lib_a-findfp (noflash) if SPIRAM_CACHE_LIBMISC_IN_IRAM = y: - lib_a-raise (noflash) - lib_a-system (noflash) + if IDF_TOOLCHAIN = "gcc": + libc_a-raise (noflash) + libc_a-system (noflash) + else: + lib_a-raise (noflash) + lib_a-system (noflash) From 9dcc9a73f6df2234dbf6a33f8bd4ccd66c858b58 Mon Sep 17 00:00:00 2001 From: Alexey Lapshin Date: Thu, 3 Aug 2023 13:35:43 +0400 Subject: [PATCH 15/20] fix(esp_rom): fix libc_stubs.h includes --- .../esp_rom/include/esp32/rom/libc_stubs.h | 19 ++++++------------- .../esp_rom/include/esp32c2/rom/libc_stubs.h | 1 + .../esp_rom/include/esp32c3/rom/libc_stubs.h | 1 + .../esp_rom/include/esp32c6/rom/libc_stubs.h | 1 + .../esp_rom/include/esp32h2/rom/libc_stubs.h | 1 + .../esp_rom/include/esp32p4/rom/libc_stubs.h | 1 + .../esp_rom/include/esp32s2/rom/libc_stubs.h | 19 ++++++------------- .../esp_rom/include/esp32s3/rom/libc_stubs.h | 1 + tools/ci/check_copyright_ignore.txt | 2 -- 9 files changed, 18 insertions(+), 28 deletions(-) diff --git a/components/esp_rom/include/esp32/rom/libc_stubs.h b/components/esp_rom/include/esp32/rom/libc_stubs.h index 47e75bcb33..ce858013e4 100644 --- a/components/esp_rom/include/esp32/rom/libc_stubs.h +++ b/components/esp_rom/include/esp32/rom/libc_stubs.h @@ -1,16 +1,8 @@ -// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at - -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +/* + * SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ #ifndef _ROM_LIBC_STUBS_H_ #define _ROM_LIBC_STUBS_H_ @@ -18,6 +10,7 @@ #include #include #include +#include #include #include diff --git a/components/esp_rom/include/esp32c2/rom/libc_stubs.h b/components/esp_rom/include/esp32c2/rom/libc_stubs.h index eb31357fc2..077b6c94c5 100644 --- a/components/esp_rom/include/esp32c2/rom/libc_stubs.h +++ b/components/esp_rom/include/esp32c2/rom/libc_stubs.h @@ -11,6 +11,7 @@ #include #include #include +#include #include #include diff --git a/components/esp_rom/include/esp32c3/rom/libc_stubs.h b/components/esp_rom/include/esp32c3/rom/libc_stubs.h index 7008b48794..8378fe53ce 100644 --- a/components/esp_rom/include/esp32c3/rom/libc_stubs.h +++ b/components/esp_rom/include/esp32c3/rom/libc_stubs.h @@ -11,6 +11,7 @@ #include #include #include +#include #include #include diff --git a/components/esp_rom/include/esp32c6/rom/libc_stubs.h b/components/esp_rom/include/esp32c6/rom/libc_stubs.h index 494a70e867..cf1ffbbbf3 100644 --- a/components/esp_rom/include/esp32c6/rom/libc_stubs.h +++ b/components/esp_rom/include/esp32c6/rom/libc_stubs.h @@ -11,6 +11,7 @@ #include #include #include +#include #include #include diff --git a/components/esp_rom/include/esp32h2/rom/libc_stubs.h b/components/esp_rom/include/esp32h2/rom/libc_stubs.h index b7e28e5caf..88ea08cd1e 100644 --- a/components/esp_rom/include/esp32h2/rom/libc_stubs.h +++ b/components/esp_rom/include/esp32h2/rom/libc_stubs.h @@ -11,6 +11,7 @@ #include #include #include +#include #include #include diff --git a/components/esp_rom/include/esp32p4/rom/libc_stubs.h b/components/esp_rom/include/esp32p4/rom/libc_stubs.h index 2601476984..acb569c169 100644 --- a/components/esp_rom/include/esp32p4/rom/libc_stubs.h +++ b/components/esp_rom/include/esp32p4/rom/libc_stubs.h @@ -11,6 +11,7 @@ #include #include #include +#include #include #include diff --git a/components/esp_rom/include/esp32s2/rom/libc_stubs.h b/components/esp_rom/include/esp32s2/rom/libc_stubs.h index 5e514e1803..fe806b4eef 100644 --- a/components/esp_rom/include/esp32s2/rom/libc_stubs.h +++ b/components/esp_rom/include/esp32s2/rom/libc_stubs.h @@ -1,16 +1,8 @@ -// Copyright 2015-2019 Espressif Systems (Shanghai) PTE LTD -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +/* + * SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ #ifndef _ROM_LIBC_STUBS_H_ #define _ROM_LIBC_STUBS_H_ @@ -18,6 +10,7 @@ #include #include #include +#include #include #include diff --git a/components/esp_rom/include/esp32s3/rom/libc_stubs.h b/components/esp_rom/include/esp32s3/rom/libc_stubs.h index 47050b543e..937d809981 100644 --- a/components/esp_rom/include/esp32s3/rom/libc_stubs.h +++ b/components/esp_rom/include/esp32s3/rom/libc_stubs.h @@ -11,6 +11,7 @@ #include #include #include +#include #include #include diff --git a/tools/ci/check_copyright_ignore.txt b/tools/ci/check_copyright_ignore.txt index d362986e16..cfc01ba522 100644 --- a/tools/ci/check_copyright_ignore.txt +++ b/tools/ci/check_copyright_ignore.txt @@ -460,7 +460,6 @@ components/esp_rom/include/esp32/rom/aes.h components/esp_rom/include/esp32/rom/bigint.h components/esp_rom/include/esp32/rom/crc.h components/esp_rom/include/esp32/rom/efuse.h -components/esp_rom/include/esp32/rom/libc_stubs.h components/esp_rom/include/esp32/rom/sha.h components/esp_rom/include/esp32/rom/tbconsole.h components/esp_rom/include/esp32/rom/tjpgd.h @@ -477,7 +476,6 @@ components/esp_rom/include/esp32s2/rom/bigint.h components/esp_rom/include/esp32s2/rom/crc.h components/esp_rom/include/esp32s2/rom/digital_signature.h components/esp_rom/include/esp32s2/rom/hmac.h -components/esp_rom/include/esp32s2/rom/libc_stubs.h components/esp_rom/include/esp32s2/rom/opi_flash.h components/esp_rom/include/esp32s2/rom/rsa_pss.h components/esp_rom/include/esp32s2/rom/sha.h From 73742dcdaa26889735e7174b0587e9fe3f68cb09 Mon Sep 17 00:00:00 2001 From: Alexey Lapshin Date: Sun, 6 Aug 2023 18:15:40 +0400 Subject: [PATCH 16/20] fix(console): fix linenoise flushing in dumb mode --- components/console/linenoise/linenoise.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/components/console/linenoise/linenoise.c b/components/console/linenoise/linenoise.c index 48e510f521..965945aeda 100644 --- a/components/console/linenoise/linenoise.c +++ b/components/console/linenoise/linenoise.c @@ -1092,6 +1092,7 @@ static int linenoiseRaw(char *buf, size_t buflen, const char *prompt) { static int linenoiseDumb(char* buf, size_t buflen, const char* prompt) { /* dumb terminal, fall back to fgets */ fputs(prompt, stdout); + flushWrite(); size_t count = 0; while (count < buflen) { int c = fgetc(stdin); @@ -1105,11 +1106,13 @@ static int linenoiseDumb(char* buf, size_t buflen, const char* prompt) { count --; } fputs("\x08 ", stdout); /* Windows CMD: erase symbol under cursor */ + flushWrite(); } else { buf[count] = c; ++count; } fputc(c, stdout); /* echo */ + flushWrite(); } fputc('\n', stdout); flushWrite(); From e381041a522f3aad617b4a1531c6d26a16c65eae Mon Sep 17 00:00:00 2001 From: Alexey Lapshin Date: Tue, 12 Sep 2023 13:39:41 +0400 Subject: [PATCH 17/20] change(app_trace): decrease leaks in test to save ci time --- .../system/sysview_tracing_heap_log/main/sysview_heap_log.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/system/sysview_tracing_heap_log/main/sysview_heap_log.c b/examples/system/sysview_tracing_heap_log/main/sysview_heap_log.c index bd21ed86b5..5b01772833 100644 --- a/examples/system/sysview_tracing_heap_log/main/sysview_heap_log.c +++ b/examples/system/sysview_tracing_heap_log/main/sysview_heap_log.c @@ -53,7 +53,7 @@ static void alloc_task(void *p) xTaskCreatePinnedToCore(free_task, task_name, 2500, queue, 5, NULL, portNUM_PROCESSORS-1); // here GDB will stop at brekpoint and execute OpenOCD command to start tracing - for(int i = 1; i < 100; i++) { + for(int i = 1; i < 10; i++) { uint32_t sz = 2*i*(task_args->idx + 1); void *p = malloc(sz/2); // WARNING: the previous allocated memory is intentionally not deallocated in order to cause memory leak! From 33d9fd629dbf2468ecfdef6d5ebec2b7f6199060 Mon Sep 17 00:00:00 2001 From: Alexey Lapshin Date: Tue, 12 Sep 2023 21:15:09 +0400 Subject: [PATCH 18/20] fix(xtensa): fix registers curruption on context switch a6, a7 registers may be corrupted on multicore ESP chips while FreeRTOS Kernel SMP context switch --- components/xtensa/xtensa_vectors.S | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/components/xtensa/xtensa_vectors.S b/components/xtensa/xtensa_vectors.S index 4843bbae70..bcaa6b97a9 100644 --- a/components/xtensa/xtensa_vectors.S +++ b/components/xtensa/xtensa_vectors.S @@ -1163,13 +1163,17 @@ _xt_coproc_exc: bnone a2, a0, .L_xt_coproc_done /* if no match then done */ and a2, a2, a0 /* a2 = which CPs to restore */ extui a2, a2, 0, 8 /* extract low 8 bits */ +#if portNUM_PROCESSORS == 1 s32i a6, sp, XT_STK_A6 /* save extra needed regs */ s32i a7, sp, XT_STK_A7 +#endif /* portNUM_PROCESSORS == 1 */ s32i a13, sp, XT_STK_A13 s32i a14, sp, XT_STK_A14 call0 _xt_coproc_restorecs /* restore CP registers */ +#if portNUM_PROCESSORS == 1 l32i a6, sp, XT_STK_A6 /* restore saved registers */ l32i a7, sp, XT_STK_A7 +#endif /* portNUM_PROCESSORS == 1 */ l32i a13, sp, XT_STK_A13 l32i a14, sp, XT_STK_A14 j .L_xt_coproc_done From 47a902c813ef2141dd139e642219727bf60791b9 Mon Sep 17 00:00:00 2001 From: Alexey Lapshin Date: Sun, 24 Sep 2023 12:39:02 +0400 Subject: [PATCH 19/20] fix(build_system): disable shrink-wrapping in Og builds to reduce binary size --- CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9535eecfa9..a033c3d478 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,6 +22,9 @@ if(NOT BOOTLOADER_BUILD) endif() elseif(CONFIG_COMPILER_OPTIMIZATION_DEBUG) list(APPEND compile_options "-Og") + if(CMAKE_C_COMPILER_ID MATCHES "GNU" AND NOT CONFIG_IDF_TARGET_LINUX) + list(APPEND compile_options "-fno-shrink-wrap") # Disable shrink-wrapping to reduce binary size + endif() elseif(CONFIG_COMPILER_OPTIMIZATION_NONE) list(APPEND compile_options "-O0") elseif(CONFIG_COMPILER_OPTIMIZATION_PERF) @@ -37,6 +40,9 @@ else() # BOOTLOADER_BUILD endif() elseif(CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_DEBUG) list(APPEND compile_options "-Og") + if(CMAKE_C_COMPILER_ID MATCHES "GNU" AND NOT CONFIG_IDF_TARGET_LINUX) + list(APPEND compile_options "-fno-shrink-wrap") # Disable shrink-wrapping to reduce binary size + endif() elseif(CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_NONE) list(APPEND compile_options "-O0") elseif(CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_PERF) From 7f4de1364452547cfcc0b4809380f3e0a3aa14d1 Mon Sep 17 00:00:00 2001 From: Alexey Lapshin Date: Mon, 25 Sep 2023 15:02:46 +0400 Subject: [PATCH 20/20] fix(perfmon): fix test_app false-positive memory leak detection --- components/perfmon/test_apps/main/test_perfmon_main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/components/perfmon/test_apps/main/test_perfmon_main.c b/components/perfmon/test_apps/main/test_perfmon_main.c index 656bf5596c..0b65561820 100644 --- a/components/perfmon/test_apps/main/test_perfmon_main.c +++ b/components/perfmon/test_apps/main/test_perfmon_main.c @@ -7,6 +7,7 @@ #include "unity.h" #include "unity_test_runner.h" #include "esp_heap_caps.h" +#include "esp_newlib.h" #define TEST_MEMORY_LEAK_THRESHOLD_DEFAULT 0 static int leak_threshold = TEST_MEMORY_LEAK_THRESHOLD_DEFAULT; @@ -33,6 +34,7 @@ void setUp(void) void tearDown(void) { + esp_reent_cleanup(); //clean up some of the newlib's lazy allocations size_t after_free_8bit = heap_caps_get_free_size(MALLOC_CAP_8BIT); size_t after_free_32bit = heap_caps_get_free_size(MALLOC_CAP_32BIT); check_leak(before_free_8bit, after_free_8bit, "8BIT");