mirror of
https://github.com/esphome/esphome.git
synced 2026-06-24 08:29:51 +00:00
[esp32] Fix clang-tidy on ESP-IDF 6 (#16850)
This commit is contained in:
@@ -1 +1 @@
|
||||
d9c755e5f019b2ecb324834717bc1fb8563e622f5751794cb7156d324884481e
|
||||
58a760f5fd174bd438bcc3a7018292c158530c1a1d15181941c832d4c032511c
|
||||
|
||||
@@ -222,6 +222,7 @@ bool BTHomeMiThermometer::decrypt_bthome_payload_(const std::vector<uint8_t> &da
|
||||
}
|
||||
|
||||
size_t plaintext_length;
|
||||
// NOLINTNEXTLINE(readability-suspicious-call-argument) - similarly named size args are not swapped
|
||||
psa_status_t status = psa_aead_decrypt(key_id, PSA_ALG_AEAD_WITH_SHORTENED_TAG(PSA_ALG_CCM, BTHOME_MIC_SIZE),
|
||||
nonce.data(), nonce.size(), nullptr, 0, ct_with_tag, ct_with_tag_size,
|
||||
payload.data(), ciphertext_size, &plaintext_length);
|
||||
|
||||
@@ -165,6 +165,8 @@ void LEDCOutput::write_state(float state) {
|
||||
void LEDCOutput::setup() {
|
||||
if (!ledc_peripheral_reset_done) {
|
||||
ESP_LOGV(TAG, "Resetting LEDC peripheral to clear stale state after reboot");
|
||||
// Skip under clang-tidy: the inlined HAL MMIO writes trip clang-analyzer-core.FixedAddressDereference
|
||||
#if !defined(CLANG_TIDY)
|
||||
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(6, 1, 0)
|
||||
PERIPH_RCC_ATOMIC() { ledc_ll_reset_register(0); }
|
||||
#elif ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(6, 0, 0)
|
||||
@@ -174,6 +176,7 @@ void LEDCOutput::setup() {
|
||||
}
|
||||
#else
|
||||
periph_module_reset(PERIPH_LEDC_MODULE);
|
||||
#endif
|
||||
#endif
|
||||
ledc_peripheral_reset_done = true;
|
||||
}
|
||||
|
||||
@@ -132,10 +132,7 @@ extra_scripts = post:esphome/components/esp8266/post_build.py.script
|
||||
; This are common settings for the ESP32 (all variants) using Arduino.
|
||||
[common:esp32-arduino]
|
||||
extends = common:arduino
|
||||
platform = https://github.com/pioarduino/platform-espressif32/releases/download/55.03.39/platform-espressif32.zip
|
||||
platform_packages =
|
||||
pioarduino/framework-arduinoespressif32@https://github.com/espressif/arduino-esp32/releases/download/3.3.9/esp32-core-3.3.9.tar.xz
|
||||
pioarduino/framework-espidf@https://github.com/pioarduino/esp-idf/releases/download/v5.5.4/esp-idf-v5.5.4.tar.xz
|
||||
platform = https://github.com/pioarduino/platform-espressif32.git
|
||||
|
||||
framework = arduino, espidf ; Arduino as an ESP-IDF component
|
||||
lib_deps =
|
||||
@@ -167,9 +164,7 @@ extra_scripts = post:esphome/components/esp32/post_build.py.script
|
||||
; This are common settings for the ESP32 (all variants) using IDF.
|
||||
[common:esp32-idf]
|
||||
extends = common:idf
|
||||
platform = https://github.com/pioarduino/platform-espressif32/releases/download/55.03.39/platform-espressif32.zip
|
||||
platform_packages =
|
||||
pioarduino/framework-espidf@https://github.com/pioarduino/esp-idf/releases/download/v5.5.4/esp-idf-v5.5.4.tar.xz
|
||||
platform = https://github.com/pioarduino/platform-espressif32.git
|
||||
|
||||
framework = espidf
|
||||
lib_deps =
|
||||
|
||||
@@ -73,6 +73,7 @@ def clang_options(idedata):
|
||||
"-freorder-blocks",
|
||||
"-fno-jump-tables",
|
||||
"-fno-shrink-wrap",
|
||||
"-mno-target-align",
|
||||
)
|
||||
|
||||
if "zephyr" in triplet:
|
||||
@@ -137,6 +138,7 @@ def clang_options(idedata):
|
||||
if flag not in omit_flags
|
||||
and not flag.startswith("-Werror")
|
||||
and not flag.startswith("-std=")
|
||||
and not flag.startswith("-mtune=esp")
|
||||
)
|
||||
cmd.append("-std=gnu++20")
|
||||
|
||||
|
||||
@@ -2,6 +2,14 @@
|
||||
# (clang-tidy) -- by both the PlatformIO and the native ESP-IDF toolchain paths -- and when PlatformIO is run directly
|
||||
# from the source directory (e.g. by IDEs). This should enable all flags that are set by any component.
|
||||
|
||||
# clang-tidy analyzes with clang, and IDF 6 only offers newlib under clang
|
||||
# (picolibc's Kconfig depends on !IDF_TOOLCHAIN_CLANG). The idedata is generated
|
||||
# with GCC, whose default is picolibc -- but clang-tidy uses the toolchain's
|
||||
# newlib headers, so a picolibc build config mismatches them (IDF's hal/assert.h
|
||||
# redeclares abort()/__assert_func() with [[noreturn]] after newlib's stdlib.h,
|
||||
# tripping clang-diagnostic-error). Pin newlib to match the analyzed headers.
|
||||
CONFIG_LIBC_NEWLIB=y
|
||||
|
||||
# esp32
|
||||
CONFIG_COMPILER_OPTIMIZATION_SIZE=y
|
||||
CONFIG_FREERTOS_HZ=1000
|
||||
|
||||
Reference in New Issue
Block a user