Skip to content

Commit 4b88a3a

Browse files
committed
fix(build): Initial changes to build against IDF v5.3
1 parent def319a commit 4b88a3a

File tree

13 files changed

+93
-87
lines changed

13 files changed

+93
-87
lines changed

.github/workflows/push.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ jobs:
216216
- name: Build Sketches
217217
run: bash ./.github/scripts/on-push.sh 1 1 #equal and non-zero to trigger PIO
218218

219+
# ESP-IDF component build
219220
build-esp-idf-component:
220221
name: Build with ESP-IDF ${{ matrix.idf_ver }} for ${{ matrix.idf_target }}
221222
needs: gen-chunks
@@ -231,7 +232,7 @@ jobs:
231232
# See https://hub.docker.com/r/espressif/idf/tags and
232233
# https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/tools/idf-docker-image.html
233234
# for details.
234-
idf_ver: ["release-v5.1"]
235+
idf_ver: ["release-v5.3"]
235236
idf_target: ["esp32", "esp32s2", "esp32s3", "esp32c2", "esp32c3", "esp32c6", "esp32h2"]
236237
container: espressif/idf:${{ matrix.idf_ver }}
237238
steps:

CMakeLists.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
# export ARDUINO_SKIP_IDF_VERSION_CHECK=1
66
# idf.py build
77

8-
set(min_supported_idf_version "5.1.0")
9-
set(max_supported_idf_version "5.1.99")
8+
set(min_supported_idf_version "5.3.0")
9+
set(max_supported_idf_version "5.3.99")
1010
set(idf_version "${IDF_VERSION_MAJOR}.${IDF_VERSION_MINOR}.${IDF_VERSION_PATCH}")
1111

1212
if ("${idf_version}" AND NOT "$ENV{ARDUINO_SKIP_IDF_VERSION_CHECK}")

cores/esp32/Client.h

+2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@
2626
class Client : public Stream {
2727
public:
2828
virtual int connect(IPAddress ip, uint16_t port) = 0;
29+
virtual int connect(IPAddress ip, uint16_t port, int32_t timeout) = 0;
2930
virtual int connect(const char *host, uint16_t port) = 0;
31+
virtual int connect(const char *host, uint16_t port, int32_t timeout) = 0;
3032
virtual size_t write(uint8_t) = 0;
3133
virtual size_t write(const uint8_t *buf, size_t size) = 0;
3234
virtual int available() = 0;

cores/esp32/HWCDC.cpp

+8-8
Original file line numberDiff line numberDiff line change
@@ -286,14 +286,14 @@ bool HWCDC::deinit(void *busptr) {
286286
running = true;
287287
// Setting USB D+ D- pins
288288
bool retCode = true;
289-
retCode &= perimanClearPinBus(USB_DM_GPIO_NUM);
290-
retCode &= perimanClearPinBus(USB_DP_GPIO_NUM);
289+
retCode &= perimanClearPinBus(USB_INT_PHY0_DM_GPIO_NUM);
290+
retCode &= perimanClearPinBus(USB_INT_PHY0_DP_GPIO_NUM);
291291
if (retCode) {
292292
// Force the host to re-enumerate (BUS_RESET)
293-
pinMode(USB_DM_GPIO_NUM, OUTPUT_OPEN_DRAIN);
294-
pinMode(USB_DP_GPIO_NUM, OUTPUT_OPEN_DRAIN);
295-
digitalWrite(USB_DM_GPIO_NUM, LOW);
296-
digitalWrite(USB_DP_GPIO_NUM, LOW);
293+
pinMode(USB_INT_PHY0_DM_GPIO_NUM, OUTPUT_OPEN_DRAIN);
294+
pinMode(USB_INT_PHY0_DP_GPIO_NUM, OUTPUT_OPEN_DRAIN);
295+
digitalWrite(USB_INT_PHY0_DM_GPIO_NUM, LOW);
296+
digitalWrite(USB_INT_PHY0_DP_GPIO_NUM, LOW);
297297
}
298298
// release the flag
299299
running = false;
@@ -323,11 +323,11 @@ void HWCDC::begin(unsigned long baud) {
323323
// delay(10); // USB Host has to enumerate it again
324324

325325
// Peripheral Manager setting for USB D+ D- pins
326-
uint8_t pin = USB_DM_GPIO_NUM;
326+
uint8_t pin = USB_INT_PHY0_DM_GPIO_NUM;
327327
if (!perimanSetPinBus(pin, ESP32_BUS_TYPE_USB_DM, (void *)this, -1, -1)) {
328328
goto err;
329329
}
330-
pin = USB_DP_GPIO_NUM;
330+
pin = USB_INT_PHY0_DP_GPIO_NUM;
331331
if (!perimanSetPinBus(pin, ESP32_BUS_TYPE_USB_DP, (void *)this, -1, -1)) {
332332
goto err;
333333
}

cores/esp32/HardwareSerial.cpp

+12-12
Original file line numberDiff line numberDiff line change
@@ -26,23 +26,23 @@
2626
void serialEvent(void) __attribute__((weak));
2727
void serialEvent(void) {}
2828

29-
#if SOC_UART_NUM > 1
29+
#if SOC_UART_HP_NUM > 1
3030
void serialEvent1(void) __attribute__((weak));
3131
void serialEvent1(void) {}
32-
#endif /* SOC_UART_NUM > 1 */
32+
#endif /* SOC_UART_HP_NUM > 1 */
3333

34-
#if SOC_UART_NUM > 2
34+
#if SOC_UART_HP_NUM > 2
3535
void serialEvent2(void) __attribute__((weak));
3636
void serialEvent2(void) {}
37-
#endif /* SOC_UART_NUM > 2 */
37+
#endif /* SOC_UART_HP_NUM > 2 */
3838

3939
#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_SERIAL)
4040
// There is always Seria0 for UART0
4141
HardwareSerial Serial0(0);
42-
#if SOC_UART_NUM > 1
42+
#if SOC_UART_HP_NUM > 1
4343
HardwareSerial Serial1(1);
4444
#endif
45-
#if SOC_UART_NUM > 2
45+
#if SOC_UART_HP_NUM > 2
4646
HardwareSerial Serial2(2);
4747
#endif
4848

@@ -72,12 +72,12 @@ void serialEventRun(void) {
7272
if (Serial0.available()) {
7373
serialEvent();
7474
}
75-
#if SOC_UART_NUM > 1
75+
#if SOC_UART_HP_NUM > 1
7676
if (Serial1.available()) {
7777
serialEvent1();
7878
}
7979
#endif
80-
#if SOC_UART_NUM > 2
80+
#if SOC_UART_HP_NUM > 2
8181
if (Serial2.available()) {
8282
serialEvent2();
8383
}
@@ -279,8 +279,8 @@ void HardwareSerial::_uartEventTask(void *args) {
279279
}
280280

281281
void HardwareSerial::begin(unsigned long baud, uint32_t config, int8_t rxPin, int8_t txPin, bool invert, unsigned long timeout_ms, uint8_t rxfifo_full_thrhd) {
282-
if (_uart_nr >= SOC_UART_NUM) {
283-
log_e("Serial number is invalid, please use a number from 0 to %u", SOC_UART_NUM - 1);
282+
if (_uart_nr >= SOC_UART_HP_NUM) {
283+
log_e("Serial number is invalid, please use a number from 0 to %u", SOC_UART_HP_NUM - 1);
284284
return;
285285
}
286286

@@ -305,7 +305,7 @@ void HardwareSerial::begin(unsigned long baud, uint32_t config, int8_t rxPin, in
305305
txPin = _txPin < 0 ? (int8_t)SOC_TX0 : _txPin;
306306
}
307307
break;
308-
#if SOC_UART_NUM > 1 // may save some flash bytes...
308+
#if SOC_UART_HP_NUM > 1 // may save some flash bytes...
309309
case UART_NUM_1:
310310
if (rxPin < 0 && txPin < 0) {
311311
// do not change RX1/TX1 if it has already been set before
@@ -314,7 +314,7 @@ void HardwareSerial::begin(unsigned long baud, uint32_t config, int8_t rxPin, in
314314
}
315315
break;
316316
#endif
317-
#if SOC_UART_NUM > 2 // may save some flash bytes...
317+
#if SOC_UART_HP_NUM > 2 // may save some flash bytes...
318318
case UART_NUM_2:
319319
if (rxPin < 0 && txPin < 0) {
320320
// do not change RX2/TX2 if it has already been set before

cores/esp32/esp32-hal-i2c-slave.c

+15-15
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949

5050
#define I2C_SLAVE_USE_RX_QUEUE 0 // 1: Queue, 0: RingBuffer
5151

52-
#if SOC_I2C_NUM > 1
52+
#if SOC_HP_I2C_NUM > 1
5353
#define I2C_SCL_IDX(p) ((p == 0) ? I2CEXT0_SCL_OUT_IDX : ((p == 1) ? I2CEXT1_SCL_OUT_IDX : 0))
5454
#define I2C_SDA_IDX(p) ((p == 0) ? I2CEXT0_SDA_OUT_IDX : ((p == 1) ? I2CEXT1_SDA_OUT_IDX : 0))
5555
#else
@@ -99,14 +99,14 @@ typedef union {
9999
uint32_t val;
100100
} i2c_slave_queue_event_t;
101101

102-
static i2c_slave_struct_t _i2c_bus_array[SOC_I2C_NUM] = {
102+
static i2c_slave_struct_t _i2c_bus_array[SOC_HP_I2C_NUM] = {
103103
{&I2C0, 0, -1, -1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0
104104
#if !CONFIG_DISABLE_HAL_LOCKS
105105
,
106106
NULL
107107
#endif
108108
},
109-
#if SOC_I2C_NUM > 1
109+
#if SOC_HP_I2C_NUM > 1
110110
{&I2C1, 1, -1, -1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0
111111
#if !CONFIG_DISABLE_HAL_LOCKS
112112
,
@@ -210,7 +210,7 @@ static bool i2cSlaveDetachBus(void *bus_i2c_num);
210210
//=====================================================================================================================
211211

212212
esp_err_t i2cSlaveAttachCallbacks(uint8_t num, i2c_slave_request_cb_t request_callback, i2c_slave_receive_cb_t receive_callback, void *arg) {
213-
if (num >= SOC_I2C_NUM) {
213+
if (num >= SOC_HP_I2C_NUM) {
214214
log_e("Invalid port num: %u", num);
215215
return ESP_ERR_INVALID_ARG;
216216
}
@@ -224,7 +224,7 @@ esp_err_t i2cSlaveAttachCallbacks(uint8_t num, i2c_slave_request_cb_t request_ca
224224
}
225225

226226
esp_err_t i2cSlaveInit(uint8_t num, int sda, int scl, uint16_t slaveID, uint32_t frequency, size_t rx_len, size_t tx_len) {
227-
if (num >= SOC_I2C_NUM) {
227+
if (num >= SOC_HP_I2C_NUM) {
228228
log_e("Invalid port num: %u", num);
229229
return ESP_ERR_INVALID_ARG;
230230
}
@@ -309,14 +309,14 @@ esp_err_t i2cSlaveInit(uint8_t num, int sda, int scl, uint16_t slaveID, uint32_t
309309

310310
if (i2c->num == 0) {
311311
periph_ll_enable_clk_clear_rst(PERIPH_I2C0_MODULE);
312-
#if SOC_I2C_NUM > 1
312+
#if SOC_HP_I2C_NUM > 1
313313
} else {
314314
periph_ll_enable_clk_clear_rst(PERIPH_I2C1_MODULE);
315315
#endif
316316
}
317317

318318
i2c_ll_slave_init(i2c->dev);
319-
i2c_ll_set_fifo_mode(i2c->dev, true);
319+
i2c_ll_slave_set_fifo_mode(i2c->dev, true);
320320
i2c_ll_set_slave_addr(i2c->dev, slaveID, false);
321321
i2c_ll_set_tout(i2c->dev, I2C_LL_MAX_TIMEOUT);
322322
i2c_slave_set_frequency(i2c, frequency);
@@ -337,13 +337,13 @@ esp_err_t i2cSlaveInit(uint8_t num, int sda, int scl, uint16_t slaveID, uint32_t
337337

338338
i2c_ll_disable_intr_mask(i2c->dev, I2C_LL_INTR_MASK);
339339
i2c_ll_clear_intr_mask(i2c->dev, I2C_LL_INTR_MASK);
340-
i2c_ll_set_fifo_mode(i2c->dev, true);
340+
i2c_ll_slave_set_fifo_mode(i2c->dev, true);
341341

342342
if (!i2c->intr_handle) {
343343
uint32_t flags = ESP_INTR_FLAG_LOWMED | ESP_INTR_FLAG_SHARED;
344344
if (i2c->num == 0) {
345345
ret = esp_intr_alloc(ETS_I2C_EXT0_INTR_SOURCE, flags, &i2c_slave_isr_handler, i2c, &i2c->intr_handle);
346-
#if SOC_I2C_NUM > 1
346+
#if SOC_HP_I2C_NUM > 1
347347
} else {
348348
ret = esp_intr_alloc(ETS_I2C_EXT1_INTR_SOURCE, flags, &i2c_slave_isr_handler, i2c, &i2c->intr_handle);
349349
#endif
@@ -375,7 +375,7 @@ esp_err_t i2cSlaveInit(uint8_t num, int sda, int scl, uint16_t slaveID, uint32_t
375375
}
376376

377377
esp_err_t i2cSlaveDeinit(uint8_t num) {
378-
if (num >= SOC_I2C_NUM) {
378+
if (num >= SOC_HP_I2C_NUM) {
379379
log_e("Invalid port num: %u", num);
380380
return ESP_ERR_INVALID_ARG;
381381
}
@@ -398,7 +398,7 @@ esp_err_t i2cSlaveDeinit(uint8_t num) {
398398
}
399399

400400
size_t i2cSlaveWrite(uint8_t num, const uint8_t *buf, uint32_t len, uint32_t timeout_ms) {
401-
if (num >= SOC_I2C_NUM) {
401+
if (num >= SOC_HP_I2C_NUM) {
402402
log_e("Invalid port num: %u", num);
403403
return 0;
404404
}
@@ -515,16 +515,16 @@ static bool i2c_slave_set_frequency(i2c_slave_struct_t *i2c, uint32_t clk_speed)
515515

516516
i2c_hal_clk_config_t clk_cal;
517517
#if SOC_I2C_SUPPORT_APB
518-
i2c_ll_cal_bus_clk(APB_CLK_FREQ, clk_speed, &clk_cal);
518+
i2c_ll_master_cal_bus_clk(APB_CLK_FREQ, clk_speed, &clk_cal);
519519
i2c_ll_set_source_clk(i2c->dev, SOC_MOD_CLK_APB); /*!< I2C source clock from APB, 80M*/
520520
#elif SOC_I2C_SUPPORT_XTAL
521-
i2c_ll_cal_bus_clk(XTAL_CLK_FREQ, clk_speed, &clk_cal);
521+
i2c_ll_master_cal_bus_clk(XTAL_CLK_FREQ, clk_speed, &clk_cal);
522522
i2c_ll_set_source_clk(i2c->dev, SOC_MOD_CLK_XTAL); /*!< I2C source clock from XTAL, 40M */
523523
#endif
524524
i2c_ll_set_txfifo_empty_thr(i2c->dev, a);
525525
i2c_ll_set_rxfifo_full_thr(i2c->dev, SOC_I2C_FIFO_LEN - a);
526-
i2c_ll_set_bus_timing(i2c->dev, &clk_cal);
527-
i2c_ll_set_filter(i2c->dev, 3);
526+
i2c_ll_master_set_bus_timing(i2c->dev, &clk_cal);
527+
i2c_ll_master_set_filter(i2c->dev, 3);
528528
return true;
529529
}
530530

cores/esp32/esp32-hal-touch.c

+17-17
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@
2222
Internal Private Touch Data Structure and Functions
2323
*/
2424

25-
#if SOC_TOUCH_VERSION_1 // ESP32
25+
#if SOC_TOUCH_SENSOR_VERSION == 1 // ESP32
2626
static uint16_t __touchSleepCycles = 0x1000;
2727
static uint16_t __touchMeasureCycles = 0x1000;
28-
#elif SOC_TOUCH_VERSION_2 // ESP32S2, ESP32S3
28+
#elif SOC_TOUCH_SENSOR_VERSION == 2 // ESP32S2, ESP32S3
2929
static uint16_t __touchSleepCycles = TOUCH_PAD_SLEEP_CYCLE_DEFAULT;
3030
static uint16_t __touchMeasureCycles = TOUCH_PAD_MEASURE_CYCLE_DEFAULT;
3131
#endif
@@ -37,7 +37,7 @@ typedef struct {
3737
voidFuncPtr fn;
3838
bool callWithArgs;
3939
void *arg;
40-
#if SOC_TOUCH_VERSION_2 // Only for ESP32S2 and ESP32S3
40+
#if SOC_TOUCH_SENSOR_VERSION == 2 // Only for ESP32S2 and ESP32S3
4141
bool lastStatusIsPressed;
4242
#endif
4343
} TouchInterruptHandle_t;
@@ -51,7 +51,7 @@ static bool initialized = false;
5151
static bool channels_initialized[SOC_TOUCH_SENSOR_NUM] = {false};
5252

5353
static void ARDUINO_ISR_ATTR __touchISR(void *arg) {
54-
#if SOC_TOUCH_VERSION_1 // ESP32
54+
#if SOC_TOUCH_SENSOR_VERSION == 1 // ESP32
5555
uint32_t pad_intr = touch_pad_get_status();
5656
//clear interrupt
5757
touch_pad_clear_status();
@@ -68,7 +68,7 @@ static void ARDUINO_ISR_ATTR __touchISR(void *arg) {
6868
}
6969
}
7070
}
71-
#elif SOC_TOUCH_VERSION_2 // ESP32S2, ESP32S3
71+
#elif SOC_TOUCH_SENSOR_VERSION == 2 // ESP32S2, ESP32S3
7272
touch_pad_intr_mask_t evt = touch_pad_read_intr_status_mask();
7373
uint8_t pad_num = touch_pad_get_current_meas_channel();
7474
if (evt & TOUCH_PAD_INTR_MASK_ACTIVE) {
@@ -93,9 +93,9 @@ static void ARDUINO_ISR_ATTR __touchISR(void *arg) {
9393
static void __touchSetCycles(uint16_t measure, uint16_t sleep) {
9494
__touchSleepCycles = sleep;
9595
__touchMeasureCycles = measure;
96-
#if SOC_TOUCH_VERSION_1 // ESP32
96+
#if SOC_TOUCH_SENSOR_VERSION == 1 // ESP32
9797
touch_pad_set_measurement_clock_cycles(measure);
98-
#elif SOC_TOUCH_VERSION_2 // ESP32S2, ESP32S3
98+
#elif SOC_TOUCH_SENSOR_VERSION == 2 // ESP32S2, ESP32S3
9999
touch_pad_set_charge_discharge_times(measure);
100100
#endif
101101
touch_pad_set_measurement_interval(sleep);
@@ -123,7 +123,7 @@ static void __touchInit() {
123123

124124
esp_err_t err = ESP_OK;
125125

126-
#if SOC_TOUCH_VERSION_1 // ESP32
126+
#if SOC_TOUCH_SENSOR_VERSION == 1 // ESP32
127127
err = touch_pad_init();
128128
if (err != ESP_OK) {
129129
goto err;
@@ -144,7 +144,7 @@ static void __touchInit() {
144144
goto err;
145145
}
146146
touch_pad_intr_enable(); // returns ESP_OK
147-
#elif SOC_TOUCH_VERSION_2 // ESP32S2, ESP32S3
147+
#elif SOC_TOUCH_SENSOR_VERSION == 2 // ESP32S2, ESP32S3
148148
err = touch_pad_init();
149149
if (err != ESP_OK) {
150150
goto err;
@@ -179,11 +179,11 @@ static void __touchChannelInit(int pad) {
179179
return;
180180
}
181181

182-
#if SOC_TOUCH_VERSION_1 // ESP32
182+
#if SOC_TOUCH_SENSOR_VERSION == 1 // ESP32
183183
// Initial no Threshold and setup
184184
__touchInterruptHandlers[pad].fn = NULL;
185-
touch_pad_config(pad, SOC_TOUCH_PAD_THRESHOLD_MAX); // returns ESP_OK
186-
#elif SOC_TOUCH_VERSION_2 // ESP32S2, ESP32S3
185+
touch_pad_config(pad, TOUCH_PAD_THRESHOLD_MAX); // returns ESP_OK
186+
#elif SOC_TOUCH_SENSOR_VERSION == 2 // ESP32S2, ESP32S3
187187
// Initial no Threshold and setup
188188
__touchInterruptHandlers[pad].fn = NULL;
189189
touch_pad_config(pad); // returns ESP_OK
@@ -238,7 +238,7 @@ static void __touchConfigInterrupt(uint8_t pin, void (*userFunc)(void), void *Ar
238238
if (userFunc == NULL) {
239239
// detach ISR User Call
240240
__touchInterruptHandlers[pad].fn = NULL;
241-
threshold = SOC_TOUCH_PAD_THRESHOLD_MAX; // deactivate the ISR with SOC_TOUCH_PAD_THRESHOLD_MAX
241+
threshold = TOUCH_PAD_THRESHOLD_MAX; // deactivate the ISR with SOC_TOUCH_PAD_THRESHOLD_MAX
242242
} else {
243243
// attach ISR User Call
244244
__touchInit();
@@ -270,15 +270,15 @@ static void __touchDettachInterrupt(uint8_t pin) {
270270
External Public Touch API Functions
271271
*/
272272

273-
#if SOC_TOUCH_VERSION_1 // Only for ESP32 SoC
273+
#if SOC_TOUCH_SENSOR_VERSION == 1 // Only for ESP32 SoC
274274
void touchInterruptSetThresholdDirection(bool mustbeLower) {
275275
if (mustbeLower) {
276276
touch_pad_set_trigger_mode(TOUCH_TRIGGER_BELOW);
277277
} else {
278278
touch_pad_set_trigger_mode(TOUCH_TRIGGER_ABOVE);
279279
}
280280
}
281-
#elif SOC_TOUCH_VERSION_2 // Only for ESP32S2 and ESP32S3
281+
#elif SOC_TOUCH_SENSOR_VERSION == 2 // Only for ESP32S2 and ESP32S3
282282
// returns true if touch pad has been and continues pressed and false otherwise
283283
bool touchInterruptGetLastStatus(uint8_t pin) {
284284
int8_t pad = digitalPinToTouchChannel(pin);
@@ -307,10 +307,10 @@ void touchSleepWakeUpEnable(uint8_t pin, touch_value_t threshold) {
307307
return;
308308
}
309309
}
310-
#if SOC_TOUCH_VERSION_1 // Only for ESP32 SoC
310+
#if SOC_TOUCH_SENSOR_VERSION == 1 // Only for ESP32 SoC
311311
touch_pad_set_thresh(pad, threshold);
312312

313-
#elif SOC_TOUCH_VERSION_2
313+
#elif SOC_TOUCH_SENSOR_VERSION == 2
314314
touch_pad_sleep_channel_enable(pad, true);
315315
touch_pad_sleep_set_threshold(pad, threshold);
316316

0 commit comments

Comments
 (0)