Skip to content

Commit a819990

Browse files
authored
Merge branch 'master' into idf-master
2 parents 400b987 + cf6ab9c commit a819990

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

Diff for: CMakeLists.txt

+13-1
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ set(includedirs
161161
set(srcs ${CORE_SRCS} ${LIBRARY_SRCS} ${BLE_SRCS})
162162
set(priv_includes cores/esp32/libb64)
163163
set(requires spi_flash mbedtls mdns esp_adc_cal wifi_provisioning nghttp)
164-
set(priv_requires fatfs nvs_flash app_update spiffs bootloader_support openssl bt main)
164+
set(priv_requires fatfs nvs_flash app_update spiffs bootloader_support openssl bt esp_ipc)
165165

166166
if(IDF_TARGET MATCHES "esp32s2|esp32s3" AND CONFIG_TINYUSB_ENABLED)
167167
list(APPEND priv_requires arduino_tinyusb)
@@ -183,3 +183,15 @@ endif()
183183
if(IDF_TARGET STREQUAL "esp32s2")
184184
target_compile_options(${COMPONENT_TARGET} PUBLIC -DARDUINO=10812 -DARDUINO_ESP32S2_DEV -DARDUINO_ARCH_ESP32 -DARDUINO_BOARD="ESP32S2_DEV" -DARDUINO_VARIANT="esp32s2" -DESP32)
185185
endif()
186+
187+
if(CONFIG_AUTOSTART_ARDUINO)
188+
# in autostart mode, arduino-esp32 contains app_main() function and needs to
189+
# reference setup() and loop() in the main component. If we add main
190+
# component to priv_requires then we create a large circular dependency
191+
# (arduino-esp32 -> main -> arduino-esp32) and can get linker errors, so
192+
# instead we add setup() and loop() to the undefined symbols list so the
193+
# linker will always include them.
194+
#
195+
# (As they are C++ symbol, we need to add the C++ mangled names.)
196+
target_link_libraries(${COMPONENT_LIB} INTERFACE "-u _Z5setupv -u _Z4loopv")
197+
endif()

Diff for: cores/esp32/esp32-hal-uart.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ void uartWrite(uart_t* uart, uint8_t c)
422422
return;
423423
}
424424
UART_MUTEX_LOCK();
425-
while(uart->dev->status.txfifo_cnt == 0x7F);
425+
while(uart->dev->status.txfifo_cnt >= 0x7E);
426426
#if CONFIG_IDF_TARGET_ESP32
427427
uart->dev->fifo.rw_byte = c;
428428
#else
@@ -441,7 +441,7 @@ void uartWriteBuf(uart_t* uart, const uint8_t * data, size_t len)
441441
uint32_t fifo_reg = UART_FIFO_AHB_REG(uart->num);
442442
#endif
443443
while(len) {
444-
while(uart->dev->status.txfifo_cnt == 0x7F);
444+
while(uart->dev->status.txfifo_cnt >= 0x7E);
445445
#if CONFIG_IDF_TARGET_ESP32
446446
uart->dev->fifo.rw_byte = *data++;
447447
#else
@@ -563,7 +563,7 @@ uint32_t uartGetBaudRate(uart_t* uart)
563563
static void ARDUINO_ISR_ATTR uart0_write_char(char c)
564564
{
565565
#if CONFIG_IDF_TARGET_ESP32
566-
while(((ESP_REG(0x01C+DR_REG_UART_BASE) >> UART_TXFIFO_CNT_S) & 0x7F) == 0x7F);
566+
while(((ESP_REG(0x01C+DR_REG_UART_BASE) >> UART_TXFIFO_CNT_S) & 0x7F) >= 0x7E);
567567
ESP_REG(DR_REG_UART_BASE) = c;
568568
#else
569569
while(UART0.status.txfifo_cnt == 0x7F);
@@ -574,7 +574,7 @@ static void ARDUINO_ISR_ATTR uart0_write_char(char c)
574574
static void ARDUINO_ISR_ATTR uart1_write_char(char c)
575575
{
576576
#if CONFIG_IDF_TARGET_ESP32
577-
while(((ESP_REG(0x01C+DR_REG_UART1_BASE) >> UART_TXFIFO_CNT_S) & 0x7F) == 0x7F);
577+
while(((ESP_REG(0x01C+DR_REG_UART1_BASE) >> UART_TXFIFO_CNT_S) & 0x7F) >= 0x7E);
578578
ESP_REG(DR_REG_UART1_BASE) = c;
579579
#else
580580
while(UART1.status.txfifo_cnt == 0x7F);
@@ -585,7 +585,7 @@ static void ARDUINO_ISR_ATTR uart1_write_char(char c)
585585
#if CONFIG_IDF_TARGET_ESP32
586586
static void ARDUINO_ISR_ATTR uart2_write_char(char c)
587587
{
588-
while(((ESP_REG(0x01C+DR_REG_UART2_BASE) >> UART_TXFIFO_CNT_S) & 0x7F) == 0x7F);
588+
while(((ESP_REG(0x01C+DR_REG_UART2_BASE) >> UART_TXFIFO_CNT_S) & 0x7F) >= 0x7E);
589589
ESP_REG(DR_REG_UART2_BASE) = c;
590590
}
591591
#endif

0 commit comments

Comments
 (0)