@@ -219,6 +219,30 @@ component_compile_options(
219
219
-DMEMFAULT_FREERTOS_REGISTRY_FULL_ERROR_LOG_INCLUDE="memfault_platform_freertos_error_log.h"
220
220
)
221
221
222
+ # Extra compilation options set globally
223
+ if (NOT DEFINED ENV{IDF_VERSION})
224
+ set (IDF_VERSION "3.3.5" )
225
+ else ()
226
+ set (IDF_VERSION $ENV{IDF_VERSION} )
227
+ endif ()
228
+ if (IDF_VERSION VERSION_GREATER_EQUAL "5.0.0" )
229
+ # Empty for now, reserving for the future
230
+ elseif (IDF_VERSION VERSION_GREATER_EQUAL "4.4.0" )
231
+ # ESP-IDF v4.4 forces the FreeRTOS config
232
+ # INCLUDE_xTimerGetTimerDaemonTaskHandle=0, which is used to record timer task
233
+ # stack in the SDK. Just disable the usage unconditionally.
234
+ list (APPEND MEMFAULT_EXTRA_COMPILE_OPTIONS
235
+ "-DMEMFAULT_FREERTOS_COLLECT_TIMER_STACK_FREE_BYTES=0"
236
+ )
237
+ else ()
238
+ # ESP-IDF < 4.4 don't force this setting, so set it ourselves to the correct
239
+ # value.
240
+ list (APPEND MEMFAULT_EXTRA_COMPILE_OPTIONS
241
+ "-DINCLUDE_xTimerGetTimerDaemonTaskHandle=1"
242
+ )
243
+ endif ()
244
+
245
+
222
246
# Set the heartbeat config file to use the ESP-IDF port file, which will bring
223
247
# in the user's heartbeat config automatically. Set it as a global compiler
224
248
# option so it properly affects both component compilation and when the metric
@@ -232,6 +256,7 @@ if (IDF_VERSION_MAJOR VERSION_EQUAL 3)
232
256
"-DMEMFAULT_METRICS_USER_HEARTBEAT_DEFS_FILE=\\\" memfault_esp_metrics_heartbeat_config.def\\\" "
233
257
"-DMEMFAULT_PLATFORM_CONFIG_FILE=\\\" memfault_esp_idf_port_config.h\\\" "
234
258
"-DMEMFAULT_TRACE_REASON_USER_DEFS_FILE=\\\" memfault_trace_reason_esp_idf_port_config.def\\\" "
259
+ ${MEMFAULT_EXTRA_COMPILE_OPTIONS}
235
260
)
236
261
# convert from list to string before setting
237
262
list (JOIN memfault_c_flags " " memfault_c_flags)
@@ -249,6 +274,7 @@ else()
249
274
"-DMEMFAULT_METRICS_USER_HEARTBEAT_DEFS_FILE=\" memfault_esp_metrics_heartbeat_config.def\" "
250
275
"-DMEMFAULT_PLATFORM_CONFIG_FILE=\" memfault_esp_idf_port_config.h\" "
251
276
"-DMEMFAULT_TRACE_REASON_USER_DEFS_FILE=\" memfault_trace_reason_esp_idf_port_config.def\" "
277
+ ${MEMFAULT_EXTRA_COMPILE_OPTIONS}
252
278
)
253
279
idf_build_set_property(
254
280
COMPILE_OPTIONS
0 commit comments