8000 Merge branch 'release/v3.1.x' into idf-release/v5.3 · espressif/arduino-esp32@43f1a80 · GitHub
[go: up one dir, main page]

Skip to content
Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 43f1a80

Browse files
authored
Merge branch 'release/v3.1.x' into idf-release/v5.3
2 parents 80e6e4d + c6bf1b4 commit 43f1a80

File tree

13 files changed

+794
-32
lines changed

13 files changed

+794
-32
lines changed

boards.txt

Lines changed: 473 additions & 0 deletions
Large diffs are not rendered by default.

cores/esp32/HardwareSerial.cpp

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,23 @@
2424
#endif
2525

2626
void serialEvent(void) __attribute__((weak));
27-
void serialEvent(void) {}
2827

2928
#if SOC_UART_HP_NUM > 1
3029
void serialEvent1(void) __attribute__((weak));
31-
void serialEvent1(void) {}
3230
#endif /* SOC_UART_HP_NUM > 1 */
3331

3432
#if SOC_UART_HP_NUM > 2
3533
void serialEvent2(void) __attribute__((weak));
36-
void serialEvent2(void) {}
3734
#endif /* SOC_UART_HP_NUM > 2 */
3835

36+
#if SOC_UART_HP_NUM > 3
37+
void serialEvent3(void) __attribute__((weak));
38+
#endif /* SOC_UART_HP_NUM > 3 */
39+
40+
#if SOC_UART_HP_NUM > 4
41+
void serialEvent4(void) __attribute__((weak));
42+
#endif /* SOC_UART_HP_NUM > 4 */
43+
3944
#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_SERIAL)
4045
// There is always Seria0 for UART0
4146
HardwareSerial Serial0(0);
@@ -45,43 +50,57 @@ HardwareSerial Serial1(1);
4550
#if SOC_UART_HP_NUM > 2
4651
HardwareSerial Serial2(2);
4752
#endif
53+
#if SOC_UART_HP_NUM > 3
54+
HardwareSerial Serial3(3);
55+
#endif
56+
#if SOC_UART_HP_NUM > 4
57+
HardwareSerial Serial4(4);
58+
#endif
4859

4960
#if HWCDC_SERIAL_IS_DEFINED == 1 // Hardware JTAG CDC Event
5061
extern void HWCDCSerialEvent(void) __attribute__((weak));
51-
void HWCDCSerialEvent(void) {}
5262
#endif
5363

5464
#if USB_SERIAL_IS_DEFINED == 1 // Native USB CDC Event
5565
// Used by Hardware Serial for USB CDC events
5666
extern void USBSerialEvent(void) __attribute__((weak));
57-
void USBSerialEvent(void) {}
5867
#endif
5968

6069
void serialEventRun(void) {
6170
#if HWCDC_SERIAL_IS_DEFINED == 1 // Hardware JTAG CDC Event
62-
if (HWCDCSerial.available()) {
71+
if (HWCDCSerialEvent && HWCDCSerial.available()) {
6372
HWCDCSerialEvent();
6473
}
6574
#endif
6675
#if USB_SERIAL_IS_DEFINED == 1 // Native USB CDC Event
67-
if (USBSerial.available()) {
76+
if (USBSerialEvent && USBSerial.available()) {
6877
USBSerialEvent();
6978
}
7079
#endif
7180
// UART0 is default serialEvent()
72-
if (Serial0.available()) {
81+
if (serialEvent && Serial0.available()) {
7382
serialEvent();
7483
}
7584
#if SOC_UART_HP_NUM > 1
76-
if (Serial1.available()) {
85+
if (serialEvent1 && Serial1.available()) {
7786
serialEvent1();
7887
}
7988
#endif
8089
#if SOC_UART_HP_NUM > 2
81-
if (Serial2.available()) {
90+
if (serialEvent2 && Serial2.available()) {
8291
serialEvent2();
8392
}
8493
#endif
94+
#if SOC_UART_HP_NUM > 3
95+
if (serialEvent3 && Serial3.available()) {
96+
serialEvent3();
97+
}
98+
#endif
99+
#if SOC_UART_HP_NUM > 4
100+
if (serialEvent4 && Serial4.available()) {
101+
serialEvent4();
102+
}
103+
#endif
85104
}
86105
#endif
87106

cores/esp32/HardwareSerial.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,12 @@ extern HardwareSerial Serial1;
375375
#if SOC_UART_HP_NUM > 2
376376
extern HardwareSerial Serial2;
377377
#endif
378+
#if SOC_UART_HP_NUM > 3
379+
extern HardwareSerial Serial3;
380+
#endif
381+
#if SOC_UART_HP_NUM > 4
382+
extern HardwareSerial Serial4;
383+
#endif
378384
#endif //!defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_SERIAL)
379385

380386
#endif // HardwareSerial_h

cores/esp32/esp32-hal-uart.c

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,12 @@ static uart_t _uart_bus_array[] = {
6767
#if SOC_UART_HP_NUM > 2
6868
{2, false, 0, NULL, -1, -1, -1, -1, 0, 0, 0, 0, false, 0},
6969
#endif
70+
#if SOC_UART_HP_NUM > 3
71+
{3, false, 0, NULL, -1, -1, -1, -1, 0, 0, 0, 0, false, 0},
72+
#endif
73+
#if SOC_UART_HP_NUM > 4
74+
{4, false, 0, NULL, -1, -1, -1, -1, 0, 0, 0, 0, false, 0},
75+
#endif
7076
};
7177

7278
#else
@@ -87,6 +93,12 @@ static uart_t _uart_bus_array[] = {
8793
#if SOC_UART_HP_NUM > 2
8894
{NULL, 2, false, 0, NULL, -1, -1, -1, -1, 0, 0, 0, 0, false, 0},
8995
#endif
96+
#if SOC_UART_HP_NUM > 3
97+
{NULL, 3, false, 0, NULL, -1, -1, -1, -1, 0, 0, 0, 0, false, 0},
98+
#endif
99+
#if SOC_UART_HP_NUM > 4
100+
{NULL, 4, false, 0, NULL, -1, -1, -1, -1, 0, 0, 0, 0, false, 0},
101+
#endif
90102
};
91103

92104
#endif
@@ -835,6 +847,20 @@ static void ARDUINO_ISR_ATTR uart2_write_char(char c) {
835847
}
836848
#endif
837849

850+
#if SOC_UART_HP_NUM > 3
851+
static void ARDUINO_ISR_ATTR uart3_write_char(char c) {
852+
while (uart_ll_get_txfifo_len(&UART3) == 0);
853+
uart_ll_write_txfifo(&UART3, (const uint8_t *)&c, 1);
854+
}
855+
#endif
856+
857+
#if SOC_UART_HP_NUM > 4
858+
static void ARDUINO_ISR_ATTR uart4_write_char(char c) {
859+
while (uart_ll_get_txfifo_len(&UART4) == 0);
860+
uart_ll_write_txfifo(&UART4, (const uint8_t *)&c, 1);
861+
}
862+
#endif
863+
838864
void uart_install_putc() {
839865
switch (s_uart_debug_nr) {
840866
case 0: ets_install_putc1((void (*)(char)) & uart0_write_char); break;
@@ -843,6 +869,12 @@ void uart_install_putc() {
843869
#endif
844870
#if SOC_UART_HP_NUM > 2
845871
case 2: ets_install_putc1((void (*)(char)) & uart2_write_char); break;
872+
#endif
873+
#if SOC_UART_HP_NUM > 3
874+
case 3: ets_install_putc1((void (*)(char)) & uart3_write_char); break;
875+
#endif
876+
#if SOC_UART_HP_NUM > 4
877+
case 4: ets_install_putc1((void (*)(char)) & uart4_write_char); break;
846878
#endif
847879
default: ets_install_putc1(NULL); break;
848880
}

libraries/AsyncUDP/src/AsyncUDP.cpp

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,21 @@ extern "C" {
1515

1616
#include "lwip/priv/tcpip_priv.h"
1717

18+
#ifdef CONFIG_LWIP_TCPIP_CORE_LOCKING
19+
#define UDP_MUTEX_LOCK() \
20+
if (!sys_thread_tcpip(LWIP_CORE_LOCK_QUERY_HOLDER)) { \
21+
LOCK_TCPIP_CORE(); \
22+
}
23+
24+
#define UDP_MUTEX_UNLOCK() \
25+
if (sys_thread_tcpip(LWIP_CORE_LOCK_QUERY_HOLDER)) { \
26+
UNLOCK_TCPIP_CORE(); \
27+
}
28+
#else // CONFIG_LWIP_TCPIP_CORE_LOCKING
29+
#define UDP_MUTEX_LOCK()
30+
#define UDP_MUTEX_UNLOCK()
31+
#endif // CONFIG_LWIP_TCPIP_CORE_LOCKING
32+
1833
static const char *netif_ifkeys[TCPIP_ADAPTER_IF_MAX] = {"WIFI_STA_DEF", "WIFI_AP_DEF", "ETH_DEF", "PPP_DEF"};
1934

2035
static esp_err_t tcpip_adapter_get_netif(tcpip_adapter_if_t tcpip_if, void **netif) {
@@ -28,7 +43,9 @@ static esp_err_t tcpip_adapter_get_netif(tcpip_adapter_if_t tcpip_if, void **net
2843
if (netif_index < 0) {
2944
return ESP_FAIL;
3045
}
46+
UDP_MUTEX_LOCK();
3147
*netif = (void *)netif_get_by_index(netif_index);
48+
UDP_MUTEX_UNLOCK();
3249
} else {
3350
*netif = netif_default;
3451
}
@@ -232,9 +249,6 @@ static bool _udp_task_stop(){
232249
}
233250
*/
234251

235-
#define UDP_MUTEX_LOCK() //xSemaphoreTake(_lock, portMAX_DELAY)
236-
#define UDP_MUTEX_UNLOCK() //xSemaphoreGive(_lock)
237-
238252
AsyncUDPMessage::AsyncUDPMessage(size_t size) {
239253
_index = 0;
240254
if (size > CONFIG_TCP_MSS) {
@@ -473,12 +487,14 @@ bool AsyncUDP::_init() {
473487
if (_pcb) {
474488
return true;
475489
}
490+
UDP_MUTEX_LOCK();
476491
_pcb = udp_new();
477492
if (!_pcb) {
493+
UDP_MUTEX_UNLOCK();
478494
return false;
479495
}
480-
//_lock = xSemaphoreCreateMutex();
481496
udp_recv(_pcb, &_udp_recv, (void *)this);
497+
UDP_MUTEX_UNLOCK();
482498
return true;
483499
}
484500

@@ -493,22 +509,19 @@ AsyncUDP::~AsyncUDP() {
493509
close();
494510
UDP_MUTEX_LOCK();
495511
udp_recv(_pcb, NULL, NULL);
512+
UDP_MUTEX_UNLOCK();
496513
_udp_remove(_pcb);
497514
_pcb = NULL;
498-
UDP_MUTEX_UNLOCK();
499-
//vSemaphoreDelete(_lock);
500515
}
501516

502517
void AsyncUDP::close() {
503-
UDP_MUTEX_LOCK();
504518
if (_pcb != NULL) {
505519
if (_connected) {
506520
_udp_disconnect(_pcb);
507521
}
508522
_connected = false;
509523
//todo: unjoin multicast group
510524
}
511-
UDP_MUTEX_UNLOCK();
512525
}
513526

514527
bool AsyncUDP::connect(const ip_addr_t *addr, uint16_t port) {
@@ -520,14 +533,11 @@ bool AsyncUDP::connect(const ip_addr_t *addr, uint16_t port) {
520533
return false;
521534
}
522535
close();
523-
UDP_MUTEX_LOCK();
524536
_lastErr = _udp_connect(_pcb, addr, port);
525537
if (_lastErr != ERR_OK) {
526-
UDP_MUTEX_UNLOCK();
527538
return false;
528539
}
529540
_connected = true;
530-
UDP_MUTEX_UNLOCK();
531541
return true;
532542
}
533543

@@ -544,13 +554,10 @@ bool AsyncUDP::listen(const ip_addr_t *addr, uint16_t port) {
544554
IP_SET_TYPE_VAL(_pcb->local_ip, addr->type);
545555
IP_SET_TYPE_VAL(_pcb->remote_ip, addr->type);
546556
}
547-
UDP_MUTEX_LOCK();
548557
if (_udp_bind(_pcb, addr, port) != ERR_OK) {
549-
UDP_MUTEX_UNLOCK();
550558
return false;
551559
}
552560
_connected = true;
553-
UDP_MUTEX_UNLOCK();
554561
return true;
555562
}
556563

@@ -624,12 +631,10 @@ bool AsyncUDP::listenMulticast(const ip_addr_t *addr, uint16_t port, uint8_t ttl
624631
return false;
625632
}
626633

627-
UDP_MUTEX_LOCK();
628634
_pcb->mcast_ttl = ttl;
629635
_pcb->remote_port = port;
630636
ip_addr_copy(_pcb->remote_ip, *addr);
631637
//ip_addr_copy(_pcb->remote_ip, ip_addr_any_type);
632-
UDP_MUTEX_UNLOCK();
633638

634639
return true;
635640
}
@@ -651,7 +656,6 @@ size_t AsyncUDP::writeTo(const uint8_t *data, size_t len, const ip_addr_t *addr,
651656
if (pbt != NULL) {
652657
uint8_t *dst = reinterpret_cast<uint8_t *>(pbt->payload);
653658
memcpy(dst, data, len);
654-
UDP_MUTEX_LOCK();
655659
if (tcpip_if < TCPIP_ADAPTER_IF_MAX) {
656660
void *nif = NULL;
657661
tcpip_adapter_get_netif((tcpip_adapter_if_t)tcpip_if, &nif);
@@ -663,7 +667,6 @@ size_t AsyncUDP::writeTo(const uint8_t *data, size_t len, const ip_addr_t *addr,
663667
} else {
664668
_lastErr = _udp_sendto(_pcb, pbt, addr, port);
665669
}
666-
UDP_MUTEX_UNLOCK();
667670
pbuf_free(pbt);
668671
if (_lastErr < ERR_OK) {
669672
return 0;

libraries/Wire/src/Wire.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -646,8 +646,8 @@ void TwoWire::onRequestService(uint8_t num, void *arg) {
646646
#endif /* SOC_I2C_SUPPORT_SLAVE */
647647

648648
TwoWire Wire = TwoWire(0);
649-
#if SOC_I2C_NUM > 1
649+
#if SOC_HP_I2C_NUM > 1
650650
TwoWire Wire1 = TwoWire(1);
651-
#endif /* SOC_I2C_NUM */
651+
#endif /* SOC_HP_I2C_NUM */
652652

653653
#endif /* SOC_I2C_SUPPORTED */

libraries/Wire/src/Wire.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,9 @@ class TwoWire : public HardwareI2C {
144144
};
145145

146146
extern TwoWire Wire;
147-
#if SOC_I2C_NUM > 1
147+
#if SOC_HP_I2C_NUM > 1
148148
extern TwoWire Wire1;
149-
#endif /* SOC_I2C_NUM */
149+
#endif /* SOC_HP_I2C_NUM */
150150

151151
#endif /* SOC_I2C_SUPPORTED */
152152
#endif /* TwoWire_h */

tests/validation/psram/ci.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"platforms": {
3+
"qemu": false,
4+
"wokwi": false
5+
},
6+
"requires": [
7+
"CONFIG_SPIRAM=y"
8+
],
9+
"targets": {
10+
"esp32c3": false,
11+
"esp32c6": false,
12+
"esp32h2": false
13+
}
14+
}

0 commit comments

Comments
 (0)
0