ESP32-S2 Hello World fails to printf USBSERIAL not found

reducing to the least common denominator… can’t get printf to work on ESP32-S2 with framework = espidf, arduino This works with ESP32-S3

platformio:

[env:lolin_s2_mini]
platform = espressif32
board = lolin_s2_mini
framework = espidf, arduino

main.cpp

#include <Arduino.h>
#include <stdio.h>
#include "sdkconfig.h"

void setup()
{
printf("Hello World\n");
}

void loop()
{}

errors:

In file included from C:/Users/peted/.platformio/packages/framework-arduinoespressif32-src-16f16f9b46f255eba682607449bb3231/cores/esp32/Arduino.h:196,
                 from C:/Users/peted/.platformio/packages/framework-arduinoespressif32-src-16f16f9b46f255eba682607449bb3231/cores/esp32/chip-debug-report.cpp:17:
C:/Users/peted/.platformio/packages/framework-arduinoespressif32-src-16f16f9b46f255eba682607449bb3231/cores/esp32/chip-debug-report.cpp: In function 'void printBeforeSetupInfo()':     
C:/Users/peted/.platformio/packages/framework-arduinoespressif32-src-16f16f9b46f255eba682607449bb3231/cores/esp32/HardwareSerial.h:360:16: error: 'USBSerial' was not declared in this scope; did you mean 'Serial'?
  360 | #define Serial USBSerial
      |                ^~~~~~~~~
C:/Users/peted/.platformio/packages/framework-arduinoespressif32-src-16f16f9b46f255eba682607449bb3231/cores/esp32/chip-debug-report.cpp:260:3: note: in expansion of macro 'Serial'     
  260 |   Serial.begin(0);
  • List item