Skip to content

Fix compilation for use as IDF component #5265

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,9 @@ if(NOT CONFIG_ARDUINO_SELECTIVE_COMPILATION OR CONFIG_ARDUINO_SELECTIVE_ArduinoO
list(APPEND priv_requires esp_https_ota)
endif()
if(NOT CONFIG_ARDUINO_SELECTIVE_COMPILATION OR CONFIG_ARDUINO_SELECTIVE_LITTLEFS)
list(APPEND priv_requires esp_littlefs)
if(CONFIG_LITTLEFS_PAGE_SIZE)
list(APPEND priv_requires esp_littlefs)
endif()
endif()

idf_component_register(INCLUDE_DIRS ${includedirs} PRIV_INCLUDE_DIRS ${priv_includes} SRCS ${srcs} REQUIRES ${requires} PRIV_REQUIRES ${priv_requires})
Expand Down
6 changes: 3 additions & 3 deletions docs/esp-idf_component.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ For a simplified method, see [lib-builder](lib_builder.md)
cd arduino && \
git submodule update --init --recursive && \
cd ../.. && \
make menuconfig
idf.py menuconfig
```
- ```make menuconfig``` has some Arduino options
- ```idf.py menuconfig``` has some Arduino options
- "Autostart Arduino setup and loop on boot"
- If you enable this options, your main.cpp should be formated like any other sketch

Expand Down Expand Up @@ -60,7 +60,7 @@ For a simplified method, see [lib-builder](lib_builder.md)
- "Autoconnect WiFi on boot"
- If enabled, WiFi will start with the last known configuration
- Else it will wait for WiFi.begin
- ```make flash monitor``` will build, upload and open serial monitor to your board
- ```idf.py -p <your-board-serial-port> flash monitor``` will build, upload and open serial monitor to your board

## Logging To Serial

Expand Down
10 changes: 7 additions & 3 deletions libraries/LITTLEFS/src/LITTLEFS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,15 @@ extern "C" {
#include <sys/unistd.h>
#include <sys/stat.h>
#include <dirent.h>
#include "esp_littlefs.h"
}

#include "sdkconfig.h"
#include "LITTLEFS.h"

#ifdef CONFIG_LITTLEFS_PAGE_SIZE
extern "C" {
#include "esp_littlefs.h"
}

using namespace fs;

class LITTLEFSImpl : public VFSImpl
Expand Down Expand Up @@ -137,4 +141,4 @@ size_t LITTLEFSFS::usedBytes()
}

LITTLEFSFS LITTLEFS;

#endif
2 changes: 1 addition & 1 deletion libraries/RainMaker/src/RMaker.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "RMaker.h"
#if ESP_IDF_VERSION_MAJOR >= 4 && CONFIG_IDF_TARGET_ESP32
#if ESP_IDF_VERSION_MAJOR >= 4 && CONFIG_ESP_RMAKER_TASK_STACK && CONFIG_IDF_TARGET_ESP32
#include <esp_rmaker_schedule.h>
#include <esp_rmaker_utils.h>
bool wifiLowLevelInit(bool persistent);
Expand Down
2 changes: 1 addition & 1 deletion libraries/RainMaker/src/RMaker.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "esp_system.h"
#if ESP_IDF_VERSION_MAJOR >= 4 && CONFIG_IDF_TARGET_ESP32
#if ESP_IDF_VERSION_MAJOR >= 4 && CONFIG_ESP_RMAKER_TASK_STACK && CONFIG_IDF_TARGET_ESP32

#include "Arduino.h"
#include "RMakerNode.h"
Expand Down
2 changes: 1 addition & 1 deletion libraries/RainMaker/src/RMakerDevice.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "RMakerDevice.h"
#if ESP_IDF_VERSION_MAJOR >= 4 && CONFIG_IDF_TARGET_ESP32
#if ESP_IDF_VERSION_MAJOR >= 4 && CONFIG_ESP_RMAKER_TASK_STACK && CONFIG_IDF_TARGET_ESP32

static esp_err_t err;
typedef void (*deviceWriteCb)(Device*, Param*, const param_val_t val, void *priv_data, write_ctx_t *ctx);
Expand Down
2 changes: 1 addition & 1 deletion libraries/RainMaker/src/RMakerDevice.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "esp_system.h"
#if ESP_IDF_VERSION_MAJOR >= 4 && CONFIG_IDF_TARGET_ESP32
#if ESP_IDF_VERSION_MAJOR >= 4 && CONFIG_ESP_RMAKER_TASK_STACK && CONFIG_IDF_TARGET_ESP32

#include "RMakerParam.h"
#include <esp_rmaker_standard_devices.h>
Expand Down
2 changes: 1 addition & 1 deletion libraries/RainMaker/src/RMakerNode.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "RMakerNode.h"
#if ESP_IDF_VERSION_MAJOR >= 4 && CONFIG_IDF_TARGET_ESP32
#if ESP_IDF_VERSION_MAJOR >= 4 && CONFIG_ESP_RMAKER_TASK_STACK && CONFIG_IDF_TARGET_ESP32
static esp_err_t err;

esp_err_t Node::addDevice(Device device)
Expand Down
2 changes: 1 addition & 1 deletion libraries/RainMaker/src/RMakerNode.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "esp_system.h"
#if ESP_IDF_VERSION_MAJOR >= 4 && CONFIG_IDF_TARGET_ESP32
#if ESP_IDF_VERSION_MAJOR >= 4 && CONFIG_ESP_RMAKER_TASK_STACK && CONFIG_IDF_TARGET_ESP32

#include "RMakerDevice.h"

Expand Down
2 changes: 1 addition & 1 deletion libraries/RainMaker/src/RMakerParam.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "RMakerParam.h"
#if ESP_IDF_VERSION_MAJOR >= 4 && CONFIG_IDF_TARGET_ESP32
#if ESP_IDF_VERSION_MAJOR >= 4 && CONFIG_ESP_RMAKER_TASK_STACK && CONFIG_IDF_TARGET_ESP32

static esp_err_t err;

Expand Down
2 changes: 1 addition & 1 deletion libraries/RainMaker/src/RMakerParam.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "esp_system.h"
#if ESP_IDF_VERSION_MAJOR >= 4 && CONFIG_IDF_TARGET_ESP32
#if ESP_IDF_VERSION_MAJOR >= 4 && CONFIG_ESP_RMAKER_TASK_STACK && CONFIG_IDF_TARGET_ESP32

#include "RMakerType.h"

Expand Down
2 changes: 1 addition & 1 deletion libraries/RainMaker/src/RMakerQR.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "esp_system.h"
#if ESP_IDF_VERSION_MAJOR >= 4 && CONFIG_IDF_TARGET_ESP32
#if ESP_IDF_VERSION_MAJOR >= 4 && CONFIG_ESP_RMAKER_TASK_STACK && CONFIG_IDF_TARGET_ESP32

#include <qrcode.h>

Expand Down
2 changes: 1 addition & 1 deletion libraries/RainMaker/src/RMakerType.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "RMakerType.h"
#if ESP_IDF_VERSION_MAJOR >= 4 && CONFIG_IDF_TARGET_ESP32
#if ESP_IDF_VERSION_MAJOR >= 4 && CONFIG_ESP_RMAKER_TASK_STACK && CONFIG_IDF_TARGET_ESP32

param_val_t value(int ival)
{
Expand Down
2 changes: 1 addition & 1 deletion libraries/RainMaker/src/RMakerType.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "esp_system.h"
#if ESP_IDF_VERSION_MAJOR >= 4 && CONFIG_IDF_TARGET_ESP32
#if ESP_IDF_VERSION_MAJOR >= 4 && CONFIG_ESP_RMAKER_TASK_STACK && CONFIG_IDF_TARGET_ESP32

#include <esp_rmaker_core.h>
#include <esp_rmaker_ota.h>
Expand Down
2 changes: 1 addition & 1 deletion libraries/RainMaker/src/RMakerUtils.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "esp_system.h"
#if ESP_IDF_VERSION_MAJOR >= 4 && CONFIG_IDF_TARGET_ESP32
#if ESP_IDF_VERSION_MAJOR >= 4 && CONFIG_ESP_RMAKER_TASK_STACK && CONFIG_IDF_TARGET_ESP32

#include <esp_rmaker_utils.h>

Expand Down
6 changes: 4 additions & 2 deletions libraries/WiFiClientSecure/src/ssl_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
#include "WiFi.h"

#ifndef MBEDTLS_KEY_EXCHANGE__SOME__PSK_ENABLED
# error "Please configure IDF framework to include mbedTLS -> Enable pre-shared-key ciphersuites and activate at least one cipher"
#endif
# warning "Please configure IDF framework to include mbedTLS -> Enable pre-shared-key ciphersuites and activate at least one cipher"
#else

const char *pers = "esp32-tls";

Expand Down Expand Up @@ -459,3 +459,5 @@ bool verify_ssl_dn(sslclient_context *ssl_client, const char* domain_name)

return false;
}
#endif