Skip to content

Commit e44db5f

Browse files
committed
test fix
1 parent 11bc7ac commit e44db5f

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed

CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ set(CORE_SRCS
3737
cores/esp32/esp32-hal-i2c-ng.c
3838
cores/esp32/esp32-hal-i2c-slave.c
3939
cores/esp32/esp32-hal-ledc.c
40+
cores/esp32/esp32-hal-log-wrapper.c
4041
cores/esp32/esp32-hal-matrix.c
4142
cores/esp32/esp32-hal-misc.c
4243
cores/esp32/esp32-hal-periman.c
@@ -426,6 +427,13 @@ if(CONFIG_AUTOSTART_ARDUINO)
426427
target_link_libraries(${COMPONENT_LIB} INTERFACE "-u _Z5setupv -u _Z4loopv")
427428
endif()
428429

430+
# Add linker wrap flags for esp_log functions when CONFIG_DIAG_USE_EXTERNAL_LOG_WRAP is not enabled
431+
# This provides wrapper functions required by WiFi library even when esp_diagnostics is not active
432+
if(NOT CONFIG_DIAG_USE_EXTERNAL_LOG_WRAP)
433+
target_link_libraries(${COMPONENT_LIB} INTERFACE "-Wl,--wrap=esp_log_write")
434+
target_link_libraries(${COMPONENT_LIB} INTERFACE "-Wl,--wrap=esp_log_writev")
435+
endif()
436+
429437
# This function adds a dependency on the given component if the component is included into the build.
430438
function(maybe_add_component component_name)
431439
idf_build_get_property(components BUILD_COMPONENTS)
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#include "sdkconfig.h"
8+
9+
/*
10+
* This file provides wrapper implementations for esp_log_write and esp_log_writev
11+
* when CONFIG_DIAG_USE_EXTERNAL_LOG_WRAP is not enabled.
12+
*
13+
* When CONFIG_DIAG_USE_EXTERNAL_LOG_WRAP is enabled, the esp_diagnostics component
14+
* provides these wrappers. However, when it's disabled, WiFi libraries still expect
15+
* these wrapper functions to exist, causing linker errors.
16+
*
17+
* This implementation provides simple pass-through wrappers that call the real
18+
* ESP-IDF logging functions, ensuring compatibility without requiring esp_diagnostics.
19+
*/
20+
21+
#ifndef CONFIG_DIAG_USE_EXTERNAL_LOG_WRAP
22+
23+
#include <stdarg.h>
24+
#include "esp_log_write.h"
25+
26+
// Declare the real functions that will be wrapped
27+
void __real_esp_log_write(esp_log_level_t level, const char* tag, const char* format, ...);
28+
void __real_esp_log_writev(esp_log_level_t level, const char* tag, const char* format, va_list args);
29+
30+
// Wrapper implementations that simply call through to the real functions
31+
void __wrap_esp_log_write(esp_log_level_t level, const char* tag, const char* format, ...) {
32+
va_list args;
33+
va_start(args, format);
34+
__real_esp_log_writev(level, tag, format, args);
35+
va_end(args);
36+
}
37+
38+
void __wrap_esp_log_writev(esp_log_level_t level, const char* tag, const char* format, va_list args) {
39+
__real_esp_log_writev(level, tag, format, args);
40+
}
41+
42+
#endif // !CONFIG_DIAG_USE_EXTERNAL_LOG_WRAP

0 commit comments

Comments
 (0)