Просмотр исходного кода

Merge branch 'bugfix/esp-system-warnings' into 'master'

system: minor fixes of warnings

See merge request espressif/esp-idf!18310
Anton Maklakov 3 лет назад
Родитель
Сommit
3c8a1390a0

+ 1 - 1
components/esp_hw_support/port/esp32c3/esp_memprot.c

@@ -28,7 +28,7 @@ static void *esp_memprot_iram0_get_def_split_addr(void)
 
 static void *esp_memprot_dram0_get_def_split_addr(void)
 {
-    return MAP_IRAM_TO_DRAM(&_iram_text_end);
+    return (void *)MAP_IRAM_TO_DRAM((uint32_t)&_iram_text_end);
 }
 
 static void *esp_memprot_rtcfast_get_min_split_addr(void)

+ 12 - 12
components/esp_hw_support/test/test_ds.c

@@ -59,36 +59,36 @@ _Static_assert(NUM_RESULTS == NUM_MESSAGES, "expected_results size should be the
 
 TEST_CASE("Digital Signature Parameter Encryption data NULL", "[hw_crypto] [ds]")
 {
-    const char iv [32];
-    esp_ds_p_data_t p_data;
-    const char key [32];
+    const char iv [32] = {0};
+    esp_ds_p_data_t p_data = {0};
+    const char key [32] = {0};
 
     TEST_ASSERT_EQUAL(ESP_ERR_INVALID_ARG, esp_ds_encrypt_params(NULL, iv, &p_data, key));
 }
 
 TEST_CASE("Digital Signature Parameter Encryption iv NULL", "[hw_crypto] [ds]")
 {
-    esp_ds_data_t data;
-    esp_ds_p_data_t p_data;
-    const char key [32];
+    esp_ds_data_t data = {0};
+    esp_ds_p_data_t p_data = {0};
+    const char key [32] = {0};
 
     TEST_ASSERT_EQUAL(ESP_ERR_INVALID_ARG, esp_ds_encrypt_params(&data, NULL, &p_data, key));
 }
 
 TEST_CASE("Digital Signature Parameter Encryption p_data NULL", "[hw_crypto] [ds]")
 {
-    esp_ds_data_t data;
-    const char iv [32];
-    const char key [32];
+    esp_ds_data_t data = {0};
+    const char iv [32] = {0};
+    const char key [32] = {0};
 
     TEST_ASSERT_EQUAL(ESP_ERR_INVALID_ARG, esp_ds_encrypt_params(&data, iv, NULL, key));
 }
 
 TEST_CASE("Digital Signature Parameter Encryption key NULL", "[hw_crypto] [ds]")
 {
-    esp_ds_data_t data;
-    const char iv [32];
-    esp_ds_p_data_t p_data;
+    esp_ds_data_t data = {0};
+    const char iv [32] = {0};
+    esp_ds_p_data_t p_data = {0};
 
     TEST_ASSERT_EQUAL(ESP_ERR_INVALID_ARG, esp_ds_encrypt_params(&data, iv, &p_data, NULL));
 }

+ 5 - 0
components/esp_rom/esp32s2/usb_descriptors.c

@@ -49,6 +49,10 @@ void rom_usb_cdc_set_descriptor_patch(void)
     uint8_t mac_bytes[6];
     efuse_hal_get_mac(mac_bytes);
     /* Convert to UTF16 string */
+#pragma GCC diagnostic push
+#if     __GNUC__ >= 9
+#pragma GCC diagnostic ignored "-Waddress-of-packed-member"
+#endif
     uint16_t* dst = s_str_serial_descr.bString;
     for (int i = 0; i < 6; ++i) {
         uint8_t b = mac_bytes[5 - i]; /* printing from the MSB */
@@ -56,6 +60,7 @@ void rom_usb_cdc_set_descriptor_patch(void)
         *dst++ = nibble_to_hex_u16(b & 0xf);
         dst++;
     }
+#pragma GCC diagnostic pop
 
     /* Override the pointer to descriptors structure */
     rom_usb_curr_desc = &s_acm_usb_descriptors_override;

+ 7 - 0
components/esp_system/port/cpu_start.c

@@ -613,7 +613,14 @@ void IRAM_ATTR call_start_cpu0(void)
 #else
     // This assumes that DROM is the first segment in the application binary, i.e. that we can read
     // the binary header through cache by accessing SOC_DROM_LOW address.
+#pragma GCC diagnostic push
+#if     __GNUC__ >= 11
+#pragma GCC diagnostic ignored "-Wstringop-overread"
+#endif
+#pragma GCC diagnostic ignored "-Warray-bounds"
     memcpy(&fhdr, (void *) SOC_DROM_LOW, sizeof(fhdr));
+#pragma GCC diagnostic pop
+
 #endif // CONFIG_APP_BUILD_TYPE_ELF_RAM
 
 #if CONFIG_IDF_TARGET_ESP32

+ 4 - 4
components/newlib/stdatomic.c

@@ -497,16 +497,16 @@ ATOMIC_STORE(8, long long unsigned int)
 #endif // !HAS_ATOMICS_64
 
 // Clang generates calls to the __atomic_load/__atomic_store functions for object size more then 4 bytes
-void CLANG_ATOMIC_SUFFIX( __atomic_load ) (int size, void *src, void *dest, int model) {
+void CLANG_ATOMIC_SUFFIX( __atomic_load ) (size_t size, const volatile void *src, void *dest, int model) {
     unsigned state = _ATOMIC_ENTER_CRITICAL();
-    memcpy(dest, src, size);
+    memcpy(dest, (const void *)src, size);
     _ATOMIC_EXIT_CRITICAL(state);
 }
 CLANG_DECLARE_ALIAS( __atomic_load )
 
-void CLANG_ATOMIC_SUFFIX( __atomic_store ) (int size, void *dest, void *src, int model) {
+void CLANG_ATOMIC_SUFFIX( __atomic_store ) (size_t size, volatile void *dest, void *src, int model) {
     unsigned state = _ATOMIC_ENTER_CRITICAL();
-    memcpy(dest, src, size);
+    memcpy((void *)dest, (const void *)src, size);
     _ATOMIC_EXIT_CRITICAL(state);
 }
 CLANG_DECLARE_ALIAS( __atomic_store)

+ 1 - 0
components/pthread/test/test_pthread_cxx.cpp

@@ -2,6 +2,7 @@
 #include <sstream>
 #include <thread>
 #include <mutex>
+#include <memory>
 #include "freertos/FreeRTOS.h"
 #include "freertos/task.h"
 #include "unity.h"

+ 2 - 0
components/xtensa/include/xtensa-debug-module.h

@@ -1,6 +1,8 @@
 #ifndef XTENSA_DEBUG_MODULE_H
 #define XTENSA_DEBUG_MODULE_H
 
+#include <xtensa/config/core-isa.h>
+
 /*
 ERI registers / OCD offsets and field definitions
 */

+ 1 - 1
examples/system/esp_timer/main/esp_timer_example_main.c

@@ -70,7 +70,7 @@ void app_main(void)
     int64_t t2 = esp_timer_get_time();
     ESP_LOGI(TAG, "Woke up from light sleep, time since boot: %lld us", t2);
 
-    assert(abs((t2 - t1) - 500000) < 1000);
+    assert(llabs((t2 - t1) - 500000) < 1000);
 
     /* Let the timer run for a little bit more */
     usleep(2000000);