Skip to content

Commit c78bb1c

Browse files
authored
Merge pull request #9141 from gojimmypi/espressif-latest-debug
Fix workflow for latest ESP-IDF for espressif examples
2 parents 02cba85 + 797c1d0 commit c78bb1c

File tree

6 files changed

+127
-0
lines changed

6 files changed

+127
-0
lines changed

IDE/Espressif/ESP-IDF/examples/template/CMakeLists.txt

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,19 @@ message(STATUS "Begin project ${CMAKE_PROJECT_NAME}")
77

88
cmake_minimum_required(VERSION 3.16)
99

10+
# For the main project using ESP-IDF version 6 or greater.
11+
# Numerous "dangerous relocation: call8: call target out of range: memcpy" errors encountered
12+
# So we'll allow long calls with the `-mlongcalls` compiler option for all components.
13+
if(IDF_VERSION_MAJOR GREATER_EQUAL 6)
14+
if(IDF_TARGET STREQUAL "esp32" OR IDF_TARGET STREQUAL "esp32s2" OR IDF_TARGET STREQUAL "esp32s3")
15+
message(STATUS "Adding mlongcalls")
16+
add_compile_options(-mlongcalls)
17+
add_link_options(-mlongcalls)
18+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mlongcalls")
19+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mlongcalls")
20+
endif()
21+
endif()
22+
1023
# Optional no watchdog typically used for test & benchmark
1124
if (idf_target STREQUAL "esp8266" OR IDF_TARGET STREQUAL "esp8266" OR IDF_VERSION_MAJOR VERSION_LESS "5.0")
1225
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_ESP_NO_WATCHDOG=1")
@@ -144,5 +157,15 @@ endif()
144157

145158
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
146159

160+
# Once the project is loaded, next check for ESP-IDF version 6 or greater.
161+
# Numerous "dangerous relocation: call8: call target out of range: memcpy" errors encountered
162+
# So we'll allow long calls with the `-mlongcalls` compiler option for all components.
163+
if(IDF_VERSION_MAJOR GREATER_EQUAL 6)
164+
if(IDF_TARGET STREQUAL "esp32" OR IDF_TARGET STREQUAL "esp32s2" OR IDF_TARGET STREQUAL "esp32s3")
165+
message(STATUS "mlongcalls for all components")
166+
idf_build_set_property(COMPILE_OPTIONS "-mlongcalls" APPEND)
167+
endif()
168+
endif()
169+
147170
project(wolfssl_template)
148171
message(STATUS "end project")

IDE/Espressif/ESP-IDF/examples/wolfssl_benchmark/CMakeLists.txt

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,19 @@ message(STATUS "Begin project ${CMAKE_PROJECT_NAME}")
77

88
cmake_minimum_required(VERSION 3.16)
99

10+
# For the main project using ESP-IDF version 6 or greater.
11+
# Numerous "dangerous relocation: call8: call target out of range: memcpy" errors encountered
12+
# So we'll allow long calls with the `-mlongcalls` compiler option for all components.
13+
if(IDF_VERSION_MAJOR GREATER_EQUAL 6)
14+
if(IDF_TARGET STREQUAL "esp32" OR IDF_TARGET STREQUAL "esp32s2" OR IDF_TARGET STREQUAL "esp32s3")
15+
message(STATUS "Adding mlongcalls")
16+
add_compile_options(-mlongcalls)
17+
add_link_options(-mlongcalls)
18+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mlongcalls")
19+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mlongcalls")
20+
endif()
21+
endif()
22+
1023
# Optional no watchdog typically used for test & benchmark
1124
if (idf_target STREQUAL "esp8266" OR IDF_TARGET STREQUAL "esp8266" OR IDF_VERSION_MAJOR VERSION_LESS "5.0")
1225
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_ESP_NO_WATCHDOG=1")
@@ -144,5 +157,15 @@ endif()
144157

145158
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
146159

160+
# Once the project is loaded, next check for ESP-IDF version 6 or greater.
161+
# Numerous "dangerous relocation: call8: call target out of range: memcpy" errors encountered
162+
# So we'll allow long calls with the `-mlongcalls` compiler option for all components.
163+
if(IDF_VERSION_MAJOR GREATER_EQUAL 6)
164+
if(IDF_TARGET STREQUAL "esp32" OR IDF_TARGET STREQUAL "esp32s2" OR IDF_TARGET STREQUAL "esp32s3")
165+
message(STATUS "mlongcalls for all components")
166+
idf_build_set_property(COMPILE_OPTIONS "-mlongcalls" APPEND)
167+
endif()
168+
endif()
169+
147170
project(wolfssl_benchmark)
148171
message(STATUS "end project")

IDE/Espressif/ESP-IDF/examples/wolfssl_client/CMakeLists.txt

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,19 @@ message(STATUS "Begin project ${CMAKE_PROJECT_NAME}")
77

88
cmake_minimum_required(VERSION 3.16)
99

10+
# For the main project using ESP-IDF version 6 or greater.
11+
# Numerous "dangerous relocation: call8: call target out of range: memcpy" errors encountered
12+
# So we'll allow long calls with the `-mlongcalls` compiler option for all components.
13+
if(IDF_VERSION_MAJOR GREATER_EQUAL 6)
14+
if(IDF_TARGET STREQUAL "esp32" OR IDF_TARGET STREQUAL "esp32s2" OR IDF_TARGET STREQUAL "esp32s3")
15+
message(STATUS "Adding mlongcalls")
16+
add_compile_options(-mlongcalls)
17+
add_link_options(-mlongcalls)
18+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mlongcalls")
19+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mlongcalls")
20+
endif()
21+
endif()
22+
1023
# Optional no watchdog typically used for test & benchmark
1124
if (idf_target STREQUAL "esp8266" OR IDF_TARGET STREQUAL "esp8266" OR IDF_VERSION_MAJOR VERSION_LESS "5.0")
1225
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_ESP_NO_WATCHDOG=1")
@@ -144,5 +157,15 @@ endif()
144157

145158
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
146159

160+
# Once the project is loaded, next check for ESP-IDF version 6 or greater.
161+
# Numerous "dangerous relocation: call8: call target out of range: memcpy" errors encountered
162+
# So we'll allow long calls with the `-mlongcalls` compiler option for all components.
163+
if(IDF_VERSION_MAJOR GREATER_EQUAL 6)
164+
if(IDF_TARGET STREQUAL "esp32" OR IDF_TARGET STREQUAL "esp32s2" OR IDF_TARGET STREQUAL "esp32s3")
165+
message(STATUS "mlongcalls for all components")
166+
idf_build_set_property(COMPILE_OPTIONS "-mlongcalls" APPEND)
167+
endif()
168+
endif()
169+
147170
project(wolfssl_client)
148171
message(STATUS "end project")

IDE/Espressif/ESP-IDF/examples/wolfssl_server/CMakeLists.txt

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,19 @@ message(STATUS "Begin project ${CMAKE_PROJECT_NAME}")
77

88
cmake_minimum_required(VERSION 3.16)
99

10+
# For the main project using ESP-IDF version 6 or greater.
11+
# Numerous "dangerous relocation: call8: call target out of range: memcpy" errors encountered
12+
# So we'll allow long calls with the `-mlongcalls` compiler option for all components.
13+
if(IDF_VERSION_MAJOR GREATER_EQUAL 6)
14+
if(IDF_TARGET STREQUAL "esp32" OR IDF_TARGET STREQUAL "esp32s2" OR IDF_TARGET STREQUAL "esp32s3")
15+
message(STATUS "Adding mlongcalls")
16+
add_compile_options(-mlongcalls)
17+
add_link_options(-mlongcalls)
18+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mlongcalls")
19+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mlongcalls")
20+
endif()
21+
endif()
22+
1023
# Optional no watchdog typically used for test & benchmark
1124
if (idf_target STREQUAL "esp8266" OR IDF_TARGET STREQUAL "esp8266" OR IDF_VERSION_MAJOR VERSION_LESS "5.0")
1225
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_ESP_NO_WATCHDOG=1")
@@ -144,5 +157,15 @@ endif()
144157

145158
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
146159

160+
# Once the project is loaded, next check for ESP-IDF version 6 or greater.
161+
# Numerous "dangerous relocation: call8: call target out of range: memcpy" errors encountered
162+
# So we'll allow long calls with the `-mlongcalls` compiler option for all components.
163+
if(IDF_VERSION_MAJOR GREATER_EQUAL 6)
164+
if(IDF_TARGET STREQUAL "esp32" OR IDF_TARGET STREQUAL "esp32s2" OR IDF_TARGET STREQUAL "esp32s3")
165+
message(STATUS "mlongcalls for all components")
166+
idf_build_set_property(COMPILE_OPTIONS "-mlongcalls" APPEND)
167+
endif()
168+
endif()
169+
147170
project(wolfssl_server)
148171
message(STATUS "end project")

IDE/Espressif/ESP-IDF/examples/wolfssl_test/CMakeLists.txt

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,19 @@ message(STATUS "Begin project ${CMAKE_PROJECT_NAME}")
77

88
cmake_minimum_required(VERSION 3.16)
99

10+
# For the main project using ESP-IDF version 6 or greater.
11+
# Numerous "dangerous relocation: call8: call target out of range: memcpy" errors encountered
12+
# So we'll allow long calls with the `-mlongcalls` compiler option for all components.
13+
if(IDF_VERSION_MAJOR GREATER_EQUAL 6)
14+
if(IDF_TARGET STREQUAL "esp32" OR IDF_TARGET STREQUAL "esp32s2" OR IDF_TARGET STREQUAL "esp32s3")
15+
message(STATUS "Adding mlongcalls")
16+
add_compile_options(-mlongcalls)
17+
add_link_options(-mlongcalls)
18+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mlongcalls")
19+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mlongcalls")
20+
endif()
21+
endif()
22+
1023
# Optional no watchdog typically used for test & benchmark
1124
if (idf_target STREQUAL "esp8266" OR IDF_TARGET STREQUAL "esp8266" OR IDF_VERSION_MAJOR VERSION_LESS "5.0")
1225
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWOLFSSL_ESP_NO_WATCHDOG=1")
@@ -144,5 +157,15 @@ endif()
144157

145158
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
146159

160+
# Once the project is loaded, next check for ESP-IDF version 6 or greater.
161+
# Numerous "dangerous relocation: call8: call target out of range: memcpy" errors encountered
162+
# So we'll allow long calls with the `-mlongcalls` compiler option for all components.
163+
if(IDF_VERSION_MAJOR GREATER_EQUAL 6)
164+
if(IDF_TARGET STREQUAL "esp32" OR IDF_TARGET STREQUAL "esp32s2" OR IDF_TARGET STREQUAL "esp32s3")
165+
message(STATUS "mlongcalls for all components")
166+
idf_build_set_property(COMPILE_OPTIONS "-mlongcalls" APPEND)
167+
endif()
168+
endif()
169+
147170
project(wolfssl_test)
148171
message(STATUS "end project")

wolfcrypt/src/port/Espressif/esp_sdk_mem_lib.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,9 @@ extern wc_ptr_t _heap_end[];
119119
#define IRAMF2_START ((void*)(0x4010C000))
120120
#define IRAMF2_END ((void*)(0x4010C000 + 0x4000))
121121

122+
#if defined(ESP_IDF_VERSION) && (ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(6, 0, 0))
123+
/* Skipping for ESP-IDF v6.0 */
124+
#else
122125
enum sdk_memory_segment
123126
{
124127
/* Ensure this list exactly matches order in sdk_memory_segment_text */
@@ -187,10 +190,14 @@ int sdk_log_meminfo(enum sdk_memory_segment m, void* start, void* end)
187190
}
188191
return ESP_OK;
189192
}
193+
#endif
190194

191195
/* Show all known linker memory segment names, starting & ending addresses. */
192196
int sdk_init_meminfo(void)
193197
{
198+
#if defined(ESP_IDF_VERSION) && (ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(6, 0, 0))
199+
ESP_LOGI(TAG, "sdk_init_meminfo not available for ESP-IDF V6.0");
200+
#else
194201
void* sample_heap_var;
195202
int sample_stack_var = 0;
196203

@@ -238,13 +245,17 @@ int sdk_init_meminfo(void)
238245
sdk_var_whereis("sample_heap_var", sample_heap_var);
239246
free(sample_heap_var);
240247
}
248+
#endif
241249
return ESP_OK;
242250
}
243251

244252
/* Returns ESP_OK if found in known memory map, ESP_FAIL otherwise */
245253
esp_err_t sdk_var_whereis(const char* v_name, void* v)
246254
{
247255
esp_err_t ret = ESP_FAIL;
256+
#if defined(ESP_IDF_VERSION) && (ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(6, 0, 0))
257+
ESP_LOGI(TAG, "sdk_var_whereis not available for ESP-IDF V6.0");
258+
#else
248259

249260
for (enum sdk_memory_segment m = 0 ;m < SDK_MEMORY_SEGMENT_COUNT; m++) {
250261
if (v >= sdk_memory_segment_start[m] &&
@@ -257,6 +268,7 @@ esp_err_t sdk_var_whereis(const char* v_name, void* v)
257268
}
258269
}
259270
}
271+
#endif
260272

261273
if (ret == ESP_FAIL) {
262274
ESP_LOGW(TAG, "%s not found in known memory map: %p", v_name, v);

0 commit comments

Comments
 (0)