ESP-IDF component with Arduino

sukeshak
Posts: 32
Joined: Sat Aug 19, 2017 10:20 am

ESP-IDF component with Arduino

Postby sukeshak » Thu Sep 14, 2017 7:21 pm

Hello everyone,

I am using the following instruction and trying to get ESP-IDF simple CPP program compiled.
https://github.com/espressif/arduino-esp32/blob/master/docs/esp-idf_component.md

Need help since its not compiling.

Code: Select all

#ifndef ARDUINO_ARCH_ESP32
#define ARDUINO_ARCH_ESP32
#endif

#include <Arduino.h>

#define LED_PIN 13
#define TAG "ESP32_ARDUINO"

extern "C"
{
   #include "sdkconfig.h"
   #include "esp_log.h"
   #include "freertos/FreeRTOS.h"
   #include "freertos/task.h"
   void app_main(void);
}

void app_main(void) {
   ESP_LOGI(TAG,"Starting...");
   initArduino();
   pinMode(LED_PIN,OUTPUT);
   digitalWrite(LED_PIN,HIGH);
   delay(1000);
   digitalWrite(LED_PIN,LOW);
   delay(1000);
   ESP_LOGI(TAG,"Done...");
}


Fails compilation and shows the following error

Code: Select all

CXX build/main/main.o
In file included from D:/msys32/home/sukesh/esp/ESP32_Arduino_template/components/arduino/cores/esp32/Arduino.h:149:0,
                 from D:/msys32/home/sukesh/esp/ESP32_Arduino_template/main/main.cpp:7:
D:/msys32/home/sukesh/esp/ESP32_Arduino_template/components/arduino/cores/esp32/WString.h:38:0: warning: "F" redefined
 #define F(string_literal) (reinterpret_cast<const __FlashStringHelper *>(PSTR(string_literal)))
 ^
In file included from D:/msys32/home/sukesh/esp/ESP32_Arduino_template/components/arduino/cores/esp32/WString.h:29:0,
                 from D:/msys32/home/sukesh/esp/ESP32_Arduino_template/components/arduino/cores/esp32/Arduino.h:149,
                 from D:/msys32/home/sukesh/esp/ESP32_Arduino_template/main/main.cpp:7:
D:/github/esp/esp-idf/components/AzureIoTHub/include/pgmspace.h:41:0: note: this is the location of the previous definition
 #define F(s)          (s)
 ^
In file included from D:/msys32/home/sukesh/esp/ESP32_Arduino_template/components/arduino/cores/esp32/Arduino.h:149:0,
                 from D:/msys32/home/sukesh/esp/ESP32_Arduino_template/main/main.cpp:7:
D:/msys32/home/sukesh/esp/ESP32_Arduino_template/components/arduino/cores/esp32/WString.h:37:7: error: using typedef-name '__FlashStringHelper' after 'class'
 class __FlashStringHelper;
       ^
In file included from D:/msys32/home/sukesh/esp/ESP32_Arduino_template/components/arduino/cores/esp32/WString.h:29:0,
                 from D:/msys32/home/sukesh/esp/ESP32_Arduino_template/components/arduino/cores/esp32/Arduino.h:149,
                 from D:/msys32/home/sukesh/esp/ESP32_Arduino_template/main/main.cpp:7:
D:/github/esp/esp-idf/components/AzureIoTHub/include/pgmspace.h:32:14: note: '__FlashStringHelper' has a previous declaration here
 typedef char __FlashStringHelper;
              ^
In file included from D:/msys32/home/sukesh/esp/ESP32_Arduino_template/components/arduino/cores/esp32/Arduino.h:149:0,
                 from D:/msys32/home/sukesh/esp/ESP32_Arduino_template/main/main.cpp:7:
D:/msys32/home/sukesh/esp/ESP32_Arduino_template/components/arduino/cores/esp32/WString.h:59:5: error: 'String::String(const __FlashStringHelper*)' cannot be overloaded
     String(const __FlashStringHelper *str) : String(reinterpret_cast<const char *>(str)) {};
     ^
D:/msys32/home/sukesh/esp/ESP32_Arduino_template/components/arduino/cores/esp32/WString.h:57:5: error: with 'String::String(const char*)'
     String(const char *cstr = "");
     ^
D:/msys32/home/sukesh/esp/ESP32_Arduino_template/components/arduino/cores/esp32/WString.h:93:14: error: 'String& String::operator=(const __FlashStringHelper*)' cannot be overloaded
     String & operator = (const __FlashStringHelper *str);
              ^
D:/msys32/home/sukesh/esp/ESP32_Arduino_template/components/arduino/cores/esp32/WString.h:92:14: error: with 'String& String::operator=(const char*)'
     String & operator =(const char *cstr);
              ^
D:/msys32/home/sukesh/esp/ESP32_Arduino_template/components/arduino/cores/esp32/WString.h:114:19: error: 'unsigned char String::concat(const __FlashStringHelper*)' cannot be overloaded
     unsigned char concat(const __FlashStringHelper * str);
                   ^
D:/msys32/home/sukesh/esp/ESP32_Arduino_template/components/arduino/cores/esp32/WString.h:105:19: error: with 'unsigned char String::concat(const char*)'
     unsigned char concat(const char *cstr);
                   ^
D:/msys32/home/sukesh/esp/ESP32_Arduino_template/components/arduino/cores/esp32/WString.h:168:14: error: 'String& String::operator+=(const __FlashStringHelper*)' cannot be overloaded
     String & operator += (const __FlashStringHelper *str)
              ^
D:/msys32/home/sukesh/esp/ESP32_Arduino_template/components/arduino/cores/esp32/WString.h:123:14: error: with 'String& String::operator+=(const char*)'
     String & operator +=(const char *cstr)
              ^
D:/msys32/home/sukesh/esp/ESP32_Arduino_template/components/arduino/cores/esp32/WString.h:275:14: error: 'String& String::copy(const __FlashStringHelper*, unsigned int)' cannot be overloaded
     String & copy(const __FlashStringHelper *pstr, unsigned int length);
              ^
D:/msys32/home/sukesh/esp/ESP32_Arduino_template/components/arduino/cores/esp32/WString.h:274:14: error: with 'String& String::copy(const char*, unsigned int)'
     String & copy(const char *cstr, unsigned int length);
              ^
In file included from D:/msys32/home/sukesh/esp/ESP32_Arduino_template/components/arduino/cores/esp32/Stream.h:26:0,
                 from D:/msys32/home/sukesh/esp/ESP32_Arduino_template/components/arduino/cores/esp32/Arduino.h:150,
                 from D:/msys32/home/sukesh/esp/ESP32_Arduino_template/main/main.cpp:7:
D:/msys32/home/sukesh/esp/ESP32_Arduino_template/components/arduino/cores/esp32/Print.h:77:12: error: 'size_t Print::print(const char*)' cannot be overloaded
     size_t print(const char[]);
            ^
D:/msys32/home/sukesh/esp/ESP32_Arduino_template/components/arduino/cores/esp32/Print.h:75:12: error: with 'size_t Print::print(const __FlashStringHelper*)'
     size_t print(const __FlashStringHelper *);
            ^
D:/msys32/home/sukesh/esp/ESP32_Arduino_template/components/arduino/cores/esp32/Print.h:90:12: error: 'size_t Print::println(const char*)' cannot be overloaded
     size_t println(const char[]);
            ^
D:/msys32/home/sukesh/esp/ESP32_Arduino_template/components/arduino/cores/esp32/Print.h:88:12: error: with 'size_t Print::println(const __FlashStringHelper*)'
     size_t println(const __FlashStringHelper *);
            ^
make[1]: *** [/d/github/esp/esp-idf/make/component_wrapper.mk:239: main.o] Error 1
make: *** [d:/github/esp/esp-idf/make/project.mk:421: component-main-build] Error 2


f.h-f.s.
Posts: 180
Joined: Thu Dec 08, 2016 2:53 pm

Re: ESP-IDF component with Arduino

Postby f.h-f.s. » Thu Oct 05, 2017 10:01 am

Try compiling with your AzureIoTHub component disabled. (rename component.mk to component.mk.disabledorsmthn)
D:/github/esp/esp-idf/components/AzureIoTHub/include/pgmspace.h:41:0: note: this is the location of the previous definition
#define F(s) (s)
^

Who is online

Users browsing this forum: Baidu [Spider] and 6 guests