@ivankravets the LDF seems to have a problem here. Latest PIO core. Minimal example
[env:nanoatmega328]
platform = atmelavr
board = nanoatmega328
framework = arduino
lib_deps =
adafruit/Adafruit GPS Library@^1.5.3
arduino-libraries/SD @ 1.2.4
SoftwareSerial
lib_ldf_mode = deep+
#include <Arduino.h>
#include <Adafruit_GPS.h>
#include <SoftwareSerial.h>
// you can change the pin numbers to match your wiring:
SoftwareSerial mySerial(8, 7);
Adafruit_GPS GPS(&mySerial);
void setup() {}
void loop(){}
The LDF is unable to identify the dependency of the GPS library to the SoftwareSerial, even on deep+ or chain+.
Dependency Graph
|-- <Adafruit GPS Library> 1.5.3
| |-- <SPI> 1.0
| |-- <Wire> 1.0
|-- <SD> 1.2.4
| |-- <SPI> 1.0
|-- <SoftwareSerial> 1.0
|-- <SPI> 1.0
|-- <Wire> 1.0
Building in release mode
As soon as I comment out line 57 and 59 in the library, the dependency is recognized and the build goes through.
//#if (defined(__AVR__) || defined(ESP8266)) && defined(USE_SW_SERIAL)
#include <SoftwareSerial.h>
//#endif
Dependency Graph
|-- <Adafruit GPS Library> 1.5.3
| |-- <SoftwareSerial> 1.0
| |-- <SPI> 1.0
| |-- <Wire> 1.0
|-- <SD> 1.2.4
| |-- <SPI> 1.0
|-- <SoftwareSerial> 1.0
|-- <SPI> 1.0
|-- <Wire> 1.0
Building in release mode
Note the additional SoftwareSerial
beneath Adafruit GPS Library
, which previously wasn’t there.
@poulette, please do the following:
- Close VSCode.
- Open a windows explorer to Documents\PlatformIO\Projects<your project>
- Modify the
platformio.ini
of your project to
[env:nanoatmega328]
platform = atmelavr
board = nanoatmega328
framework = arduino
lib_deps =
marcoschwartz/LiquidCrystal_I2C@^1.1.4
seeed-studio/Grove 3Axis Compass V2.0 BMM150@^1.0.0
arduino-libraries/Servo@^1.1.7
arduino-libraries/SD @ 1.2.4
Adafruit GPS Library
SoftwareSerial
- Remove the
.pio
folder of the project
- Download the file https://github.com/adafruit/Adafruit_GPS/archive/1.5.3.zip
- Open the ZIP file and pull the
Adafruit_GPS-1.5.3
folder from inside there into the lib
folder of the project
- Rename the
Adafruit_GPS-1.5.3
folder to Adafruit GPS Library
- Open the file
Adafruit GPS Library\src\Adafruit_GPS.h
and search for the code block
#if (defined(__AVR__) || defined(ESP8266)) && defined(USE_SW_SERIAL)
#include <SoftwareSerial.h>
#endif
- Change that codeblock to
//#if (defined(__AVR__) || defined(ESP8266)) && defined(USE_SW_SERIAL)
#include <SoftwareSerial.h>
//#endif
- Re-Open VSCode and your project and hit the build button.
Building should give you a success now.
This procedure effectively makes PlatformIO use the GPS library that you put in the lib/
folder, which has a patch for removing a conditional include line that PlatformIO currently has problems with. I’m sure the bug will be solved ASAP and that procedure won’t be necessary then, but if you want to compile the firmware now, then you have to do that modification.