Skip to content

Commit 8c723be

Browse files
committed
Initial IDF-4.0 port
SmartConfig and ETH need some work to adapt to the new API
1 parent b50a175 commit 8c723be

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+414
-263
lines changed

.github/scripts/install-arduino-core-esp32.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ if [ ! -d "$ARDUINO_ESP32_PATH" ]; then
2323
git clone https://github.com/espressif/arduino-esp32.git esp32 > /dev/null 2>&1
2424
fi
2525

26-
echo "Updating Submodules ..."
26+
#echo "Updating Submodules ..."
2727
cd esp32
28-
git submodule update --init --recursive > /dev/null 2>&1
28+
#git submodule update --init --recursive > /dev/null 2>&1
2929

3030
echo "Installing Platform Tools ..."
3131
cd tools && python get.py

.github/scripts/on-push.sh

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ elif [ "$CHUNK_INDEX" -eq "$CHUNKS_CNT" ]; then
3030
BUILD_PIO=1
3131
fi
3232

33-
echo "Updating submodules ..."
34-
git -C "$GITHUB_WORKSPACE" submodule update --init --recursive > /dev/null 2>&1
33+
#echo "Updating submodules ..."
34+
#git -C "$GITHUB_WORKSPACE" submodule update --init --recursive > /dev/null 2>&1
3535

3636
if [ "$BUILD_PIO" -eq 0 ]; then
3737
# ArduinoIDE Test
@@ -41,14 +41,12 @@ if [ "$BUILD_PIO" -eq 0 ]; then
4141
if [ "$OS_IS_WINDOWS" == "1" ]; then
4242
build_sketch "$FQBN" "$ARDUINO_ESP32_PATH/libraries/WiFiClientSecure/examples/WiFiClientSecure/WiFiClientSecure.ino" && \
4343
build_sketch "$FQBN" "$ARDUINO_ESP32_PATH/libraries/BLE/examples/BLE_server/BLE_server.ino" && \
44-
build_sketch "$FQBN" "$ARDUINO_ESP32_PATH/libraries/AzureIoT/examples/GetStarted/GetStarted.ino" && \
4544
build_sketch "$FQBN" "$ARDUINO_ESP32_PATH/libraries/ESP32/examples/Camera/CameraWebServer/CameraWebServer.ino"
4645
elif [ "$OS_IS_MACOS" == "1" ]; then
4746
build_sketch "$FQBN" "$ARDUINO_ESP32_PATH/libraries/WiFi/examples/WiFiClient/WiFiClient.ino" && \
4847
build_sketch "$FQBN" "$ARDUINO_ESP32_PATH/libraries/WiFiClientSecure/examples/WiFiClientSecure/WiFiClientSecure.ino" && \
4948
build_sketch "$FQBN" "$ARDUINO_ESP32_PATH/libraries/BluetoothSerial/examples/SerialToSerialBT/SerialToSerialBT.ino" && \
5049
build_sketch "$FQBN" "$ARDUINO_ESP32_PATH/libraries/BLE/examples/BLE_server/BLE_server.ino" && \
51-
build_sketch "$FQBN" "$ARDUINO_ESP32_PATH/libraries/AzureIoT/examples/GetStarted/GetStarted.ino" && \
5250
build_sketch "$FQBN" "$ARDUINO_ESP32_PATH/libraries/ESP32/examples/Camera/CameraWebServer/CameraWebServer.ino"
5351
else
5452
# CMake Test
@@ -65,7 +63,6 @@ else
6563
build_pio_sketch "$BOARD" "$PLATFORMIO_ESP32_PATH/libraries/WiFiClientSecure/examples/WiFiClientSecure/WiFiClientSecure.ino" && \
6664
build_pio_sketch "$BOARD" "$PLATFORMIO_ESP32_PATH/libraries/BluetoothSerial/examples/SerialToSerialBT/SerialToSerialBT.ino" && \
6765
build_pio_sketch "$BOARD" "$PLATFORMIO_ESP32_PATH/libraries/BLE/examples/BLE_server/BLE_server.ino" && \
68-
build_pio_sketch "$BOARD" "$PLATFORMIO_ESP32_PATH/libraries/AzureIoT/examples/GetStarted/GetStarted.ino" && \
6966
build_pio_sketch "$BOARD" "$PLATFORMIO_ESP32_PATH/libraries/ESP32/examples/Camera/CameraWebServer/CameraWebServer.ino"
7067
#build_pio_sketches esp32dev "$PLATFORMIO_ESP32_PATH/libraries"
7168
fi

.gitmodules

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +0,0 @@
1-
[submodule "libraries/AzureIoT"]
2-
path = libraries/AzureIoT
3-
url = https://github.com/VSChina/ESP32_AzureIoT_Arduino

CMakeLists.txt

Lines changed: 1 addition & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -78,66 +78,6 @@ set(LIBRARY_SRCS
7878
libraries/Wire/src/Wire.cpp
7979
)
8080

81-
set(AZURE_SRCS
82-
libraries/AzureIoT/src/az_iot/azureiotcerts.c
83-
libraries/AzureIoT/src/az_iot/c-utility/pal/agenttime.c
84-
libraries/AzureIoT/src/az_iot/c-utility/pal/dns_async.c
85-
libraries/AzureIoT/src/az_iot/c-utility/pal/freertos/lock.c
86-
libraries/AzureIoT/src/az_iot/c-utility/pal/freertos/threadapi.c
87-
libraries/AzureIoT/src/az_iot/c-utility/pal/freertos/tickcounter.c
88-
libraries/AzureIoT/src/az_iot/c-utility/pal/lwip/sntp_lwip.c
89-
libraries/AzureIoT/src/az_iot/c-utility/pal/socket_async.c
90-
libraries/AzureIoT/src/az_iot/c-utility/pal/src/platform_openssl_compact.c
91-
libraries/AzureIoT/src/az_iot/c-utility/pal/src/tlsio_openssl_compact.c
92-
libraries/AzureIoT/src/az_iot/c-utility/pal/tlsio_options.c
93-
libraries/AzureIoT/src/az_iot/c-utility/src/base64.c
94-
libraries/AzureIoT/src/az_iot/c-utility/src/buffer.c
95-
libraries/AzureIoT/src/az_iot/c-utility/src/connection_string_parser.c
96-
libraries/AzureIoT/src/az_iot/c-utility/src/consolelogger.c
97-
libraries/AzureIoT/src/az_iot/c-utility/src/constbuffer.c
98-
libraries/AzureIoT/src/az_iot/c-utility/src/constmap.c
99-
libraries/AzureIoT/src/az_iot/c-utility/src/crt_abstractions.c
100-
libraries/AzureIoT/src/az_iot/c-utility/src/doublylinkedlist.c
101-
libraries/AzureIoT/src/az_iot/c-utility/src/gballoc.c
102-
libraries/AzureIoT/src/az_iot/c-utility/src/gb_stdio.c
103-
libraries/AzureIoT/src/az_iot/c-utility/src/gb_time.c
104-
libraries/AzureIoT/src/az_iot/c-utility/src/hmac.c
105-
libraries/AzureIoT/src/az_iot/c-utility/src/hmacsha256.c
106-
libraries/AzureIoT/src/az_iot/c-utility/src/httpapiex.c
107-
libraries/AzureIoT/src/az_iot/c-utility/src/httpapiexsas.c
108-
libraries/AzureIoT/src/az_iot/c-utility/src/httpheaders.c
109-
libraries/AzureIoT/src/az_iot/c-utility/src/http_proxy_io.c
110-
libraries/AzureIoT/src/az_iot/c-utility/src/map.c
111-
libraries/AzureIoT/src/az_iot/c-utility/src/optionhandler.c
112-
libraries/AzureIoT/src/az_iot/c-utility/src/sastoken.c
113-
libraries/AzureIoT/src/az_iot/c-utility/src/sha1.c
114-
libraries/AzureIoT/src/az_iot/c-utility/src/sha224.c
115-
libraries/AzureIoT/src/az_iot/c-utility/src/sha384-512.c
116-
libraries/AzureIoT/src/az_iot/c-utility/src/singlylinkedlist.c
117-
libraries/AzureIoT/src/az_iot/c-utility/src/strings.c
118-
libraries/AzureIoT/src/az_iot/c-utility/src/string_tokenizer.c
119-
libraries/AzureIoT/src/az_iot/c-utility/src/urlencode.c
120-
libraries/AzureIoT/src/az_iot/c-utility/src/usha.c
121-
libraries/AzureIoT/src/az_iot/c-utility/src/vector.c
122-
libraries/AzureIoT/src/az_iot/c-utility/src/xio.c
123-
libraries/AzureIoT/src/az_iot/c-utility/src/xlogging.c
124-
libraries/AzureIoT/src/az_iot/iothub_client/src/blob.c
125-
libraries/AzureIoT/src/az_iot/iothub_client/src/iothub_client_authorization.c
126-
libraries/AzureIoT/src/az_iot/iothub_client/src/iothub_client.c
127-
libraries/AzureIoT/src/az_iot/iothub_client/src/iothub_client_ll.c
128-
libraries/AzureIoT/src/az_iot/iothub_client/src/iothub_client_retry_control.c
129-
libraries/AzureIoT/src/az_iot/iothub_client/src/iothub_message.c
130-
libraries/AzureIoT/src/az_iot/iothub_client/src/iothubtransport.c
131-
libraries/AzureIoT/src/az_iot/iothub_client/src/iothubtransportmqtt.c
132-
libraries/AzureIoT/src/az_iot/iothub_client/src/iothubtransport_mqtt_common.c
133-
libraries/AzureIoT/src/az_iot/iothub_client/src/version.c
134-
libraries/AzureIoT/src/az_iot/umqtt/src/mqtt_client.c
135-
libraries/AzureIoT/src/az_iot/umqtt/src/mqtt_codec.c
136-
libraries/AzureIoT/src/az_iot/umqtt/src/mqtt_message.c
137-
libraries/AzureIoT/src/AzureIotHub.cpp
138-
libraries/AzureIoT/src/Esp32MQTTClient.cpp
139-
)
140-
14181
set(BLE_SRCS
14282
libraries/BLE/src/BLE2902.cpp
14383
libraries/BLE/src/BLE2904.cpp
@@ -170,7 +110,7 @@ set(BLE_SRCS
170110
libraries/BLE/src/GeneralUtils.cpp
171111
)
172112

173-
set(COMPONENT_SRCS ${CORE_SRCS} ${LIBRARY_SRCS} ${AZURE_SRCS} ${BLE_SRCS})
113+
set(COMPONENT_SRCS ${CORE_SRCS} ${LIBRARY_SRCS} ${BLE_SRCS})
174114

175115
set(COMPONENT_ADD_INCLUDEDIRS
176116
variants/esp32/

cores/esp32/Arduino.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,9 @@ typedef unsigned int word;
118118
void setup(void);
119119
void loop(void);
120120

121+
#ifdef __cplusplus
121122
long random(long, long);
123+
#endif
122124
void randomSeed(unsigned long);
123125
long map(long, long, long, long, long);
124126

cores/esp32/Esp.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
#include "Arduino.h"
2121
#include "Esp.h"
22-
#include "rom/spi_flash.h"
2322
#include "esp_sleep.h"
2423
#include "esp_spi_flash.h"
2524
#include <memory>
@@ -32,6 +31,17 @@ extern "C" {
3231
}
3332
#include <MD5Builder.h>
3433

34+
#include "esp_system.h"
35+
#ifdef ESP_IDF_VERSION_MAJOR // IDF 4+
36+
#if CONFIG_IDF_TARGET_ESP32 // ESP32/PICO-D4
37+
#include "esp32/rom/spi_flash.h"
38+
#else
39+
#error Target CONFIG_IDF_TARGET is not supported
40+
#endif
41+
#else // ESP32 Before IDF 4.0
42+
#include "rom/spi_flash.h"
43+
#endif
44+
3545
/**
3646
* User-defined Literals
3747
* usage:

cores/esp32/MD5Builder.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,17 @@
2121

2222
#include <WString.h>
2323
#include <Stream.h>
24+
25+
#include "esp_system.h"
26+
#ifdef ESP_IDF_VERSION_MAJOR // IDF 4+
27+
#if CONFIG_IDF_TARGET_ESP32 // ESP32/PICO-D4
28+
#include "esp32/rom/md5_hash.h"
29+
#else
30+
#error Target CONFIG_IDF_TARGET is not supported
31+
#endif
32+
#else // ESP32 Before IDF 4.0
2433
#include "rom/md5_hash.h"
34+
#endif
2535

2636
class MD5Builder
2737
{

cores/esp32/esp32-hal-adc.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,27 @@
1515
#include "esp32-hal-adc.h"
1616
#include "freertos/FreeRTOS.h"
1717
#include "freertos/task.h"
18-
#include "rom/ets_sys.h"
1918
#include "esp_attr.h"
20-
#include "esp_intr.h"
2119
#include "soc/rtc_io_reg.h"
2220
#include "soc/rtc_cntl_reg.h"
2321
#include "soc/sens_reg.h"
2422

2523
#include "driver/adc.h"
2624
#include "esp_adc_cal.h"
2725

26+
#include "esp_system.h"
27+
#ifdef ESP_IDF_VERSION_MAJOR // IDF 4+
28+
#if CONFIG_IDF_TARGET_ESP32 // ESP32/PICO-D4
29+
#include "esp32/rom/ets_sys.h"
30+
#include "esp_intr_alloc.h"
31+
#else
32+
#error Target CONFIG_IDF_TARGET is not supported
33+
#endif
34+
#else // ESP32 Before IDF 4.0
35+
#include "rom/ets_sys.h"
36+
#include "esp_intr.h"
37+
#endif
38+
2839
#define DEFAULT_VREF 1100
2940
static esp_adc_cal_characteristics_t *__analogCharacteristics[2] = {NULL, NULL};
3041
static uint8_t __analogAttenuation = 3;//11db

cores/esp32/esp32-hal-cpu.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,22 @@
2121
#include "esp_log.h"
2222
#include "soc/rtc.h"
2323
#include "soc/rtc_cntl_reg.h"
24-
#include "rom/rtc.h"
2524
#include "soc/apb_ctrl_reg.h"
2625
#include "soc/efuse_reg.h"
2726
#include "esp32-hal.h"
2827
#include "esp32-hal-cpu.h"
2928

29+
#include "esp_system.h"
30+
#ifdef ESP_IDF_VERSION_MAJOR // IDF 4+
31+
#if CONFIG_IDF_TARGET_ESP32 // ESP32/PICO-D4
32+
#include "esp32/rom/rtc.h"
33+
#else
34+
#error Target CONFIG_IDF_TARGET is not supported
35+
#endif
36+
#else // ESP32 Before IDF 4.0
37+
#include "rom/rtc.h"
38+
#endif
39+
3040
typedef struct apb_change_cb_s {
3141
struct apb_change_cb_s * prev;
3242
struct apb_change_cb_s * next;

cores/esp32/esp32-hal-dac.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,24 @@
1515
#include "esp32-hal-dac.h"
1616
#include "freertos/FreeRTOS.h"
1717
#include "freertos/task.h"
18-
#include "rom/ets_sys.h"
1918
#include "esp_attr.h"
20-
#include "esp_intr.h"
2119
#include "soc/rtc_io_reg.h"
2220
#include "soc/rtc_cntl_reg.h"
2321
#include "soc/sens_reg.h"
2422

23+
#include "esp_system.h"
24+
#ifdef ESP_IDF_VERSION_MAJOR // IDF 4+
25+
#if CONFIG_IDF_TARGET_ESP32 // ESP32/PICO-D4
26+
#include "esp32/rom/ets_sys.h"
27+
#include "esp_intr_alloc.h"
28+
#else
29+
#error Target CONFIG_IDF_TARGET is not supported
30+
#endif
31+
#else // ESP32 Before IDF 4.0
32+
#include "rom/ets_sys.h"
33+
#include "esp_intr.h"
34+
#endif
35+
2536
void IRAM_ATTR __dacWrite(uint8_t pin, uint8_t value)
2637
{
2738
if(pin < 25 || pin > 26){

cores/esp32/esp32-hal-gpio.c

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,27 @@
1515
#include "esp32-hal-gpio.h"
1616
#include "freertos/FreeRTOS.h"
1717
#include "freertos/task.h"
18-
#include "rom/ets_sys.h"
1918
#include "esp_attr.h"
20-
#include "esp_intr.h"
21-
#include "rom/gpio.h"
2219
#include "soc/gpio_reg.h"
2320
#include "soc/io_mux_reg.h"
2421
#include "soc/gpio_struct.h"
2522
#include "soc/rtc_io_reg.h"
2623

24+
#include "esp_system.h"
25+
#ifdef ESP_IDF_VERSION_MAJOR // IDF 4+
26+
#if CONFIG_IDF_TARGET_ESP32 // ESP32/PICO-D4
27+
#include "esp32/rom/ets_sys.h"
28+
#include "esp32/rom/gpio.h"
29+
#include "esp_intr_alloc.h"
30+
#else
31+
#error Target CONFIG_IDF_TARGET is not supported
32+
#endif
33+
#else // ESP32 Before IDF 4.0
34+
#include "rom/ets_sys.h"
35+
#include "rom/gpio.h"
36+
#include "esp_intr.h"
37+
#endif
38+
2739
const int8_t esp32_adc2gpio[20] = {36, 37, 38, 39, 32, 33, 34, 35, -1, -1, 4, 0, 2, 15, 13, 12, 14, 27, 25, 26};
2840

2941
const DRAM_ATTR esp32_gpioMux_t esp32_gpioMux[GPIO_PIN_COUNT]={

cores/esp32/esp32-hal-i2c.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,25 @@
1818
#include "freertos/task.h"
1919
#include "freertos/semphr.h"
2020
#include "freertos/event_groups.h"
21-
#include "rom/ets_sys.h"
2221
#include "driver/periph_ctrl.h"
2322
#include "soc/i2c_reg.h"
2423
#include "soc/i2c_struct.h"
2524
#include "soc/dport_reg.h"
2625
#include "esp_attr.h"
2726
#include "esp32-hal-cpu.h" // cpu clock change support 31DEC2018
27+
28+
#include "esp_system.h"
29+
#ifdef ESP_IDF_VERSION_MAJOR // IDF 4+
30+
#if CONFIG_IDF_TARGET_ESP32 // ESP32/PICO-D4
31+
#include "esp32/rom/ets_sys.h"
32+
#else
33+
#error Target CONFIG_IDF_TARGET is not supported
34+
#endif
35+
#else // ESP32 Before IDF 4.0
36+
#include "rom/ets_sys.h"
37+
#endif
38+
39+
2840
//#define I2C_DEV(i) (volatile i2c_dev_t *)((i)?DR_REG_I2C1_EXT_BASE:DR_REG_I2C_EXT_BASE)
2941
//#define I2C_DEV(i) ((i2c_dev_t *)(REG_I2C_BASE(i)))
3042
#define I2C_SCL_IDX(p) ((p==0)?I2CEXT0_SCL_OUT_IDX:((p==1)?I2CEXT1_SCL_OUT_IDX:0))

cores/esp32/esp32-hal-ledc.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,22 @@
1616
#include "freertos/FreeRTOS.h"
1717
#include "freertos/task.h"
1818
#include "freertos/semphr.h"
19-
#include "rom/ets_sys.h"
2019
#include "esp32-hal-matrix.h"
2120
#include "soc/dport_reg.h"
2221
#include "soc/ledc_reg.h"
2322
#include "soc/ledc_struct.h"
2423

24+
#include "esp_system.h"
25+
#ifdef ESP_IDF_VERSION_MAJOR // IDF 4+
26+
#if CONFIG_IDF_TARGET_ESP32 // ESP32/PICO-D4
27+
#include "esp32/rom/ets_sys.h"
28+
#else
29+
#error Target CONFIG_IDF_TARGET is not supported
30+
#endif
31+
#else // ESP32 Before IDF 4.0
32+
#include "rom/ets_sys.h"
33+
#endif
34+
2535
#if CONFIG_DISABLE_HAL_LOCKS
2636
#define LEDC_MUTEX_LOCK()
2737
#define LEDC_MUTEX_UNLOCK()

cores/esp32/esp32-hal-matrix.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,17 @@
1414

1515
#include "esp32-hal-matrix.h"
1616
#include "esp_attr.h"
17+
18+
#include "esp_system.h"
19+
#ifdef ESP_IDF_VERSION_MAJOR // IDF 4+
20+
#if CONFIG_IDF_TARGET_ESP32 // ESP32/PICO-D4
21+
#include "esp32/rom/gpio.h"
22+
#else
23+
#error Target CONFIG_IDF_TARGET is not supported
24+
#endif
25+
#else // ESP32 Before IDF 4.0
1726
#include "rom/gpio.h"
27+
#endif
1828

1929
#define MATRIX_DETACH_OUT_SIG 0x100
2030
#define MATRIX_DETACH_IN_LOW_PIN 0x30

cores/esp32/esp32-hal-misc.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,20 @@
3131
#include "soc/rtc.h"
3232
#include "soc/rtc_cntl_reg.h"
3333
#include "soc/apb_ctrl_reg.h"
34-
#include "rom/rtc.h"
3534
#include "esp_task_wdt.h"
3635
#include "esp32-hal.h"
3736

37+
#include "esp_system.h"
38+
#ifdef ESP_IDF_VERSION_MAJOR // IDF 4+
39+
#if CONFIG_IDF_TARGET_ESP32 // ESP32/PICO-D4
40+
#include "esp32/rom/rtc.h"
41+
#else
42+
#error Target CONFIG_IDF_TARGET is not supported
43+
#endif
44+
#else // ESP32 Before IDF 4.0
45+
#include "rom/rtc.h"
46+
#endif
47+
3848
//Undocumented!!! Get chip temperature in Farenheit
3949
//Source: https://github.com/pcbreflux/espressif/blob/master/esp32/arduino/sketchbook/ESP32_int_temp_sensor/ESP32_int_temp_sensor.ino
4050
uint8_t temprature_sens_read();

0 commit comments

Comments
 (0)