From 636485db8e9fb40258b0b560f933ce83d4ed8a0d Mon Sep 17 00:00:00 2001 From: Mahavir Jain Date: Thu, 7 Jun 2018 11:40:52 +0530 Subject: [PATCH 1/3] vfs: change task{ENTER/EXIT}_CRITICAL with port{ENTER/EXIT}_CRITICAL Signed-off-by: Mahavir Jain --- components/vfs/vfs_uart.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/components/vfs/vfs_uart.c b/components/vfs/vfs_uart.c index e52b5dd74..d53de7597 100644 --- a/components/vfs/vfs_uart.c +++ b/components/vfs/vfs_uart.c @@ -335,28 +335,28 @@ static esp_err_t uart_start_select(int nfds, fd_set *readfds, fd_set *writefds, const int max_fds = MIN(nfds, UART_NUM); - taskENTER_CRITICAL(uart_get_selectlock()); + portENTER_CRITICAL(uart_get_selectlock()); if (_readfds || _writefds || _errorfds || _readfds_orig || _writefds_orig || _errorfds_orig || _signal_sem) { - taskEXIT_CRITICAL(uart_get_selectlock()); + portEXIT_CRITICAL(uart_get_selectlock()); uart_end_select(); return ESP_ERR_INVALID_STATE; } if ((_readfds_orig = malloc(sizeof(fd_set))) == NULL) { - taskEXIT_CRITICAL(uart_get_selectlock()); + portEXIT_CRITICAL(uart_get_selectlock()); uart_end_select(); return ESP_ERR_NO_MEM; } if ((_writefds_orig = malloc(sizeof(fd_set))) == NULL) { - taskEXIT_CRITICAL(uart_get_selectlock()); + portEXIT_CRITICAL(uart_get_selectlock()); uart_end_select(); return ESP_ERR_NO_MEM; } if ((_errorfds_orig = malloc(sizeof(fd_set))) == NULL) { - taskEXIT_CRITICAL(uart_get_selectlock()); + portEXIT_CRITICAL(uart_get_selectlock()); uart_end_select(); return ESP_ERR_NO_MEM; } @@ -382,7 +382,7 @@ static esp_err_t uart_start_select(int nfds, fd_set *readfds, fd_set *writefds, FD_ZERO(writefds); FD_ZERO(exceptfds); - taskEXIT_CRITICAL(uart_get_selectlock()); + portEXIT_CRITICAL(uart_get_selectlock()); // s_one_select_lock is not released on successfull exit - will be // released in uart_end_select() @@ -391,7 +391,7 @@ static esp_err_t uart_start_select(int nfds, fd_set *readfds, fd_set *writefds, static void uart_end_select() { - taskENTER_CRITICAL(uart_get_selectlock()); + portENTER_CRITICAL(uart_get_selectlock()); for (int i = 0; i < UART_NUM; ++i) { uart_set_select_notif_callback(i, NULL); } @@ -416,7 +416,7 @@ static void uart_end_select() free(_errorfds_orig); _errorfds_orig = NULL; } - taskEXIT_CRITICAL(uart_get_selectlock()); + portEXIT_CRITICAL(uart_get_selectlock()); _lock_release(&s_one_select_lock); } From eef8d0f7edf1cef6c228e4ce3dbeed99a0b90d76 Mon Sep 17 00:00:00 2001 From: Mahavir Jain Date: Thu, 7 Jun 2018 11:41:25 +0530 Subject: [PATCH 2/3] Resolve required include header dependencies in component itself Signed-off-by: Mahavir Jain --- components/driver/sdio_slave.c | 1 + components/newlib/time.c | 1 + 2 files changed, 2 insertions(+) diff --git a/components/driver/sdio_slave.c b/components/driver/sdio_slave.c index b63b5c677..1727e4349 100644 --- a/components/driver/sdio_slave.c +++ b/components/driver/sdio_slave.c @@ -96,6 +96,7 @@ The driver of FIFOs works as below: #include "freertos/FreeRTOS.h" #include "soc/dport_access.h" #include "soc/dport_reg.h" +#include "soc/io_mux_reg.h" #include "freertos/semphr.h" #include "xtensa/core-macros.h" #include "driver/periph_ctrl.h" diff --git a/components/newlib/time.c b/components/newlib/time.c index 6bfa1e751..6137f2143 100644 --- a/components/newlib/time.c +++ b/components/newlib/time.c @@ -36,6 +36,7 @@ #include "freertos/xtensa_api.h" #include "freertos/task.h" #include "sdkconfig.h" +#include "limits.h" #if defined( CONFIG_ESP32_TIME_SYSCALL_USE_RTC ) || defined( CONFIG_ESP32_TIME_SYSCALL_USE_RTC_FRC1 ) #define WITH_RTC 1 From 4e43c920d882eae61879417efaa1e22acba20260 Mon Sep 17 00:00:00 2001 From: Mahavir Jain Date: Mon, 11 Jun 2018 14:06:32 +0530 Subject: [PATCH 3/3] freertos: make task{ENTER/EXIT} macros deprecated for external use Signed-off-by: Mahavir Jain --- components/freertos/component.mk | 2 ++ components/freertos/include/freertos/task.h | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/components/freertos/component.mk b/components/freertos/component.mk index 7841d8f69..a10f84d80 100644 --- a/components/freertos/component.mk +++ b/components/freertos/component.mk @@ -5,3 +5,5 @@ COMPONENT_ADD_LDFLAGS += -Wl,--undefined=uxTopUsedPriority COMPONENT_ADD_INCLUDEDIRS := include COMPONENT_PRIV_INCLUDEDIRS := include/freertos + +tasks.o event_groups.o timers.o queue.o ringbuf.o: CFLAGS += -D_ESP_FREERTOS_INTERNAL diff --git a/components/freertos/include/freertos/task.h b/components/freertos/include/freertos/task.h index 5af62c69c..ab605bb30 100644 --- a/components/freertos/include/freertos/task.h +++ b/components/freertos/include/freertos/task.h @@ -233,7 +233,11 @@ typedef enum * * \ingroup SchedulerControl */ +#ifdef _ESP_FREERTOS_INTERNAL #define taskENTER_CRITICAL(mux) portENTER_CRITICAL(mux) +#else +#define taskENTER_CRITICAL(mux) _Pragma("GCC warning \"'taskENTER_CRITICAL(mux)' is deprecated in ESP-IDF, consider using 'portENTER_CRITICAL(mux)'\"") portENTER_CRITICAL(mux) +#endif #define taskENTER_CRITICAL_ISR(mux) portENTER_CRITICAL_ISR(mux) /** @@ -247,7 +251,11 @@ typedef enum * * \ingroup SchedulerControl */ +#ifdef _ESP_FREERTOS_INTERNAL #define taskEXIT_CRITICAL(mux) portEXIT_CRITICAL(mux) +#else +#define taskEXIT_CRITICAL(mux) _Pragma("GCC warning \"'taskEXIT_CRITICAL(mux)' is deprecated in ESP-IDF, consider using 'portEXIT_CRITICAL(mux)'\"") portEXIT_CRITICAL(mux) +#endif #define taskEXIT_CRITICAL_ISR(mux) portEXIT_CRITICAL_ISR(mux) /**