letscontrolit / ESPEasy

Easy MultiSensor device based on ESP8266/ESP32
http://www.espeasy.com
Other
3.28k stars 2.21k forks source link

ESP32: disabling ARDUINO_OTA fails the buil #3083

Closed fmuntean closed 4 years ago

fmuntean commented 4 years ago

I am trying to disable the ARDUINO_OTA feature for ESP32 board by commenting out the

define FEATURE_ARDUINO_OTA from inside the ESPEasy_common.h

The build fails with the following errors:

D:/git/HomeAutomation/ESPEasy/src/ESPEasyStorage.ino: In function 'String SaveSettings()':
D:/git/HomeAutomation/ESPEasy/src/ESPEasyStorage.ino:263:3: error: 'MD5Builder' was not declared in this scope
   MD5Builder md5;
Compiling .pio\build\MFD_ESP32_4M316k\src\src\Commands\MQTT.cpp.o
   ^
D:/git/HomeAutomation/ESPEasy/src/ESPEasyStorage.ino:296:3: error: 'md5' was not declared in this scope
   md5.begin();
   ^
D:/git/HomeAutomation/ESPEasy/src/ESPEasyStorage.ino: In function 'String LoadSettings()':
D:/git/HomeAutomation/ESPEasy/src/ESPEasyStorage.ino:344:3: error: 'MD5Builder' was not declared in this scope
   MD5Builder md5;
Compiling .pio\build\MFD_ESP32_4M316k\src\src\Commands\Networks.cpp.o
   ^
Compiling .pio\build\MFD_ESP32_4M316k\src\src\Commands\Notifications.cpp.o
D:/git/HomeAutomation/ESPEasy/src/ESPEasyStorage.ino:373:3: error: 'md5' was not declared in this scope
   md5.begin();
   ^
D:/git/HomeAutomation/ESPEasy/src/ESPEasyStorage.ino: In function 'String getPartitionType(byte, byte)':
D:/git/HomeAutomation/ESPEasy/src/ESPEasyStorage.ino:1263:3: error: 'esp_partition_type_t' was not declared in this scope
Compiling .pio\build\MFD_ESP32_4M316k\src\src\Commands\RTC.cpp.o
   esp_partition_type_t partitionType       = static_cast<esp_partition_type_t>(pType);
   ^
D:/git/HomeAutomation/ESPEasy/src/ESPEasyStorage.ino:1264:3: error: 'esp_partition_subtype_t' was not declared in this scope
   esp_partition_subtype_t partitionSubType = static_cast<esp_partition_subtype_t>(pSubType);
   ^
D:/git/HomeAutomation/ESPEasy/src/ESPEasyStorage.ino:1266:7: error: 'partitionType' was not declared in this scope
   if (partitionType == ESP_PARTITION_TYPE_APP) {
       ^
D:/git/HomeAutomation/ESPEasy/src/ESPEasyStorage.ino:1266:24: error: 'ESP_PARTITION_TYPE_APP' was not declared in this scope
   if (partitionType == ESP_PARTITION_TYPE_APP) {
                        ^
D:/git/HomeAutomation/ESPEasy/src/ESPEasyStorage.ino:1267:10: error: 'partitionSubType' was not declared in this scope
     if ((partitionSubType >= ESP_PARTITION_SUBTYPE_APP_OTA_MIN) &&
          ^
D:/git/HomeAutomation/ESPEasy/src/ESPEasyStorage.ino:1267:30: error: 'ESP_PARTITION_SUBTYPE_APP_OTA_MIN' was not declared in this scope
     if ((partitionSubType >= ESP_PARTITION_SUBTYPE_APP_OTA_MIN) &&
                              ^
D:/git/HomeAutomation/ESPEasy/src/ESPEasyStorage.ino:1268:29: error: 'ESP_PARTITION_SUBTYPE_APP_OTA_MAX' was not declared in this scope
         (partitionSubType < ESP_PARTITION_SUBTYPE_APP_OTA_MAX)) {
                             ^
D:/git/HomeAutomation/ESPEasy/src/ESPEasyStorage.ino:1274:13: error: 'partitionSubType' was not declared in this scope
     switch (partitionSubType) {
             ^
D:/git/HomeAutomation/ESPEasy/src/ESPEasyStorage.ino:1275:12: error: 'ESP_PARTITION_SUBTYPE_APP_FACTORY' was not declared in this scope
       case ESP_PARTITION_SUBTYPE_APP_FACTORY: return F("Factory app");
            ^
D:/git/HomeAutomation/ESPEasy/src/ESPEasyStorage.ino:1276:12: error: 'ESP_PARTITION_SUBTYPE_APP_TEST' was not declared in this scope
       case ESP_PARTITION_SUBTYPE_APP_TEST:    return F("Test app");
            ^
D:/git/HomeAutomation/ESPEasy/src/ESPEasyStorage.ino:1281:7: error: 'partitionType' was not declared in this scope
   if (partitionType == ESP_PARTITION_TYPE_DATA) {
       ^
D:/git/HomeAutomation/ESPEasy/src/ESPEasyStorage.ino:1281:24: error: 'ESP_PARTITION_TYPE_DATA' was not declared in this scope
   if (partitionType == ESP_PARTITION_TYPE_DATA) {
                        ^
D:/git/HomeAutomation/ESPEasy/src/ESPEasyStorage.ino:1282:13: error: 'partitionSubType' was not declared in this scope
     switch (partitionSubType) {
             ^
D:/git/HomeAutomation/ESPEasy/src/ESPEasyStorage.ino:1283:12: error: 'ESP_PARTITION_SUBTYPE_DATA_OTA' was not declared in this scope
       case ESP_PARTITION_SUBTYPE_DATA_OTA:      return F("OTA selection");
            ^
D:/git/HomeAutomation/ESPEasy/src/ESPEasyStorage.ino:1284:12: error: 'ESP_PARTITION_SUBTYPE_DATA_PHY' was not declared in this scope
       case ESP_PARTITION_SUBTYPE_DATA_PHY:      return F("PHY init data");
            ^
D:/git/HomeAutomation/ESPEasy/src/ESPEasyStorage.ino:1285:12: error: 'ESP_PARTITION_SUBTYPE_DATA_NVS' was not declared in this scope
       case ESP_PARTITION_SUBTYPE_DATA_NVS:      return F("NVS");
            ^
Compiling .pio\build\MFD_ESP32_4M316k\src\src\Commands\Rules.cpp.o
D:/git/HomeAutomation/ESPEasy/src/ESPEasyStorage.ino:1286:12: error: 'ESP_PARTITION_SUBTYPE_DATA_COREDUMP' was not declared in this scope
       case ESP_PARTITION_SUBTYPE_DATA_COREDUMP: return F("COREDUMP");
            ^
Compiling .pio\build\MFD_ESP32_4M316k\src\src\Commands\SDCARD.cpp.o
D:/git/HomeAutomation/ESPEasy/src/ESPEasyStorage.ino:1287:12: error: 'ESP_PARTITION_SUBTYPE_DATA_ESPHTTPD' was not declared in this scope
       case ESP_PARTITION_SUBTYPE_DATA_ESPHTTPD: return F("ESPHTTPD");
            ^
D:/git/HomeAutomation/ESPEasy/src/ESPEasyStorage.ino:1288:12: error: 'ESP_PARTITION_SUBTYPE_DATA_FAT' was not declared in this scope
       case ESP_PARTITION_SUBTYPE_DATA_FAT:      return F("FAT");
            ^
D:/git/HomeAutomation/ESPEasy/src/ESPEasyStorage.ino:1289:12: error: 'ESP_PARTITION_SUBTYPE_DATA_SPIFFS' was not declared in this scope
       case ESP_PARTITION_SUBTYPE_DATA_SPIFFS:   return F("SPIFFS");
            ^
D:/git/HomeAutomation/ESPEasy/src/ESPEasyStorage.ino:1294:13: error: 'partitionSubType' was not declared in this scope
   result += partitionSubType;
             ^
D:/git/HomeAutomation/ESPEasy/src/ESPEasyStorage.ino: In function 'String getPartitionTable(byte, const String&, const String&)':
Compiling .pio\build\MFD_ESP32_4M316k\src\src\Commands\Settings.cpp.o
Compiling .pio\build\MFD_ESP32_4M316k\src\src\Commands\System.cpp.o
D:/git/HomeAutomation/ESPEasy/src/ESPEasyStorage.ino:1316:3: error: 'esp_partition_type_t' was not declared in this scope
   esp_partition_type_t partitionType = static_cast<esp_partition_type_t>(pType);
   ^
Compiling .pio\build\MFD_ESP32_4M316k\src\src\Commands\Tasks.cpp.o
D:/git/HomeAutomation/ESPEasy/src/ESPEasyStorage.ino:1318:3: error: 'esp_partition_iterator_t' was not declared in this scope
Compiling .pio\build\MFD_ESP32_4M316k\src\src\Commands\Time.cpp.o
   esp_partition_iterator_t _mypartiterator = esp_partition_find(partitionType, ESP_PARTITION_SUBTYPE_ANY, NULL);
   ^
D:/git/HomeAutomation/ESPEasy/src/ESPEasyStorage.ino:1320:7: error: '_mypartiterator' was not declared in this scope
   if (_mypartiterator) {
Compiling .pio\build\MFD_ESP32_4M316k\src\src\Commands\Timer.cpp.o
       ^
D:/git/HomeAutomation/ESPEasy/src/ESPEasyStorage.ino:1322:13: error: 'esp_partition_t' does not name a type
       const esp_partition_t *_mypart = esp_partition_get(_mypartiterator);
             ^
D:/git/HomeAutomation/ESPEasy/src/ESPEasyStorage.ino:1323:29: error: '_mypart' was not declared in this scope
       result += formatToHex(_mypart->address);
                             ^
D:/git/HomeAutomation/ESPEasy/src/ESPEasyStorage.ino:1333:67: error: 'esp_partition_next' was not declared in this scope
     } while ((_mypartiterator = esp_partition_next(_mypartiterator)) != NULL);
                                                                   ^
D:/git/HomeAutomation/ESPEasy/src/ESPEasyStorage.ino:1335:34: error: '_mypartiterator' was not declared in this scope
   esp_partition_iterator_release(_mypartiterator);
                                  ^
D:/git/HomeAutomation/ESPEasy/src/ESPEasyStorage.ino:1335:49: error: 'esp_partition_iterator_release' was not declared in this scope
   esp_partition_iterator_release(_mypartiterator);
                                                 ^
D:/git/HomeAutomation/ESPEasy/src/Misc.ino: In function 'uint32_t progMemMD5check()':
D:/git/HomeAutomation/ESPEasy/src/Misc.ino:1080:5: error: 'MD5Builder' was not declared in this scope
     MD5Builder md5;
     ^
D:/git/HomeAutomation/ESPEasy/src/Misc.ino:1081:5: error: 'md5' was not declared in this scope
     md5.begin();
     ^
D:/git/HomeAutomation/ESPEasy/src/WebServer.ino: In function 'int getPartionCount(byte)':
D:/git/HomeAutomation/ESPEasy/src/WebServer.ino:1129:3: error: 'esp_partition_type_t' was not declared in this scope
   esp_partition_type_t partitionType       = static_cast<esp_partition_type_t>(pType);
   ^
D:/git/HomeAutomation/ESPEasy/src/WebServer.ino:1130:3: error: 'esp_partition_iterator_t' was not declared in this scope
   esp_partition_iterator_t _mypartiterator = esp_partition_find(partitionType, ESP_PARTITION_SUBTYPE_ANY, NULL);
   ^
D:/git/HomeAutomation/ESPEasy/src/WebServer.ino:1133:7: error: '_mypartiterator' was not declared in this scope
   if (_mypartiterator) {
       ^
D:/git/HomeAutomation/ESPEasy/src/WebServer.ino:1136:67: error: 'esp_partition_next' was not declared in this scope
     } while ((_mypartiterator = esp_partition_next(_mypartiterator)) != NULL);
                                                                   ^
In file included from src\src\Commands\Controller.cpp:6:0:
src\src\Commands\../../ESPEasy-Globals.h:21:4: warning: #warning "**** Using Settings from Custom.h File ***" [-Wcpp]
   #warning "**** Using Settings from Custom.h File ***"
    ^
D:/git/HomeAutomation/ESPEasy/src/WebServer.ino:1138:34: error: '_mypartiterator' was not declared in this scope
   esp_partition_iterator_release(_mypartiterator);
                                  ^
D:/git/HomeAutomation/ESPEasy/src/WebServer.ino:1138:49: error: 'esp_partition_iterator_release' was not declared in this scope
   esp_partition_iterator_release(_mypartiterator);
                                                 ^
D:/git/HomeAutomation/ESPEasy/src/WebServer.ino: In function 'void getPartitionTableSVG(byte, unsigned int)':
D:/git/HomeAutomation/ESPEasy/src/WebServer.ino:1149:3: error: 'esp_partition_type_t' was not declared in this scope
   esp_partition_type_t     partitionType = static_cast<esp_partition_type_t>(pType);
   ^
D:/git/HomeAutomation/ESPEasy/src/WebServer.ino:1150:9: error: 'esp_partition_t' does not name a type
   const esp_partition_t   *_mypart;
         ^
D:/git/HomeAutomation/ESPEasy/src/WebServer.ino:1151:3: error: 'esp_partition_iterator_t' was not declared in this scope
   esp_partition_iterator_t _mypartiterator = esp_partition_find(partitionType, ESP_PARTITION_SUBTYPE_ANY, NULL);
   ^
D:/git/HomeAutomation/ESPEasy/src/WebServer.ino:1155:7: error: '_mypartiterator' was not declared in this scope
   if (_mypartiterator) {
       ^
D:/git/HomeAutomation/ESPEasy/src/WebServer.ino:1157:7: error: '_mypart' was not declared in this scope
       _mypart = esp_partition_get(_mypartiterator);
       ^
D:/git/HomeAutomation/ESPEasy/src/WebServer.ino:1157:50: error: 'esp_partition_get' was not declared in this scope
       _mypart = esp_partition_get(_mypartiterator);
                                                  ^
D:/git/HomeAutomation/ESPEasy/src/WebServer.ino:1168:67: error: 'esp_partition_next' was not declared in this scope
     } while ((_mypartiterator = esp_partition_next(_mypartiterator)) != NULL);
                                                                   ^
D:/git/HomeAutomation/ESPEasy/src/WebServer.ino:1171:34: error: '_mypartiterator' was not declared in this scope
   esp_partition_iterator_release(_mypartiterator);
                                  ^
D:/git/HomeAutomation/ESPEasy/src/WebServer.ino:1171:49: error: 'esp_partition_iterator_release' was not declared in this scope
   esp_partition_iterator_release(_mypartiterator);
                                                 ^
D:/git/HomeAutomation/ESPEasy/src/WebServer_SysInfoPage.ino: In function 'void handle_sysinfo_Storage()':
D:/git/HomeAutomation/ESPEasy/src/WebServer_SysInfoPage.ino:669:24: error: 'ESP_PARTITION_TYPE_DATA' was not declared in this scope      
   getPartitionTableSVG(ESP_PARTITION_TYPE_DATA, 0x5856e6);
                        ^
D:/git/HomeAutomation/ESPEasy/src/WebServer_SysInfoPage.ino:675:24: error: 'ESP_PARTITION_TYPE_APP' was not declared in this scope
   getPartitionTableSVG(ESP_PARTITION_TYPE_APP, 0xab56e6);

This was possible for the ESP8266 boards before.

TD-er commented 4 years ago

OK, this is clearly a missing #ifdef somewhere and for ESP32 probably never tried before by anyone.

fmuntean commented 4 years ago

From my investigation I found that there are missing includes in ESPEasayStorage.ino

ifdef ESP32 //MFD: These were missing when not using the ARDUINO_OTA lib

include

include

endif

I can add a pull request for this if you want.

TD-er commented 4 years ago

@fmuntean If you could make a PR for it, that would be great.

fmuntean commented 4 years ago

@TD-er : this issue seems to be still here in 20200721 release:

This is the environment configuration I was able to build before but can't anymore [env:MFD_ESP32_4M316k] extends = esp32_common lib_ignore = ${esp32_common.lib_ignore}, ArduinoOTA, Adafruit SGP30 Sensor, Adafruit TCS34725, Adafruit TSL2591 Library, ESP8266_SSD1306, Adafruit ILI9341, Adafruit GFX Library, Adafruit Motor Shield V2 Library, Adafruit MPR121, Adafruit NeoPixel, Adafruit Unified Sensor, AM2320, Blynk, CHT16K33 LED Matrix Library, LiquidCrystal_I2C, RN2xx3 Arduino Library, SparkFun APDS9960 RGB and Gesture Sensor, TinyGPSPlus, MechInputs, SDM, SerialSensors, NewPingESP8266, HLW8012

lib_deps = https://github.com/TD-er/ESPEasySerial.git#v2.0.1, Adafruit ILI9341, Adafruit GFX Library

lib_deps = https://github.com/TD-er/ESPEasySerial.git#v2.0.1, https://github.com/lbernstone/Tone, MFRC522 platform = ${esp32_common.platform} build_flags = ${esp32_common.build_flags}
-D PLUGIN_BUILD_CUSTOM -D MFD_PLUGIN_SET_PROD -D USE_CUSTOM_H -D DONT_USE_SERVO -D ESP32 -D WEBSERVER_NEW_UI -D USES_P201 -D USES_P129 -D CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT board = esp32dev board_build.flash_mode = qio extra_scripts = ${esp32_common.extra_scripts} pre:tools/pio/pre_custom_esp32.py post:post_build_ESP32.py upload_speed = 921600

TD-er commented 4 years ago

It would help if you also gave the build errors. And your pre_custom_esp32.py

If you don't like to share it online, you can also email me.

Is the build error related to P012_LCD ? I tested with your config and I ran into a build error there which I cannot yet explain.

TD-er commented 4 years ago

I noticed MD5Builder is part of the Arduino_OTA library, so if you ignore that lib then MD5Builder will not work.

I will have a look at it.

TD-er commented 4 years ago

I will make a commit with a few changes I made. That commit, including this build env should probably work:

[env:MFD_ESP32_4M316k]
extends                   = esp32_common
board                     = esp32dev
platform                  = ${esp32_common.platform}
lib_ignore = ${esp32_common.lib_ignore}, ArduinoOTA, Adafruit SGP30 Sensor, Adafruit TCS34725, Adafruit TSL2591 Library, ESP8266_SSD1306, Adafruit ILI9341, Adafruit GFX Library, Adafruit Motor Shield V2 Library, Adafruit MPR121, Adafruit NeoPixel, Adafruit Unified Sensor, AM2320, Blynk, CHT16K33 LED Matrix Library, LiquidCrystal_I2C, RN2xx3 Arduino Library, SparkFun APDS9960 RGB and Gesture Sensor, TinyGPSPlus, MechInputs, SDM, SerialSensors, NewPingESP8266, HLW8012, LOLIN_EPD
lib_deps = ${esp32_common.lib_deps}, https://github.com/lbernstone/Tone, MFRC522
build_flags = ${esp32_common.build_flags} -DPLUGIN_BUILD_CUSTOM -D MFD_PLUGIN_SET_PROD -D DONT_USE_SERVO -D ESP32 -D WEBSERVER_NEW_UI -D USES_P201 -D USES_P129 -D CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT
board_build.flash_mode = qio
extra_scripts = ${esp32_common.extra_scripts} pre:tools/pio/pre_custom_esp32.py
upload_speed = 921600
fmuntean commented 4 years ago

It would help if you also gave the build errors. And your pre_custom_esp32.py

If you don't like to share it online, you can also email me.

Is the build error related to P012_LCD ? I tested with your config and I ran into a build error there which I cannot yet explain.

I don't have a custom pre ESP32 script. This is the one that is part of the ESPEasy project. I also just realized that I don't need it. The error was around the MD5Builder not being found. In my local env I have added #include inside misc.ino and it compiled. But the question is why do we need this for ESP32 ? I thought that based on previous discussions MD5 signing and validation is not used for ESP32 anymore.

fmuntean commented 4 years ago

You might have run into a different build error than me due to the fact that you might use different plugins. I use so many lib_ignore due to the fact that I don't need them as I am not using the plugins that are using those libraries. So no need to slow the process down. my MFD_PLUGIN_SET_PROD selection is:

// This selects only the plugins I use in my prod boards
#ifdef MFD_PLUGIN_SET_PROD
    # define PLUGIN_SET_NONE

    # define USES_P001 // Switch
    # define USES_P002 // ADC
    # define USES_P003 // Pulse
    # define USES_P014 // SI7021

    # define USES_P017 // PN532 RFID reader

    # define USES_P025 // ADS1115
    # define USES_P026 // SysInfo
    # define USES_P028 // BME280
    # define USES_P033 // Dummy
    # define USES_P069 // LM75A Temperature Sensor

    #define USES_P097   // Touch (ESP32)

    # define USES_P105 //RGBW Light
    # define USES_P123 // SI7013 Temperature Humindity and ADC
// # define USES_P129 // RC522 RFID reader
    # define USES_P200 // ADS1115 Thermistor

    # define CONTROLLER_SET_NONE
    # define USES_C005 // OpenHAB MQTT

// # define NOTIFIER_SET_NONE //MFD: setting this removes the notification page
    # ifdef NOTIFIER_SET_STABLE
        #  undef NOTIFIER_SET_STABLE
    # endif // ifdef NOTIFIER_SET_STABLE
    # ifdef NOTIFIER_SET_TESTING
        #  undef NOTIFIER_SET_TESTING
    # endif // ifdef NOTIFIER_SET_TESTING
    # ifdef NOTIFIER_SET_EXPERIMENTAL
        #  undef NOTIFIER_SET_EXPERIMENTAL
    # endif // ifdef NOTIFIER_SET_EXPERIMENTAL
    # ifdef NOTIFIER_SET_NONE
        #  undef NOTIFIER_SET_NONE
    # endif // ifdef NOTIFIER_SET_NONE
    # define USES_N002  // Buzzer

#endif      // ifdef MFD_PLUGIN_SET_PROD
TD-er commented 4 years ago

With the pending PR and the esp32 env for in your .ini file I can build it just fine with this plugin set you showed.

fmuntean commented 4 years ago

With the pending PR and the esp32 env for in your .ini file I can build it just fine with this plugin set you showed.

Great: let's have this PR moved forward and I can test it locally.

TD-er commented 4 years ago

It has been merged.

fmuntean commented 4 years ago

tested with latest and now builds successful.