ammgtz
(Andres)
July 23, 2025, 5:03pm
1
Hi everyone,
I’ve been using freeRTOS with esp32 devices for a while, and recently a colleague suggested me to look into Percepio View to visualize, debug and analyze how my tasks are being scheduled and behaving.
I’ve followed the installation guide Getting Started with Percepio View on FreeRTOS , and I have made all the necessary changes for my specific board (Esp32 DevKitC) in my project. The project is being developed using the PlatformIO extension in VSC.
However, after making all the changes and including the trcRecorder
header file, the build fails and throws the following error:
C:/Users/andres/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/freertos/port/xtensa/include/freertos/portmacro.h:476:53: error: too few arguments to function 'vPortEnterCritical'
#define portENTER_CRITICAL(mux) vPortEnterCritical(mux)
I’m not entirely sure what the root cause of this issue is. I’ve searched through the web and forums for any kind of reference for this problem but haven’t found anything helpful.
I’m reaching out to the community to share my experience and see if anyone else has encountered this issue, and if so, how you resolved it. Any suggestions and insights would be greatly appreciated.
Best regards,
Andres
aggarg
(Gaurav Aggarwal)
July 23, 2025, 5:53pm
2
Can you share the complete build log?
ammgtz
(Andres)
July 23, 2025, 8:17pm
3
Here is the build log.
Processing esp32doit-devkit-v1 (platform: espressif32; board: esp32doit-devkit-v1; framework: arduino)
----------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32doit-devkit-v1.html
PLATFORM: Espressif 32 (6.11.0) > DOIT ESP32 DEVKIT V1
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, esp-bridge, esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:
- framework-arduinoespressif32 @ 3.20017.241212+sha.dcc1105b
- tool-esptoolpy @ 1.40501.0 (4.5.1)
- toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch5
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 39 compatible libraries
Scanning dependencies...
Dependency Graph
|-- Adafruit MCP4728 @ 1.0.9
|-- Adafruit SSD1306 @ 2.5.14
|-- Adafruit GFX Library @ 1.12.1
|-- TraceRecorder
|-- Wire @ 2.0.0
Building in release mode
Compiling .pio\build\esp32doit-devkit-v1\src\main.cpp.o
Compiling .pio\build\esp32doit-devkit-v1\lib522\TraceRecorder\streamports\RingBuffer\trcStreamPort.c.o
Compiling .pio\build\esp32doit-devkit-v1\lib522\TraceRecorder\trcAssert.c.o
Compiling .pio\build\esp32doit-devkit-v1\lib522\TraceRecorder\trcCounter.c.o
Compiling .pio\build\esp32doit-devkit-v1\lib522\TraceRecorder\trcDependency.c.o
Compiling .pio\build\esp32doit-devkit-v1\lib522\TraceRecorder\trcDiagnostics.c.o
Compiling .pio\build\esp32doit-devkit-v1\lib522\TraceRecorder\trcEntryTable.c.o
Compiling .pio\build\esp32doit-devkit-v1\lib522\TraceRecorder\trcError.c.o
Compiling .pio\build\esp32doit-devkit-v1\lib522\TraceRecorder\trcEvent.c.o
Compiling .pio\build\esp32doit-devkit-v1\lib522\TraceRecorder\trcEventBuffer.c.o
Compiling .pio\build\esp32doit-devkit-v1\lib522\TraceRecorder\trcExtension.c.o
Compiling .pio\build\esp32doit-devkit-v1\lib522\TraceRecorder\trcHardwarePort.c.o
Compiling .pio\build\esp32doit-devkit-v1\lib522\TraceRecorder\trcHeap.c.o
Compiling .pio\build\esp32doit-devkit-v1\lib522\TraceRecorder\trcISR.c.o
Compiling .pio\build\esp32doit-devkit-v1\lib522\TraceRecorder\trcInternalEventBuffer.c.o
Compiling .pio\build\esp32doit-devkit-v1\lib522\TraceRecorder\trcInterval.c.o
Compiling .pio\build\esp32doit-devkit-v1\lib522\TraceRecorder\trcKernelPort.c.o
Compiling .pio\build\esp32doit-devkit-v1\lib522\TraceRecorder\trcMultiCoreEventBuffer.c.o
Compiling .pio\build\esp32doit-devkit-v1\lib522\TraceRecorder\trcObject.c.o
Compiling .pio\build\esp32doit-devkit-v1\lib522\TraceRecorder\trcPrint.c.o
Compiling .pio\build\esp32doit-devkit-v1\lib522\TraceRecorder\trcRunnable.c.o
Compiling .pio\build\esp32doit-devkit-v1\lib522\TraceRecorder\trcSnapshotRecorder.c.o
Compiling .pio\build\esp32doit-devkit-v1\lib522\TraceRecorder\trcStackMonitor.c.o
Compiling .pio\build\esp32doit-devkit-v1\lib522\TraceRecorder\trcStateMachine.c.o
Compiling .pio\build\esp32doit-devkit-v1\lib522\TraceRecorder\trcStaticBuffer.c.o
Compiling .pio\build\esp32doit-devkit-v1\lib522\TraceRecorder\trcStreamPort.c.o
Compiling .pio\build\esp32doit-devkit-v1\lib522\TraceRecorder\trcStreamingRecorder.c.o
Compiling .pio\build\esp32doit-devkit-v1\lib522\TraceRecorder\trcString.c.o
Compiling .pio\build\esp32doit-devkit-v1\lib522\TraceRecorder\trcTask.c.o
Compiling .pio\build\esp32doit-devkit-v1\lib522\TraceRecorder\trcTimestamp.c.o
In file included from C:/Users/RD97JAK/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/freertos/include/freertos/portable.h:51,
from C:/Users/RD97JAK/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/freertos/include/freertos/FreeRTOS.h:64,
from lib/TraceRecorder/include/trcKernelPort.h:15,
from lib/TraceRecorder/include/trcRecorder.h:87,
from lib/TraceRecorder/trcSnapshotRecorder.c:11:
lib/TraceRecorder/trcSnapshotRecorder.c: In function 'vTraceClear':
C:/Users/andres/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/freertos/port/xtensa/include/freertos/portmacro.h:476:53: error: too few arguments to function 'vPortEnterCritical'
#define portENTER_CRITICAL(mux) vPortEnterCritical(mux)
^~~~~~~~~~~~~~~~~~
lib/TraceRecorder/include/trcKernelPort.h:178:2: note: in expansion of macro 'portENTER_CRITICAL'
portENTER_CRITICAL()
^~~~~~~~~~~~~~~~~~
lib/TraceRecorder/include/trcHardwarePort.h:812:40: note: in expansion of macro 'TRC_KERNEL_PORT_ENTER_CRITICAL_SECTION'
#define TRACE_ENTER_CRITICAL_SECTION() TRC_KERNEL_PORT_ENTER_CRITICAL_SECTION()
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/TraceRecorder/include/trcRecorder.h:1170:3: note: in expansion of macro 'TRACE_ENTER_CRITICAL_SECTION'
TRACE_ENTER_CRITICAL_SECTION(); \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/TraceRecorder/trcSnapshotRecorder.c:409:3: note: in expansion of macro 'trcCRITICAL_SECTION_BEGIN'
trcCRITICAL_SECTION_BEGIN();
^~~~~~~~~~~~~~~~~~~~~~~~~
C:/Users/andres/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/freertos/port/xtensa/include/freertos/portmacro.h:576:51: note: declared here
static inline void __attribute__((always_inline)) vPortEnterCritical(portMUX_TYPE *mux)
C:/Users/andres/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/freertos/port/xtensa/include/freertos/portmacro.h:477:53: error: too few arguments to function 'vPortExitCritical'
#define portEXIT_CRITICAL(mux) vPortExitCritical(mux)
^~~~~~~~~~~~~~~~~
lib/TraceRecorder/include/trcKernelPort.h:185:2: note: in expansion of macro 'portEXIT_CRITICAL'
portEXIT_CRITICAL()
^~~~~~~~~~~~~~~~~
lib/TraceRecorder/include/trcHardwarePort.h:815:39: note: in expansion of macro 'TRC_KERNEL_PORT_EXIT_CRITICAL_SECTION'
#define TRACE_EXIT_CRITICAL_SECTION() TRC_KERNEL_PORT_EXIT_CRITICAL_SECTION()
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/TraceRecorder/include/trcRecorder.h:1176:3: note: in expansion of macro 'TRACE_EXIT_CRITICAL_SECTION'
TRACE_EXIT_CRITICAL_SECTION(); \
^~~~~~~~~~~~~~~~~~~~~~~~~~~
lib/TraceRecorder/trcSnapshotRecorder.c:2572:2: note: in expansion of macro 'trcCRITICAL_SECTION_END'
trcCRITICAL_SECTION_END();
^~~~~~~~~~~~~~~~~~~~~~~
C:/Users/andres/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/freertos/port/xtensa/include/freertos/portmacro.h:234:6: note: declared here
void vPortExitCritical(portMUX_TYPE *mux);
^~~~~~~~~~~~~~~~~
Compiling .pio\build\esp32doit-devkit-v1\FrameworkArduino\esp32-hal-timer.c.o
*** [.pio\build\esp32doit-devkit-v1\lib522\TraceRecorder\trcSnapshotRecorder.c.o] Error 1
In file included from lib/TraceRecorder/include/trcRecorder.h:87,
from C:/Users/andres/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/freertos/include/esp_additions/freertos/FreeRTOSConfig.h:261,
from C:/Users/andres/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/freertos/include/freertos/FreeRTOS.h:58,
from C:/Users/andres/.platformio/packages/framework-arduinoespressif32/cores/esp32/esp32-hal.h:34,
from C:/Users/andres/.platformio/packages/framework-arduinoespressif32/cores/esp32/esp32-hal-timer.h:23,
from C:/Users/andres/.platformio/packages/framework-arduinoespressif32/cores/esp32/esp32-hal-timer.c:15:
lib/TraceRecorder/include/trcKernelPort.h:1088:21: error: expected identifier before '(' token
#define TIMER_START (EVENTGROUP_TIMER + 1UL) /*0xB1*/
^
C:/Users/andres/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/hal/include/hal/timer_types.h:63:5: note: in expansion of macro 'TIMER_START'
TIMER_START = 1, /*!<Start timer counter*/
^~~~~~~~~~~
*** [.pio\build\esp32doit-devkit-v1\FrameworkArduino\esp32-hal-timer.c.o] Error 1
aggarg
(Gaurav Aggarwal)
July 24, 2025, 6:47am
4
We have not tested TraceRecorder with Platformio + ESP32 yet, but this thread seems relevant:
You could try redefining TRC_KERNEL_PORT_ENTER_CRITICAL_SECTION in trcKernelPort.h to match the correct vPortEnterCritical arguments.
Also note that the Espressif version of FreeRTOS is quite different from the original FreeRTOS.org version in details affecting TraceRecorder compatibility. The guide for Percepio View assumes “vanilla” FreeRTOS. We have another guide for ESP-IDF (different trcKernelPort files), but I’m not sure if it applies to Platformio.