PROGMEM being redifined in project

I am currently trying to make a canbus gauge for my car and used lvgl with squareline studio to create a UI. I am pushing that UI from my teensy 4.0 to a small round lcd display with TFT_eSPI. I continue to get this warning...

In file included from C:\Users\elias\OneDrive\Desktop\CANGauge\ui\ui.ino:2:
c:\Users\elias\OneDrive\Desktop\CANGauge\ui\libraries\TFT_eSPI/TFT_eSPI.h:64: warning: "PROGMEM" redefined
   64 |   #define PROGMEM
      | 
In file included from C:\Users\elias\AppData\Local\Arduino15\packages\teensy\hardware\avr\1.59.0\cores\teensy4/WProgram.h:42,
                 from C:\Users\elias\AppData\Local\Temp\arduino\sketches\4764E34AF4BFE0814E69E258FE3A0AC8\pch\Arduino.h:6:
C:\Users\elias\AppData\Local\Arduino15\packages\teensy\hardware\avr\1.59.0\cores\teensy4/avr/pgmspace.h:30: note: this is the location of the previous definition
   30 | #define PROGMEM __attribute__((section(".progmem")))
      | 
In file included from C:\Users\elias\OneDrive\Desktop\CANGauge\ui\ui.ino:2:
c:\Users\elias\OneDrive\Desktop\CANGauge\ui\libraries\TFT_eSPI/TFT_eSPI.h:883:8: warning: #warning >>>>------>> TOUCH_CS pin not defined, TFT_eSPI touch functions will not be available! [-Wcpp]
  883 |       #warning >>>>------>> TOUCH_CS pin not defined, TFT_eSPI touch functions will not be available!
      |        ^~~~~~~
Opening Teensy Loader...
Memory Usage on Teensy 4.0:
  FLASH: code:205280, data:102344, headers:8788   free for files:1715204
   RAM1: variables:165344, code:203496, padding:25880   free for local variables:129568
   RAM2: variables:12416  free for malloc/new:511872

I am not worried about the touch pin warning as my display is not touch screen. (Hopefully I can rightfully ignore this) But I am unsure if the redefinition of PROGMEM will cause an issue, as my hardware is not fully set up yet. I already tried to go into the pgmspace.h and mess with the define in there and the compiler got angry. I took a peek into the TFT_eSPI.h and found the define in an elseif but can't figure out what's going on.

// Handle FLASH based storage e.g. PROGMEM
#if defined(ARDUINO_ARCH_RP2040)
  #undef pgm_read_byte
  #define pgm_read_byte(addr)   (*(const unsigned char *)(addr))
  #undef pgm_read_word
  #define pgm_read_word(addr) ({ \
    typeof(addr) _addr = (addr); \
    *(const unsigned short *)(_addr); \
  })
  #undef pgm_read_dword
  #define pgm_read_dword(addr) ({ \
    typeof(addr) _addr = (addr); \
    *(const unsigned long *)(_addr); \
  })
#elif defined(__AVR__)
  #include <avr/pgmspace.h>
#elif defined(ESP8266) || defined(ESP32)
  #include <pgmspace.h>
#else
  #define PROGMEM
#endif

Any help would be appreciated. Would be awesome if this is ignorable as well. Hopefully I have my hardware set up in the coming days and can test my display.

PROGMEM is useful only with older Arduinos that use ATmega processors, like the Uno. It should be ignored on modern processors, and not cause problems.

If it does cause problems, you will need to change to code to remove PROGMEM and related function calls.

Beautiful, exactly what I wanted to hear haha. worst case I will comment it out of the TFT_eSPI.h file and let the teensy 4 pgmspace.h file do its thing.

It does match my display??? There just seemed to be a definition of PROGMEM in the tft_eSPI header file as well as a definition of it in a teensyduino header file, specifically pgmspace.h. Just wanted to see if that would cause any issues. Once my hardware comes in I will know for sure via bench test.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.