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

system: minor fixes of warnings

See merge request espressif/esp-idf!18310
This commit is contained in:
Anton Maklakov
2022-05-30 19:33:01 +08:00
8 changed files with 33 additions and 18 deletions

View File

@@ -28,7 +28,7 @@ static void *esp_memprot_iram0_get_def_split_addr(void)
static void *esp_memprot_dram0_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) static void *esp_memprot_rtcfast_get_min_split_addr(void)

View File

@@ -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]") TEST_CASE("Digital Signature Parameter Encryption data NULL", "[hw_crypto] [ds]")
{ {
const char iv [32]; const char iv [32] = {0};
esp_ds_p_data_t p_data; esp_ds_p_data_t p_data = {0};
const char key [32]; const char key [32] = {0};
TEST_ASSERT_EQUAL(ESP_ERR_INVALID_ARG, esp_ds_encrypt_params(NULL, iv, &p_data, key)); 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]") TEST_CASE("Digital Signature Parameter Encryption iv NULL", "[hw_crypto] [ds]")
{ {
esp_ds_data_t data; esp_ds_data_t data = {0};
esp_ds_p_data_t p_data; esp_ds_p_data_t p_data = {0};
const char key [32]; const char key [32] = {0};
TEST_ASSERT_EQUAL(ESP_ERR_INVALID_ARG, esp_ds_encrypt_params(&data, NULL, &p_data, key)); 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]") TEST_CASE("Digital Signature Parameter Encryption p_data NULL", "[hw_crypto] [ds]")
{ {
esp_ds_data_t data; esp_ds_data_t data = {0};
const char iv [32]; const char iv [32] = {0};
const char key [32]; const char key [32] = {0};
TEST_ASSERT_EQUAL(ESP_ERR_INVALID_ARG, esp_ds_encrypt_params(&data, iv, NULL, key)); 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]") TEST_CASE("Digital Signature Parameter Encryption key NULL", "[hw_crypto] [ds]")
{ {
esp_ds_data_t data; esp_ds_data_t data = {0};
const char iv [32]; const char iv [32] = {0};
esp_ds_p_data_t p_data; esp_ds_p_data_t p_data = {0};
TEST_ASSERT_EQUAL(ESP_ERR_INVALID_ARG, esp_ds_encrypt_params(&data, iv, &p_data, NULL)); TEST_ASSERT_EQUAL(ESP_ERR_INVALID_ARG, esp_ds_encrypt_params(&data, iv, &p_data, NULL));
} }

View File

@@ -49,6 +49,10 @@ void rom_usb_cdc_set_descriptor_patch(void)
uint8_t mac_bytes[6]; uint8_t mac_bytes[6];
efuse_hal_get_mac(mac_bytes); efuse_hal_get_mac(mac_bytes);
/* Convert to UTF16 string */ /* 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; uint16_t* dst = s_str_serial_descr.bString;
for (int i = 0; i < 6; ++i) { for (int i = 0; i < 6; ++i) {
uint8_t b = mac_bytes[5 - i]; /* printing from the MSB */ 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++ = nibble_to_hex_u16(b & 0xf);
dst++; dst++;
} }
#pragma GCC diagnostic pop
/* Override the pointer to descriptors structure */ /* Override the pointer to descriptors structure */
rom_usb_curr_desc = &s_acm_usb_descriptors_override; rom_usb_curr_desc = &s_acm_usb_descriptors_override;

View File

@@ -613,7 +613,14 @@ void IRAM_ATTR call_start_cpu0(void)
#else #else
// This assumes that DROM is the first segment in the application binary, i.e. that we can read // 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. // 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)); memcpy(&fhdr, (void *) SOC_DROM_LOW, sizeof(fhdr));
#pragma GCC diagnostic pop
#endif // CONFIG_APP_BUILD_TYPE_ELF_RAM #endif // CONFIG_APP_BUILD_TYPE_ELF_RAM
#if CONFIG_IDF_TARGET_ESP32 #if CONFIG_IDF_TARGET_ESP32

View File

@@ -497,16 +497,16 @@ ATOMIC_STORE(8, long long unsigned int)
#endif // !HAS_ATOMICS_64 #endif // !HAS_ATOMICS_64
// Clang generates calls to the __atomic_load/__atomic_store functions for object size more then 4 bytes // 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(); unsigned state = _ATOMIC_ENTER_CRITICAL();
memcpy(dest, src, size); memcpy(dest, (const void *)src, size);
_ATOMIC_EXIT_CRITICAL(state); _ATOMIC_EXIT_CRITICAL(state);
} }
CLANG_DECLARE_ALIAS( __atomic_load ) 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(); unsigned state = _ATOMIC_ENTER_CRITICAL();
memcpy(dest, src, size); memcpy((void *)dest, (const void *)src, size);
_ATOMIC_EXIT_CRITICAL(state); _ATOMIC_EXIT_CRITICAL(state);
} }
CLANG_DECLARE_ALIAS( __atomic_store) CLANG_DECLARE_ALIAS( __atomic_store)

View File

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

View File

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

View File

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