Eclipse Mars - PROGMEM results in Syntax Error

Hi community
As an old Eclipse (Java) Buff I wanted to give the Platformio Eclipse Integration a try. Now I am struggling with the following statement:

const char ArialMT_Plain_10 PROGMEM = {…};
Which gives me a syntax error. When I remove the PROGMEM statement it compiles just fine. I followed the instructions on the setup page but still can’t get the code to compile. I suspect that the compiler doesn’t know about the PROGMEM keyword. How can I teach it?

BTW: I just love the platformio stuff. It makes me a lot more at home than the Arduino IDE…

You may be missing appropriate include:

#include <avr/pgmspace.h>

Hm, I tried that now but the problems are still there. And since I am developing for the ESP8266 platform it would also feel a bit wrong to include something avr specific or am I wrong?

I’m sorry, you did not specify platform. PROGMEM is present only in AVR libc i think.

My bad I didn’t mention the platform. The PROGMEM statement is also known to the ESP8266/espressif platform. It works fine in the Atom IDE and the Arduino IDE. Just in Eclipse I get the Syntax error which later leads to an unknown symbol when I try to use that declaration. I also included the ESP8266 statement

#include <pgmspace.h>

but still no success…

Please share your platformio.ini and test code.

Hi @squix78 !

I’ve just compiled a simple project with a PROGMEM variable, everything works well.
Could you paste the content of the error message here?

Also, if you update platformio.ini and change platform/framework, you will need to re-init project again via platformio init --ide eclipse -b xxxx.

You guys are really responsive! Awesome community!

OK, I tried to update an example project:

I got confused about two things: I tried to install my oled library with

platformio lib install 562

And the command line tool said it was already installed, but Eclipse didn’t find the includes. And suddenly the board type nodemcuv2 seems to have disappeared?

OK, running platformio init after adding libraries in platformio.ini solved the library issue. I updated now the above repository and I get an error in the line

display.setFont(ArialMT_Plain_10);

because the font from the library has the mentioned syntax error due to the progmem issue…

GitHub - squix78/esp8266-ci-ota: Example for a continuus delivery by OTA project works OK with Eclipse Mars on my Windows machine.
Could you paste the content of the error message here?

In main.cpp:

Description Resource Path Location Type
Invalid arguments ’
Candidates are:
void setFont(const char *)
’ main.cpp /esp8266-ci-ota/src line 42 Semantic Error

and

Description Resource Path Location Type
Symbol ‘ArialMT_Plain_10’ could not be resolved main.cpp /esp8266-ci-ota/src line 43 Semantic Error

In SSD1306Fonts.h is only a warning “Syntax error”, but by removing the PROGMEM statement the two above errors disappear… And I should mention that I’m using Eclipse on Mac OS X

You have to copy your string from Flash to SRAM (strcpy_P() I believe), apparently this function does not accept Flash strings.

What do you see in the Eclipse console output panel? Does your project compile with PlatformIO CLI?

Feeling very stupid:-( While my Atom IDE was up to date with the latest version of platformio the version used by Eclipse wasn’t. So the initialisation for the IDE obviously used an old version which resulted in the mentioned errors.
So, for anybody having similar issues: MAKE SURE YOUR COMMAND LINE VERSION IS UP TO DATE!!!

Thank you guys for your help and sorry for having wasted your time…

  1. Thanks a lot for your contribution! :moneybag:
  2. PlatformIO IDE has built-in PlatformIO CLI. In this, you see 2 different versions of PlatformIO CLI.
  3. It seems that you have GLOBAL PlatformIO CLI in your system.

You can have 1 PlatformIO CLI in the system. Please open system terminal (not IDE Terminal) and uninstall old PlatformIO CLI via

sudo pip uninstall platformio

Then go to PlatformIO IDE and Menu: PlatformIO > Install Shell Commands.

I recommend using PlatformIO CLI from the IDE because IDE controls the version of the CLI and updates it once in a while.

Thanks Ivan, I will clean up my CLI mess:-). One more question: is there an easy way to have a serial monitor in Eclipse as there is in the Atom IDE, which preferably even opens automatically after an upload?

I use this Terminal Plugin https://marketplace.eclipse.org/content/terminal-plug
Just open Serial Terminal via pio serialports monitor

This is impossible in the current configuration :frowning: We don’t have own plugin for Eclipse. We propose integration with “customization” which we do on “init” process.