plerup/makeEspArduino

compiling a sketch with Bodmers TFT_eSPI library

lugdunum-1964 opened this issue · 2 comments

Hi,

I recently got my hands on a LilyGo TTGO display. This is an esp32 with a TTF SPI display.

The instructions say to edit a User_Setup_Select.h file to select the proper hardware. Which I did.

But when trying to compile any of the examples in the TFT_eSPI library with makeEspArduino (mEA), I get a bunch of errors about PROGMEM not being defined and unknown classes.

Looking at the files that give these errors, I find that there are no header files included. Adding these manually gets me only so far. At some point mEA tries to compile a file for architecture that's not available on the TTGO.

I tried compiling with the Arduino IDE, and there it compiles just fine. My guess is that the Arduino IDE just concats all source files into one big file and then compiles. That means that some pieces will be blocked off by #ifdefined statements. Whereas mEA just tries to compile all files individually. And without headers that fails.

Are there other users of mEA who have been able to use TFT_eSPI?

commenting on myself...

I found that first running make, and then editing the resulting $(BUILD_DIR)/src_list.mk to remove all TFT_eSPI sources apart from the main TFT_eSPI.cpp from the USER_SRC variable works. The sketch compiled fine after this.

The problem really is with the way the library is written. The main file pulls in bits and pieces using includes. These are not header files, but bits of code that selectively get merged into the main source. They contain parts of classes and functions so will never compile separately.

mEA sticks all the source files it finds in $(BUILD_DIR)/src_list.mk and then tries to compile them. Which is bound to fail in this particular case.

I've tried overriding USER_SRC in the local makefile, without luck. Is there a way to exclude certain directories from the find process?

--
regards,
Lyon

sorry about this. Found the solution. EXCLUDE_DIRS does what I need.

in the makefile:

empty :=
space := $(empty) $(empty)

LIB_DIR := $(HOME)/src/esp32/libraries
TFT_DIR := TFT_eSPI

EXCLUDE_DIRS := $(strip $(subst /$(space),|,\
				$(subst $(LIB_DIR)/,,\
				$(dir $(wildcard $(LIB_DIR)/$(TFT_DIR)/*/)\
))))

Then include the mEA makefile.

Turns out: mEA is an awesome piece of work. Thanks Peter!