PlatformIO Community

Build error: Adafruit ST7735 and ST7789 Library on ESP8266 platform

Hello, new to PlatformIO here.
As the title said, I am trying to build a sample sketch from “Adafruit ST7735 and ST7789” library. Using Arduino IDE there was no problem building => uploading => running the sketch on NodeMCU v2. Using PlatformIO however there was this error (and many similar errors) from SD_ID161 library:

.platformio\lib\SD_ID161\utility\Sd2PinMap.h:371:2: error: #error Architecture or board not supported.

This is the Dependency Graph:

Dependency Graph
|-- <Wire> 1.0
|-- <Adafruit GFX Library> 1.7.5
|   |-- <Adafruit ILI9341> 1.5.4
|   |   |-- <Adafruit STMPE610> 1.1.1
|   |   |   |-- <SPI> 1.0
|   |   |   |-- <Wire> 1.0
|   |   |-- <Adafruit TouchScreen> 1.0.5
|   |   |-- <SPI> 1.0
|   |-- <SPI> 1.0
|-- <Adafruit ST7735 and ST7789 Library> 1.5.15
|   |-- <Adafruit GFX Library> 1.7.5
|   |   |-- <Adafruit ILI9341> 1.5.4
|   |   |   |-- <Adafruit STMPE610> 1.1.1
|   |   |   |   |-- <SPI> 1.0
|   |   |   |   |-- <Wire> 1.0
|   |   |   |-- <Adafruit TouchScreen> 1.0.5
|   |   |   |-- <SPI> 1.0
|   |   |-- <SPI> 1.0
|   |-- <Adafruit seesaw Library> 1.3.0
|   |   |-- <Wire> 1.0
|   |-- <SD>
|   |   |-- <SPI> 1.0
|   |-- <SPI> 1.0
|-- <SPI> 1.0

It seems that on ESP8266, there is a SD library that should be used instead of the default SD_ID161, I have tried adding this to my platformio.ini:

lib_deps = SD(esp8266)

which results in:

Dependency Graph
|-- <Wire> 1.0
|-- <SD(esp8266)> 2.0.0
|   |-- <SDFS> 0.1.0
|   |   |-- <SPI> 1.0
|   |   |-- <ESP8266SdFat> 1.1.0
|   |   |   |-- <SPI> 1.0       
|   |-- <SPI> 1.0
|   |-- <ESP8266SdFat> 1.1.0    
|   |   |-- <SPI> 1.0
|-- <Adafruit GFX Library> 1.7.5
|   |-- <Adafruit ILI9341> 1.5.4
|   |   |-- <Adafruit STMPE610> 1.1.1
|   |   |   |-- <SPI> 1.0
|   |   |   |-- <Wire> 1.0
|   |   |-- <Adafruit TouchScreen> 1.0.5
|   |   |-- <SPI> 1.0
|   |-- <SPI> 1.0
|-- <Adafruit ST7735 and ST7789 Library> 1.5.15
|   |-- <Adafruit GFX Library> 1.7.5
|   |   |-- <Adafruit ILI9341> 1.5.4
|   |   |   |-- <Adafruit STMPE610> 1.1.1
|   |   |   |   |-- <SPI> 1.0
|   |   |   |   |-- <Wire> 1.0
|   |   |   |-- <Adafruit TouchScreen> 1.0.5
|   |   |   |-- <SPI> 1.0
|   |   |-- <SPI> 1.0
|   |-- <Adafruit seesaw Library> 1.3.0
|   |   |-- <Wire> 1.0
|   |-- <SD>
|   |   |-- <SPI> 1.0
|   |-- <SPI> 1.0
|-- <SPI> 1.0

It seems that the default SD library is still being used as dependency of “Adafruit ST7735 and ST7789”, instead of using SD(esp8266). On Arduino IDE this seems not to be the case.

Any advice on how to build the sketch? Thanks in advance!

Which one from the https://github.com/adafruit/Adafruit-ST7735-Library/tree/master/examples exactly? What’s the full platformio.ini?

Thanks for replying! It was the graphic test example. Full platformio.ini:

[platformio]
default_envs = nodemcuv2

[env:nodemcuv2]
platform = espressif8266
board = nodemcuv2
framework = arduino
lib_deps = 
	Wire
	SD(esp8266)
lib_ldf_mode = deep+

PS: I am using 240*240 pixels ST7789 display, with SPI_MODE2 since the display does not have CS pin exposed.

I don’t see the SD library or the Seesaw library being used though in the sketch, so a workaround is to force these libraries to be ignored.

This compiles the graphicstest.ino just fine:

[platformio]
default_envs = nodemcuv2

[env:nodemcuv2]
platform = espressif8266
board = nodemcuv2
framework = arduino
lib_ignore = 
	SD
	Adafruit ILI9341	
	Adafruit seesaw Library
lib_deps =
	Adafruit ST7735 and ST7789 Library
	Adafruit GFX Library
	Wire
lib_ldf_mode = deep+
1 Like

Hm but I see the problem now. You cannot lib_ignore the wrong SD library (ID:161) and force it to use the correct library (which is the SD library of the framework, at https://github.com/esp8266/Arduino/tree/master/libraries/SD, so it’s built-in). This may actually be a problem if you need the SD card. I’ll open a bug report at https://github.com/platformio/platformio-core/issues/.

1 Like

Your lib_ignore workaround is very nice! But yeah unfortunately I do need to use SD card, since working with the display requires lots of resource files.

I’ll open a bug report at https://github.com/platformio/platformio-core/issues/.

So I must stick to Arduino IDE for now… Hope this will be fixed soon! Thanks for supporting :slight_smile: