Can the tracing hook macros be redefined in Arduino?

greengnu
Posts: 66
Joined: Wed May 08, 2019 8:45 pm

Can the tracing hook macros be redefined in Arduino?

Postby greengnu » Thu Jul 17, 2025 12:48 pm

can the FreeRTOS trace hook macros (https://freertos.org/Documentation/02-K ... ce-feature) be used in Arduino?

I tried to use them by creating a custom FreeRTOSConfig.h:

Code: Select all

#include_next "freertos/FreeRTOSConfig.h"

#ifdef __cplusplus
extern "C" {
#endif

void vTaskSwitchedIn(void *pxTCB);
void vTaskSwitchedOut(void *pxTCB);

#ifdef __cplusplus
}
#endif

#define traceTASK_SWITCHED_IN()     vTaskSwitchedIn(pxCurrentTCB)
#define traceTASK_SWITCHED_OUT()    vTaskSwitchedOut(pxCurrentTCB)
and then implementing vTaskSwitchedIn and vTaskSwitchedOut in the .ino, but they never get called.

Adding #define configUSE_TRACE_FACILITY 1 doesn't make a difference either.

Is this possible in Arduino?

lbernstone
Posts: 1132
Joined: Mon Jul 22, 2019 3:20 pm

Re: Can the tracing hook macros be redefined in Arduino?

Postby lbernstone » Thu Jul 17, 2025 6:04 pm

Arduino-esp32 uses a pre-compiled version of ESP-IDF. This means any #define macros in that code have already been compiled in. This would include those trace macros for FreeRTOS, along with any of the Kconfig CONFIG_XX macros. To make these changes (or enable AppTracing in IDF), you would need to make your own archives with lib-builder, or use arduino as an esp-idf component.

Who is online

Users browsing this forum: PerplexityBot and 3 guests