PlatformIO/Arduino/ESP-IDF: 'Serial' was not declared in this scope
Posted: Tue Dec 12, 2023 11:06 pm
I am writing a library that I'd like to be as portable as possible, and my development boards are all ESP32-based (the board I'm using currently is the Unexpected Maker Feather S3). I had been primarily using PlatformIO, with platform = espressif32 and framework = arduino until yesterday, when I realized I was going to need some of the APIs implemented in ESP-IDF.
I then spent several hours trying to get it compiling in the ESP-IDF VS Code extension, with no luck–I couldn't get all of my Arduino-based dependencies to cooperate. As a result, I kept researching and discovered framework-arduinoespressif32 and framework-espidf which I am now using in PlatformIO as follows:
This *almost* works for me, but I have one compiler error that I cannot figure out: 'Serial' is no longer defined, so I've got errors coming from everywhere.
I looked into it the best I could, and found HardwareSerial.h, which declares Serial if !ARDUINO_USB_CDC_ON_BOOT && !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_SERIAL).
I have gone through menuconfig a dozen times, and I cannot come up with a configuration that resolves this situation.
If anyone has some insight into this problem, I would greatly appreciate being pointed in the right direction.
Thanks in advance!
I then spent several hours trying to get it compiling in the ESP-IDF VS Code extension, with no luck–I couldn't get all of my Arduino-based dependencies to cooperate. As a result, I kept researching and discovered framework-arduinoespressif32 and framework-espidf which I am now using in PlatformIO as follows:
Code: Select all
platform = espressif32
platform_packages = platformio/framework-arduinoespressif32
board = um_feathers3
framework = arduino, espidf
lib_deps [...]
This *almost* works for me, but I have one compiler error that I cannot figure out: 'Serial' is no longer defined, so I've got errors coming from everywhere.
I looked into it the best I could, and found HardwareSerial.h, which declares Serial if !ARDUINO_USB_CDC_ON_BOOT && !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_SERIAL).
I have gone through menuconfig a dozen times, and I cannot come up with a configuration that resolves this situation.
If anyone has some insight into this problem, I would greatly appreciate being pointed in the right direction.
Thanks in advance!