How can one load an ino file from Arduino IDE into Eclipse/Sloeber ?

So far I have used the Arduino IDE and now wanted to switch to Eclipse. That failed miserably: no matter what versions of eclipse or plugins I tried, I could not even compile the most trivial sketches. Ohh, they call it projects in eclipse...

Finally I installed the Sloeber all-in-one version (4.3.1), and that at least works. Loading from the Arduino examples I can execute them successfully on a ESP32 WROVER, and some newly created test scripts also compile and work. So far looks ok.

But I have some complex Arduino Sketches *.ino, which I would like to load into the sloeber ide now, but I find no way to do it.

How is that done? Or is it really impossible?

create in Eclipse an Arduino sketch with the name of you project and copy the files of your sketch into this new Eclipse project

Aaahh! That wasn't too difficult :slight_smile:

In the meantime I have also learned how to include all those other missing libraries; ok.

But now I am stuck at the next issue: My Arduino-IDE developed sketch has additional 4 sub-sketches, all of the *.ino type, which are opened as additional tabs in the A-IDE, and somehow magically use the includes and definitions of the main sketch.

I have brought them into the Eclipse/Sloeber-IDE via File-->Import and also via Arduino-->Add a source folder ... (both commands seem to be doing the same thing?), but now they are in the project, but eclipse has no idea what to do with them. I am getting errors like:

../AM_sl1.ino:182:17: error: 'initDisplay' was not declared in this scope
initDisplay();
^

Which is not surprsing, because initDisplay is one of the functions in those other sketches.

How do I make Eclipse aware of of those other *.ino files?

ullix:
Aaahh! That wasn't too difficult :slight_smile:

In the meantime I have also learned how to include all those other missing libraries; ok.

But now I am stuck at the next issue: My Arduino-IDE developed sketch has additional 4 sub-sketches, all of the *.ino type, which are opened as additional tabs in the A-IDE, and somehow magically use the includes and definitions of the main sketch.

I have brought them into the Eclipse/Sloeber-IDE via File-->Import and also via Arduino-->Add a source folder ... (both commands seem to be doing the same thing?), but now they are in the project, but eclipse has no idea what to do with them. I am getting errors like:

Which is not surprsing, because initDisplay is one of the functions in those other sketches.

How do I make Eclipse aware of of those other *.ino files?

they should all be in the root of the project. paste them there as complete files or drag and drop them there

Screenshot from 2019-10-19 16-48-52.png

Screenshot from 2019-10-19 16-48-52.png

Couldn't be any easier - once you know it. Thanks again!

Now, while this hurdle was taken, it stopped me at compiling with a bug somewhere. I just don't know where to look.

I shrunk my sketch down to the minimum. This runs well when started on Arduino-IDE, but does not compile on Eclipse/Sloeber. This is the simplified code:

// simple Webservertest
#include <Arduino.h>
#include "WiFi.h"
#include "WebServer.h"

/* SSID & Password */
const char* ssid = " YourNetworkName";  // Enter SSID here
const char* password = " YourPassword";  //Enter Password here


WebServer server(80);

void setup() {
  Serial.begin(115200);
  Serial.println("");

  // Double WiFi.begin and delay is workaround for bug reported here:
  // https://www.esp32.com/viewtopic.php?f=19&t=12720&sid=3ed49d3cf2cbb7e1549d760f83444359
  WiFi.begin(ssid, password);  //Connect to the WiFi network
  delay(200);
  WiFi.begin(ssid, password);

  while (WiFi.status() != 3) {  //Wait for connection; WL_CONNECTED==3
    Serial.println("Waiting for WiFi connection…");
    delay(500);
  }

  Serial.print("IP address: ");
  Serial.println(WiFi.localIP());    // local IP

  server.on("/",  []() {
    server.send(200, "text / plain", "Greetings from root dir");});

  server.on("/test", []() {
    server.send(200, "text / plain", "Plain text on test");  });

  server.begin();                    //Start the server
  Serial.println("Server listening");
}

void loop() {
  server.handleClient();            //Handling of incoming requests
}

The double WiFi.begin and delay are needed to cope with a bug described here: No WiFi connection after upload - odd workaround needed - ESP32 Forum but as it is coded it runs well (only on Arduino-IDE.)

However, compiling on sloeber gives this message:

Starting C++ compile
...
In file included from /home/ullix/sloeber/arduinoPlugin/packages/esp32/hardware/esp32/1.0.4/libraries/WebServer/src/WebServer.cpp:32:0:
/home/ullix/sloeber//arduinoPlugin/packages/esp32/hardware/esp32/1.0.4/tools/sdk/include/mbedtls/mbedtls/md5.h:34:10: error: #include expects "FILENAME" or <FILENAME>
 #include MBEDTLS_CONFIG_FILE
          ^
make: *** [libraries/WebServer/src/WebServer.cpp.o] Fehler 1
libraries/WebServer/src/subdir.mk:28: die Regel für Ziel „libraries/WebServer/src/WebServer.cpp.o“ scheiterte

The md5.h file has this content:

#if !defined(MBEDTLS_CONFIG_FILE)
#include "config.h"
#else
#include MBEDTLS_CONFIG_FILE
#endif

Where do I have to look?

something eats the "

open in Sloeber installation folder arduinoPlugin/packages/esp32/hardware/esp32/1.0.4/platform.txt

and change
-DMBEDTLS_CONFIG_FILE="mbedtls/esp_config.h"
to
-DMBEDTLS_CONFIG_FILE="<mbedtls/esp_config.h>"

then restart Eclipse or open project Properties, select other boards package and board, click Apply (not Close) and the select back the Esp32 board. it will reload platform.txt

try WiFi.disconnect() instead of first begin. or try WiFi.setAutoConnect(false)

Juraj: you were right again with your advice, and I very much appreciate your help. Though I am wondering - how could I possibly have discovered how to solve this bug on my own? Is there some system between the complexity of Eclipse IDE and Arduino IDE, which I be able to master? I feel a bit overwhelmed.

Because, while this bug has been solved, the next one has come up, and this although the "Sketch" is a really simple one. The next problem:

In file included from /home/ullix/sloeber/arduinoPlugin/libraries/FreeRTOS/10.2.0-3/src/Arduino_FreeRTOS.h:56:0,
                 from /home/ullix/sloeber/arduinoPlugin/libraries/FreeRTOS/10.2.0-3/src/croutine.c:28:
/home/ullix/sloeber/arduinoPlugin/libraries/FreeRTOS/10.2.0-3/src/FreeRTOSConfig.h:31:20: fatal error: avr/io.h: No such file or directory
libraries/FreeRTOS/src/subdir.mk:49: die Regel für Ziel „libraries/FreeRTOS/src/croutine.c.o“ scheiterte
compilation terminated.

What is this avr/io.h - is it file io.h in subdirectory avr, or does the / have a different meaning?

I think the WiFi.begin issue gets even weirder. Since sloeber did not compile, I tried your advice on the Arduino-IDE.

I left only a single WiFi.begin(ssid, password); in the code, preceded by either WiFi.disconnect(); or WiFi.setAutoConnect(false); or neither. In all 3 cases it worked only every 2nd time. Like EXACTLY every 2nd time with a long delay due to re-uploading the code.

In effect, this is the same as having my original solution of a double WiFi.begin() !?

But I had always re-uploaded the code. So who keeps a memory of the WiFi connections? Is it the ESP32, or is it my router?

ullix:
Juraj: you were right again with your advice, and I very much appreciate your help. Though I am wondering - how could I possibly have discovered how to solve this bug on my own? Is there some system between the complexity of Eclipse IDE and Arduino IDE, which I be able to master? I feel a bit overwhelmed.

the compile command was in Console right above the error, so I saw there the -DMBEDTLS_CONFIG_FILE=mbedtls/esp_config.h without "". so I checked the platform.txt

ullix:
Because, while this bug has been solved, the next one has come up, and this although the "Sketch" is a really simple one. The next problem:

In file included from /home/ullix/sloeber/arduinoPlugin/libraries/FreeRTOS/10.2.0-3/src/Arduino_FreeRTOS.h:56:0,

from /home/ullix/sloeber/arduinoPlugin/libraries/FreeRTOS/10.2.0-3/src/croutine.c:28:
/home/ullix/sloeber/arduinoPlugin/libraries/FreeRTOS/10.2.0-3/src/FreeRTOSConfig.h:31:20: fatal error: avr/io.h: No such file or directory
libraries/FreeRTOS/src/subdir.mk:49: die Regel für Ziel „libraries/FreeRTOS/src/croutine.c.o“ scheiterte
compilation terminated.




What is this avr/io.h - is it file io.h in subdirectory avr, or does the / have a different meaning?

the library is not for ESP32

ullix:
I think the WiFi.begin issue gets even weirder. Since sloeber did not compile, I tried your advice on the Arduino-IDE.

I left only a single WiFi.begin(ssid, password); in the code, preceded by either WiFi.disconnect(); or WiFi.setAutoConnect(false); or neither. In all 3 cases it worked only every 2nd time. Like EXACTLY every 2nd time with a long delay due to re-uploading the code.

In effect, this is the same as having my original solution of a double WiFi.begin() !?

But I had always re-uploaded the code. So who keeps a memory of the WiFi connections? Is it the ESP32, or is it my router?

the ESP32 SDK stores the ssid and pass in flash to start the connection immediately after power-up or reset.

WiFi.persistent(true) and WiFi.setAutoConnect(true) is the default.