[Resolved] SoftwareSerial.cpp:41:10: fatal error: avr/interrupt.h: No such file or directory

Microsoft Windows 11 Version 22H2 (OS Build 22621.4249)
PlatformIO Core 6.1.16·Home 3.4.4 ( airm2m_core_esp32c3 board selected )
ESP32-C3-ZERO
Zadig 2.9 (Build 788)
FTDI driver CDM212364_Setup

I am using ESP32-C3 to compile for Arduino platform, and encountered error below.

Compiling .pio\build\airm2m_core_esp32c3\lib6b7\SoftwareSerial\SoftwareSerial.cpp.o
.pio/libdeps/airm2m_core_esp32c3/SoftwareSerial/SoftwareSerial.cpp:41:10: fatal error: avr/interrupt.h: No such file or directory
 #include <avr/interrupt.h>
          ^~~~~~~~~~~~~~~~~
compilation terminated.
The platformio.ini
[env:airm2m_core_esp32c3]
platform = espressif32
board = airm2m_core_esp32c3
framework = arduino
upload_port = \\.\COM16
upload_speed = 9600
upload_protocol = esptool
debug_tool = esp-prog
debug_init_break = tbreak setup
debug_speed = 1000
build_flags =
    -D ARDUINO_USB_MODE=1
    -D ARDUINO_USB_CDC_ON_BOOT=1
    -std=c++17
lib_ignore = FreeRTOS
lib_deps =
featherfly/SoftwareSerial@^1.0

Any help is greatly appreciated.

This doesn’t match together.
Your include statement is for AVR architecture.
Check the example from the featherlfy library

But why do you need a software serial on an ESP32-C3?
It has 2 hardware UART interfaces!

The first can be accessed via Serial0 (because you have ARDUINO_USB_CDC_ON_BOOT=1) and the second is Serial1.

GPIOs RX TX
Serial0 20 21
Serial1 18 19

hi,

Your include statement is for AVR architecture.

  • That’s strange to me too, as it is not from my code, it is from the SoftwareSerial itself and I saw this library supports “Espressif 32” as shown picture below highlighted.

image

“But why do you need a software serial on an ESP32-C3?”

  • To test the SoftwareSerial library by Arduino on ESP32, as using existing written code that is from ATmega328p.

Apologizing, just added EspSoftwareSerial by Dirk Kaar, now things running smoothly already. Thank you.